You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/07/12 16:46:39 UTC
svn commit: r555648 -
/incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/FelixRuntime.java
Author: rfeng
Date: Thu Jul 12 07:46:39 2007
New Revision: 555648
URL: http://svn.apache.org/viewvc?view=rev&rev=555648
Log:
Apply a patch from Rajini Sivaram for TUSCANY-1424. Thank you, Rajini Sivaram.
Modified:
incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/FelixRuntime.java
Modified: incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/FelixRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/FelixRuntime.java?view=diff&rev=555648&r1=555647&r2=555648
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/FelixRuntime.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/FelixRuntime.java Thu Jul 12 07:46:39 2007
@@ -72,9 +72,6 @@
Class felixMainClass = cl.loadClass("org.apache.felix.main.Main");
felixClass = cl.loadClass("org.apache.felix.framework.Felix");
- Class propertyResolverClass = cl.loadClass("org.apache.felix.framework.util.MutablePropertyResolver");
- Class propertyResolverImplClass = cl.loadClass("org.apache.felix.framework.util.MutablePropertyResolverImpl");
-
Method propsMethod = felixMainClass.getMethod("loadConfigProperties");
Properties props = (Properties)propsMethod.invoke(null);
@@ -92,34 +89,52 @@
"org.osgi.framework; version=1.3.0," +
"org.osgi.service.packageadmin; version=1.2.0, " +
"org.osgi.service.startlevel; version=1.0.0, " +
- "org.osgi.service.url; version=1.0.0 ");
-
-
+ "org.osgi.service.url; version=1.0.0, " +
+ "org.osoa.sca.annotations; version=1.0.0, " +
+ "org.osoa.sca; version=1.0.0");
- Constructor implConstructor = propertyResolverImplClass.getConstructor(Map.class);
- Object mutableProps = implConstructor.newInstance(props);
try {
- Constructor felixConstructor = felixClass.getConstructor(propertyResolverClass, List.class);
+ Constructor felixConstructor = felixClass.getConstructor(Map.class, List.class);
List<BundleActivator> activators = new ArrayList<BundleActivator>();
- felix = felixConstructor.newInstance(mutableProps, activators);
+ felix = felixConstructor.newInstance(props, activators);
((Bundle)felix).start();
bundleContext = ((Bundle)felix).getBundleContext();
+
} catch (Exception e) {
-
- felix = felixClass.newInstance();
- Method startMethod = felixClass.getMethod("start", propertyResolverClass, List.class);
- List<BundleActivator> activators = new ArrayList<BundleActivator>();
- BundleActivator activator = new FelixRuntime();
- activators.add(activator);
- startMethod.invoke(felix, mutableProps, activators);
-
- synchronized (activator) {
- int retries = 0;
- while (bundleContext == null && retries++ < 10) {
- activator.wait(1000);
+ // This is the older Felix API which has been retained temporarily to avoid build break
+ // TODO: Remove these once Felix 1.0.0 is released.
+
+ Class propertyResolverClass = cl.loadClass("org.apache.felix.framework.util.MutablePropertyResolver");
+ Class propertyResolverImplClass = cl.loadClass("org.apache.felix.framework.util.MutablePropertyResolverImpl");
+
+ Constructor implConstructor = propertyResolverImplClass.getConstructor(Map.class);
+ Object mutableProps = implConstructor.newInstance(props);
+
+
+ try {
+ Constructor felixConstructor = felixClass.getConstructor(propertyResolverClass, List.class);
+ List<BundleActivator> activators = new ArrayList<BundleActivator>();
+ felix = felixConstructor.newInstance(mutableProps, activators);
+ ((Bundle)felix).start();
+ bundleContext = ((Bundle)felix).getBundleContext();
+ } catch (Exception e1) {
+
+
+ felix = felixClass.newInstance();
+ Method startMethod = felixClass.getMethod("start", propertyResolverClass, List.class);
+ List<BundleActivator> activators = new ArrayList<BundleActivator>();
+ BundleActivator activator = new FelixRuntime();
+ activators.add(activator);
+ startMethod.invoke(felix, mutableProps, activators);
+
+ synchronized (activator) {
+ int retries = 0;
+ while (bundleContext == null && retries++ < 10) {
+ activator.wait(1000);
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org