You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by jh...@apache.org on 2006/09/15 21:01:22 UTC
svn commit: r446688 -
/webservices/muse/trunk/modules/muse-tools/resources/osgi/Activator
Author: jhawkins
Date: Fri Sep 15 12:01:22 2006
New Revision: 446688
URL: http://svn.apache.org/viewvc?view=rev&rev=446688
Log:
MUSE-109 - Use FileLocator to determine Bundle install location
Modified:
webservices/muse/trunk/modules/muse-tools/resources/osgi/Activator
Modified: webservices/muse/trunk/modules/muse-tools/resources/osgi/Activator
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/resources/osgi/Activator?view=diff&rev=446688&r1=446687&r2=446688
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/resources/osgi/Activator (original)
+++ webservices/muse/trunk/modules/muse-tools/resources/osgi/Activator Fri Sep 15 12:01:22 2006
@@ -5,19 +5,27 @@
import org.apache.muse.core.platform.osgi.util.BundleRootHelper;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.Bundle;
+import org.eclipse.core.runtime.FileLocator;
public class Activator implements BundleActivator {
-
+
public void start(BundleContext context) throws Exception {
- String prop = System.getProperty("data.location");
+ String prop = System.getProperty("data.location");
+ String dir = System.getProperty("user.dir");
File root = null;
if(prop == null){
- String location = context.getBundle().getLocation();
- if(location.startsWith("initial@reference:file:")){
- location = location.substring("initial@reference:file:".length());
- root = new File(location);
- location = root.getCanonicalPath();
+ Bundle bundles[] = context.getBundles();
+ for(int i=0;i<bundles.length;i++){
+ if("org.eclipse.equinox.common".equals(bundles[i].getSymbolicName())){
+ if(Bundle.ACTIVE != bundles[i].getState()){
+ //Allow the exception to propogate - we're no good without the location
+ bundles[i].start();
+ }
+ break;
+ }
}
+ root = new File(FileLocator.resolve(context.getBundle().getEntry("/")).getFile());
} else if("USE_BUNDLE_DATA".equals(prop)){
root = context.getDataFile(".");
} else {
@@ -25,7 +33,8 @@
}
BundleRootHelper.registerRoot(context.getBundle(), root);
}
-
+
public void stop(BundleContext context) throws Exception {
}
-}
\ No newline at end of file
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org