[Yanel-commits] rev 21957 - in public/yanel/trunk/src/contributions/resources: . resource-creator resource-creator/src resource-creator/src/build resource-creator/src/java resource-creator/src/java/org resource-creator/src/java/org/wyona resource-creator/src/java/org/wyona/yanel resource-creator/src/java/org/wyona/yanel/impl resource-creator/src/java/org/wyona/yanel/impl/resources

michi at wyona.com michi at wyona.com
Sun Jan 21 00:42:03 CET 2007


Author: michi
Date: 2007-01-21 00:42:01 +0100 (Sun, 21 Jan 2007)
New Revision: 21957

Added:
   public/yanel/trunk/src/contributions/resources/resource-creator/
   public/yanel/trunk/src/contributions/resources/resource-creator/build.xml
   public/yanel/trunk/src/contributions/resources/resource-creator/resource.xml
   public/yanel/trunk/src/contributions/resources/resource-creator/src/
   public/yanel/trunk/src/contributions/resources/resource-creator/src/build/
   public/yanel/trunk/src/contributions/resources/resource-creator/src/build/build.properties
   public/yanel/trunk/src/contributions/resources/resource-creator/src/build/dependencies.xml
   public/yanel/trunk/src/contributions/resources/resource-creator/src/java/
   public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/
   public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/
   public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/
   public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/
   public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/
   public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/ResourceCreatorResource.java
   public/yanel/trunk/src/contributions/resources/resource-creator/src/test/
Log:
resource creator resource started

Added: public/yanel/trunk/src/contributions/resources/resource-creator/build.xml
===================================================================
--- public/yanel/trunk/src/contributions/resources/resource-creator/build.xml	2007-01-20 23:24:11 UTC (rev 21956)
+++ public/yanel/trunk/src/contributions/resources/resource-creator/build.xml	2007-01-20 23:42:01 UTC (rev 21957)
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+
+<project name="yanel-resource" default="compile">
+
+  <import file="src/build/dependencies.xml"/>
+
+  <target name="init" description="Initialize build" depends="dependencies">
+    <echo>Initialize build</echo>
+
+    <dirname property="resource.home.dir" file="${ant.file}"/>
+    <echo>Resource Home Directory: ${resource.home.dir}</echo>
+
+    <property file="${resource.home.dir}/src/build/local.build.properties"/>
+    <property file="${resource.home.dir}/src/build/build.properties"/>
+
+    <path id="classpath">
+      <pathelement path="${maven2.cp}"/>
+    </path>
+    <property name="resource.build.dir" value="${resource.home.dir}/build"/>
+    <property name="resource.classes.dir" value="${resource.build.dir}/classes"/>
+    <property name="resource.lib.dir" value="${resource.build.dir}/lib"/>
+    <property name="resource.java.dir" value="${resource.home.dir}/src/java"/>
+  </target>
+
+  <target name="compile" description="Compile Java classes" depends="init">
+
+    <mkdir dir="${resource.classes.dir}"/>
+    <javac srcdir="${resource.java.dir}" destdir="${resource.classes.dir}"
+      classpathref="classpath"
+      debug="true"
+    />
+    <mkdir dir="${resource.lib.dir}"/>
+    <jar destfile="${resource.lib.dir}/yanel-resource-${resource.name}-${resource.version}.jar"
+      basedir="${resource.classes.dir}"
+    />
+  </target>
+
+  <target name="clean" depends="init">
+    <delete dir="${resource.build.dir}"/>
+  </target>
+
+  <target name="copy-dependencies" depends="init">
+    <copy todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/lib">
+      <fileset refid="maven2.resource.fileset"/>
+      <mapper type="flatten"/>
+    </copy>
+  </target>
+</project>

Added: public/yanel/trunk/src/contributions/resources/resource-creator/resource.xml
===================================================================
--- public/yanel/trunk/src/contributions/resources/resource-creator/resource.xml	2007-01-20 23:24:11 UTC (rev 21956)
+++ public/yanel/trunk/src/contributions/resources/resource-creator/resource.xml	2007-01-20 23:42:01 UTC (rev 21957)
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+
+<resource xmlns="http://www.wyona.org/yanel/1.0"
+  name="resource-creator"
+  namespace="http://www.wyona.org/yanel/resource/1.0"
+  class="org.wyona.yanel.impl.resources.ResourceCreatorResource"
+  >
+<description>
+Allows to create new resources
+</description>
+
+<rtd>
+<!--
+  <property name="foo" default-value="bar"/>
+-->
+</rtd>
+</resource>

Added: public/yanel/trunk/src/contributions/resources/resource-creator/src/build/build.properties
===================================================================
--- public/yanel/trunk/src/contributions/resources/resource-creator/src/build/build.properties	2007-01-20 23:24:11 UTC (rev 21956)
+++ public/yanel/trunk/src/contributions/resources/resource-creator/src/build/build.properties	2007-01-20 23:42:01 UTC (rev 21957)
@@ -0,0 +1,2 @@
+resource.name=resource-creator
+resource.version=0.0.1-dev-rXXX

Added: public/yanel/trunk/src/contributions/resources/resource-creator/src/build/dependencies.xml
===================================================================
--- public/yanel/trunk/src/contributions/resources/resource-creator/src/build/dependencies.xml	2007-01-20 23:24:11 UTC (rev 21956)
+++ public/yanel/trunk/src/contributions/resources/resource-creator/src/build/dependencies.xml	2007-01-20 23:42:01 UTC (rev 21957)
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+
+<project name="wiki-dependencies" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+  <target name="dependencies" description="Dependencies">
+    <artifact:remoteRepository id="wyona.remote.repository" url="http://www.wyona.org/maven2/"/>
+
+    <artifact:dependencies pathId="maven2.classpath" filesetId="maven2.fileset">
+      <remoteRepository refid="wyona.remote.repository"/>
+      <dependency groupId="wyona-org-yanel" artifactId="yanel-core"
+                  version="${yanel.source.version}"/>
+    </artifact:dependencies>
+
+    <artifact:dependencies pathId="maven2.resource.classpath" filesetId="maven2.resource.fileset">
+      <remoteRepository refid="wyona.remote.repository"/>
+      <!-- No resource specific libs yet -->
+    </artifact:dependencies>
+
+    <property name="maven2.cp" refid="maven2.classpath"/>
+    <!--<echo>Maven2 classpath: ${maven2.cp}</echo>-->
+  </target>
+
+</project>

Added: public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/ResourceCreatorResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/ResourceCreatorResource.java	2007-01-20 23:24:11 UTC (rev 21956)
+++ public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/ResourceCreatorResource.java	2007-01-20 23:42:01 UTC (rev 21957)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2006 Wyona
+ */
+
+package org.wyona.yanel.impl.resources;
+
+import org.wyona.yanel.core.Resource;
+import org.wyona.yanel.core.api.attributes.ViewableV2;
+import org.wyona.yanel.core.attributes.viewable.View;
+import org.wyona.yanel.core.attributes.viewable.ViewDescriptor;
+
+/**
+ *
+ */
+public class ResourceCreatorResource extends Resource implements ViewableV2{
+
+    /**
+     *
+     */
+    public ResourceCreatorResource() {
+    }
+
+    /**
+     *
+     */
+    public boolean exists() {
+        return true;
+    }
+
+    /**
+     *
+     */
+    public long getSize() {
+        return -1;
+    }
+
+    /**
+     *
+     */
+    public View getView(String viewId) {
+        View view = new View();
+        view.setMimeType("text/plain");
+        view.setInputStream(new java.io.StringBufferInputStream("Hello World"));
+        return view;
+    }
+
+    /**
+     *
+     */
+    public ViewDescriptor[] getViewDescriptors() {
+        ViewDescriptor[] vd = new ViewDescriptor[2];
+        vd[0] = new ViewDescriptor();
+        vd[0].setMimeType("application/xhtml+xml");
+        vd[1] = new ViewDescriptor();
+        vd[1].setMimeType("application/xml");
+        return vd;
+    }
+}




More information about the Yanel-commits mailing list