cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dani...@apache.org
Subject svn commit: r189461 [1/3] - in /cocoon/whiteboard/osgi: ./ ant/ ant/html_template/ ant/src/ ant/src/org/ ant/src/org/knopflerfish/ ant/src/org/knopflerfish/ant/ ant/src/org/knopflerfish/ant/taskdefs/ ant/src/org/knopflerfish/ant/taskdefs/bundle/ bundles/ bundles/cocoon/ bundles/cocoon/src/ bundles/cocoon_testcase/ bundles/cocoon_testcase/src/ bundles/cocoon_testcase/src/org/ bundles/cocoon_testcase/src/org/apache/ bundles/cocoon_testcase/src/org/apache/cocoon/ bundles/cocoon_testcase/src/org/apache/cocoon/service/ bundles/cocoon_testcase/src/org/apache/cocoon/service/cocoon_testcase/ bundles/cocoon_testcase/src/org/apache/cocoon/service/cocoon_testcase/impl/ bundles/test/ bundles/test/src/ bundles/test/src/org/ bundles/test/src/org/apache/ bundles/test/src/org/apache/cocoon/ bundles/test/src/org/apache/cocoon/service/ bundles/test/src/org/apache/cocoon/service/test/ bundles/test/src/org/apache/cocoon/service/test/impl/ jars-external/ jars-external/junit/ jars/ legal/
Date Tue, 07 Jun 2005 22:32:52 GMT
Author: danielf
Date: Tue Jun  7 15:32:48 2005
New Revision: 189461

URL: http://svn.apache.org/viewcvs?rev=189461&view=rev
Log:
Initial import of OSGi experiments. It consist of the framework, a junit bundle and some build scripts from www.knopflerfish.org, an init script that loads a minimal interactive kernel environment. Also there is a minimal test bundle, an ant script for creating a Cocoon core bundle and an ant script and some code for creating a test bundle for the blocks system. The later doesn't work yet.

Added:
    cocoon/whiteboard/osgi/
    cocoon/whiteboard/osgi/ant/
    cocoon/whiteboard/osgi/ant/README.Cocoon
    cocoon/whiteboard/osgi/ant/build.xml
    cocoon/whiteboard/osgi/ant/build_example.xml
    cocoon/whiteboard/osgi/ant/bundlebuild_include.xml
    cocoon/whiteboard/osgi/ant/html_template/
    cocoon/whiteboard/osgi/ant/html_template/bundle_index.html
    cocoon/whiteboard/osgi/ant/html_template/bundle_info.html
    cocoon/whiteboard/osgi/ant/html_template/bundle_list.html
    cocoon/whiteboard/osgi/ant/html_template/bundle_main.html
    cocoon/whiteboard/osgi/ant/html_template/style.css
    cocoon/whiteboard/osgi/ant/readme.txt
    cocoon/whiteboard/osgi/ant/src/
    cocoon/whiteboard/osgi/ant/src/org/
    cocoon/whiteboard/osgi/ant/src/org/knopflerfish/
    cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/
    cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/
    cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/
    cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/ArrayInt.java
    cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/Bundle.java
    cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/BundleHTMLExtractorTask.java
    cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/BundleInfoTask.java
    cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/BundleManifestTask.java
    cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/EE.java
    cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/OBRExtractorTask.java
    cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/OSGiPackage.java
    cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/Util.java
    cocoon/whiteboard/osgi/bundles/
    cocoon/whiteboard/osgi/bundles/cocoon/
    cocoon/whiteboard/osgi/bundles/cocoon/build.xml
    cocoon/whiteboard/osgi/bundles/cocoon/src/
    cocoon/whiteboard/osgi/bundles/cocoon_testcase/
    cocoon/whiteboard/osgi/bundles/cocoon_testcase/build.xml
    cocoon/whiteboard/osgi/bundles/cocoon_testcase/src/
    cocoon/whiteboard/osgi/bundles/cocoon_testcase/src/org/
    cocoon/whiteboard/osgi/bundles/cocoon_testcase/src/org/apache/
    cocoon/whiteboard/osgi/bundles/cocoon_testcase/src/org/apache/cocoon/
    cocoon/whiteboard/osgi/bundles/cocoon_testcase/src/org/apache/cocoon/service/
    cocoon/whiteboard/osgi/bundles/cocoon_testcase/src/org/apache/cocoon/service/cocoon_testcase/
    cocoon/whiteboard/osgi/bundles/cocoon_testcase/src/org/apache/cocoon/service/cocoon_testcase/impl/
    cocoon/whiteboard/osgi/bundles/cocoon_testcase/src/org/apache/cocoon/service/cocoon_testcase/impl/Activator.java
    cocoon/whiteboard/osgi/bundles/test/
    cocoon/whiteboard/osgi/bundles/test/build.xml
    cocoon/whiteboard/osgi/bundles/test/src/
    cocoon/whiteboard/osgi/bundles/test/src/org/
    cocoon/whiteboard/osgi/bundles/test/src/org/apache/
    cocoon/whiteboard/osgi/bundles/test/src/org/apache/cocoon/
    cocoon/whiteboard/osgi/bundles/test/src/org/apache/cocoon/service/
    cocoon/whiteboard/osgi/bundles/test/src/org/apache/cocoon/service/test/
    cocoon/whiteboard/osgi/bundles/test/src/org/apache/cocoon/service/test/impl/
    cocoon/whiteboard/osgi/bundles/test/src/org/apache/cocoon/service/test/impl/Activator.java
    cocoon/whiteboard/osgi/framework.jar   (with props)
    cocoon/whiteboard/osgi/init.xargs
    cocoon/whiteboard/osgi/jars/
    cocoon/whiteboard/osgi/jars-external/
    cocoon/whiteboard/osgi/jars-external/junit/
    cocoon/whiteboard/osgi/jars-external/junit/junit_all-1.0.0.jar   (with props)
    cocoon/whiteboard/osgi/legal/
    cocoon/whiteboard/osgi/legal/knopflerfish.license.txt
    cocoon/whiteboard/osgi/legal/osgi_copyright.txt
    cocoon/whiteboard/osgi/props.xargs
    cocoon/whiteboard/osgi/restart.xargs

Added: cocoon/whiteboard/osgi/ant/README.Cocoon
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/osgi/ant/README.Cocoon?rev=189461&view=auto
==============================================================================
--- cocoon/whiteboard/osgi/ant/README.Cocoon (added)
+++ cocoon/whiteboard/osgi/ant/README.Cocoon Tue Jun  7 15:32:48 2005
@@ -0,0 +1,10 @@
+This directory contains a copy of code from
+http://www.knopflerfish.org/releases/1.3.3/knopflerfish_osgi_1.3.3.jar.
+The only difference from the original is that some default property
+values has been changed in bundlebuild_include.xml.
+
+TODO
+----
+
+Cocoon's block build system should be used instead and this code
+should be removed.

Added: cocoon/whiteboard/osgi/ant/build.xml
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/osgi/ant/build.xml?rev=189461&view=auto
==============================================================================
--- cocoon/whiteboard/osgi/ant/build.xml (added)
+++ cocoon/whiteboard/osgi/ant/build.xml Tue Jun  7 15:32:48 2005
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+
+<project name="anttasks" default="all">
+
+ <property name  = "javadoc.packages"
+           value = "org.knopflerfish.ant.taskdefs.bundle"/>
+
+
+  <!-- targets -->
+  <target name="all">
+  </target>
+
+  <target name="javadoc">
+  <mkdir dir="javadoc"/>
+  <javadoc sourcepath    = "src"
+           destdir       = "javadoc"
+	   packagenames  = "${javadoc.packages}"
+   >	   
+  </javadoc>
+ </target>
+ 
+ <target name="clean" description="removes all generated files">
+  <delete dir="javadoc"/>
+  <delete dir="classes"/>
+ </target>
+
+</project>

Added: cocoon/whiteboard/osgi/ant/build_example.xml
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/osgi/ant/build_example.xml?rev=189461&view=auto
==============================================================================
--- cocoon/whiteboard/osgi/ant/build_example.xml (added)
+++ cocoon/whiteboard/osgi/ant/build_example.xml Tue Jun  7 15:32:48 2005
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE project [
+  <!ENTITY bundlebuild_include  SYSTEM "../../../ant/bundlebuild_include.xml">
+]>
+
+<!-- Name of generated jar files will be:  -->
+<!--  ${ant.project.name}-${version}.jar              -->
+<!--  ${ant.project.name}_api-${version}.jar          -->
+<!--  ${ant.project.name}_all-${version}.jar          -->
+
+<project name="build_example" default="all">
+
+  <!-- Set to top directory of OSGi code -->
+  <property name="topdir"       location="../.."/>
+
+  <!-- Code which belong to bundle implementation -->
+  <property name  = "impl.pattern"
+            value = "org/knopflerfish/bundle/httptest/**"/>
+
+
+  <!-- explicit paths to compile-time jar files -->
+
+  <path id="bundle.compile.path">
+   <pathelement location="${topdir}/jars/log/log_api.jar"/>
+   <pathelement location="${topdir}/jars/console/console_api.jar"/>
+   <pathelement location="${topdir}/jars/http/http_api.jar"/>
+   <pathelement location="../jsdk/resources/servlet.jar"/>
+  </path>
+
+
+  <!-- Activator, imports, exports etc are automatically found       -->
+  <!-- but can be specified explicitly. See bundlebuild_include.xml  -->
+  <!-- for details                                                   -->
+
+  <property name="bundle.description"    value="HTTP test servlet"/>
+  <property name="bundle.vendor"         value="knopflerfish"/>
+
+  &bundlebuild_include;
+
+</project>
\ No newline at end of file

Added: cocoon/whiteboard/osgi/ant/bundlebuild_include.xml
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/osgi/ant/bundlebuild_include.xml?rev=189461&view=auto
==============================================================================
--- cocoon/whiteboard/osgi/ant/bundlebuild_include.xml (added)
+++ cocoon/whiteboard/osgi/ant/bundlebuild_include.xml Tue Jun  7 15:32:48 2005
@@ -0,0 +1,748 @@
+<!--
+  ** Copyright (c) 2003-2004, KNOPFLERFISH project
+  ** All rights reserved.
+  ** 
+  ** Redistribution and use in source and binary forms, with or without 
+  ** modification, are permitted provided that the following conditions 
+  ** are met:
+  ** 
+  ** - Redistributions of source code must retain the above copyright notice, 
+  **   this list of conditions and the following disclaimer. 
+  ** 
+  ** - Redistributions in binary form must reproduce the above copyright 
+  **   notice, this list of conditions and the following disclaimer in 
+  **   the documentation and/or other materials provided with the 
+  **   distribution. 
+  ** 
+  ** - Neither the name of the KNOPFLERFISH project nor the names of its 
+  **   contributors may be used to endorse or promote products derived 
+  **   from this software without specific prior written permission. 
+  ** 
+  ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  ** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+  ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+  ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+  ** STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+  ** OF THE POSSIBILITY OF SUCH DAMAGE.
+  -->
+
+ <property name = "topdir"   location = "."/>
+
+ <property name = "proj.dir" location = "."/>
+
+ <property name  = "bundle.emptystring" 
+           value = "[bundle.emptystring]"/>
+
+ <property environment="sysprops"/>
+
+ <property name = "bcel.version"        value    = "5.1"/> 
+
+ <property name = "javac.target"        value    = "1.2"/>
+ <property name = "ant.dir"             location = "${topdir}/ant"/>
+ <property name = "antclasses"          location = "${ant.dir}/classes"/>
+
+ <property environment = "env"/>
+
+ <property name = "ee.check.foundation"   value = "false"/>
+
+ <property name = "xinclude.source"       value = "true"/>
+ <property name = "bundle.name"           value = "${ant.project.name}"/>
+ <property name = "bundle.version"        value = "${bundle.emptystring}"/>
+ <property name = "bundle.uuid"           value = "org.apache.cocoon:${bundle.name}:${bundle.version}"/>
+ <property name = "bundle.symbolicname"   value = "${bundle.uuid}"/>
+ <property name = "bundle.config"         value = "${bundle.emptystring}"/>
+ <property name = "bundle.vendor"         value = "Cocoon"/>
+ <property name = "bundle.description"    value = "${bundle.emptystring}"/>
+ <property name = "bundle.docurl"         value = "http://cocoon.apache.org"/>
+ <property name = "bundle.contactaddress" value = "http://cocoon.apache.org"/>
+ <property name = "bundle.category"       value = "${bundle.emptystring}"/>
+ <property name = "export.service"        value = "${bundle.emptystring}"/>
+ <property name = "import.service"        value = "${bundle.emptystring}"/>
+ <property name = "bundle.classpath"      value = "${bundle.emptystring}"/>
+ <property name = "dynamicimport.package"  value = "${bundle.emptystring}"/>
+ <property name = "bundle.nativecode"     value = "${bundle.emptystring}"/>
+
+ <property name = "bundle.icon"           value = "${bundle.emptystring}"/>
+
+ <property name = "console.host"        value = "localhost"/>
+ <property name = "console.port"        value = "23"/>
+ <property name = "console.user"        value = "admin"/>
+ <property name = "console.pwd"         value = "admin"/>
+ <property name = "console.welcome"     value = "Knopflerfish OSGi console"/>
+ <property name = "console.loginok"     value = "'quit' to end session"/>
+
+ <property name = "bundle.subversionurl"  value = "https://svn.apache.org/repos/asf/cocoon/whiteboard/osgi/"/>
+ <property name = "bundle.apivendor"  value = "${bundle.emptystring}"/>
+
+
+ <property name = "bundle.uuid.impl"          value = "${bundle.uuid}:impl"/>
+ <property name = "bundle.uuid.api"           value = "${bundle.uuid}:api"/>
+ <property name = "bundle.uuid.all"           value = "${bundle.uuid}:all"/>
+
+ <property name="http.host"          value="localhost"/>
+ <property name="http.port"          value="8080"/>
+ <property name="junit.runner.class" value="junit.swingui.TestRunner"/>
+ <property name="junit.formatter"    value="plain"/>
+ <property name="junit.outfile"      value="junit"/>
+
+
+ <property name = "src.dir"        location = "src"/>
+ <property name = "resources.dir"  location = "resources"/>
+
+ <property name = "outdir"   location = "${topdir}/out/${ant.project.name}"/>
+ <property name = "jardir"   location = "${topdir}/jars/${ant.project.name}"/>
+
+ <property name = "exported.file" location = "${topdir}/out/exported.txt"/>
+ <property name = "sources.file"  location = "${topdir}/out/sources.txt"/>
+
+ <property name = "classes.out.dir"     location = "${outdir}/classes"/>
+
+ <property name = "install_url_prefix"  value = "file:"/>
+
+ <property name = "bundle.build.lib"    value = "false"/>
+ <property name = "bundle.build.api"    value = "true"/>
+ <property name = "bundle.build.impl"   value = "true"/>
+ <property name = "bundle.build.all"    value = "true"/>
+
+ 
+ <property name     = "all.suffix" value="_all-${bundle.version}"/>
+
+ <property name     = "api.jar"  
+           location = "${jardir}/${ant.project.name}_api-${bundle.version}.jar"/>
+
+ <property name     = "api_noversion.jar"  
+           location = "${jardir}/${ant.project.name}_api.jar"/>
+
+ <property name     = "impl.jar"     
+           location = "${jardir}/${ant.project.name}-${bundle.version}.jar"/>
+
+ <property name     = "impl_noversion.jar"     
+           location = "${jardir}/${ant.project.name}.jar"/>
+
+ <property name     = "all.jar"
+           location = "${jardir}/${ant.project.name}${all.suffix}.jar"/>
+
+ <property name     = "all_noversion.jar"
+           location = "${jardir}/${ant.project.name}_all.jar"/>
+
+
+ 
+
+ <path id = "framework.path">
+  <pathelement location = "${topdir}/framework.jar"/>
+ </path>
+
+ <path id = "bundle.api.path">
+  <pathelement location = "${api.jar}"/>
+ </path>
+
+
+ <path id = "bundle.path">
+   <path refid = "framework.path"/>
+   <path refid = "bundle.api.path"/>
+   <path refid = "bundle.compile.path"/>
+ </path>
+
+ <target name="init" depends="setup_build">
+   <tstamp>
+    <format property = "bundle.date" 
+            pattern  = "EE MMMM d yyyy, HH:mm:ss"
+            locale   = "en"/>
+   </tstamp>
+
+   <available classname = "org.apache.bcel.classfile.JavaClass" 
+              property  = "bcel.available"/>
+
+   <fail unless  = "bcel.available" 
+         message = "BCEL lib not available. Please download from http://jakarta.apache.org/bcel and install in $$ANT_HOME/lib. You can also try  'ant install_bcel'"/>
+
+
+ </target>
+
+ <target name="install_bcel">
+   <antcall target="download_bcel" />
+   <antcall target="unpack_bcel"   />
+ </target>
+
+ <target name="download_bcel">
+   <get src = "http://apache.archive.sunet.se/dist/jakarta/bcel/binaries/bcel-${bcel.version}.zip" 
+        dest = "${sysprops.ANT_HOME}/bcel-${bcel.version}.zip"/>
+ </target>
+
+ <target name="unpack_bcel">
+   <unzip src = "${sysprops.ANT_HOME}/bcel-${bcel.version}.zip"
+         dest = "${sysprops.ANT_HOME}/lib">
+    <patternset>
+     <include name="bcel-${bcel.version}/bcel-${bcel.version}.jar"/>
+    </patternset>
+   </unzip>
+
+   <move file   = "${sysprops.ANT_HOME}/lib/bcel-${bcel.version}/bcel-${bcel.version}.jar" 
+         tofile = "${sysprops.ANT_HOME}/lib/bcel-${bcel.version}.jar"/>
+
+ </target>
+
+ <target name="install_netcomponents">
+   <antcall target="download_netcomponents'" />
+   <antcall target="unpack_netcomponents'"   />
+ </target>
+
+ <target name="download_netcomponents">
+   <get src = "http://www.savarese.org/oro/downloads/NetComponents-1.3.8.zip" 
+        dest = "${sysprops.ANT_HOME}/NetComponents-1.3.8.zip"/>
+ </target>
+
+ <target name="unpack_netcomponents">
+   <unzip src = "${sysprops.ANT_HOME}/NetComponents-1.3.8.zip"
+         dest = "${sysprops.ANT_HOME}/lib">
+    <patternset>
+     <include name="NetComponents-1.3.8a/NetComponents.jar"/>
+    </patternset>
+   </unzip>
+
+   <move file   = "${sysprops.ANT_HOME}/lib/NetComponents-1.3.8a/NetComponents.jar" 
+         tofile = "${sysprops.ANT_HOME}/lib/NetComponents.jar"/>
+
+ </target>
+
+
+ <target name = "all" depends = "init,compile_ant">
+   <antcall target = "try_bundle.custom.pre"/>
+   <antcall target = "jars"/>
+   <antcall target = "try_bundle.custom.post"/>
+ </target>
+
+
+ <target name        = "try_bundle.custom.pre"
+         if          = "do.bundle.custom.pre">
+   <antcall target = "bundle.custom.pre"/>
+ </target>
+
+ <target name        = "try_bundle.custom.post"
+         if          = "do.bundle.custom.post">
+   <antcall target = "bundle.custom.post"/>
+ </target>
+
+ <target name        = "compile_ant" 
+         description = "Compile and link the custom bundleinfo task">
+
+   <mkdir dir = "${antclasses}"/>
+
+   <javac destdir = "${antclasses}"
+          srcdir  = "${ant.dir}/src"
+          debug = "on">
+     <!-- Bundle.java requires Ant 1.6+ -->
+     <exclude name="org/knopflerfish/ant/taskdefs/bundle/Bundle.java"/>
+   </javac>
+
+   <taskdef name      = "bundleinfo" 
+            classpath = "${antclasses}" 
+     classname = "org.knopflerfish.ant.taskdefs.bundle.BundleInfoTask"/>
+
+   <taskdef name      = "bundlemanifest" 
+            classpath = "${antclasses}" 
+     classname = "org.knopflerfish.ant.taskdefs.bundle.BundleManifestTask"/>
+
+   <taskdef name      = "bundlehtml" 
+            classpath = "${antclasses}" 
+     classname = "org.knopflerfish.ant.taskdefs.bundle.BundleHTMLExtractorTask"/>
+
+   <taskdef name      = "bundleobr" 
+            classpath = "${antclasses}" 
+     classname = "org.knopflerfish.ant.taskdefs.bundle.OBRExtractorTask"/>
+     
+ </target>
+
+
+ <target name        = "compile" 
+         description = "compiles all java sources">
+
+    <mkdir dir = "${classes.out.dir}"/>
+
+    <javac destdir       = "${classes.out.dir}" 
+           debug         = "on"
+           srcdir        = "${src.dir}"
+           target        = "${javac.target}"
+           classpathref  = "bundle.path"
+           includes      = "${impl.pattern},${api.pattern}"
+    >
+   </javac>
+  </target>
+
+ <target name        = "compile_api" 
+         description = "compiles only api java sources">
+
+    <mkdir dir = "${classes.out.dir}"/>
+
+    <javac destdir       = "${classes.out.dir}" 
+           debug         = "on"
+           srcdir        = "${src.dir}"
+           classpathref  = "bundle.path"
+           target        = "${javac.target}"
+           includes      = "${api.pattern}">
+   </javac>
+  </target>
+
+ <target name        = "jars"
+         description = "compile all jars">
+
+  <antcall target = "jar_api0"/>
+  <antcall target = "jar_lib"/>
+  <antcall target = "jar_impl"/>
+  <antcall target = "jar_all0"/>
+
+ </target>
+
+ <target name    = "jar_api0" 
+	 if      = "api.pattern">
+   <antcall target = "jar_api"/>
+ </target>
+
+ <target name    = "jar_all0" 
+	 if      = "api.pattern">
+   <antcall target = "jar_all"/>
+ </target>
+
+ <!-- set up build conditions -->
+ <target name = "setup_build">
+
+  <condition property="do_build_lib">
+   <equals arg1="${bundle.build.lib}" arg2="true"/>
+  </condition>
+
+  <condition property="do_build_api">
+   <equals arg1="${bundle.build.api}" arg2="true"/>
+  </condition>
+
+  <condition property="do_build_impl">
+   <equals arg1="${bundle.build.impl}" arg2="true"/>
+  </condition>
+
+  <condition property="do_build_all">
+   <equals arg1="${bundle.build.all}" arg2="true"/>
+  </condition>
+
+<!--
+  <echo message="do_build_lib  = ${do_build_lib}"/>
+  <echo message="do_build_api  = ${do_build_api}"/>
+  <echo message="do_build_impl = ${do_build_impl}"/>
+  <echo message="do_build_all  = ${do_build_all}"/>
+-->
+ </target>
+
+ <target name    = "jar_impl" 
+         if      = "do_build_impl">
+
+  <antcall target = "compile"/>
+
+  <bundleinfo activator = "bundle.activator" 
+              imports   = "import.package"
+              checkFoundationEE = "${ee.check.foundation}"
+  >
+   <fileset dir      = "${classes.out.dir}" 
+            includes = "${impl.pattern}">
+   </fileset>
+  </bundleinfo>
+
+  <property name="export.package" value=""/>
+
+  <echo message = "${impl.jar}"/>
+  <echo message = " imports   = ${import.package}"/>
+  <echo message = " exports   = ${export.package}"/>
+  <echo message = " activator = ${bundle.activator}"/>
+
+  <mkdir dir = "${jardir}"/>
+  <antcall target="make_resource_dir"/>
+
+  <bundlemanifest file="${outdir}/impl.mf">
+    <attribute name = "Bundle-Name"           value = "${bundle.name}"/>
+    <attribute name = "Bundle-SymbolicName"   value = "${bundle.symbolicname}"/>
+    <attribute name = "Bundle-Version"        value = "${bundle.version}"/>
+    <attribute name = "Bundle-Description"    value = "${bundle.description}"/>
+    <attribute name = "Bundle-Vendor"         value = "${bundle.vendor}"/>
+    <attribute name = "Bundle-DocURL"         value = "${bundle.docurl}"/>
+    <attribute name = "Bundle-ContactAddress" value = "${bundle.contactaddress}"/>
+    <attribute name = "Bundle-Activator"      value = "${bundle.activator}"/>
+    <attribute name = "Bundle-Category"       value = "${bundle.category}"/>
+    <attribute name = "Bundle-Config"         value = "${bundle.config}"/>
+    <attribute name = "Bundle-Classpath"      value = "${bundle.classpath}"/>
+    <attribute name = "Export-Service"        value = "${export.service}"/>
+    <attribute name = "Import-Service"        value = "${import.service}"/>
+    <attribute name = "Import-Package"        value = "${import.package}"/>
+<!--
+    <attribute name = "Export-Package"        value = "${export.package}"/>
+-->
+    <attribute name = "Bundle-UUID"           value = "${bundle.uuid.impl}"/>
+    <attribute name = "Built-From"            value = "${proj.dir}"/>
+    <attribute name = "Build-Date"            value = "${bundle.date}"/>
+    <attribute name = "Application-Icon"      value = "${bundle.icon}"/>
+    <attribute name = "DynamicImport-Package" value = "${dynamicimport.package}"/>
+    <attribute name = "Bundle-NativeCode"     value = "${bundle.nativecode}"/>
+    <attribute name = "Bundle-SubversionURL"  value = "${bundle.subversionurl}"/>
+    <attribute name = "Bundle-APIVendor"  value = "${bundle.apivendor}"/>
+    
+  </bundlemanifest>
+
+  <jar basedir  = "${classes.out.dir}"
+       jarfile  = "${impl.jar}"
+       includes = "${impl.pattern}"
+       excludes = "**/pspbrwse.jbf"
+       manifest = "${outdir}/impl.mf"
+    >
+
+     <fileset dir = "${resources.dir}"/>
+
+    </jar>  
+
+
+ </target>
+
+ <target name    = "add_src_all"
+         if      = "include.source">
+
+  <jar basedir  = "${classes.out.dir}"
+       jarfile  = "${all.jar}"
+       includes = "${api.pattern},${impl.pattern}"
+       update   = "true">
+
+     <zipfileset dir      = "${src.dir}"
+              includes = "**/*.java"
+              prefix = "OSGI-OPT/src"
+     />     
+  </jar>
+ </target>
+
+ <target name    = "add_src_lib"
+         if      = "include.source">
+
+ <jar basedir  = "${classes.out.dir}"
+       jarfile  = "${impl.jar}"
+       includes = "${api.pattern}"
+       update   = "true">
+
+     <zipfileset dir      = "${src.dir}"
+              includes = "**/*.java"
+              prefix = "OSGI-OPT/src"
+     />     
+  </jar>
+ </target>
+
+ <target name    = "jar_api" 
+         depends = "init,compile_ant" 
+	 if      = "do_build_api">
+
+  <antcall target = "compile_api"/>
+
+  <bundleinfo exports = "export.package" 
+              imports = "import.package"
+              checkFoundationEE = "${ee.check.foundation}"
+  >
+   <fileset dir      = "${classes.out.dir}" 
+            includes = "${api.pattern}">
+   </fileset>
+  </bundleinfo>
+
+  <echo message = "${api.jar}"/>
+  <echo message = " exports = ${export.package}"/>
+  <echo message = " imports = ${import.package}"/>
+
+  <mkdir dir = "${jardir}"/>
+
+  <bundlemanifest file = "${outdir}/api.mf">
+    <attribute name = "Bundle-Name"           value = "${bundle.name}-API"/>
+    <attribute name = "Bundle-SymbolicName"   value = "${bundle.symbolicname}-API"/>
+    <attribute name = "Bundle-Version"        value = "${bundle.version}"/>
+    <attribute name = "Bundle-Description"    value = "${bundle.description} (API)"/>
+    <attribute name = "Bundle-Vendor"         value = "${bundle.vendor}"/>
+    <attribute name = "Bundle-DocURL"         value = "${bundle.docurl}"/>
+    <attribute name = "Bundle-ContactAddress" value = "${bundle.contactaddress}"/>
+    <attribute name = "Bundle-Category"       value = "API"/>
+    <attribute name = "Export-Package"        value = "${export.package}"/>
+    <attribute name = "Import-Package"        value = "${import.package}"/>
+    <attribute name = "Bundle-UUID"           value = "${bundle.uuid.api}"/>
+    <attribute name = "Built-From"            value = "${proj.dir}"/>
+    <attribute name = "Build-Date"            value = "${bundle.date}"/>
+    <attribute name = "Application-Icon"      value = "${bundle.icon}"/>
+    <attribute name = "Bundle-SubversionURL"  value = "${bundle.subversionurl}"/>
+    <attribute name = "Bundle-APIVendor"  value = "${bundle.apivendor}"/>
+  </bundlemanifest>
+
+  <jar basedir  = "${classes.out.dir}"
+       jarfile  = "${api.jar}"
+       includes = "${api.pattern}"
+       manifest = "${outdir}/api.mf"
+    >
+    </jar>  
+
+ </target>
+
+ <target name    = "jar_lib" 
+         depends = "init,compile_ant" 
+	 if      = "do_build_lib">
+
+  <antcall target = "compile_api"/>
+
+  <bundleinfo exports = "export.package" 
+              imports = "import.package"
+              checkFoundationEE = "${ee.check.foundation}"
+  >
+   <fileset dir      = "${classes.out.dir}" 
+            includes = "${api.pattern}">
+   </fileset>
+  </bundleinfo>
+
+  <echo message = "${impl.jar}"/>
+  <echo message = " exports = ${export.package}"/>
+  <echo message = " imports = ${import.package}"/>
+
+  <mkdir dir = "${jardir}"/>
+  <antcall target="make_resource_dir"/>
+
+  <bundlemanifest file="${outdir}/impl.mf">
+    <attribute name = "Bundle-Name"           value = "${bundle.name}"/>
+    <attribute name = "Bundle-SymbolicName"   value = "${bundle.symbolicname}"/>
+    <attribute name = "Bundle-Version"        value = "${bundle.version}"/>
+    <attribute name = "Bundle-Description"    value = "${bundle.description}"/>
+    <attribute name = "Bundle-Vendor"         value = "${bundle.vendor}"/>
+    <attribute name = "Bundle-DocURL"         value = "${bundle.docurl}"/>
+    <attribute name = "Bundle-ContactAddress" value = "${bundle.contactaddress}"/>
+    <attribute name = "Bundle-Classpath"      value = "${bundle.classpath}"/>
+    <attribute name = "Bundle-Category"       value = "${bundle.category}"/>
+    <attribute name = "Export-Package"        value = "${export.package}"/>
+    <attribute name = "Import-Package"        value = "${import.package}"/>
+    <attribute name = "Bundle-UUID"           value = "${bundle.uuid.impl}"/>
+    <attribute name = "Built-From"            value = "${proj.dir}"/>
+    <attribute name = "Build-Date"            value = "${bundle.date}"/>
+    <attribute name = "Application-Icon"      value = "${bundle.icon}"/>
+    <attribute name = "DynamicImport-Package" value = "${dynamicimport.package}"/>
+    <attribute name = "Bundle-NativeCode"     value = "${bundle.nativecode}"/>
+    <attribute name = "Bundle-APIVendor"  value = "${bundle.apivendor}"/>
+  </bundlemanifest>
+
+  <jar basedir  = "${classes.out.dir}"
+       jarfile  = "${impl.jar}"
+       includes = "${api.pattern}"
+       manifest = "${outdir}/impl.mf"
+    >
+     <fileset dir = "${resources.dir}"/>
+  </jar>  
+
+  <antcall target="add_src_lib"/>
+
+ </target>
+
+ <target name = "make_resource_dir" if = "resources.dir">
+   <mkdir dir = "${resources.dir}"/>
+ </target>
+
+ <target name    = "jar_all" 
+         depends = "init,compile_ant" 
+	 if      = "do_build_all">
+
+  <antcall target = "compile"/>
+
+  <bundleinfo exports   = "export.package"
+              checkFoundationEE = "${ee.check.foundation}"
+  >
+   <fileset dir      = "${classes.out.dir}" 
+            includes = "${api.pattern}">
+   </fileset>
+  </bundleinfo>
+
+  <bundleinfo activator = "bundle.activator" 
+              imports   = "import.package"
+              checkFoundationEE = "${ee.check.foundation}"
+>
+   <fileset dir      = "${classes.out.dir}" 
+            includes = "${impl.pattern}">
+   </fileset>
+  </bundleinfo>
+
+  <echo message = "${all.jar}"/>
+  <echo message = " imports   = ${import.package}"/>
+  <echo message = " exports   = ${export.package}"/>
+  <echo message = " activator = ${bundle.activator}"/>
+
+  <mkdir dir = "${jardir}"/>
+  <antcall target="make_resource_dir"/>
+
+  <bundlemanifest file="${outdir}/all.mf">
+    <attribute name = "Bundle-Name"           value = "${bundle.name}"/>
+    <attribute name = "Bundle-SymbolicName"   value = "${bundle.symbolicname}"/>
+    <attribute name = "Bundle-Version"        value = "${bundle.version}"/>
+    <attribute name = "Bundle-Description"    value = "${bundle.description}"/>
+    <attribute name = "Bundle-Vendor"         value = "${bundle.vendor}"/>
+    <attribute name = "Bundle-DocURL"         value = "${bundle.docurl}"/>
+    <attribute name = "Bundle-ContactAddress" value = "${bundle.contactaddress}"/>
+    <attribute name = "Bundle-Activator"      value = "${bundle.activator}"/>
+    <attribute name = "Bundle-Category"       value = "${bundle.category}"/>
+    <attribute name = "Bundle-Config"         value = "${bundle.config}"/>
+    <attribute name = "Bundle-Classpath"      value = "${bundle.classpath}"/>
+    <attribute name = "Export-Service"        value = "${export.service}"/>
+    <attribute name = "Import-Service"        value = "${import.service}"/>
+    <attribute name = "Export-Package"        value = "${export.package}"/>
+    <attribute name = "Import-Package"        value = "${import.package}"/>
+    <attribute name = "Bundle-UUID"           value = "${bundle.uuid.all}"/>
+    <attribute name = "Built-From"            value = "${proj.dir}"/>
+    <attribute name = "Build-Date"            value = "${bundle.date}"/>
+    <attribute name = "Application-Icon"      value = "${bundle.icon}"/>
+    <attribute name = "DynamicImport-Package" value = "${dynamicimport.package}"/>
+    <attribute name = "Bundle-NativeCode"     value = "${bundle.nativecode}"/>
+    <attribute name = "Bundle-SubversionURL"  value = "${bundle.subversionurl}"/>
+    <attribute name = "Bundle-APIVendor"  value = "${bundle.apivendor}"/>
+  </bundlemanifest>
+
+  <jar basedir  = "${classes.out.dir}"
+       jarfile  = "${all.jar}"
+       compress = "true"
+       includes = "${api.pattern},${impl.pattern}"
+       excludes = "**/pspbrwse.jbf"
+       manifest = "${outdir}/all.mf"
+    >
+     <fileset dir = "${resources.dir}"/>
+    </jar>
+    
+   <antcall target = "add_src_all"/>
+ </target>
+
+ <target name="check_telnet">
+   <available classname = "com.oroinc.net.telnet.TelnetCommand" 
+              property  = "telnet.available"/>
+
+   <fail unless  = "telnet.available" 
+         message = "Telnet lib is not available. Please download from http://www.savarese.org/oro/downloads/index.html#NetComponents and install in $$ANT_HOME/lib. You can also try  'ant install_netcomponents'"/>
+ </target>
+
+ <target name="install"
+         description="Install all.jar using telnet console">
+   <antcall target="send_console_cmd">
+    <param name  = "cmd"
+           value = "/fr install ${install_url_prefix}${all.jar}"/>
+   </antcall>
+
+   <!-- give it a chance to succeed -->
+   <sleep seconds="5"/>
+ </target>
+
+ <target name="install_impl"
+         description="Install impl.jar using telnet console">
+   <antcall target="send_console_cmd">
+    <param name  = "cmd"
+           value = "/fr install ${install_url_prefix}${impl.jar}"/>
+   </antcall>
+
+   <!-- give it a chance to succeed -->
+   <sleep seconds="5"/>
+ </target>
+
+ <target name="stop" 
+         description="Stop bundle.name using telnet console">
+   <antcall target="send_console_cmd">
+    <param name  = "cmd"
+           value = "/fr stop &#34;${bundle.name}&#34;"/>
+   </antcall>
+ </target>
+
+ <target name="start" 
+         description="Start bundle.name using telnet console">
+   <antcall target="send_console_cmd">
+    <param name  = "cmd"
+           value = "/fr start &#34;${bundle.name}&#34;"/>
+   </antcall>
+ </target>
+
+ <target name="update" 
+         description="Update bundle.name using telnet console">
+   <antcall target="send_console_cmd">
+    <param name  = "cmd"
+           value = "/fr update &#34;${bundle.name}&#34;"/>
+   </antcall>
+ </target>
+
+ <target name="uninstall" 
+         description="Uninstall bundle.name using telnet console">
+   <antcall target="send_console_cmd">
+    <param name  = "cmd"
+           value = "/fr uninstall &#34;${bundle.name}&#34;"/>
+   </antcall>
+ </target>
+
+ <target name="send_console_cmd" depends="check_telnet"
+ >
+  <telnet port     = "${console.port}" 
+          server   = "${console.host}"
+          timeout  = "20">
+   <read string="${console.welcome}"/>
+   <read>ogin:</read>
+   <write echo="true">${console.user}</write>
+   <read>assword:</read>
+   <write echo="false">${console.pwd}</write>
+   <read string="${console.loginok}"/>
+   <write>${cmd}</write>
+   <read/>
+ </telnet>
+</target>
+
+
+  <target name="junit_ext" 
+          description="Runs remote JUnit test using external runner">
+
+   <fail unless="test.id" message="test.id must be set to test suite id"/>
+
+
+   <java classname="${junit.runner.class}" 
+         fork="yes"
+   >
+    <classpath>
+      <path location="${topdir}/jars/junit/junit_all-1.0.0.jar"/>
+      <path refid="bundle.compile.path"/>
+    </classpath>
+
+    <sysproperty key   = "suite.url" 
+                 value = "http://${http.host}:${http.port}/junit?id=${test.id}"/>
+    <arg value="org.knopflerfish.service.junit.client.JUnitClient"/>
+   </java>
+  </target>
+
+  <target name="junit_ant"
+          description="Runs remote JUnit test using Ant junit task">
+
+   <fail unless="test.id" message="test.id must be set to test suite id"/>
+
+   <echo message = "JUnit output file is '${junit.outfile}'"/> 
+   <junit fork         = "yes" 
+          showoutput   = "true" 
+          printsummary = "true">
+
+     <sysproperty key   = "suite.url" 
+                  value = "http://${http.host}:${http.port}/junit?id=${test.id}"/>
+
+     <classpath>
+       <path location="${topdir}/jars/junit/junit_all-1.0.0.jar"/>
+       <path refid="bundle.compile.path"/>
+     </classpath>
+
+     <formatter type="${junit.formatter}"/>
+
+     <test name    = "org.knopflerfish.service.junit.client.JUnitClient" 
+           outfile = "${junit.outfile}"/>
+   </junit>
+  </target>
+
+ <target name = "clean" description = "Removes all files in utput directory">
+  <delete dir = "${outdir}"/>
+  <delete dir = "${jardir}"/>
+ </target>
+
+
+
+
+
+
+

Added: cocoon/whiteboard/osgi/ant/html_template/bundle_index.html
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/osgi/ant/html_template/bundle_index.html?rev=189461&view=auto
==============================================================================
--- cocoon/whiteboard/osgi/ant/html_template/bundle_index.html (added)
+++ cocoon/whiteboard/osgi/ant/html_template/bundle_index.html Tue Jun  7 15:32:48 2005
@@ -0,0 +1,6 @@
+<html>
+ <frameset cols="190,*">
+  <frame name="bundle_list" src="list.html">
+  <frame name="bundle_main" src="main.html">
+ </frameset>
+</html>
\ No newline at end of file

Added: cocoon/whiteboard/osgi/ant/html_template/bundle_info.html
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/osgi/ant/html_template/bundle_info.html?rev=189461&view=auto
==============================================================================
--- cocoon/whiteboard/osgi/ant/html_template/bundle_info.html (added)
+++ cocoon/whiteboard/osgi/ant/html_template/bundle_info.html Tue Jun  7 15:32:48 2005
@@ -0,0 +1,105 @@
+<html>
+<head>
+<title>Bundle info: ${FILE}</title>
+
+<LINK href="${relpath}style.css" rel="stylesheet" type="text/css">
+
+</head>
+
+<body>
+
+<h2>${FILE}</a></h2>
+
+<p>
+<a href="${FILE}">download</a> (${FILEINFO})
+</p>
+
+<table width="100%">
+ <tr>
+  <td class="mfheader" colspan=2>OSGi manifest attributes</td>
+ </tr>
+
+ <tr>
+  <td>Bundle-Name</td>
+  <td>${Bundle-Name}</td>
+ </tr>
+ <tr>
+  <td>Bundle-Description</td>
+  <td>${Bundle-Description}</td>
+ </tr>
+ <tr>
+  <td>Bundle-Version</td>
+  <td>${Bundle-Version}</td>
+ </tr>
+ <tr>
+  <td>Bundle-Vendor</td>
+  <td>${Bundle-Vendor}</td>
+ </tr>
+ <tr>
+  <td>Bundle-Activator</td>
+  <td>${Bundle-Activator}</td>
+ </tr>
+
+
+ <tr>
+  <td>Bundle-DocURL</td>
+  <td><a href="${Bundle-DocURL}">${Bundle-DocURL}</a></td>
+ </tr>
+
+ <tr>
+  <td>Bundle-ContactAddress</td>
+  <td>${Bundle-ContactAddress}</td>
+ </tr>
+
+ <tr>
+  <td>Bundle-Classpath</td>
+  <td>${Bundle-Classpath}</td>
+ </tr>
+
+ <tr>
+  <td>Export-Package</td>
+  <td>${Export-Package}</td>
+ </tr>
+ <tr>
+  <td>Import-Package</td>
+  <td>${Import-Package}</td>
+ </tr>
+ <tr>
+  <td>Export-Service</td>
+  <td>${Export-Service}</td>
+ </tr>
+ <tr>
+  <td>Import-Service</td>
+  <td>${Import-Service}</td>
+ </tr>
+
+
+
+ <tr>
+  <td  class="mfheader" colspan=2>Other manifest attributes</td>
+ </tr>
+
+ ${MF.UNHANDLED}
+
+</table>
+
+
+<h4>Depends on</h4>
+<table>
+${depends.list}
+</table>
+
+<h4>Other bundles depending on this bundle</h4>
+<table>
+${depending.list}
+</table>
+
+
+<a name="source"></a>
+<h4>Bundle source</h4>
+${sources.list}
+
+</body>
+</html>
+
+

Added: cocoon/whiteboard/osgi/ant/html_template/bundle_list.html
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/osgi/ant/html_template/bundle_list.html?rev=189461&view=auto
==============================================================================
--- cocoon/whiteboard/osgi/ant/html_template/bundle_list.html (added)
+++ cocoon/whiteboard/osgi/ant/html_template/bundle_list.html Tue Jun  7 15:32:48 2005
@@ -0,0 +1,18 @@
+<html>
+
+<head>
+<LINK href="style.css" rel="stylesheet" type="text/css">
+</head>
+
+<body>
+<a target="_top" href="../../../index.html">Knopflerfish pages</a>
+
+<h3><a target="bundle_main" href="main.html">All bundles</a></h3>
+
+<table>
+${bundle.list}
+</table>
+</body>
+
+</html>
+

Added: cocoon/whiteboard/osgi/ant/html_template/bundle_main.html
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/osgi/ant/html_template/bundle_main.html?rev=189461&view=auto
==============================================================================
--- cocoon/whiteboard/osgi/ant/html_template/bundle_main.html (added)
+++ cocoon/whiteboard/osgi/ant/html_template/bundle_main.html Tue Jun  7 15:32:48 2005
@@ -0,0 +1,36 @@
+<html>
+
+<head>
+<title>Bundles</title>
+<LINK href="style.css" rel="stylesheet" type="text/css">
+</head>
+
+<body>
+<h3>Bundle information</h3>
+
+<p>
+These pages contains information on all built bundles. Select from the 
+bundle list to view detailed bundle information, cross 
+references to depending bundles and javadoc links.
+</p>
+<p>
+New: Source code is now included in all library bundles and bundles ending 
+with "_all". The detail pages for these bundles contains links to the
+source code.
+</p>
+
+<p>
+${unresolved.list}
+</p>
+
+<p>
+<table>
+${bundle.list}
+</table>
+</p>
+
+
+</body>
+
+</html>
+

Added: cocoon/whiteboard/osgi/ant/html_template/style.css
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/osgi/ant/html_template/style.css?rev=189461&view=auto
==============================================================================
--- cocoon/whiteboard/osgi/ant/html_template/style.css (added)
+++ cocoon/whiteboard/osgi/ant/html_template/style.css Tue Jun  7 15:32:48 2005
@@ -0,0 +1,189 @@
+BODY  {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size:11px;
+ color:000000;
+ text-align:left;
+ font-weight:normal;
+ background:#ffffdd;
+}
+
+
+
+
+TD  {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ text-align:left;
+ vertical-align:top;
+ font-size:11px;
+}
+
+TD A  {
+ color:000000;
+ text-decoration:none
+ font-size:11px;
+}
+
+.mfheader  {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ text-align:left;
+ vertical-align:top;
+ font-size:11px;
+ font-weight:bold;
+ background: #dddddd;
+}
+
+TH  {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size:11px;
+ color:000000;
+ text-align:left;
+ vertical-align:top;
+ font-weight:bold
+}
+
+TD A  {
+ color:000000;
+ text-decoration:none
+ font-size:11px;
+}
+
+PRE {
+ font-family: Courier New, Courier;
+ font-size:11px;
+ color:000000;
+ text-align:left;
+ font-weight:normal;
+}
+
+
+H1  {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size:19px;
+ font-weight:bold
+ background: #dddddd;
+}
+
+H2  {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size:15px;
+ font-weight:bold
+ background: #dddddd;
+}
+
+H3  {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size:13px;
+ font-weight:bold
+ background-color: #dddddd;
+}
+
+H4  {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size:11px;
+ font-weight:bold
+ background: #dddddd;
+}
+
+H5  {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size:9px;
+ font-weight:bold
+ background: #dddddd;
+}
+
+H6  {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size:7px;
+ font-weight:bold
+}
+
+TD.menu {
+ color: #ffffff;
+ font-size:9px;
+ font-weight:bold;
+ text-align:left;
+}
+
+A.top {
+  float: right;
+  text-decoration:  none;
+  font-weight:      bold;
+}
+
+A, A:visited, A:selected, A:active {
+ color:000000;
+ text-decoration:  none;
+ font-weight:      bold;
+}
+
+A:hover {
+ text-decoration:  underline;
+}
+
+li.A:visited, li.A:selected, li.A:active {
+ text-decoration:  none;
+ font-weight:      bold;
+}
+
+li.A:hover {
+ text-decoration:  underline;
+}
+
+.small  {
+ font-size:9px;
+}
+
+.medium  {
+ font-size:13px;
+}
+
+.big  {
+ font-size:17px;
+}
+
+.ghosted  {
+  color: #888888;
+}
+
+.framed  {
+ border-type: solid;
+ border-top: 1px solid;
+ border-left: 1px solid;
+ border-bottom: 1px solid;
+ border-right: 1px solid;
+ background:#eeeeee;
+ border-color:#000000;
+ padding-left: 2;
+ padding-top: 2;
+ padding-bottom: 2;
+ padding-right: 2;
+ text-decoration:none;
+ font-size: 11px;
+}
+
+.boxed  {
+ border-type: solid;
+ border-top: 1px solid;
+ border-left: 1px solid;
+ border-bottom: 1px solid;
+ border-right: 1px solid;
+ background:#E7DBAD;
+ border-color:#000000;
+ padding-left: 2;
+ padding-top: 1;
+ padding-bottom: 2;
+ padding-right: 2;
+ text-decoration:none;
+ float: left;
+}
+
+dt {
+ font-weight:bold;
+  margin-bottom: 5px;
+}
+
+dd {
+  margin-bottom: 5px;
+}
+
+

Added: cocoon/whiteboard/osgi/ant/readme.txt
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/osgi/ant/readme.txt?rev=189461&view=auto
==============================================================================
--- cocoon/whiteboard/osgi/ant/readme.txt (added)
+++ cocoon/whiteboard/osgi/ant/readme.txt Tue Jun  7 15:32:48 2005
@@ -0,0 +1,10 @@
+This directory contains ant related code ant build files.
+
+ build_example.xml          Example of bundle build.xml
+
+ bundlebuild_include.xml    ant build file to be included in
+                            build.xml
+
+ html_template              HTML templates for generated bundle
+                              docs
+ src                        source code for bundle build task 

Added: cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/ArrayInt.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/ArrayInt.java?rev=189461&view=auto
==============================================================================
--- cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/ArrayInt.java (added)
+++ cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/ArrayInt.java Tue Jun  7 15:32:48 2005
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2003, KNOPFLERFISH project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions are met:
+ * 
+ * - Redistributions of source code must retain the above copyright notice, 
+ *   this list of conditions and the following disclaimer. 
+ * 
+ * - Redistributions in binary form must reproduce the above copyright notice, 
+ *   this list of conditions and the following disclaimer in the documentation 
+ *   and/or other materials provided with the distribution. 
+ * 
+ * - Neither the name of the KNOPFLERFISH project nor the names of its 
+ *   contributors may be used to endorse or promote products derived 
+ *   from this software without specific prior written permission. 
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.knopflerfish.ant.taskdefs.bundle;
+
+import java.io.*;
+import java.util.*;
+
+public class ArrayInt extends Number implements Comparable {
+  int[] ia = new int[0];
+  
+  public static String UNDEF = "";
+  
+  public ArrayInt() {
+    this("0");
+  }
+  
+  public ArrayInt(String s) {
+    parseDotString(s);
+  }
+  
+  public void parseDotString(String s) {
+    if(UNDEF.equals(s)) {
+      ia = new int[0];
+      return;
+    }
+    
+    String[] sa = Util.splitwords(s, ".", '\"');
+    
+    ia = new int[sa.length];
+    
+    for(int i = 0; i < sa.length; i++) {
+      ia[i] = Integer.parseInt(sa[i]);
+    }
+  }
+  
+  public int compareTo(Object o) {
+    ArrayInt other = (ArrayInt)o;
+    
+    if(other.ia.length == 0) {
+      return 1;
+    }
+    int i = 0;
+    while(i < ia.length && i < other.ia.length) {
+      int diff = ia[i] - other.ia[i];
+      if(diff != 0) {
+	return diff;
+      }
+      i++;
+    }
+    
+    return 0;
+  }
+  
+  public double doubleValue() {
+    return (int)doubleValue();
+  }
+  
+  public float floatValue() {
+    return (float)longValue();
+  }
+  
+  public int intValue() {
+    return (int)longValue();
+  }
+  
+  
+  public long longValue() {
+    long v = 0;
+    for(int i = 0; i < ia.length; i++) {
+      v = (v << 8) + ia[i];
+    }
+    
+    return v;
+  }
+  
+  public String toString() {
+    StringBuffer sb = new StringBuffer();
+    if(ia.length == 0) {
+      sb.append(UNDEF);
+    } else {
+      for(int i = 0; i < ia.length; i++) {
+	sb.append(Integer.toString(ia[i]));
+	if(i < ia.length - 1) {
+	  sb.append(".");
+	}
+      }
+    }
+    return sb.toString();
+  }
+}
+

Added: cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/Bundle.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/Bundle.java?rev=189461&view=auto
==============================================================================
--- cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/Bundle.java (added)
+++ cocoon/whiteboard/osgi/ant/src/org/knopflerfish/ant/taskdefs/bundle/Bundle.java Tue Jun  7 15:32:48 2005
@@ -0,0 +1,603 @@
+/*
+ * Copyright (c) 2004, KNOPFLERFISH project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ *
+ * - Neither the name of the KNOPFLERFISH project nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.knopflerfish.ant.taskdefs.bundle;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.bcel.classfile.ClassParser;
+import org.apache.bcel.classfile.Constant;
+import org.apache.bcel.classfile.ConstantClass;
+import org.apache.bcel.classfile.ConstantPool;
+import org.apache.bcel.classfile.JavaClass;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.FileScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Jar;
+import org.apache.tools.ant.taskdefs.Manifest;
+import org.apache.tools.ant.taskdefs.ManifestException;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.ZipFileSet;
+
+
+/**
+ * <p>
+ * An extension of the
+ * <a href="http://ant.apache.org/manual/CoreTasks/jar.html" target="_top">Jar</a> task that
+ * builds an OSGi bundle. It can generate the Bundle-Activator,
+ * Bundle-ClassPath and Import-Package manifest headers based on the content
+ * specified in the task.
+ * </p>
+ *
+ * <p>
+ * <b>Note:</b> This task depends on the
+ * <a href="http://jakarta.apache.org/bcel/">Apache Jakarta BCEL</a> library,
+ * not included in the Ant distribution.
+ * </p>
+ *
+ * <h3>Parameters</h3>
+ * <table border="1px">
+ *   <tr>
+ *     <th align="left">Attribute</th>
+ *     <th align="left">Description</th>
+ *     <th align="left">Required</th>
+ *   </tr>
+ *   <tr>
+ *     <td valign="top">file</td>
+ *     <td valign="top">The bundle file to create.</td>
+ *     <td valign="top">Yes</td>
+ *   </tr>
+ *   <tr>
+ *     <td valign="top">activator</td>
+ *     <td valign="top">
+ *       The bundle activator class name. If set to "none" no Bundle-Activator
+ *       manifest header will be generated. If set to "auto" the bundle task
+ *       will try to find an activator in the included class files.
+ *     </td>
+ *     <td valign="top">No, default is "auto"</td>
+ *   </tr>
+ *   <tr>
+ *     <td valign="top">packageanalysis</td>
+ *     <td valign="top">
+ *       Analyzes the class files of the bundle and the contents of the
+ *       <tt>exportpackage</tt> and <tt>importpackage</tt> nested elements.
+ *       <ul>
+ *         <li>none &ndash; no analysis is performed.</li>
+ *         <li>warn &ndash; a warning will be displayed for each referenced
+ *         package not found in the bundle or the <tt>importpackage</tt> nested
+ *         elements.</li>
+ *         <li>auto &ndash; each referenced package not found in the bundle or
+ *         the <tt>importpackage</tt> nested elements will be added to the
+ *         Import-Package manifest header. Packages exported by the bundle will
+ *         be added to the Import-Package manifest header with the version as
+ *         specified in the <tt>exportpackage</tt> nested element.</li>
+ *       </ul>
+ *     </td>
+ *     <td valign="top">No, default is "warn"</td>
+ *   </tr>
+ * </table>
+ *
+ * <h3>Nested elements</h3>
+ *
+ * <h4>classes</h4>
+ * <p>
+ * The nested <tt>classes</tt> element specifies a
+ * <a href="http://ant.apache.org/manual/CoreTypes/zipfileset.html" target="_top">ZipFileSet</a>.
+ * The <tt>prefix</tt> attribute will be added to the Bundle-ClassPath manifest
+ * header. The classes specified by the file set will be included in the class
+ * analysis.
+ * </p>
+ *
+ * <h4>lib</h4>
+ * <p>
+ * The nested <tt>lib</tt> element specifies a
+ * <a href="http://ant.apache.org/manual/CoreTypes/zipfileset.html" target="_top">ZipFileSet</a>.
+ * The locations of all files in the file set will be added to the
+ * Bundle-ClassPath manifest header. All files of this file set must be either
+ * zip or jar files. The classes available in the zip or jar files will be
+ * included in the class analysis.
+ * </p>
+ *
+ * <h4>exportpackage</h4>
+ * <p>
+ * The nested <tt>exportpackage</tt> element specifies the name and
+ * specification version of a package to add to the Export-Package manifest
+ * header. If package analysis is not turned off, a warning will be issued if
+ * the specified package cannot be found in the bundle.
+ * </p>
+ *
+ * <h4>importpackage</h4>
+ * <p>
+ * The nested <tt>importpackage</tt> element specifies the name and
+ * specification version of a package to add to the Import-Package manifest
+ * header.
+ * </p>
+ *
+ * <h3>Implicit fileset</h3>
+ * <p>
+ * The implicit fileset is specified by the <tt>baseDir</tt> attribute of the
+ * bundle task and the nested <tt>include</tt> and <tt>exclude</tt> elements.
+ * </p>
+ * <p>
+ * The implicit fileset of the <tt>bundle</tt> task will be included in the
+ * class analysis and in the Bundle-ClassPath manifest header if needed.
+ * </p>
+ *
+ * <h3>Examples</h3>
+ * <pre>
+ * &lt;bundle activator="auto"
+ *         packageanalysis="auto"
+ *         file="out/${ant.project.name}.jar">
+ *
+ *   &lt;exportpackage name="se.weilenmann.bundle.test" version="1.0"/>
+ *
+ *   &lt;manifest>
+ *     &lt;attribute name="Bundle-Name" value="testbundle"/>
+ *     &lt;attribute name="Bundle-Version" value="1.0"/>
+ *     &lt;attribute name="Bundle-Vendor" value="Kaspar Weilenmann"/>
+ *   &lt;/manifest>
+ *
+ *   &lt;classes dir="out/classes">
+ *     &lt;include name="se/weilenmann/bundle/test/**"/>
+ *   &lt;/classes>
+ *   &lt;classes dir="out/classes" prefix="util">
+ *     &lt;include name="se/weilenmann/util/**"/>
+ *   &lt;/classes>
+ *   &lt;classes src="osgi/jars/log/log_api.jar" prefix="log_api">
+ *     &lt;include name="*&#42;/*.class"/>
+ *   &lt;/classes>
+ *
+ *   &lt;lib dir="osgi/jars/cm" includes="cm_api.jar" prefix="osgi"/>
+ *   &lt;lib dir="lib/commons" includes="commons-logging.jar" prefix="commons"/>
+ *
+ * &lt;/bundle>
+ * </pre>
+ * <p>Creates a bundle with the following manifest:<p>
+ * <pre>
+ * Manifest-Version: 1.0
+ * Ant-Version: Apache Ant 1.6.2
+ * Created-By: 1.4.2_02-b03 (Sun Microsystems Inc.)
+ * Bundle-Name: testbundle
+ * Bundle-Version: 1.0
+ * Bundle-Vendor: Kaspar Weilenmann
+ * Bundle-Activator: se.weilenmann.bundle.test.Activator
+ * Bundle-ClassPath: .,util,log_api,osgi/cm_api.jar,commons/commons-loggi
+ * ng.jar
+ * Import-Package: se.weilenmann.bundle.test;specification-version=1.0,or
+ * g.osgi.framework
+ * Export-Package: se.weilenmann.bundle.test;specification-version=1.0
+ * </pre>
+ *
+ * @author <a href="mailto:kaspar@weilenmann.se">Kaspar Weilenmann</a>
+ */
+public class Bundle extends Jar {
+
+  // private fields
+
+  private static final String BUNDLE_CLASS_PATH_KEY = "Bundle-ClassPath";
+  private static final String BUNDLE_ACTIVATOR_KEY = "Bundle-Activator";
+  private static final String IMPORT_PACKAGE_KEY = "Import-Package";
+  private static final String EXPORT_PACKAGE_KEY = "Export-Package";
+
+  private static final String ACTIVATOR_NONE = "none";
+  private static final String ACTIVATOR_AUTO = "auto";
+
+  private static final String PACKAGE_ANALYSIS_NONE = "none";
+  private static final String PACKAGE_ANALYSIS_WARN = "warn";
+  private static final String PACKAGE_ANALYSIS_AUTO = "auto";
+
+  private String activator = ACTIVATOR_AUTO;
+  private String packageAnalysis = PACKAGE_ANALYSIS_WARN;
+  private Map importPackage = new HashMap();
+  private Map exportPackage = new HashMap();
+  private List libs = new ArrayList();
+  private List classes = new ArrayList();
+
+  private File baseDir = null;
+  private List zipgroups = new ArrayList();
+  private List srcFilesets = new ArrayList();
+
+  private Manifest generatedManifest = new Manifest();
+
+  private Set activatorClasses = new HashSet();
+  private Set availablePackages = new HashSet();
+  private Set referencedPackages = new HashSet();
+  private Set standardPackagePrefixes = new HashSet(); {
+    standardPackagePrefixes.add("java.");
+  }
+
+
+  // private methods
+
+  private void analyze() {
+    if (activator == ACTIVATOR_AUTO ||
+        packageAnalysis != PACKAGE_ANALYSIS_NONE) {
+      addZipGroups();
+      addImplicitFileset();
+
+      for (Iterator i = srcFilesets.iterator(); i.hasNext();) {
+        FileSet fileset = (FileSet) i.next();
+        File srcFile = getZipFile(fileset);
+        if (srcFile == null) {
+          File filesetBaseDir = fileset.getDir(getProject());
+          DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
+          String[] files = ds.getIncludedFiles();
+          for (int j = 0; j < files.length; j++) {
+            String fileName = files[j];
+            if (fileName.endsWith(".class")) {
+              File file = new File(filesetBaseDir, fileName);
+              try {
+                analyzeClass(new ClassParser(file.getAbsolutePath()));
+              } catch (IOException ioe) {
+                throw new BuildException("Failed to parse class file: " + file.getAbsolutePath(), ioe);
+              }
+            }
+          }
+        } else {
+          try {
+            ZipFile zipFile = new ZipFile(srcFile);
+            Enumeration files = zipFile.entries();
+            while (files.hasMoreElements()) {
+              ZipEntry entry = (ZipEntry) files.nextElement();
+              String name = entry.getName();
+              if (name.endsWith(".class")) {
+                try {
+                  analyzeClass(new ClassParser(zipFile.getInputStream(entry), name));
+                } catch (IOException ioe) {
+                  throw new BuildException("Failed to parse class file: " + name, ioe);
+                }
+              }
+            }
+          } catch (IOException ioe) {
+            throw new BuildException("Failed to read zip file: " + zipFile.getAbsolutePath(), ioe);
+          }
+        }
+      }
+
+      Set publicPackages = exportPackage.keySet();
+
+      if (packageAnalysis != PACKAGE_ANALYSIS_NONE) {
+        for (Iterator i = publicPackages.iterator(); i.hasNext();) {
+          String packageName = (String) i.next();
+          if (!availablePackages.contains(packageName)) {
+            log("Exported package not found in bundle: " + packageName, Project.MSG_WARN);
+          }
+        }
+      }
+
+      Set privatePackages = new HashSet(availablePackages);
+      privatePackages.removeAll(publicPackages);
+
+      referencedPackages.removeAll(privatePackages);
+      for (Iterator iterator = referencedPackages.iterator(); iterator.hasNext();) {
+        String packageName = (String) iterator.next();
+        if (!isStandardPackage(packageName) &&
+            !importPackage.containsKey(packageName)) {
+          if (packageAnalysis == PACKAGE_ANALYSIS_AUTO) {
+            if (exportPackage.containsKey(packageName)) {
+              importPackage.put(packageName, exportPackage.get(packageName)); // TODO: do we want to import with version?
+            } else {
+              importPackage.put(packageName, null);
+            }
+          } else if (packageAnalysis == PACKAGE_ANALYSIS_WARN) {
+            log("Referenced package not found in bundle or imports: " + packageName, Project.MSG_WARN);
+          }
+        }
+      }
+    }
+  }
+
+  private void addZipGroups() {
+    for (int i = 0; i < zipgroups.size(); i++) {
+      FileSet fileset = (FileSet) zipgroups.get(i);
+      FileScanner fs = fileset.getDirectoryScanner(getProject());
+      String[] files = fs.getIncludedFiles();
+      File basedir = fs.getBasedir();
+      for (int j = 0; j < files.length; j++) {
+        ZipFileSet zipfileset = new ZipFileSet();
+        zipfileset.setSrc(new File(basedir, files[j]));
+        srcFilesets.add(zipfileset);
+      }
+    }
+  }
+
+  private void addImplicitFileset() {
+    if (baseDir != null) {
+      FileSet fileset = (FileSet) getImplicitFileSet().clone();
+      fileset.setDir(baseDir);
+      srcFilesets.add(fileset);
+    }
+  }
+
+  private File getZipFile(FileSet fileset) {
+    if (fileset instanceof ZipFileSet) {
+      ZipFileSet zipFileset = (ZipFileSet) fileset;
+      return zipFileset.getSrc(getProject());
+    } else {
+      return null;
+    }
+  }
+
+  private void analyzeClass(ClassParser parser) throws IOException {
+    JavaClass javaClass = parser.parse();
+    availablePackages.add(javaClass.getPackageName());
+
+    String[] interfaces = javaClass.getInterfaceNames();
+    for (int i = 0; i < interfaces.length; i++) {
+      if("org.osgi.framework.BundleActivator".equals(interfaces[i])) {
+        activatorClasses.add(javaClass.getClassName());
+      }
+    }
+
+    ConstantPool constantPool = javaClass.getConstantPool();
+    Constant[] constants = constantPool.getConstantPool();
+    for (int i = 0; i < constants.length; i++) {
+      Constant constant = constants[i];
+      if (constant instanceof ConstantClass) {
+        String referencedClass = ((ConstantClass) constant).getBytes(constantPool);
+        int lastSlashIndex = referencedClass.lastIndexOf('/');
+        if (lastSlashIndex > -1) {
+          String packageName = referencedClass.substring(0, lastSlashIndex).replace('/', '.');
+          referencedPackages.add(packageName);
+        }
+      }
+    }
+  }
+
+  private boolean isStandardPackage(String packageName) {
+    for (Iterator i = standardPackagePrefixes.iterator(); i.hasNext();) {
+      String prefix = (String) i.next();
+      if (packageName.startsWith(prefix)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  private void handleActivator() throws ManifestException {
+    if (activator == ACTIVATOR_NONE) {
+      log("No BundleActivator set", Project.MSG_DEBUG);
+    } else if (activator == ACTIVATOR_AUTO) {
+      switch (activatorClasses.size()) {
+        case 0: {
+          log("No class implementing BundleActivator found", Project.MSG_INFO);
+          break;
+        }
+        case 1: {
+          activator = (String) activatorClasses.iterator().next();
+          break;
+        }
+        default: {
+          log("More than one class implementing BundleActivator found:", Project.MSG_WARN);
+          for (Iterator i = activatorClasses.iterator(); i.hasNext();) {
+            String activator = (String) i.next();
+            log("  " + activator, Project.MSG_WARN);
+          }
+          break;
+        }
+      }
+    }
+    if (activator != ACTIVATOR_NONE && activator != ACTIVATOR_AUTO) {
+      log("Bundle-Activator set to " + activator, Project.MSG_INFO);
+      generatedManifest.addConfiguredAttribute(createAttribute(BUNDLE_ACTIVATOR_KEY, activator));
+    }
+  }
+
+  private void handleClassPath() throws ManifestException {
+    StringBuffer value = new StringBuffer();
+
+    boolean rootIncluded = false;
+    if (baseDir != null || classes.size() == 0) {
+      value.append(".,");
+      rootIncluded = true;
+    }
+
+    Iterator i = classes.iterator();
+    while (i.hasNext()) {
+      ZipFileSet zipFileSet = (ZipFileSet) i.next();
+      String prefix = zipFileSet.getPrefix(getProject());
+      if (prefix.length() > 0) {
+        value.append(prefix);
+        value.append(',');
+      } else if (!rootIncluded) {
+        value.append(".,");
+        rootIncluded = true;
+      }
+    }
+
+    i = libs.iterator();
+    while (i.hasNext()) {
+      ZipFileSet fileset = (ZipFileSet) i.next();
+      if (fileset.getSrc(getProject()) == null) {
+        DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
+        String[] files = ds.getIncludedFiles();
+        if (files.length != 0) {
+          zipgroups.add(fileset);
+          String prefix = fixPrefix(fileset.getPrefix(getProject()));
+          for (int j = 0; j < files.length; j++) {
+            value.append(prefix.replace('\\', '/'));
+            value.append(files[j].replace('\\', '/'));
+            value.append(',');
+          }
+        }
+      }
+    }
+
+    if (value.length() > 2) {
+      generatedManifest.addConfiguredAttribute(createAttribute(BUNDLE_CLASS_PATH_KEY, value.substring(0, value.length() - 1)));
+    }
+  }
+
+  private static String fixPrefix(String prefix) {
+    if (prefix.length() > 0) {
+      char c = prefix.charAt(prefix.length() - 1);
+      if (c != '/' && c != '\\') {
+        prefix = prefix + "/";
+      }
+    }
+    return prefix;
+  }
+
+  private void addPackageHeader(String headerName, Map packageMap) throws ManifestException {
+    Iterator i = packageMap.entrySet().iterator();
+    if (i.hasNext()) {
+      StringBuffer value = new StringBuffer();
+      while (i.hasNext()) {
+        Map.Entry entry = (Map.Entry) i.next();
+        String name = (String) entry.getKey();
+        String version = (String) entry.getValue();
+        value.append(name);
+        if (version != null) {
+          value.append(";specification-version=");
+          value.append(version);
+        }
+        value.append(',');
+      }
+      value.setLength(value.length() - 1);
+      generatedManifest.addConfiguredAttribute(createAttribute(headerName, value.toString()));
+    }
+  }
+
+  private static Manifest.Attribute createAttribute(String name, String value) {
+    Manifest.Attribute attribute = new Manifest.Attribute();
+    attribute.setName(name);
+    attribute.setValue(value);
+    return attribute;
+  }
+
+
+  // public methods
+
+  public void setActivator(String activator) {
+    if (ACTIVATOR_NONE.equalsIgnoreCase(activator)) {
+      this.activator = ACTIVATOR_NONE;
+    } else if (ACTIVATOR_AUTO.equalsIgnoreCase(activator)) {
+      this.activator = ACTIVATOR_AUTO;
+    } else {
+      this.activator = activator;
+    }
+  }
+
+  public void setPackageAnalysis(String packageAnalysis) {
+    packageAnalysis = packageAnalysis.trim().toLowerCase();
+    if (PACKAGE_ANALYSIS_NONE.equals(packageAnalysis)) {
+      this.packageAnalysis = PACKAGE_ANALYSIS_NONE;
+    } else if (PACKAGE_ANALYSIS_WARN.equals(packageAnalysis)) {
+      this.packageAnalysis = PACKAGE_ANALYSIS_WARN;
+    } else if (PACKAGE_ANALYSIS_AUTO.equals(packageAnalysis)) {
+      this.packageAnalysis = PACKAGE_ANALYSIS_AUTO;
+    } else {
+      throw new BuildException("Illegal value: " + packageAnalysis);
+    }
+  }
+
+  public void addConfiguredImportPackage(OSGiPackage osgiPackage) {
+    if (osgiPackage.getName() == null) {
+      throw new BuildException("ImportPackage must have a name");
+    } else {
+      importPackage.put(osgiPackage.getName(), osgiPackage.getVersion());
+    }
+  }
+
+  public void addConfiguredExportPackage(OSGiPackage osgiPackage) {
+    if (osgiPackage.getName() == null) {
+      throw new BuildException("ExportPackage must have a name");
+    } else {
+      exportPackage.put(osgiPackage.getName(), osgiPackage.getVersion());
+    }
+  }
+
+  public void addConfiguredLib(ZipFileSet fileset) {
+    // TODO: handle refid
+    if (fileset.getSrc(getProject()) == null) {
+      addFileset(fileset);
+      libs.add(fileset);
+    } else {
+      addClasses(fileset);
+    }
+  }
+
+  public void addClasses(ZipFileSet fileset) {
+    super.addZipfileset(fileset);
+    srcFilesets.add(fileset);
+    classes.add(fileset);
+  }
+
+
+  // extends Jar
+
+  public void execute() {
+    try {
+      handleClassPath();
+
+      analyze();
+
+      handleActivator();
+
+      addPackageHeader(IMPORT_PACKAGE_KEY, importPackage);
+      addPackageHeader(EXPORT_PACKAGE_KEY, exportPackage);
+
+      // TODO: better merge may be needed, currently overwrites pre-existing headers
+      addConfiguredManifest(generatedManifest);
+    } catch (ManifestException me) {
+      throw new BuildException("Error merging manifest headers", me);
+    }
+    super.execute();
+  }
+
+  public void setBasedir(File baseDir) {
+    super.setBasedir(baseDir);
+    this.baseDir = baseDir;
+  }
+
+  public void addZipGroupFileset(FileSet fileset) {
+    super.addZipGroupFileset(fileset);
+    zipgroups.add(fileset);
+  }
+
+  public void addZipfileset(ZipFileSet fileset) {
+    super.addZipfileset(fileset);
+  }
+
+} // Bundle



Mime
View raw message