JBoss-OSGI SVN: r97731 - projects/jboss-osgi/trunk/hudson.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-11 08:26:38 -0500 (Fri, 11 Dec 2009)
New Revision: 97731
Modified:
projects/jboss-osgi/trunk/hudson/ant.properties.example
Log:
Update hudson setup
Modified: projects/jboss-osgi/trunk/hudson/ant.properties.example
===================================================================
--- projects/jboss-osgi/trunk/hudson/ant.properties.example 2009-12-11 13:24:53 UTC (rev 97730)
+++ projects/jboss-osgi/trunk/hudson/ant.properties.example 2009-12-11 13:26:38 UTC (rev 97731)
@@ -9,9 +9,9 @@
# Hudson QA Environment
# hudson.username=username
-#hudson.jboss501.zip=file:///home/hudson/download/java/jboss/jboss-5.0.1.GA.zip
-#hudson.jboss510.zip=file:///home/hudson/download/java/jboss/jboss-5.1.0.GA.zip
-#hudson.jboss600.zip=file:///home/hudson/download/java/jboss/jboss-6.0.0.M1.zip
+#hudson.jboss501.zip=file:///home/username/Download/java/jboss/jboss-5.0.1.GA.zip
+#hudson.jboss510.zip=file:///home/username/Download/java/jboss/jboss-5.1.0.GA.zip
+#hudson.jboss600.zip=file:///home/username/Download/java/jboss/jboss-6.0.0.M1.zip
# JDK settings
java.home.jdk15=/usr/java/jdk1.5.0_22
14 years, 5 months
JBoss-OSGI SVN: r97730 - projects/jboss-osgi/trunk/hudson.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-11 08:24:53 -0500 (Fri, 11 Dec 2009)
New Revision: 97730
Modified:
projects/jboss-osgi/trunk/hudson/ant.properties.example
Log:
Update hudson setup
Modified: projects/jboss-osgi/trunk/hudson/ant.properties.example
===================================================================
--- projects/jboss-osgi/trunk/hudson/ant.properties.example 2009-12-11 13:23:28 UTC (rev 97729)
+++ projects/jboss-osgi/trunk/hudson/ant.properties.example 2009-12-11 13:24:53 UTC (rev 97730)
@@ -3,33 +3,33 @@
#
# $Id: ant.properties.example 3995 2007-07-26 08:52:45Z thomas.diesler(a)jboss.com $
-# The JBoss settings
-jboss.server.instance=default
-jboss.bind.address=127.0.0.1
+# Hudson Workspace Root
+# hudson.root=/home/username/workspace/hudson/jboss-osgi
+# Hudson QA Environment
+# hudson.username=username
+
+#hudson.jboss501.zip=file:///home/hudson/download/java/jboss/jboss-5.0.1.GA.zip
+#hudson.jboss510.zip=file:///home/hudson/download/java/jboss/jboss-5.1.0.GA.zip
+#hudson.jboss600.zip=file:///home/hudson/download/java/jboss/jboss-6.0.0.M1.zip
+
# JDK settings
java.home.jdk15=/usr/java/jdk1.5.0_22
java.home.jdk16=/usr/java/jdk1.6.0_17
-# Hudson QA Environment
-hudson.username=changeme
-
+# Maven settings
hudson.maven.name=apache-maven-2.2.1
hudson.maven.path=/usr/java/apache-maven-2.2.1
+hudson.maven.profile=$HUDSONDIR/profiles.xml.local.qa
-# Hudson Workspace Root
-# hudson.root=/home/username/workspace/hudson/jboss-osgi
+# The JBoss settings
+jboss.server.instance=default
+jboss.bind.address=127.0.0.1
-hudson.maven.profile=$HUDSONDIR/profiles.xml.local.qa
-
-hudson.host=jbmuc.dyndns.org
+hudson.host=localhost
hudson.admin.port=8250
hudson.http.port=8280
-#hudson.jboss501.zip=file:///home/hudson/download/java/jboss/jboss-5.0.1.GA.zip
-#hudson.jboss510.zip=file:///home/hudson/download/java/jboss/jboss-5.1.0.GA.zip
-#hudson.jboss600.zip=file:///home/hudson/download/java/jboss/jboss-6.0.0.M1.zip
-
hudson.mail.recipients=
hudson.mail.admin=yourname(a)yourdomain.com
hudson.smtp.host=localhost
14 years, 5 months
JBoss-OSGI SVN: r97727 - in projects/jboss-osgi/trunk: hudson and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-11 08:12:37 -0500 (Fri, 11 Dec 2009)
New Revision: 97727
Removed:
projects/jboss-osgi/trunk/hudson/apache-tomcat/conf/tomcat-users.xml
projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-6.0.0/
Modified:
projects/jboss-osgi/trunk/hudson/ant.properties.example
projects/jboss-osgi/trunk/hudson/build.xml
projects/jboss-osgi/trunk/pom.xml
Log:
Update to new Deployment API
Modified: projects/jboss-osgi/trunk/hudson/ant.properties.example
===================================================================
--- projects/jboss-osgi/trunk/hudson/ant.properties.example 2009-12-11 13:12:03 UTC (rev 97726)
+++ projects/jboss-osgi/trunk/hudson/ant.properties.example 2009-12-11 13:12:37 UTC (rev 97727)
@@ -13,12 +13,12 @@
# Hudson QA Environment
hudson.username=changeme
-hudson.password=changeme
hudson.maven.name=apache-maven-2.2.1
hudson.maven.path=/usr/java/apache-maven-2.2.1
-hudson.root=/home/hudson/workspace/hudson/jboss-osgi
+# Hudson Workspace Root
+# hudson.root=/home/username/workspace/hudson/jboss-osgi
hudson.maven.profile=$HUDSONDIR/profiles.xml.local.qa
@@ -28,15 +28,12 @@
#hudson.jboss501.zip=file:///home/hudson/download/java/jboss/jboss-5.0.1.GA.zip
#hudson.jboss510.zip=file:///home/hudson/download/java/jboss/jboss-5.1.0.GA.zip
+#hudson.jboss600.zip=file:///home/hudson/download/java/jboss/jboss-6.0.0.M1.zip
hudson.mail.recipients=
hudson.mail.admin=yourname(a)yourdomain.com
hudson.smtp.host=localhost
-# Hudson (1.290)
apache-tomcat=5.5.27
-sun-hudson=2402/128862
+sun-hudson=1.336
-# authentication cancelled error
-# https://hudson.dev.java.net/issues/show_bug.cgi?id=3936
-
Deleted: projects/jboss-osgi/trunk/hudson/apache-tomcat/conf/tomcat-users.xml
===================================================================
--- projects/jboss-osgi/trunk/hudson/apache-tomcat/conf/tomcat-users.xml 2009-12-11 13:12:03 UTC (rev 97726)
+++ projects/jboss-osgi/trunk/hudson/apache-tomcat/conf/tomcat-users.xml 2009-12-11 13:12:37 UTC (rev 97727)
@@ -1,5 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<tomcat-users>
- <role rolename="admin"/>
- <user username="@hudson.username@" password="@hudson.password@" roles="admin"/>
-</tomcat-users>
Modified: projects/jboss-osgi/trunk/hudson/build.xml
===================================================================
--- projects/jboss-osgi/trunk/hudson/build.xml 2009-12-11 13:12:03 UTC (rev 97726)
+++ projects/jboss-osgi/trunk/hudson/build.xml 2009-12-11 13:12:37 UTC (rev 97727)
@@ -46,6 +46,11 @@
<property file="${basedir}/ant.properties"/>
+ <!-- Setup property defaults -->
+ <property environment="env"/>
+ <property name="hudson.username" value="${env.USER}" />
+ <property name="hudson.root" value="/home/${hudson.username}/workspace/osgitck" />
+
<xmlproperty file="${project.root.dir}/pom.xml"/>
<property name="version.id" value="${project.version}"/>
</target>
@@ -66,8 +71,6 @@
<property name="hudson.username.${hudson.username}" value="true"/>
<fail message="Cannot use default hudson username: ${hudson.username}" if="hudson.username.changeme"/>
- <property name="hudson.password.${hudson.password}" value="true"/>
- <fail message="Cannot use default hudson password: ${hudson.password}" if="hudson.password.changeme"/>
</target>
<target name="init-thirdparty" depends="init-hudson">
@@ -77,6 +80,7 @@
<available property="sun.hudson.available" file="${thirdparty.dir}/hudson.war"/>
<available property="jboss501.available" file="${thirdparty.dir}/jboss-5.0.1.GA.zip"/>
<available property="jboss510.available" file="${thirdparty.dir}/jboss-5.1.0.GA.zip"/>
+ <available property="jboss600.available" file="${thirdparty.dir}/jboss-6.0.0.M1.zip"/>
</target>
<!--
@@ -90,7 +94,7 @@
<get src="http://www.apache.org/dist/tomcat/tomcat-5/v${apache-tomcat}/bin/apache-t..." dest="${thirdparty.dir}/apache-tomcat.zip" usetimestamp="true" verbose="true"/>
</target>
<target name="get-hudson" depends="init-thirdparty" unless="sun.hudson.available">
- <get src="https://hudson.dev.java.net/files/documents/${sun-hudson}/hudson.war" dest="${thirdparty.dir}/hudson.war" usetimestamp="true" verbose="true"/>
+ <get src="http://hudson-ci.org/download/war/${sun-hudson}/hudson.war" dest="${thirdparty.dir}/hudson.war" usetimestamp="true" verbose="true"/>
</target>
<target name="get-jboss501" depends="init-thirdparty" unless="jboss501.available">
<property name="hudson.jboss501.zip" value="http://downloads.sourceforge.net/jboss/jboss-5.0.1.GA.zip"/>
@@ -100,6 +104,10 @@
<property name="hudson.jboss510.zip" value="http://downloads.sourceforge.net/jboss/jboss-5.1.0.GA.zip"/>
<get src="${hudson.jboss510.zip}" dest="${thirdparty.dir}/jboss-5.1.0.GA.zip" usetimestamp="true" verbose="true"/>
</target>
+ <target name="get-jboss600" depends="init-thirdparty" unless="jboss600.available">
+ <property name="hudson.jboss600.zip" value="http://downloads.sourceforge.net/jboss/jboss-6.0.0.M1.zip"/>
+ <get src="${hudson.jboss600.zip}" dest="${thirdparty.dir}/jboss-6.0.0.M1.zip" usetimestamp="true" verbose="true"/>
+ </target>
<!--
Setup the Hudson Tomcat instance
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-12-11 13:12:03 UTC (rev 97726)
+++ projects/jboss-osgi/trunk/pom.xml 2009-12-11 13:12:37 UTC (rev 97727)
@@ -54,7 +54,7 @@
<version.jboss.osgi.common>1.0.3</version.jboss.osgi.common>
<version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
<version.jboss.osgi.deployment>1.0.1-SNAPSHOT</version.jboss.osgi.deployment>
- <version.jboss.osgi.framework>1.0.0.Alpha2</version.jboss.osgi.framework>
+ <version.jboss.osgi.framework>1.0.0.Alpha2-SNAPSHOT</version.jboss.osgi.framework>
<version.jboss.osgi.hotdeploy>1.0.3</version.jboss.osgi.hotdeploy>
<version.jboss.osgi.husky>1.0.3-SNAPSHOT</version.jboss.osgi.husky>
<version.jboss.osgi.jaxb>2.1.10.SP3</version.jboss.osgi.jaxb>
14 years, 5 months
JBoss-OSGI SVN: r97726 - in projects/jboss-osgi/projects/runtime/framework/branches/1.0.0.Alpha2: src/main/java/org/jboss/osgi/framework/bundle and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-11 08:12:03 -0500 (Fri, 11 Dec 2009)
New Revision: 97726
Modified:
projects/jboss-osgi/projects/runtime/framework/branches/1.0.0.Alpha2/pom.xml
projects/jboss-osgi/projects/runtime/framework/branches/1.0.0.Alpha2/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
Log:
Update to new Deployment API
Modified: projects/jboss-osgi/projects/runtime/framework/branches/1.0.0.Alpha2/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/1.0.0.Alpha2/pom.xml 2009-12-11 12:56:09 UTC (rev 97725)
+++ projects/jboss-osgi/projects/runtime/framework/branches/1.0.0.Alpha2/pom.xml 2009-12-11 13:12:03 UTC (rev 97726)
@@ -26,7 +26,7 @@
<artifactId>jboss-osgi-framework</artifactId>
<packaging>bundle</packaging>
- <version>1.0.0.Alpha2</version>
+ <version>1.0.0.Alpha2-SNAPSHOT</version>
<parent>
<groupId>org.jboss.osgi</groupId>
@@ -47,12 +47,12 @@
<version.jboss.osgi.apache.xerces>2.9.1.SP3</version.jboss.osgi.apache.xerces>
<version.jboss.osgi.common>1.0.3</version.jboss.osgi.common>
<version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
- <version.jboss.osgi.deployment>1.0.0</version.jboss.osgi.deployment>
- <version.jboss.osgi.husky>1.0.2</version.jboss.osgi.husky>
+ <version.jboss.osgi.deployment>1.0.1-SNAPSHOT</version.jboss.osgi.deployment>
+ <version.jboss.osgi.husky>1.0.3-SNAPSHOT</version.jboss.osgi.husky>
<version.jboss.osgi.jaxb>2.1.10.SP3</version.jboss.osgi.jaxb>
<version.jboss.osgi.jmx>1.0.2</version.jboss.osgi.jmx>
<version.jboss.osgi.runtime.deployers>1.0.3</version.jboss.osgi.runtime.deployers>
- <version.jboss.osgi.spi>1.0.3</version.jboss.osgi.spi>
+ <version.jboss.osgi.spi>1.0.4-SNAPSHOT</version.jboss.osgi.spi>
<version.jboss.osgi.xml.binding>2.0.2.Beta3</version.jboss.osgi.xml.binding>
<version.jboss.test>1.1.4.GA</version.jboss.test>
<version.ops4j.pax.web>0.7.2</version.ops4j.pax.web>
Modified: projects/jboss-osgi/projects/runtime/framework/branches/1.0.0.Alpha2/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/1.0.0.Alpha2/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-11 12:56:09 UTC (rev 97725)
+++ projects/jboss-osgi/projects/runtime/framework/branches/1.0.0.Alpha2/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-11 13:12:03 UTC (rev 97726)
@@ -110,9 +110,6 @@
/** The bundle manager's bean name: OSGiBundleManager */
public static final String BEAN_BUNDLE_MANAGER = "OSGiBundleManager";
- /** The string representation of this bundle's location identifier. */
- public static final String PROPERTY_BUNDLE_LOCATION = "org.jboss.osgi.bundle.location";
-
/** The framework version */
private static String OSGi_FRAMEWORK_VERSION = "r4v42"; // [TODO] externalise
@@ -641,9 +638,10 @@
osgiMetaData = new AbstractOSGiMetaData(manifest);
}
- String location = (String)unit.getAttachment(PROPERTY_BUNDLE_LOCATION);
- if (location == null)
- location = unit.getName();
+ // The bundle location is not necessarily the bundle root url
+ // The framework is expected to preserve the location passed into installBundle(String)
+ Deployment dep = unit.getAttachment(Deployment.class);
+ String location = (dep != null ? dep.getLocation() : unit.getName());
OSGiBundleState bundleState = new OSGiBundleState(location, osgiMetaData, unit);
addBundle(bundleState);
14 years, 5 months
JBoss-OSGI SVN: r97725 - projects/jboss-osgi/projects/runtime/framework/branches.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-11 07:56:09 -0500 (Fri, 11 Dec 2009)
New Revision: 97725
Added:
projects/jboss-osgi/projects/runtime/framework/branches/1.0.0.Alpha2/
Log:
Create branches/1.0.0.Alpha2.SP1
Copied: projects/jboss-osgi/projects/runtime/framework/branches/1.0.0.Alpha2 (from rev 97724, projects/jboss-osgi/projects/runtime/framework/tags/jboss-osgi-framework-1.0.0.Alpha2)
14 years, 5 months
JBoss-OSGI SVN: r97723 - projects/jboss-osgi/projects/runtime/framework/branches.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-11 07:48:26 -0500 (Fri, 11 Dec 2009)
New Revision: 97723
Added:
projects/jboss-osgi/projects/runtime/framework/branches/1.0.0.Alpha2/
Log:
Create branches/1.0.0.Alpha2.SP1
Copied: projects/jboss-osgi/projects/runtime/framework/branches/1.0.0.Alpha2 (from rev 97722, projects/jboss-osgi/projects/runtime/framework/tags/jboss-osgi-framework-1.0.0.Alpha2)
14 years, 5 months
JBoss-OSGI SVN: r97721 - projects/jboss-osgi/trunk.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-11 07:19:11 -0500 (Fri, 11 Dec 2009)
New Revision: 97721
Modified:
projects/jboss-osgi/trunk/pom.xml
Log:
Update to new DeploymentInfo API
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-12-11 08:22:20 UTC (rev 97720)
+++ projects/jboss-osgi/trunk/pom.xml 2009-12-11 12:19:11 UTC (rev 97721)
@@ -53,10 +53,10 @@
<version.jboss.osgi.blueprint>1.0.0.Alpha3</version.jboss.osgi.blueprint>
<version.jboss.osgi.common>1.0.3</version.jboss.osgi.common>
<version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
- <version.jboss.osgi.deployment>1.0.0</version.jboss.osgi.deployment>
+ <version.jboss.osgi.deployment>1.0.1-SNAPSHOT</version.jboss.osgi.deployment>
<version.jboss.osgi.framework>1.0.0.Alpha2</version.jboss.osgi.framework>
<version.jboss.osgi.hotdeploy>1.0.3</version.jboss.osgi.hotdeploy>
- <version.jboss.osgi.husky>1.0.2</version.jboss.osgi.husky>
+ <version.jboss.osgi.husky>1.0.3-SNAPSHOT</version.jboss.osgi.husky>
<version.jboss.osgi.jaxb>2.1.10.SP3</version.jboss.osgi.jaxb>
<version.jboss.osgi.jmx>1.0.2.SP1</version.jboss.osgi.jmx>
<version.jboss.osgi.jndi>1.0.2</version.jboss.osgi.jndi>
@@ -67,7 +67,7 @@
<version.jboss.osgi.runtime.equinox>3.5.1</version.jboss.osgi.runtime.equinox>
<version.jboss.osgi.runtime.felix>2.0.2</version.jboss.osgi.runtime.felix>
<version.jboss.osgi.runtime.jbossas>1.0.2</version.jboss.osgi.runtime.jbossas>
- <version.jboss.osgi.spi>1.0.3.SP1</version.jboss.osgi.spi>
+ <version.jboss.osgi.spi>1.0.4-SNAPSHOT</version.jboss.osgi.spi>
<version.jboss.osgi.webapp>0.7.2</version.jboss.osgi.webapp>
<version.jboss.osgi.webconsole>1.0.2</version.jboss.osgi.webconsole>
<version.jboss.osgi.xml.binding>2.0.2.Beta3</version.jboss.osgi.xml.binding>
14 years, 5 months
JBoss-OSGI SVN: r97691 - in projects/jboss-osgi/projects/osgitck/trunk/overlay/cnf: src and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-10 06:34:08 -0500 (Thu, 10 Dec 2009)
New Revision: 97691
Added:
projects/jboss-osgi/projects/osgitck/trunk/overlay/cnf/src/
projects/jboss-osgi/projects/osgitck/trunk/overlay/cnf/src/Packaging.java
Log:
StartLevelControl should use framework properties
https://www.osgi.org/members/bugzilla/show_bug.cgi?id=1498
Added: projects/jboss-osgi/projects/osgitck/trunk/overlay/cnf/src/Packaging.java
===================================================================
--- projects/jboss-osgi/projects/osgitck/trunk/overlay/cnf/src/Packaging.java (rev 0)
+++ projects/jboss-osgi/projects/osgitck/trunk/overlay/cnf/src/Packaging.java 2009-12-10 11:34:08 UTC (rev 97691)
@@ -0,0 +1,250 @@
+import java.io.*;
+import java.util.*;
+import java.util.jar.*;
+
+import aQute.bnd.build.*;
+import aQute.bnd.service.*;
+import aQute.lib.osgi.*;
+import aQute.libg.header.*;
+import aQute.libg.version.*;
+
+/**
+ * This script runs after the bnd file stuff has been done, before analyzing any
+ * classes. It will check if the bnd file contains -pack (the bnd file must
+ * contain it, not a parent). It will then pack all projects listed as its
+ * valued. For each project, a bnd file is created that has no longer references
+ * to the build. All dependent JAR files are stored in the jar directory for
+ * this purpose. Additionally, a runtests script is added and the bnd jar is
+ * included to make the tess self contained.
+ */
+
+public class Packaging implements AnalyzerPlugin {
+
+ final static String PACK = "-pack";
+ final static String ROOT = "";
+
+ public boolean analyzeJar(Analyzer analyzer) throws Exception {
+ if (!(analyzer instanceof ProjectBuilder))
+ return false;
+
+ // Make sure -pack is set in the actual file or one of its includes
+ if (!analyzer.getProperties().containsKey(PACK))
+ return false;
+
+ String pack = analyzer.getProperty(PACK);
+ ProjectBuilder pb = (ProjectBuilder) analyzer;
+ Workspace workspace = pb.getProject().getWorkspace();
+ Jar jar = analyzer.getJar();
+
+ // For each project listed ...
+ Map<String, Map<String, String>> ct = pb.parseHeader(pack);
+ for (Map.Entry<String, Map<String, String>> entry : ct.entrySet()) {
+ try {
+ Project project = workspace.getProject(entry.getKey());
+ if (!project.isValid())
+ analyzer.error("Invalid project to pack: %s", project);
+ else
+ pack(analyzer, jar, project);
+ }
+ catch (Exception t) {
+ analyzer.error("While packaging %s got %s", entry.getKey(), t);
+ throw t;
+ }
+ }
+
+ // Include bnd so it is fully self contained, except for the
+ // java runtime.
+ Container c = pb.getProject().getBundle("biz.aQute.bnd", "latest",
+ Constants.STRATEGY_HIGHEST, null);
+
+ File f = c.getFile();
+ if (f != null)
+ jar.putResource("jar/bnd.jar", new FileResource(f));
+ else
+ analyzer.error("Cannot find bnd's jar file in a repository ");
+
+ List<Container> extra = pb.getProject().getBundles(Constants.STRATEGY_HIGHEST, "com.springsource.junit");
+ flatten(analyzer,null,jar,extra,true);
+
+ StringBuilder script = new StringBuilder();
+ script.append("java -jar jar/bnd.jar runtests -title ");
+ script.append(pb.getProject());
+ script.append("\n");
+ jar.putResource("runtests", new EmbeddedResource(script.toString()
+ .getBytes("UTF-8"), 0));
+
+ return false;
+ }
+
+ /**
+ * Store a project in a JAR so that we can later unzip this project and have
+ * all information.
+ *
+ * @param jar
+ * @param project
+ * @throws Exception
+ */
+ @SuppressWarnings("unchecked")
+ private void pack(Analyzer analyzer, Jar jar, Project project)
+ throws Exception {
+ Collection<Container> runpath = project.getRunpath();
+ Collection<Container> runbundles = project.getRunbundles();
+ String runproperties = project.getProperty(Constants.RUNPROPERTIES);
+ StringBuilder sb = new StringBuilder();
+
+ sb.append("# bnd pack for project " + project + "\n");
+ sb.append("# " + new Date() + "\n");
+ sb.append("build=.\n");
+ sb.append("\n");
+ sb.append("-target = ");
+ flatten(analyzer, sb, jar, project, Collections.EMPTY_MAP, true);
+ sb.deleteCharAt(sb.length() - 1);
+
+ sb.append("\n");
+ sb.append("\n");
+ sb.append("-runpath = ");
+ flatten(analyzer, sb, jar, runpath, false);
+
+ sb.append("\n\n");
+ sb.append("-runbundles = ");
+ flatten(analyzer, sb, jar, runbundles, false);
+
+ Map<String, String> properties = OSGiHeader
+ .parseProperties(runproperties);
+
+ String del = "\n\n" + Constants.RUNPROPERTIES + " = \\\n";
+ properties.put("report", "true");
+ for (Map.Entry<String, String> entry : properties.entrySet()) {
+ sb.append(del);
+
+ sb.append(entry.getKey());
+ sb.append("=");
+ if (entry.getKey().equals("org.osgi.framework.trust.repositories")) {
+ sb.append("keystore");
+
+ // Copy the key store
+ File keystore = analyzer.getFile(entry.getValue());
+ if (keystore.exists() && keystore.isFile()) {
+ jar.putResource("keystore", new FileResource(keystore));
+ }
+ else {
+ analyzer.error("The referred keystore %s is not a file",
+ entry.getValue());
+ }
+ }
+ else {
+ sb.append("\"");
+ sb.append(entry.getValue());
+ sb.append("\"");
+ }
+ del = ", \\\n";
+ }
+
+ // TDI: StartLevelControl should use framework properties
+ // https://www.osgi.org/members/bugzilla/show_bug.cgi?id=1498
+ String runvm = project.getProperty(Constants.RUNVM);
+ if (runvm != null && runvm.length() > 0)
+ {
+ sb.append("\n\n");
+ sb.append(Constants.RUNVM + " = " + runvm);
+ }
+
+ sb.append("\n\n\n\n");
+
+ Resource r = new EmbeddedResource(sb.toString().getBytes("UTF-8"),
+ project.lastModified());
+ jar.putResource(project.getName() + ".bnd", r);
+
+ }
+
+ private void flatten(Analyzer analyzer, StringBuilder sb, Jar jar,
+ Collection<Container> path, boolean store) throws Exception {
+ for (Container container : path) {
+ flatten(analyzer, sb, jar, container, store);
+ }
+ if (sb != null)
+ sb.deleteCharAt(sb.length() - 2);
+ }
+
+ private void flatten(Analyzer analyzer, StringBuilder sb, Jar jar,
+ Container container, boolean store) throws Exception {
+ switch (container.getType()) {
+ case LIBRARY :
+ flatten(analyzer, sb, jar, container.getMembers(), store);
+ return;
+
+ case PROJECT :
+ flatten(analyzer, sb, jar, container.getProject(), container
+ .getAttributes(), store);
+ break;
+
+ case EXTERNAL :
+ flatten(analyzer, sb, jar, container.getFile(), container
+ .getAttributes(), store);
+ break;
+
+ case REPO :
+ flatten(analyzer, sb, jar, container.getFile(), container
+ .getAttributes(), store);
+ break;
+ }
+ }
+
+ private void flatten(Analyzer analyzer, StringBuilder sb, Jar jar,
+ Project project, Map<String, String> map, boolean store) throws Exception {
+ File[] subs = project.getBuildFiles();
+ analyzer.getInfo(project);
+ if (subs == null) {
+ analyzer.error("Project cannot build %s ", project);
+ }
+ else
+ for (File sub : subs)
+ flatten(analyzer, sb, jar, sub, map, store);
+ }
+
+ private void flatten(Analyzer analyzer, StringBuilder sb, Jar jar,
+ File sub, Map<String, String> map, boolean store) throws Exception {
+ Jar s = new Jar(sub);
+ try {
+ Manifest m = s.getManifest();
+ String bsn = m.getMainAttributes().getValue(
+ Constants.BUNDLE_SYMBOLICNAME);
+ int n = bsn.indexOf(';');
+ if (n > 0)
+ bsn = bsn.substring(0, n);
+
+ String version = m.getMainAttributes().getValue(
+ Constants.BUNDLE_VERSION);
+ if (version == null)
+ version = "0";
+ Version v = new Version(version);
+
+ String path = "jar/" + bsn + "-" + v.getMajor() + "."
+ + v.getMinor() + "." + v.getMicro() + ".jar";
+
+ if ( store )
+ jar.putResource(path, new FileResource(sub));
+
+ if (sb != null) {
+ sb.append("\\\n ");
+ sb.append(path);
+ sb.append(";version=file");
+ }
+ for (Map.Entry<String, String> entry : map.entrySet()) {
+ if (sb != null && !entry.getKey().equals("version")) {
+ sb.append(";");
+ sb.append(entry.getKey());
+ sb.append("=\"");
+ sb.append(entry.getValue());
+ sb.append("\"");
+ }
+ }
+ if (sb != null)
+ sb.append(", ");
+ }
+ finally {
+ s.close();
+ }
+ }
+
+}
Property changes on: projects/jboss-osgi/projects/osgitck/trunk/overlay/cnf/src/Packaging.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
14 years, 5 months