[Osgi-messages] SF.net SVN: osgi:[264] papoose-core/trunk/core/src/main/java/org/papoose/ core
Status: Beta
Brought to you by:
maguro
|
From: <osg...@li...> - 2010-03-04 18:28:55
|
Revision: 264
http://osgi.svn.sourceforge.net/osgi/?rev=264&view=rev
Author: maguro
Date: 2010-03-04 18:28:49 +0000 (Thu, 04 Mar 2010)
Log Message:
-----------
Minor cleanup
Modified Paths:
--------------
papoose-core/trunk/core/src/main/java/org/papoose/core/Papoose.java
papoose-core/trunk/core/src/main/java/org/papoose/core/util/Util.java
Modified: papoose-core/trunk/core/src/main/java/org/papoose/core/Papoose.java
===================================================================
--- papoose-core/trunk/core/src/main/java/org/papoose/core/Papoose.java 2010-02-27 15:54:12 UTC (rev 263)
+++ papoose-core/trunk/core/src/main/java/org/papoose/core/Papoose.java 2010-03-04 18:28:49 UTC (rev 264)
@@ -21,12 +21,10 @@
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.Hashtable;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -69,8 +67,8 @@
private final static Properties DEFAULTS = new Properties();
private static int FRAMEWORK_COUNTER = 0;
- private final static Map<Integer, Reference<Papoose>> FRAMEWORKS_BY_ID = new HashMap<Integer, Reference<Papoose>>();
- private final static Map<String, Reference<Papoose>> FRAMEWORKS_BY_NAME = new HashMap<String, Reference<Papoose>>();
+ private final static Map<Integer, Reference<Papoose>> FRAMEWORKS_BY_ID = new Hashtable<Integer, Reference<Papoose>>();
+ private final static Map<String, Reference<Papoose>> FRAMEWORKS_BY_NAME = new Hashtable<String, Reference<Papoose>>();
private final Object lock = new Object();
private volatile State state = new Installed();
@@ -181,7 +179,7 @@
synchronized (FRAMEWORKS_BY_NAME)
{
- ensureUrlHandling();
+ Util.ensureUrlHandling();
this.frameworkId = FRAMEWORK_COUNTER++;
@@ -355,11 +353,6 @@
}
}
- public Properties getClientProperties()
- {
- return clientProperties;
- }
-
public Object getProperty(String key)
{
return properties.get(key);
@@ -520,7 +513,7 @@
startManager.stop(bundle, options);
}
- private void doInitialze() throws PapooseException
+ private void doInitialize() throws PapooseException
{
BundleManager manager = getBundleManager();
@@ -552,10 +545,10 @@
serviceRegistry.start();
- startBootLevelServices();
-
SystemBundleController systemBundleController = (SystemBundleController) manager.installSystemBundle(new Version(properties.getProperty(PapooseConstants.PAPOOSE_VERSION)));
+ startBootLevelServices();
+
manager.loadBundles();
manager.fireFrameworkEvent(new FrameworkEvent(FrameworkEvent.STARTED, systemBundleController, null));
@@ -603,52 +596,6 @@
return result;
}
- private static void ensureUrlHandling()
- {
- LOGGER.entering(CLASS_NAME, "ensureUrlHandling");
-
- try
- {
- new URL("codesource://1:0...@or....0");
-
- LOGGER.finest("Handler for codesource protocol found");
- }
- catch (MalformedURLException e)
- {
- LOGGER.finest("Handler for codesource protocol not found");
-
- String prefixes = System.getProperty("java.protocol.handler.pkgs");
-
- if (prefixes == null)
- {
- prefixes = "org.papoose.core.protocols";
- }
- else
- {
- prefixes = prefixes + "|org.papoose.core.protocols";
- }
-
- if (LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("java.protocol.handler.pkgs: " + prefixes);
-
- System.setProperty("java.protocol.handler.pkgs", prefixes);
-
- try
- {
- new URL("codesource://1:0...@or...-0");
-
- LOGGER.finest("Handler for codesource protocol found");
- }
- catch (MalformedURLException mue)
- {
- LOGGER.severe("Unable to pick up Papoose protocol handlers");
-
- throw new FatalError("Unable to pick up Papoose protocol handlers", mue);
- }
- }
-
- LOGGER.exiting(CLASS_NAME, "ensureUrlHandling");
- }
-
private Properties assembleProperties(Properties properties)
{
Properties result = new Properties();
@@ -884,7 +831,7 @@
public void init() throws PapooseException
{
- doInitialze();
+ doInitialize();
state = new Starting();
}
@@ -893,7 +840,7 @@
{
futureStop = new FutureFrameworkEvent();
- doInitialze();
+ doInitialize();
doStart();
state = new Active();
@@ -923,7 +870,7 @@
public void init() throws PapooseException
{
- doInitialze();
+ doInitialize();
state = new Starting();
}
Modified: papoose-core/trunk/core/src/main/java/org/papoose/core/util/Util.java
===================================================================
--- papoose-core/trunk/core/src/main/java/org/papoose/core/util/Util.java 2010-02-27 15:54:12 UTC (rev 263)
+++ papoose-core/trunk/core/src/main/java/org/papoose/core/util/Util.java 2010-03-04 18:28:49 UTC (rev 264)
@@ -24,6 +24,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigInteger;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -37,6 +39,7 @@
import org.osgi.framework.BundleException;
+import org.papoose.core.FatalError;
import org.papoose.core.Papoose;
import org.papoose.core.descriptions.Extension;
import org.papoose.core.descriptions.Resolution;
@@ -777,6 +780,52 @@
return builder.toString();
}
+ public static void ensureUrlHandling()
+ {
+ LOGGER.entering(CLASS_NAME, "ensureUrlHandling");
+
+ try
+ {
+ new URL("codesource://1:0...@or....0");
+
+ LOGGER.finest("Handler for codesource protocol found");
+ }
+ catch (MalformedURLException e)
+ {
+ LOGGER.finest("Handler for codesource protocol not found");
+
+ String prefixes = System.getProperty("java.protocol.handler.pkgs");
+
+ if (prefixes == null)
+ {
+ prefixes = "org.papoose.core.protocols";
+ }
+ else
+ {
+ prefixes = prefixes + "|org.papoose.core.protocols";
+ }
+
+ if (LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("java.protocol.handler.pkgs: " + prefixes);
+
+ System.setProperty("java.protocol.handler.pkgs", prefixes);
+
+ try
+ {
+ new URL("codesource://1:0...@or...-0");
+
+ LOGGER.finest("Handler for codesource protocol found");
+ }
+ catch (MalformedURLException mue)
+ {
+ LOGGER.severe("Unable to pick up Papoose protocol handlers");
+
+ throw new FatalError("Unable to pick up Papoose protocol handlers", mue);
+ }
+ }
+
+ LOGGER.exiting(CLASS_NAME, "ensureUrlHandling");
+ }
+
public static <T> Iterable<List<T>> combinations(final List<T> set)
{
final List<T> list = new ArrayList<T>(set);
@@ -870,7 +919,6 @@
};
}
-
private static BigInteger getFactorial(int n)
{
BigInteger fact = BigInteger.ONE;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|