JBoss-OSGI SVN: r97286 - in projects/jboss-osgi/projects/bundles: jboss-xml-binding/trunk and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-02 08:13:29 -0500 (Wed, 02 Dec 2009)
New Revision: 97286
Modified:
projects/jboss-osgi/projects/bundles/jboss-reflect/trunk/pom.xml
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml
projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml
Log:
Remove lazy activation policy
Modified: projects/jboss-osgi/projects/bundles/jboss-reflect/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-reflect/trunk/pom.xml 2009-12-02 13:12:06 UTC (rev 97285)
+++ projects/jboss-osgi/projects/bundles/jboss-reflect/trunk/pom.xml 2009-12-02 13:13:29 UTC (rev 97286)
@@ -82,7 +82,6 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
<Embed-Transitive>true</Embed-Transitive>
<Import-Package>
Modified: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml 2009-12-02 13:12:06 UTC (rev 97285)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml 2009-12-02 13:13:29 UTC (rev 97286)
@@ -146,7 +146,6 @@
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Bundle-Activator>org.jboss.osgi.jbossxb.internal.XMLBindingActivator</Bundle-Activator>
- <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
<Embed-Transitive>true</Embed-Transitive>
<Export-Package>
org.jboss.osgi.jbossxb;version=${version}
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml 2009-12-02 13:12:06 UTC (rev 97285)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml 2009-12-02 13:13:29 UTC (rev 97286)
@@ -181,7 +181,6 @@
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Bundle-Activator>org.jboss.osgi.microcontainer.internal.MicrocontainerServiceActivator</Bundle-Activator>
- <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
<Export-Package>
org.jboss.osgi.microcontainer;version=2.0.9
</Export-Package>
16 years, 7 months
JBoss-OSGI SVN: r97285 - projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-02 08:12:06 -0500 (Wed, 02 Dec 2009)
New Revision: 97285
Modified:
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java
Log:
Cache remote bundle headers
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java 2009-12-02 13:09:54 UTC (rev 97284)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java 2009-12-02 13:12:06 UTC (rev 97285)
@@ -98,11 +98,13 @@
{
log.debug("Add capability: " + capability);
+ // Install the capability bundles
for (BundleInfo info : capability.getBundles())
{
String location = info.getLocation();
String symName = info.getSymbolicName();
- if (bundles.get(location) == null && getBundle(symName, null) == null)
+ Version version = info.getVersion();
+ if (bundles.get(location) == null && getBundle(symName, version) == null)
{
OSGiBundle bundle = installBundle(location);
bundle.start();
@@ -116,7 +118,7 @@
}
else
{
- log.debug("Skip capability : " + capability);
+ log.debug("Skip capability: " + capability);
}
}
@@ -316,9 +318,9 @@
this.oname = oname;
}
- public void deploy(Deployment[] bundleDeps) throws BundleException
+ public void deploy(Deployment[] deps) throws BundleException
{
- invokeDeployerMBean(oname, "deploy", bundleDeps, Deployment[].class.getName());
+ invokeDeployerMBean(oname, "deploy", deps, Deployment[].class.getName());
}
public void deploy(URL url) throws BundleException
@@ -326,9 +328,9 @@
invokeDeployerMBean(oname, "deploy", url, URL.class.getName());
}
- public void undeploy(Deployment[] bundleDeps) throws BundleException
+ public void undeploy(Deployment[] deps) throws BundleException
{
- invokeDeployerMBean(oname, "undeploy", bundleDeps, Deployment[].class.getName());
+ invokeDeployerMBean(oname, "undeploy", deps, Deployment[].class.getName());
}
public void undeploy(URL url) throws BundleException
@@ -346,16 +348,18 @@
{
throw rte;
}
- catch (MBeanException ex)
- {
- Exception target = ex.getTargetException();
- if (target instanceof BundleException)
- throw (BundleException)target;
-
- throw new BundleException("Cannot " + method + ": " + arg, target);
- }
catch (Exception ex)
{
+ if (ex instanceof MBeanException)
+ {
+ ex = ((MBeanException)ex).getTargetException();
+ if (ex instanceof BundleException)
+ throw (BundleException)ex;
+ }
+
+ if (arg instanceof Deployment[])
+ arg = Arrays.asList((Deployment[])arg);
+
throw new BundleException("Cannot " + method + ": " + arg, ex);
}
}
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java 2009-12-02 13:09:54 UTC (rev 97284)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java 2009-12-02 13:12:06 UTC (rev 97285)
@@ -27,6 +27,7 @@
import org.jboss.osgi.spi.management.ManagedBundleMBean;
import org.jboss.osgi.spi.util.BundleInfo;
+import org.jboss.osgi.spi.util.UnmodifiableDictionary;
import org.jboss.osgi.testing.OSGiBundle;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -52,6 +53,7 @@
private long bundleId;
private String symbolicName;
+ private Dictionary<String, String> headers;
private Version version;
public RemoteBundle(OSGiRuntimeImpl runtime, ManagedBundleMBean bundle, BundleInfo bundleInfo)
@@ -66,11 +68,14 @@
super(runtime);
this.bundle = bundle;
- // Initialize cached properties to avoid remote access
+ // The getHeaders methods must continue to provide the manifest header
+ // information after the bundle enters the UNINSTALLED state.
+
bundleId = bundle.getBundleId();
symbolicName = bundle.getSymbolicName();
+ headers = bundle.getHeaders();
- String versionStr = getHeaders().get(Constants.BUNDLE_VERSION);
+ String versionStr = headers.get(Constants.BUNDLE_VERSION);
version = Version.parseVersion(versionStr);
}
@@ -105,10 +110,10 @@
}
@Override
+ @SuppressWarnings("unchecked")
public Dictionary<String, String> getHeaders()
{
- assertNotUninstalled();
- return bundle.getHeaders();
+ return new UnmodifiableDictionary(headers);
}
@Override
16 years, 7 months
JBoss-OSGI SVN: r97284 - in projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi: util and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-12-02 08:09:54 -0500 (Wed, 02 Dec 2009)
New Revision: 97284
Added:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/UnmodifiableDictionary.java
Modified:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
Log:
Add UnmodifieableDictionary
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java 2009-12-02 11:37:57 UTC (rev 97283)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java 2009-12-02 13:09:54 UTC (rev 97284)
@@ -75,10 +75,7 @@
* # Bundles that need to be started automatically
* org.jboss.osgi.spi.framework.autoStart=\
* file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
- * file://${test.archive.directory}/bundles/jboss-osgi-logging.jar \
* file://${test.archive.directory}/bundles/jboss-osgi-common.jar \
- * file://${test.archive.directory}/bundles/jboss-osgi-jmx.jar \
- * file://${test.archive.directory}/bundles/jboss-osgi-microcontainer.jar
* </pre>
*
* @author thomas.diesler(a)jboss.com
Added: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/UnmodifiableDictionary.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/UnmodifiableDictionary.java (rev 0)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/UnmodifiableDictionary.java 2009-12-02 13:09:54 UTC (rev 97284)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.util;
+
+//$Id$
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+
+/**
+ * An unmodifieable dictionary.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 02-Dec-2009
+ */
+@SuppressWarnings("rawtypes")
+public class UnmodifiableDictionary extends Dictionary
+{
+ private final Dictionary delegate;
+
+ public UnmodifiableDictionary(Dictionary wrapped)
+ {
+ this.delegate = wrapped;
+ }
+
+ public Enumeration elements()
+ {
+ return delegate.elements();
+ }
+
+ public Object get(Object key)
+ {
+ return delegate.get(key);
+ }
+
+ public boolean isEmpty()
+ {
+ return delegate.isEmpty();
+ }
+
+ public Enumeration keys()
+ {
+ return delegate.keys();
+ }
+
+ public Object put(Object key, Object value)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object remove(Object key)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public int size()
+ {
+ return delegate.size();
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/UnmodifiableDictionary.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
16 years, 7 months
JBoss-OSGI SVN: r97259 - projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle.
by jboss-osgi-commits@lists.jboss.org
Author: alesj
Date: 2009-12-01 16:08:06 -0500 (Tue, 01 Dec 2009)
New Revision: 97259
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
Log:
Track osgi services in context2deployment registry.
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2009-12-01 20:55:46 UTC (rev 97258)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2009-12-01 21:08:06 UTC (rev 97259)
@@ -436,16 +436,36 @@
checkValidBundleContext();
OSGiServiceState serviceState = getBundleManager().registerService(this, clazzes, service, properties);
+ afterServiceRegistration(serviceState);
return serviceState.getRegistration();
}
/**
+ * After service registration callback.
+ *
+ * @param service the service
+ */
+ protected void afterServiceRegistration(OSGiServiceState service)
+ {
+ }
+
+ /**
+ * Before service unregistration callback.
+ *
+ * @param service the service
+ */
+ protected void beforeServiceUnregistration(OSGiServiceState service)
+ {
+ }
+
+ /**
* Unregister a service
*
* @param serviceState the service state
*/
void unregisterService(OSGiServiceState serviceState)
{
+ beforeServiceUnregistration(serviceState);
getBundleManager().unregisterService(serviceState);
}
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-01 20:55:46 UTC (rev 97258)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-01 21:08:06 UTC (rev 97259)
@@ -310,6 +310,30 @@
}
/**
+ * Put context to deployment mapping.
+ *
+ * @param context the context
+ * @param unit the deployment
+ * @return previous mapping value
+ */
+ DeploymentUnit putContext(ControllerContext context, DeploymentUnit unit)
+ {
+ return registry.putContext(context, unit);
+ }
+
+ /**
+ * Remove context to deployment mapping.
+ *
+ * @param context the context
+ * @param unit the deployment
+ * @return is previous mapping value same as unit param
+ */
+ DeploymentUnit removeContext(ControllerContext context, DeploymentUnit unit)
+ {
+ return registry.removeContext(context, unit);
+ }
+
+ /**
* Get bundle for user tracker.
*
* @param user the user tracker object
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2009-12-01 20:55:46 UTC (rev 97258)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2009-12-01 21:08:06 UTC (rev 97259)
@@ -391,6 +391,18 @@
getBundleManager().uninstallBundle(this);
}
+ @Override
+ protected void afterServiceRegistration(OSGiServiceState service)
+ {
+ getBundleManager().putContext(service, unit);
+ }
+
+ @Override
+ protected void beforeServiceUnregistration(OSGiServiceState service)
+ {
+ getBundleManager().removeContext(service, unit);
+ }
+
public static OSGiBundleState assertBundleState(Bundle bundle)
{
if (bundle == null)
16 years, 7 months
JBoss-OSGI SVN: r97258 - projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle.
by jboss-osgi-commits@lists.jboss.org
Author: alesj
Date: 2009-12-01 15:55:46 -0500 (Tue, 01 Dec 2009)
New Revision: 97258
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
Log:
Check only installed.
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-01 20:17:59 UTC (rev 97257)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-01 20:55:46 UTC (rev 97258)
@@ -1249,9 +1249,9 @@
{
Class<?> type = loadClass(bundle, clazz);
if (type == null)
- return null;
+ return null; // or check all?
- contexts = controller.getInstantiatedContexts(type);
+ contexts = controller.getContexts(type, ControllerState.INSTALLED);
}
else
{
@@ -1269,6 +1269,7 @@
Collection<ServiceReference> result = new ArrayList<ServiceReference>();
for (ControllerContext context : sorted)
{
+ // re-check?? -- we already only get INSTALLED
if (isUnregistered(context) == false)
{
ServiceReference ref = getServiceReferenceForContext(context);
16 years, 7 months
JBoss-OSGI SVN: r97256 - projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle.
by jboss-osgi-commits@lists.jboss.org
Author: alesj
Date: 2009-12-01 14:22:01 -0500 (Tue, 01 Dec 2009)
New Revision: 97256
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
Log:
Better MDR using method name.
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-01 17:59:32 UTC (rev 97255)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-01 19:22:01 UTC (rev 97256)
@@ -240,20 +240,22 @@
systemBundle = new OSGiSystemState(systemMetaData);
addBundle(systemBundle);
- applySystemContextTracker(true);
+ applyMDRUsage(true);
}
public void stop()
{
- applySystemContextTracker(false);
+ applyMDRUsage(false);
}
/**
- * Add system bundle as default context tracker.
+ * Apply OSGi's MDR usage:
+ * - add/remove system bundle as default context tracker
+ * - add/remove instance metadata retrieval factory
*
* @param register do we register or unregister
*/
- protected void applySystemContextTracker(boolean register)
+ protected void applyMDRUsage(boolean register)
{
MutableMetaDataRepository repository = kernel.getMetaDataRepository().getMetaDataRepository();
MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(ScopeKey.DEFAULT_SCOPE);
16 years, 7 months
JBoss-OSGI SVN: r97250 - projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle.
by jboss-osgi-commits@lists.jboss.org
Author: alesj
Date: 2009-12-01 12:01:16 -0500 (Tue, 01 Dec 2009)
New Revision: 97250
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java
Log:
Simplify.
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java 2009-12-01 16:59:47 UTC (rev 97249)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java 2009-12-01 17:01:16 UTC (rev 97250)
@@ -115,10 +115,11 @@
if (classes == EMPTY)
{
ClassInfo clazz = null;
+ Object target = context.getTarget();
BeanInfo info = context.getBeanInfo();
- if (context.getTarget() != null)
+ if (target != null)
{
- clazz = getClassInfo(context.getTarget().getClass());
+ clazz = getClassInfo(target.getClass());
}
else if (info != null)
{
16 years, 7 months
JBoss-OSGI SVN: r97249 - projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle.
by jboss-osgi-commits@lists.jboss.org
Author: alesj
Date: 2009-12-01 11:59:47 -0500 (Tue, 01 Dec 2009)
New Revision: 97249
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java
Log:
Try target first, fall back to bean info.
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java 2009-12-01 16:53:38 UTC (rev 97248)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java 2009-12-01 16:59:47 UTC (rev 97249)
@@ -116,13 +116,13 @@
{
ClassInfo clazz = null;
BeanInfo info = context.getBeanInfo();
- if (info != null)
+ if (context.getTarget() != null)
{
- clazz = info.getClassInfo();
+ clazz = getClassInfo(context.getTarget().getClass());
}
- else if (context.getTarget() != null)
+ else if (info != null)
{
- clazz = getClassInfo(context.getTarget().getClass());
+ clazz = info.getClassInfo();
}
if (clazz != null)
16 years, 7 months
JBoss-OSGI SVN: r97248 - projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle.
by jboss-osgi-commits@lists.jboss.org
Author: alesj
Date: 2009-12-01 11:53:38 -0500 (Tue, 01 Dec 2009)
New Revision: 97248
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
Log:
Don't use deprecated api.
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java 2009-12-01 16:53:20 UTC (rev 97247)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java 2009-12-01 16:53:38 UTC (rev 97248)
@@ -24,11 +24,13 @@
import java.util.Collections;
import java.util.Dictionary;
import java.util.Enumeration;
+import java.util.HashSet;
import java.util.Set;
-import java.util.HashSet;
import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.kernel.spi.config.KernelConfigurator;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.reflect.spi.ClassInfo;
import org.jboss.util.collection.Iterators;
import org.osgi.framework.Constants;
@@ -40,7 +42,30 @@
public class KernelDictionaryFactory implements DictionaryFactory<KernelControllerContext>
{
private static final String[] EMPTY = new String[0];
+ private KernelConfigurator configurator;
+ private final ClassInfo OBJECT;
+ public KernelDictionaryFactory(KernelConfigurator configurator)
+ {
+ if (configurator == null)
+ throw new IllegalArgumentException("Null configurator");
+
+ this.configurator = configurator;
+ OBJECT = getClassInfo(Object.class);
+ }
+
+ private ClassInfo getClassInfo(Class<?> clazz)
+ {
+ try
+ {
+ return configurator.getClassInfo(clazz);
+ }
+ catch (Throwable t)
+ {
+ throw new RuntimeException(t);
+ }
+ }
+
public Class<KernelControllerContext> getContextType()
{
return KernelControllerContext.class;
@@ -51,7 +76,7 @@
return new KernelDictionary(context);
}
- private static class KernelDictionary extends Dictionary<String, Object>
+ private class KernelDictionary extends Dictionary<String, Object>
{
private KernelControllerContext context;
private String[] classes = EMPTY;
@@ -89,15 +114,15 @@
{
if (classes == EMPTY)
{
- Class<?> clazz = null;
+ ClassInfo clazz = null;
BeanInfo info = context.getBeanInfo();
if (info != null)
{
- clazz = info.getClassInfo().getType();
+ clazz = info.getClassInfo();
}
else if (context.getTarget() != null)
{
- clazz = context.getTarget().getClass();
+ clazz = getClassInfo(context.getTarget().getClass());
}
if (clazz != null)
@@ -122,9 +147,9 @@
return null;
}
- protected static void traverseClass(Class<?> clazz, Set<String> classes)
+ protected void traverseClass(ClassInfo clazz, Set<String> classes)
{
- if (clazz == null || clazz == Object.class)
+ if (clazz == null || clazz == OBJECT)
{
return;
}
@@ -133,11 +158,14 @@
// traverse superclass
traverseClass(clazz.getSuperclass(), classes);
- Class<?>[] interfaces = clazz.getInterfaces();
- // traverse interfaces
- for(Class<?> intface : interfaces)
+ ClassInfo[] interfaces = clazz.getInterfaces();
+ if (interfaces != null)
{
- traverseClass(intface, classes);
+ // traverse interfaces
+ for(ClassInfo intface : interfaces)
+ {
+ traverseClass(intface, classes);
+ }
}
}
}
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-01 16:53:20 UTC (rev 97247)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-01 16:53:38 UTC (rev 97248)
@@ -285,7 +285,7 @@
Controller controller = kernel.getController();
InstanceMetaDataRetrievalFactory imdrf = new InstanceMetaDataRetrievalFactory(controller);
imdrf.addFactory(new OSGiServiceStateDictionaryFactory());
- imdrf.addFactory(new KernelDictionaryFactory());
+ imdrf.addFactory(new KernelDictionaryFactory(kernel.getConfigurator()));
// TODO - JMX?
mdrFactory = imdrf;
}
16 years, 7 months
JBoss-OSGI SVN: r97240 - projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle.
by jboss-osgi-commits@lists.jboss.org
Author: alesj
Date: 2009-12-01 10:42:43 -0500 (Tue, 01 Dec 2009)
New Revision: 97240
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/ContextRegistryAction.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
Log:
Typos.
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/ContextRegistryAction.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/ContextRegistryAction.java 2009-12-01 15:29:01 UTC (rev 97239)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/ContextRegistryAction.java 2009-12-01 15:42:43 UTC (rev 97240)
@@ -22,6 +22,7 @@
package org.jboss.osgi.framework.bundle;
import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.tracker.ContextRegistry;
/**
@@ -37,7 +38,7 @@
* @param context the context
* @return context registry or null if cannot be applied
*/
- protected ContextRegistry getContextRegistry(org.jboss.dependency.spi.ControllerContext context)
+ protected ContextRegistry getContextRegistry(ControllerContext context)
{
Controller controller = context.getController();
return (controller instanceof ContextRegistry) ? ContextRegistry.class.cast(controller) : null;
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-01 15:29:01 UTC (rev 97239)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-12-01 15:42:43 UTC (rev 97240)
@@ -317,8 +317,8 @@
{
if (user instanceof AbstractBundleState)
return (AbstractBundleState)user;
- else if (user instanceof org.jboss.dependency.spi.ControllerContext)
- return getBundleForContext((org.jboss.dependency.spi.ControllerContext)user);
+ else if (user instanceof ControllerContext)
+ return getBundleForContext((ControllerContext)user);
else
throw new IllegalArgumentException("Unknown tracker type: " + user);
}
@@ -1111,7 +1111,7 @@
return true;
DeploymentUnit unit = bundleState.getDeploymentUnit();
- org.jboss.dependency.spi.ControllerContext context = unit.getAttachment(org.jboss.dependency.spi.ControllerContext.class);
+ ControllerContext context = unit.getAttachment(ControllerContext.class);
ControllerState requiredState = context.getRequiredState();
DeploymentStage requiredStage = unit.getRequiredStage();
16 years, 7 months