Author: jsdelfino
Date: Fri Sep 12 16:12:40 2008
New Revision: 694839
URL: http://svn.apache.org/viewvc?rev=694839&view=rev
Log:
Moved construction of 3rd party bundle from BundleFileFactoryHook to
LauncherBundleHelper.
Removed:
tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHookConfigurator.java
tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/LibrariesBundleFileFactoryHook.java
tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/resources/hookconfigurators.properties
Modified:
tuscany/branches/sca-equinox/modules/node-launcher-equinox/pom.xml
tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java
tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxLauncherBundleHelper.java
tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java
Modified: tuscany/branches/sca-equinox/modules/node-launcher-equinox/pom.xml
URL:
http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/node-launcher-equinox/pom.xml?rev=694839&r1=694838&r2=694839&view=diff
==============================================================================
--- tuscany/branches/sca-equinox/modules/node-launcher-equinox/pom.xml
(original)
+++ tuscany/branches/sca-equinox/modules/node-launcher-equinox/pom.xml Fri Sep
12 16:12:40 2008
@@ -111,9 +111,6 @@
<Bundle-Version>${tuscany.version}</Bundle-Version>
<Bundle-SymbolicName>org.apache.tuscany.sca.node.launcher.equinox</Bundle-SymbolicName>
<Bundle-Description>${pom.name}</Bundle-Description>
- <!--
-
<Bundle-Activator>org.apache.tuscany.sca.node.equinox.launcher.LauncherBundleActivator</Bundle-Activator>
- -->
<Export-Package>org.apache.tuscany.sca.node.equinox.launcher*</Export-Package>
<Eclipse-AutoStart>true</Eclipse-AutoStart>
</instructions>
Modified:
tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java
URL:
http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java?rev=694839&r1=694838&r2=694839&view=diff
==============================================================================
---
tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java
(original)
+++
tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java
Fri Sep 12 16:12:40 2008
@@ -101,9 +101,6 @@
// Use the boot classloader as the parent classloader
props.put("osgi.contextClassLoaderParent", "boot");
- // Set the extension bundle
- props.put("osgi.framework.extensions",
"org.apache.tuscany.sca.node.launcher.equinox");
-
// Set startup properties
props.put(EclipseStarter.PROP_CLEAN, "true");
Modified:
tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxLauncherBundleHelper.java
URL:
http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxLauncherBundleHelper.java?rev=694839&r1=694838&r2=694839&view=diff
==============================================================================
---
tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxLauncherBundleHelper.java
(original)
+++
tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxLauncherBundleHelper.java
Fri Sep 12 16:12:40 2008
@@ -1,6 +1,12 @@
package org.apache.tuscany.sca.node.equinox.launcher;
-import java.io.ByteArrayInputStream;
+import static java.lang.System.currentTimeMillis;
+import static java.lang.System.getProperty;
+import static java.lang.System.setProperty;
+import static
org.apache.tuscany.sca.node.equinox.launcher.NodeLauncherUtil.libraryBundle;
+import static
org.apache.tuscany.sca.node.equinox.launcher.NodeLauncherUtil.string;
+
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -32,20 +38,22 @@
this.bundleContext.addBundleListener(this);
// Install the Tuscany bundles
- long start = System.currentTimeMillis();
+ long start = currentTimeMillis();
// FIXME: SDO bundles dont have the correct dependencies
- System.setProperty("commonj.sdo.impl.HelperProvider",
"org.apache.tuscany.sdo.helper.HelperProviderImpl");
+ setProperty("commonj.sdo.impl.HelperProvider",
"org.apache.tuscany.sdo.helper.HelperProviderImpl");
// Get the list of JAR files to install
- String jarFilesProperty =
System.getProperty("org.apache.tuscany.sca.node.launcher.equinox.jarFiles");
+ String jarFilesProperty =
getProperty("org.apache.tuscany.sca.node.launcher.equinox.jarFiles");
String[] jarFiles = jarFilesProperty.split(";");
// Create a single 'library' bundle for them
- long libraryStart = System.currentTimeMillis();
- //InputStream library = NodeLauncherUtil.libraryBundle(jarFiles);
- Bundle libraryBundle =
bundleContext.installBundle("org.apache.tuscany.sca.node.launcher.equinox.libraries",
new ByteArrayInputStream(new byte[0]));
- logger.info("Third-party library bundle installed in " +
(System.currentTimeMillis() - libraryStart) + " ms: " +
NodeLauncherUtil.string(libraryBundle, false));
+ long libraryStart = currentTimeMillis();
+ InputStream library = libraryBundle(jarFiles);
+ logger.info("Third-party library bundle generated in " +
(currentTimeMillis() - libraryStart) + " ms.");
+ libraryStart = currentTimeMillis();
+ Bundle libraryBundle =
bundleContext.installBundle("org.apache.tuscany.sca.node.launcher.equinox.libraries",
library);
+ logger.info("Third-party library bundle installed in " +
(currentTimeMillis() - libraryStart) + " ms: " + string(libraryBundle, false));
installedBundles.add(libraryBundle);
// Get the set of already installed bundles
@@ -55,9 +63,9 @@
}
// Get the list of bundle files and names to install
- String bundleFilesProperty =
System.getProperty("org.apache.tuscany.sca.node.launcher.equinox.bundleFiles");
+ String bundleFilesProperty =
getProperty("org.apache.tuscany.sca.node.launcher.equinox.bundleFiles");
String[] bundleFiles = bundleFilesProperty.split(";");
- String bundleNamesProperty =
System.getProperty("org.apache.tuscany.sca.node.launcher.equinox.bundleNames");
+ String bundleNamesProperty =
getProperty("org.apache.tuscany.sca.node.launcher.equinox.bundleNames");
String[] bundleNames = bundleNamesProperty.split(";");
// Install all the bundles that are not already installed
@@ -68,14 +76,14 @@
if (bundleName.contains("org.eclipse.jdt.junit")) {
continue;
}
- long installStart = System.currentTimeMillis();
+ long installStart = currentTimeMillis();
Bundle bundle = bundleContext.installBundle(bundleFile);
- logger.info("Bundle installed in " +
(System.currentTimeMillis() - installStart) + " ms: " +
NodeLauncherUtil.string(bundle, false));
+ logger.info("Bundle installed in " + (currentTimeMillis() -
installStart) + " ms: " + string(bundle, false));
installedBundles.add(bundle);
}
}
- long end = System.currentTimeMillis();
+ long end = currentTimeMillis();
logger.info("Tuscany bundles are installed in " + (end - start) + "
ms.");
}
@@ -86,7 +94,7 @@
Bundle bundle = installedBundles.get(i);
try {
//if (logger.isLoggable(Level.FINE)) {
- logger.info("Uninstalling bundle: " +
NodeLauncherUtil.string(bundle, false));
+ logger.info("Uninstalling bundle: " + string(bundle, false));
//}
bundle.uninstall();
} catch (Exception e) {
Modified:
tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java
URL:
http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java?rev=694839&r1=694838&r2=694839&view=diff
==============================================================================
---
tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java
(original)
+++
tuscany/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java
Fri Sep 12 16:12:40 2008
@@ -26,11 +26,13 @@
import static org.osgi.framework.Constants.EXPORT_PACKAGE;
import static org.osgi.framework.Constants.IMPORT_PACKAGE;
+import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.net.URI;
import java.net.URISyntaxException;
@@ -308,11 +310,12 @@
}
}
- static byte[] generateBundle(Manifest mf) throws IOException {
+ static InputStream libraryBundle(String[] jarFiles) throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ Manifest mf = libraryManifest(jarFiles);
JarOutputStream jos = new JarOutputStream(bos, mf);
jos.close();
- return bos.toByteArray();
+ return new ByteArrayInputStream(bos.toByteArray());
}
/**