JBoss-OSGI SVN: r99652 - in projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework: plugins and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-20 06:17:27 -0500 (Wed, 20 Jan 2010)
New Revision: 99652
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/ControllerContextPlugin.java
Log:
Simplify ControllerContext handling
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-01-20 10:44:03 UTC (rev 99651)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-01-20 11:17:27 UTC (rev 99652)
@@ -29,7 +29,6 @@
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -39,7 +38,6 @@
import java.util.MissingResourceException;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
-import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import org.jboss.dependency.plugins.tracker.AbstractContextTracker;
@@ -419,16 +417,6 @@
plugin.removeServiceListener(this, listener);
}
- /**
- * Get registered contexts.
- *
- * @return the registered contexts
- */
- protected Set<ControllerContext> getRegisteredContexts()
- {
- return Collections.emptySet();
- }
-
public ServiceReference[] getRegisteredServices()
{
checkInstalled();
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java 2010-01-20 10:44:03 UTC (rev 99651)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java 2010-01-20 11:17:27 UTC (rev 99652)
@@ -23,6 +23,7 @@
//$Id$
+import java.util.Collections;
import java.util.Set;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
@@ -49,10 +50,10 @@
{
// Provide logging
final Logger log = Logger.getLogger(ControllerContextPluginImpl.class);
-
+
/** The deployment registry */
private DeploymentRegistry registry;
-
+
public ControllerContextPluginImpl(OSGiBundleManager bundleManager, DeploymentRegistry registry)
{
super(bundleManager);
@@ -73,9 +74,12 @@
return registry.removeContext(context, unit);
}
- public Set<ControllerContext> getRegisteredContext(AbstractDeployedBundleState bundleState)
+ public Set<ControllerContext> getRegisteredContexts(AbstractBundleState bundleState)
{
- DeploymentUnit unit = bundleState.getDeploymentUnit();
+ if (bundleState instanceof OSGiBundleState == false)
+ return Collections.emptySet();
+
+ DeploymentUnit unit = ((OSGiBundleState)bundleState).getDeploymentUnit();
return registry.getContexts(unit);
}
@@ -154,22 +158,20 @@
*
* @param bundleState the stopping bundle
*/
- public void unregisterContexts(AbstractDeployedBundleState bundleState)
+ public void unregisterContexts(AbstractBundleState bundleState)
{
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- Set<ControllerContext> contexts = registry.getContexts(unit);
- for (ControllerContext context : contexts)
+ if (bundleState instanceof OSGiBundleState)
{
- unregisterContext(context);
+ DeploymentUnit unit = ((OSGiBundleState)bundleState).getDeploymentUnit();
+ Set<ControllerContext> contexts = registry.getContexts(unit);
+ for (ControllerContext context : contexts)
+ {
+ if (context instanceof ServiceRegistration)
+ {
+ ServiceRegistration service = (ServiceRegistration)context;
+ service.unregister();
+ }
+ }
}
}
-
- private void unregisterContext(ControllerContext context)
- {
- if (context instanceof ServiceRegistration)
- {
- ServiceRegistration service = (ServiceRegistration)context;
- service.unregister();
- }
- }
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2010-01-20 10:44:03 UTC (rev 99651)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2010-01-20 11:17:27 UTC (rev 99652)
@@ -136,7 +136,7 @@
{
OSGiBundleManager manager = getBundleManager();
ControllerContextPlugin plugin = manager.getPlugin(ControllerContextPlugin.class);
- return plugin.getRegisteredContext(this);
+ return plugin.getRegisteredContexts(this);
}
public Class<?> loadClass(String name) throws ClassNotFoundException
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java 2010-01-20 10:44:03 UTC (rev 99651)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java 2010-01-20 11:17:27 UTC (rev 99652)
@@ -25,15 +25,12 @@
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
-import java.util.Set;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import java.util.jar.Attributes.Name;
-import org.jboss.dependency.spi.ControllerContext;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
import org.jboss.osgi.framework.metadata.internal.AbstractOSGiMetaData;
-import org.jboss.util.collection.ConcurrentSet;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
@@ -47,8 +44,6 @@
*/
public class OSGiSystemState extends AbstractBundleState
{
- /** The registred contexts */
- private Set<ControllerContext> registered = new ConcurrentSet<ControllerContext>();
/** The osgi metadata */
private OSGiMetaData osgiMetaData;
@@ -74,23 +69,6 @@
return false;
}
- protected Set<ControllerContext> getRegisteredContexts()
- {
- return registered;
- }
-
- @Override
- protected void afterServiceRegistration(OSGiServiceState service)
- {
- registered.add(service);
- }
-
- @Override
- protected void beforeServiceUnregistration(OSGiServiceState service)
- {
- registered.remove(service);
- }
-
public long getBundleId()
{
return 0;
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java 2010-01-20 10:44:03 UTC (rev 99651)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java 2010-01-20 11:17:27 UTC (rev 99652)
@@ -92,7 +92,8 @@
public ServiceReference[] getRegisteredServices(AbstractBundleState bundleState)
{
- Set<ControllerContext> contexts = bundleState.getRegisteredContexts();
+ ControllerContextPlugin plugin = getBundleManager().getPlugin(ControllerContextPlugin.class);
+ Set<ControllerContext> contexts = plugin.getRegisteredContexts(bundleState);
if (contexts.isEmpty())
return null;
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/ControllerContextPlugin.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/ControllerContextPlugin.java 2010-01-20 10:44:03 UTC (rev 99651)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/ControllerContextPlugin.java 2010-01-20 11:17:27 UTC (rev 99652)
@@ -26,7 +26,6 @@
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
/**
@@ -61,14 +60,14 @@
* @param bundleState the owning bundle
* @return registered contexts
*/
- Set<ControllerContext> getRegisteredContext(AbstractDeployedBundleState bundleState);
+ Set<ControllerContext> getRegisteredContexts(AbstractBundleState bundleState);
/**
* Unregister contexts.
*
* @param bundleState the stopping bundle
*/
- void unregisterContexts(AbstractDeployedBundleState bundleState);
+ void unregisterContexts(AbstractBundleState bundleState);
/**
* Get bundle for user tracker.
16 years, 4 months
JBoss-OSGI SVN: r99651 - in projects/jboss-osgi: projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework and 8 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-20 05:44:03 -0500 (Wed, 20 Jan 2010)
New Revision: 99651
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/ControllerContextPlugin.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/util/KernelUtils.java
Removed:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/servicemix/
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
Log:
Externalize ControllerContextPlugin
Remove all ControllerContext and OSGi service handling from OSGiBundleManager
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml 2010-01-20 09:48:55 UTC (rev 99650)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml 2010-01-20 10:44:03 UTC (rev 99651)
@@ -12,7 +12,6 @@
<constructor>
<parameter><inject bean="jboss.kernel:service=Kernel" /></parameter>
<parameter><inject bean="MainDeployer" /></parameter>
- <parameter><inject bean="DeploymentRegistry" /></parameter>
</constructor>
<property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
@@ -54,6 +53,12 @@
********************************
-->
+ <bean name="OSGiControllerContextPlugin" class="org.jboss.osgi.framework.bundle.ControllerContextPluginImpl">
+ <constructor>
+ <parameter><inject bean="OSGiBundleManager" /></parameter>
+ <parameter><inject bean="DeploymentRegistry" /></parameter>
+ </constructor>
+ </bean>
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-01-20 09:48:55 UTC (rev 99650)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-01-20 10:44:03 UTC (rev 99651)
@@ -552,7 +552,7 @@
boolean ungetContext(ControllerContext context)
{
- return getBundleManager().ungetContext(this, context);
+ return removeContextInUse(context);
}
public void addBundleListener(BundleListener listener)
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java 2010-01-20 10:44:03 UTC (rev 99651)
@@ -0,0 +1,175 @@
+/*
+ * 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.framework.bundle;
+
+//$Id$
+
+import java.util.Set;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+import java.util.jar.Attributes.Name;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.deployers.structure.spi.DeploymentRegistry;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.metadata.internal.AbstractOSGiMetaData;
+import org.jboss.osgi.framework.plugins.ControllerContextPlugin;
+import org.jboss.osgi.framework.plugins.internal.AbstractPlugin;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * A plugin that manages OSGi services
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 20-Jan-2010
+ */
+public class ControllerContextPluginImpl extends AbstractPlugin implements ControllerContextPlugin
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(ControllerContextPluginImpl.class);
+
+ /** The deployment registry */
+ private DeploymentRegistry registry;
+
+ public ControllerContextPluginImpl(OSGiBundleManager bundleManager, DeploymentRegistry registry)
+ {
+ super(bundleManager);
+
+ if (registry == null)
+ throw new IllegalArgumentException("Null deployment registry");
+
+ this.registry = registry;
+ }
+
+ public DeploymentUnit putContext(ControllerContext context, DeploymentUnit unit)
+ {
+ return registry.putContext(context, unit);
+ }
+
+ public DeploymentUnit removeContext(ControllerContext context, DeploymentUnit unit)
+ {
+ return registry.removeContext(context, unit);
+ }
+
+ public Set<ControllerContext> getRegisteredContext(AbstractDeployedBundleState bundleState)
+ {
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ return registry.getContexts(unit);
+ }
+
+ /**
+ * Get bundle for user tracker.
+ *
+ * @param user the user tracker object
+ * @return bundle state
+ */
+ public AbstractBundleState getBundleForUser(Object user)
+ {
+ if (user instanceof AbstractBundleState)
+ return (AbstractBundleState)user;
+ else if (user instanceof ControllerContext)
+ return getBundleForContext((ControllerContext)user);
+ else
+ throw new IllegalArgumentException("Unknown tracker type: " + user);
+ }
+
+ /**
+ * Get bundle for context.
+ *
+ * @param context the context
+ * @return bundle state
+ */
+ public AbstractBundleState getBundleForContext(ControllerContext context)
+ {
+ if (context instanceof OSGiServiceState)
+ {
+ OSGiServiceState service = (OSGiServiceState)context;
+ return service.getBundleState();
+ }
+
+ OSGiBundleManager bundleManager = getBundleManager();
+ DeploymentUnit unit = registry.getDeployment(context);
+ if (unit != null)
+ {
+ synchronized (unit)
+ {
+ OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
+ if (bundleState == null)
+ {
+ OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);
+ if (osgiMetaData == null)
+ {
+ Manifest manifest = unit.getAttachment(Manifest.class);
+ // [TODO] we need a mechanism to construct an OSGiMetaData from an easier factory
+ if (manifest == null)
+ manifest = new Manifest();
+ // [TODO] populate some bundle information
+ Attributes attributes = manifest.getMainAttributes();
+ attributes.put(new Name(Constants.BUNDLE_SYMBOLICNAME), unit.getName());
+ osgiMetaData = new AbstractOSGiMetaData(manifest);
+ unit.addAttachment(OSGiMetaData.class, osgiMetaData);
+ }
+
+ try
+ {
+ bundleState = (OSGiBundleState)bundleManager.addDeployment(unit);
+ bundleState.startInternal();
+ }
+ catch (Throwable t)
+ {
+ throw new RuntimeException("Cannot dynamically add generic bundle: " + unit, t);
+ }
+ }
+ return bundleState;
+ }
+ }
+
+ return bundleManager.getSystemBundle();
+ }
+
+ /**
+ * Unregister contexts.
+ *
+ * @param bundleState the stopping bundle
+ */
+ public void unregisterContexts(AbstractDeployedBundleState bundleState)
+ {
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ Set<ControllerContext> contexts = registry.getContexts(unit);
+ for (ControllerContext context : contexts)
+ {
+ unregisterContext(context);
+ }
+ }
+
+ private void unregisterContext(ControllerContext context)
+ {
+ if (context instanceof ServiceRegistration)
+ {
+ ServiceRegistration service = (ServiceRegistration)context;
+ service.unregister();
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java 2010-01-20 09:48:55 UTC (rev 99650)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java 2010-01-20 10:44:03 UTC (rev 99651)
@@ -29,6 +29,8 @@
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.tracker.ContextTracker;
import org.jboss.dependency.spi.tracker.ContextTracking;
+import org.jboss.osgi.framework.plugins.ControllerContextPlugin;
+import org.jboss.osgi.framework.util.KernelUtils;
import org.osgi.framework.Bundle;
/**
@@ -75,7 +77,7 @@
public Bundle getBundle()
{
- if (OSGiBundleManager.isUnregistered(context))
+ if (KernelUtils.isUnregistered(context))
return null;
return bundleState.getBundleInternal();
@@ -91,11 +93,13 @@
return null;
OSGiBundleManager manager = bundleState.getBundleManager();
+ ControllerContextPlugin plugin = manager.getPlugin(ControllerContextPlugin.class);
+
Set<Object> users = ct.getUsers(context);
Set<Bundle> bundles = new HashSet<Bundle>();
for (Object user : users)
{
- AbstractBundleState abs = manager.getBundleForUser(user);
+ AbstractBundleState abs = plugin.getBundleForUser(user);
bundles.add(abs.getBundleInternal());
}
if (bundles.isEmpty() == false)
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java 2010-01-20 09:48:55 UTC (rev 99650)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java 2010-01-20 10:44:03 UTC (rev 99651)
@@ -31,6 +31,8 @@
import org.jboss.metadata.spi.MetaData;
import org.jboss.metadata.spi.scope.CommonLevels;
import org.jboss.metadata.spi.scope.ScopeLevel;
+import org.jboss.osgi.framework.plugins.ControllerContextPlugin;
+import org.jboss.osgi.framework.util.KernelUtils;
import org.jboss.util.collection.Iterators;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
@@ -144,7 +146,7 @@
if (bundleState == otherBundle)
return true;
- if (OSGiBundleManager.isUnregistered(context))
+ if (KernelUtils.isUnregistered(context))
return false;
return isAssignableTo(bundleState, otherBundle, className);
@@ -256,11 +258,13 @@
throw new IllegalArgumentException("Null bundle state");
OSGiBundleManager manager = bundleState.getBundleManager();
+ ControllerContextPlugin plugin = manager.getPlugin(ControllerContextPlugin.class);
+
// context's bundle
- AbstractBundleState other = manager.getBundleForContext(context);
+ AbstractBundleState other = plugin.getBundleForContext(context);
if (bundleState == other)
return true;
- if (OSGiBundleManager.isUnregistered(context))
+ if (KernelUtils.isUnregistered(context))
return false;
String[] classes = getProperty(context, Constants.OBJECTCLASS, String[].class);
@@ -293,8 +297,8 @@
throw new IllegalArgumentException("Null class name");
OSGiBundleManager manager = bundleState.getBundleManager();
- // context's bundle
- AbstractBundleState other = manager.getBundleForContext(context);
+ ControllerContextPlugin plugin = manager.getPlugin(ControllerContextPlugin.class);
+ AbstractBundleState other = plugin.getBundleForContext(context);
return isAssignableTo(context, bundleState, other, className);
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-01-20 09:48:55 UTC (rev 99650)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-01-20 10:44:03 UTC (rev 99651)
@@ -44,11 +44,7 @@
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-import java.util.jar.Attributes.Name;
-import org.jboss.dependency.spi.Controller;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.ControllerState;
import org.jboss.deployers.client.spi.DeployerClient;
@@ -59,7 +55,6 @@
import org.jboss.deployers.spi.attachments.MutableAttachments;
import org.jboss.deployers.spi.deployer.DeploymentStage;
import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.structure.spi.DeploymentRegistry;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
import org.jboss.deployers.vfs.spi.client.VFSDeployment;
@@ -71,7 +66,6 @@
import org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
-import org.jboss.osgi.framework.metadata.internal.AbstractOSGiMetaData;
import org.jboss.osgi.framework.plugins.AutoInstallPlugin;
import org.jboss.osgi.framework.plugins.BundleStoragePlugin;
import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
@@ -91,7 +85,6 @@
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.Version;
import org.osgi.service.packageadmin.PackageAdmin;
@@ -130,10 +123,6 @@
private Kernel kernel;
/** The main deployer */
private DeployerClient deployerClient;
- /** The deployment structure */
- private MainDeployerStructure deployerStructure;
- /** The deployment registry */
- private DeploymentRegistry registry;
/** The executor */
private Executor executor;
/** The system bundle */
@@ -179,9 +168,9 @@
* @param registry the deployment registry
* @throws IllegalArgumentException for a null parameter
*/
- public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient, DeploymentRegistry registry)
+ public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient)
{
- this(kernel, deployerClient, registry, null);
+ this(kernel, deployerClient, null);
}
/**
@@ -193,7 +182,7 @@
* @param executor the executor
* @throws IllegalArgumentException for a null parameter
*/
- public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient, DeploymentRegistry registry, Executor executor)
+ public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient, Executor executor)
{
if (kernel == null)
throw new IllegalArgumentException("Null kernel");
@@ -201,13 +190,9 @@
throw new IllegalArgumentException("Null deployerClient");
if (deployerClient instanceof MainDeployerStructure == false)
throw new IllegalArgumentException("Deployer client does not implement " + MainDeployerStructure.class.getName());
- if (registry == null)
- throw new IllegalArgumentException("Null deployment registry");
-
+
this.kernel = kernel;
this.deployerClient = deployerClient;
- this.deployerStructure = (MainDeployerStructure)deployerClient;
- this.registry = registry;
// TODO thread factory
if (executor == null)
@@ -561,6 +546,7 @@
deployerClient.deploy(deployment);
try
{
+ MainDeployerStructure deployerStructure = (MainDeployerStructure)deployerClient;
DeploymentUnit unit = deployerStructure.getDeploymentUnit(deployment.getName());
bundleState = unit.getAttachment(AbstractBundleState.class);
if (bundleState == null)
@@ -1581,164 +1567,6 @@
}
}
- /**
- * 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 registered contexts for bundle.
- *
- * @param bundleState the owning bundle
- * @return registered contexts
- */
- Set<ControllerContext> getRegisteredContext(AbstractDeployedBundleState bundleState)
- {
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- return registry.getContexts(unit);
- }
-
- /**
- * Is the context undergisted.
- *
- * @param context the context
- * @return true if the context is unregisted, false otherwise
- */
- public static boolean isUnregistered(ControllerContext context)
- {
- Controller controller = context.getController();
- return controller == null || controller.getStates().isBeforeState(context.getState(), ControllerState.INSTALLED);
- }
-
- /**
- * Unregister contexts.
- *
- * @param bundleState the stopping bundle
- */
- void unregisterContexts(AbstractDeployedBundleState bundleState)
- {
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- Set<ControllerContext> contexts = registry.getContexts(unit);
- for (ControllerContext context : contexts)
- {
- unregisterContext(context);
- }
- }
-
- /**
- * Get bundle for user tracker.
- *
- * @param user the user tracker object
- * @return bundle state
- */
- AbstractBundleState getBundleForUser(Object user)
- {
- if (user instanceof AbstractBundleState)
- return (AbstractBundleState)user;
- else if (user instanceof ControllerContext)
- return getBundleForContext((ControllerContext)user);
- else
- throw new IllegalArgumentException("Unknown tracker type: " + user);
- }
-
- /**
- * Unget a context
- *
- * @param bundleState the bundle state
- * @param context the context
- * @return true when the context is still in use by the bundle
- */
- boolean ungetContext(AbstractBundleState bundleState, ControllerContext context)
- {
- return bundleState.removeContextInUse(context);
- }
-
- /**
- * Unregister context.
- *
- * @param context the context
- */
- private static void unregisterContext(ControllerContext context)
- {
- if (context instanceof ServiceRegistration)
- {
- ServiceRegistration service = (ServiceRegistration)context;
- service.unregister();
- }
- }
-
- /**
- * Get bundle for context.
- *
- * @param context the context
- * @return bundle state
- */
- public AbstractBundleState getBundleForContext(ControllerContext context)
- {
- if (context instanceof OSGiServiceState)
- {
- OSGiServiceState service = (OSGiServiceState)context;
- return service.getBundleState();
- }
-
- DeploymentUnit unit = registry.getDeployment(context);
- if (unit != null)
- {
- synchronized (unit)
- {
- OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
- if (bundleState == null)
- {
- OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);
- if (osgiMetaData == null)
- {
- Manifest manifest = unit.getAttachment(Manifest.class);
- // [TODO] we need a mechanism to construct an OSGiMetaData from an easier factory
- if (manifest == null)
- manifest = new Manifest();
- // [TODO] populate some bundle information
- Attributes attributes = manifest.getMainAttributes();
- attributes.put(new Name(Constants.BUNDLE_SYMBOLICNAME), unit.getName());
- osgiMetaData = new AbstractOSGiMetaData(manifest);
- unit.addAttachment(OSGiMetaData.class, osgiMetaData);
- }
-
- try
- {
- bundleState = (OSGiBundleState)addDeployment(unit);
- bundleState.startInternal();
- }
- catch (Throwable t)
- {
- throw new RuntimeException("Cannot dynamically add generic bundle: " + unit, t);
- }
- }
- return bundleState;
- }
- }
-
- return systemBundle;
- }
-
private URL getLocationURL(String location) throws BundleException
{
// Try location as URL
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2010-01-20 09:48:55 UTC (rev 99650)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2010-01-20 10:44:03 UTC (rev 99651)
@@ -39,6 +39,7 @@
import org.jboss.osgi.framework.classloading.OSGiClassLoadingMetaData;
import org.jboss.osgi.framework.classloading.OSGiClassLoadingMetaData.FragmentHostMetaData;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.plugins.ControllerContextPlugin;
import org.osgi.framework.AdminPermission;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
@@ -133,7 +134,9 @@
protected Set<ControllerContext> getRegisteredContexts()
{
- return getBundleManager().getRegisteredContext(this);
+ OSGiBundleManager manager = getBundleManager();
+ ControllerContextPlugin plugin = manager.getPlugin(ControllerContextPlugin.class);
+ return plugin.getRegisteredContext(this);
}
public Class<?> loadClass(String name) throws ClassNotFoundException
@@ -308,7 +311,9 @@
}
// Any services registered by this bundle must be unregistered
- getBundleManager().unregisterContexts(this);
+ OSGiBundleManager manager = getBundleManager();
+ ControllerContextPlugin plugin = manager.getPlugin(ControllerContextPlugin.class);
+ plugin.unregisterContexts(this);
// Any services used by this bundle must be released
for (ControllerContext context : getUsedContexts(this))
@@ -318,7 +323,7 @@
{
try
{
- getBundleManager().ungetContext(this, context);
+ removeContextInUse(context);
}
catch (Throwable t)
{
@@ -387,12 +392,16 @@
@Override
protected void afterServiceRegistration(OSGiServiceState service)
{
- getBundleManager().putContext(service, getDeploymentUnit());
+ OSGiBundleManager manager = getBundleManager();
+ ControllerContextPlugin plugin = manager.getPlugin(ControllerContextPlugin.class);
+ plugin.putContext(service, getDeploymentUnit());
}
@Override
protected void beforeServiceUnregistration(OSGiServiceState service)
{
- getBundleManager().removeContext(service, getDeploymentUnit());
+ OSGiBundleManager manager = getBundleManager();
+ ControllerContextPlugin plugin = manager.getPlugin(ControllerContextPlugin.class);
+ plugin.removeContext(service, getDeploymentUnit());
}
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java 2010-01-20 09:48:55 UTC (rev 99650)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java 2010-01-20 10:44:03 UTC (rev 99651)
@@ -45,6 +45,7 @@
import org.jboss.metadata.spi.scope.CommonLevels;
import org.jboss.metadata.spi.scope.Scope;
import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.osgi.framework.plugins.ControllerContextPlugin;
import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
import org.jboss.osgi.framework.util.CaseInsensitiveDictionary;
import org.jboss.osgi.spi.util.BundleClassLoader;
@@ -289,7 +290,8 @@
protected Object getActualUser(ControllerContext context)
{
OSGiBundleManager manager = bundleState.getBundleManager();
- return manager.getBundleForContext(context);
+ ControllerContextPlugin plugin = manager.getPlugin(ControllerContextPlugin.class);
+ return plugin.getBundleForContext(context);
}
protected Object getTargetForActualUser(Object user)
@@ -537,11 +539,13 @@
return null;
OSGiBundleManager manager = bundleState.getBundleManager();
+ ControllerContextPlugin plugin = manager.getPlugin(ControllerContextPlugin.class);
+
Set<Object> users = ct.getUsers(this);
Set<Bundle> bundles = new HashSet<Bundle>();
for (Object user : users)
{
- AbstractBundleState abs = manager.getBundleForUser(user);
+ AbstractBundleState abs = plugin.getBundleForUser(user);
bundles.add(abs.getBundleInternal());
}
return bundles.toArray(new Bundle[bundles.size()]);
@@ -667,9 +671,11 @@
{
Set<AbstractBundleState> used = new HashSet<AbstractBundleState>();
OSGiBundleManager manager = bundleState.getBundleManager();
+ ControllerContextPlugin plugin = manager.getPlugin(ControllerContextPlugin.class);
+
for (Object user : users)
{
- AbstractBundleState using = manager.getBundleForUser(user);
+ AbstractBundleState using = plugin.getBundleForUser(user);
if (used.add(using)) // add so we don't do duplicate work
{
int count = ct.getUsedByCount(this, using);
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java 2010-01-20 09:48:55 UTC (rev 99650)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java 2010-01-20 10:44:03 UTC (rev 99651)
@@ -46,9 +46,11 @@
import org.jboss.metadata.spi.retrieval.MetaDataRetrievalFactory;
import org.jboss.metadata.spi.scope.CommonLevels;
import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.osgi.framework.plugins.ControllerContextPlugin;
import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
import org.jboss.osgi.framework.plugins.ServiceManagerPlugin;
import org.jboss.osgi.framework.plugins.internal.AbstractPlugin;
+import org.jboss.osgi.framework.util.KernelUtils;
import org.jboss.osgi.framework.util.NoFilter;
import org.osgi.framework.Filter;
import org.osgi.framework.FrameworkUtil;
@@ -154,7 +156,7 @@
ControllerContextHandle handle = (ControllerContextHandle)reference;
ControllerContext context = handle.getContext();
- if (OSGiBundleManager.isUnregistered(context)) // we're probably not installed anymore
+ if (KernelUtils.isUnregistered(context)) // we're probably not installed anymore
return null;
return bundleState.addContextInUse(context);
@@ -227,10 +229,10 @@
ControllerContextHandle serviceReference = (ControllerContextHandle)reference;
ControllerContext context = serviceReference.getContext();
- if (OSGiBundleManager.isUnregistered(context))
+ if (KernelUtils.isUnregistered(context))
return false;
- return getBundleManager().ungetContext(bundleState, context);
+ return bundleState.removeContextInUse(context);
}
/**
@@ -341,7 +343,7 @@
for (ControllerContext context : sorted)
{
// re-check?? -- we already only get INSTALLED
- if (OSGiBundleManager.isUnregistered(context) == false)
+ if (KernelUtils.isUnregistered(context) == false)
{
ServiceReference ref = getServiceReferenceForContext(context);
if (filter.match(ref) && hasPermission(context))
@@ -372,7 +374,9 @@
return service.hasPermission() ? service.getReferenceInternal() : null;
}
- AbstractBundleState bundleState = getBundleManager().getBundleForContext(context);
+ OSGiBundleManager manager = getBundleManager();
+ ControllerContextPlugin plugin = manager.getPlugin(ControllerContextPlugin.class);
+ AbstractBundleState bundleState = plugin.getBundleForContext(context);
return new GenericServiceReferenceWrapper(context, bundleState);
}
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/ControllerContextPlugin.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/ControllerContextPlugin.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/ControllerContextPlugin.java 2010-01-20 10:44:03 UTC (rev 99651)
@@ -0,0 +1,89 @@
+/*
+ * 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.framework.plugins;
+
+import java.util.Set;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
+
+
+/**
+ * A plugin that manages kernel controller contexts.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 20-Jan-2010
+ */
+public interface ControllerContextPlugin extends Plugin
+{
+ /**
+ * Put context to deployment mapping.
+ *
+ * @param context the context
+ * @param unit the deployment
+ * @return previous mapping value
+ */
+ DeploymentUnit putContext(ControllerContext context, DeploymentUnit 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);
+
+ /**
+ * Get registered contexts for bundle.
+ *
+ * @param bundleState the owning bundle
+ * @return registered contexts
+ */
+ Set<ControllerContext> getRegisteredContext(AbstractDeployedBundleState bundleState);
+
+ /**
+ * Unregister contexts.
+ *
+ * @param bundleState the stopping bundle
+ */
+ void unregisterContexts(AbstractDeployedBundleState bundleState);
+
+ /**
+ * Get bundle for user tracker.
+ *
+ * @param user the user tracker object
+ * @return bundle state
+ */
+ AbstractBundleState getBundleForUser(Object user);
+
+ /**
+ * Get bundle for context.
+ *
+ * @param context the context
+ * @return bundle state
+ */
+ AbstractBundleState getBundleForContext(ControllerContext context);
+
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/ControllerContextPlugin.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/util/KernelUtils.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/util/KernelUtils.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/util/KernelUtils.java 2010-01-20 10:44:03 UTC (rev 99651)
@@ -0,0 +1,53 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.framework.util;
+
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+
+
+/**
+ * A collection of kernel utils
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 20-Jan-2010
+ */
+public final class KernelUtils
+{
+ // Hide the ctor
+ private KernelUtils()
+ {
+ }
+
+ /**
+ * Is the context undergisted.
+ *
+ * @param context the context
+ * @return true if the context is unregisted, false otherwise
+ */
+ public static boolean isUnregistered(ControllerContext context)
+ {
+ Controller controller = context.getController();
+ return controller == null || controller.getStates().isBeforeState(context.getState(), ControllerState.INSTALLED);
+ }
+}
Property changes on: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/util/KernelUtils.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml 2010-01-20 09:48:55 UTC (rev 99650)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml 2010-01-20 10:44:03 UTC (rev 99651)
@@ -12,7 +12,6 @@
<constructor>
<parameter><inject bean="jboss.kernel:service=Kernel" /></parameter>
<parameter><inject bean="MainDeployer" /></parameter>
- <parameter><inject bean="DeploymentRegistry" /></parameter>
</constructor>
<property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
@@ -47,10 +46,16 @@
********************************
-->
+ <bean name="OSGiControllerContextPlugin" class="org.jboss.osgi.framework.bundle.ControllerContextPluginImpl">
+ <constructor>
+ <parameter><inject bean="OSGiBundleManager" /></parameter>
+ <parameter><inject bean="DeploymentRegistry" /></parameter>
+ </constructor>
+ </bean>
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
+ <bean name="OSGiServiceManagerPlugin" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-01-20 09:48:55 UTC (rev 99650)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-01-20 10:44:03 UTC (rev 99651)
@@ -96,9 +96,11 @@
</property>
</bean>
-->
-
- <bean name="OSGiBundleResolver" class="org.jboss.osgi.framework.resolver.internal.basic.BasicResolverImpl">
- <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ <bean name="OSGiControllerContextPlugin" class="org.jboss.osgi.framework.bundle.ControllerContextPluginImpl">
+ <constructor>
+ <parameter><inject bean="OSGiBundleManager" /></parameter>
+ <parameter><inject bean="DeploymentRegistry" /></parameter>
+ </constructor>
</bean>
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml 2010-01-20 09:48:55 UTC (rev 99650)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml 2010-01-20 10:44:03 UTC (rev 99651)
@@ -12,7 +12,6 @@
<constructor>
<parameter><inject bean="jboss.kernel:service=Kernel" /></parameter>
<parameter><inject bean="MainDeployer" /></parameter>
- <parameter><inject bean="DeploymentRegistry" /></parameter>
</constructor>
<property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
@@ -91,6 +90,12 @@
</list>
</property>
</bean>
+ <bean name="OSGiControllerContextPlugin" class="org.jboss.osgi.framework.bundle.ControllerContextPluginImpl">
+ <constructor>
+ <parameter><inject bean="OSGiBundleManager" /></parameter>
+ <parameter><inject bean="DeploymentRegistry" /></parameter>
+ </constructor>
+ </bean>
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-20 09:48:55 UTC (rev 99650)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-20 10:44:03 UTC (rev 99651)
@@ -12,7 +12,6 @@
<constructor>
<parameter><inject bean="jboss.kernel:service=Kernel" /></parameter>
<parameter><inject bean="MainDeployer" /></parameter>
- <parameter><inject bean="DeploymentRegistry" /></parameter>
</constructor>
<property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
@@ -74,6 +73,12 @@
</list>
</property>
</bean>
+ <bean name="OSGiControllerContextPlugin" class="org.jboss.osgi.framework.bundle.ControllerContextPluginImpl">
+ <constructor>
+ <parameter><inject bean="OSGiBundleManager" /></parameter>
+ <parameter><inject bean="DeploymentRegistry" /></parameter>
+ </constructor>
+ </bean>
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-20 09:48:55 UTC (rev 99650)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-20 10:44:03 UTC (rev 99651)
@@ -12,7 +12,6 @@
<constructor>
<parameter><inject bean="jboss.kernel:service=Kernel" /></parameter>
<parameter><inject bean="MainDeployer" /></parameter>
- <parameter><inject bean="DeploymentRegistry" /></parameter>
</constructor>
<property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
@@ -73,6 +72,12 @@
</list>
</property>
</bean>
+ <bean name="OSGiControllerContextPlugin" class="org.jboss.osgi.framework.bundle.ControllerContextPluginImpl">
+ <constructor>
+ <parameter><inject bean="OSGiBundleManager" /></parameter>
+ <parameter><inject bean="DeploymentRegistry" /></parameter>
+ </constructor>
+ </bean>
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
16 years, 4 months
JBoss-OSGI SVN: r99648 - in projects/jboss-osgi: projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework and 11 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-20 04:27:43 -0500 (Wed, 20 Jan 2010)
New Revision: 99648
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/ServiceManagerPlugin.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/servicemix/
Removed:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/FilterParserAndMatcher.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/AbstractPlugin.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/AbstractServicePlugin.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/AutoInstallPluginImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/BundleStoragePluginImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/reactor/blueprint/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
Log:
Externalize ServiceManagerPlugin
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml 2010-01-20 09:27:43 UTC (rev 99648)
@@ -57,6 +57,9 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-01-20 09:27:43 UTC (rev 99648)
@@ -32,7 +32,6 @@
import java.util.Collections;
import java.util.Dictionary;
import java.util.Enumeration;
-import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
import java.util.Locale;
@@ -50,6 +49,7 @@
import org.jboss.osgi.framework.plugins.BundleStoragePlugin;
import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
import org.jboss.osgi.framework.plugins.LifecycleInterceptorServicePlugin;
+import org.jboss.osgi.framework.plugins.ServiceManagerPlugin;
import org.jboss.osgi.framework.util.CaseInsensitiveDictionary;
import org.jboss.osgi.spi.NotImplementedException;
import org.jboss.osgi.spi.util.ConstantsHelper;
@@ -433,21 +433,8 @@
{
checkInstalled();
- Set<ControllerContext> contexts = getRegisteredContexts();
- if (contexts.isEmpty())
- return null;
-
- OSGiBundleManager manager = getBundleManager();
- Set<ServiceReference> result = new HashSet<ServiceReference>();
- for (ControllerContext context : contexts)
- {
- ServiceReference ref = manager.getServiceReferenceForContext(context);
- if (ref != null)
- result.add(ref);
- }
- if (result.isEmpty())
- return null;
- return result.toArray(new ServiceReference[result.size()]);
+ ServiceManagerPlugin plugin = getBundleManager().getPlugin(ServiceManagerPlugin.class);
+ return plugin.getRegisteredServices(this);
}
/**
@@ -484,52 +471,37 @@
public ServiceReference[] getServicesInUse()
{
- Set<ControllerContext> contexts = getUsedContexts(this);
- if (contexts == null || contexts.isEmpty())
- return null;
-
- OSGiBundleManager manager = getBundleManager();
- List<ServiceReference> references = new ArrayList<ServiceReference>();
- for (ControllerContext context : contexts)
- {
- ServiceReference ref = manager.getServiceReferenceForContext(context);
- if (ref != null)
- references.add(ref);
- }
-
- if (references.isEmpty())
- return null;
- return references.toArray(new ServiceReference[references.size()]);
+ checkInstalled();
+ ServiceManagerPlugin plugin = getBundleManager().getPlugin(ServiceManagerPlugin.class);
+ return plugin.getServicesInUse(this);
}
public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException
{
checkValidBundleContext();
- return getBundleManager().getServiceReferences(this, clazz, filter, false);
+ ServiceManagerPlugin plugin = getBundleManager().getPlugin(ServiceManagerPlugin.class);
+ return plugin.getAllServiceReferences(this, clazz, filter);
}
public Object getService(ServiceReference reference)
{
checkValidBundleContext();
-
- if (reference == null)
- throw new IllegalArgumentException("Null reference");
-
- return getBundleManager().getService(this, reference);
+ ServiceManagerPlugin plugin = getBundleManager().getPlugin(ServiceManagerPlugin.class);
+ return plugin.getService(this, reference);
}
public ServiceReference getServiceReference(String clazz)
{
checkValidBundleContext();
- if (clazz == null)
- throw new IllegalArgumentException("Null clazz");
- return getBundleManager().getServiceReference(this, clazz);
+ ServiceManagerPlugin plugin = getBundleManager().getPlugin(ServiceManagerPlugin.class);
+ return plugin.getServiceReference(this, clazz);
}
public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException
{
checkValidBundleContext();
- return getBundleManager().getServiceReferences(this, clazz, filter, true);
+ ServiceManagerPlugin plugin = getBundleManager().getPlugin(ServiceManagerPlugin.class);
+ return plugin.getServiceReferences(this, clazz, filter);
}
@SuppressWarnings({ "rawtypes" })
@@ -544,16 +516,28 @@
public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties)
{
checkValidBundleContext();
-
- OSGiServiceState serviceState = getBundleManager().registerService(this, clazzes, service, properties);
+ ServiceManagerPlugin plugin = getBundleManager().getPlugin(ServiceManagerPlugin.class);
+ OSGiServiceState serviceState = (OSGiServiceState)plugin.registerService(this, clazzes, service, properties);
afterServiceRegistration(serviceState);
return serviceState.getRegistration();
}
+ void unregisterService(OSGiServiceState serviceState)
+ {
+ beforeServiceUnregistration(serviceState);
+ ServiceManagerPlugin plugin = getBundleManager().getPlugin(ServiceManagerPlugin.class);
+ plugin.unregisterService(serviceState);
+ }
+
+ public boolean ungetService(ServiceReference reference)
+ {
+ checkValidBundleContext();
+ ServiceManagerPlugin plugin = getBundleManager().getPlugin(ServiceManagerPlugin.class);
+ return plugin.ungetService(this, reference);
+ }
+
/**
* After service registration callback.
- *
- * @param service the service
*/
protected void afterServiceRegistration(OSGiServiceState service)
{
@@ -561,40 +545,11 @@
/**
* 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);
- }
-
- public boolean ungetService(ServiceReference reference)
- {
- if (reference == null)
- throw new IllegalArgumentException("Null reference");
-
- // Check if the service is still in use by this bundle
- ControllerContextHandle handle = (ControllerContextHandle)reference;
- ControllerContext context = handle.getContext();
- if (OSGiBundleManager.isUnregistered(context))
- return false;
-
- checkValidBundleContext();
-
- return ungetContext(context);
- }
-
+
boolean ungetContext(ControllerContext context)
{
return getBundleManager().ungetContext(this, context);
@@ -710,7 +665,7 @@
* @param className the class name
* @return the source or null if no source
*/
- Object getSource(String className)
+ public Object getSource(String className)
{
// [TODO] some more efficient way than using the class?
try
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/FilterParserAndMatcher.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/FilterParserAndMatcher.java 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/FilterParserAndMatcher.java 2010-01-20 09:27:43 UTC (rev 99648)
@@ -57,6 +57,7 @@
return QualifierContent.getContent("filter");
}
+ @SuppressWarnings("rawtypes")
public boolean matches(ControllerContext context, Set<Object> suppliedQualifiers, Filter filter)
{
MetaData metaData = context.getScopeInfo().getMetaData();
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java 2010-01-20 09:27:43 UTC (rev 99648)
@@ -1,135 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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.framework.bundle;
-
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.tracker.ContextTracker;
-import org.jboss.dependency.spi.tracker.ContextTracking;
-import org.osgi.framework.Bundle;
-
-/**
- * GenericServiceReferenceWrapper.
- *
- * @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
- */
-class GenericServiceReferenceWrapper extends ControllerContextHandle
-{
- private ControllerContext context;
- private AbstractBundleState bundleState;
-
- public GenericServiceReferenceWrapper(ControllerContext context, AbstractBundleState bundleState)
- {
- if (context == null)
- throw new IllegalArgumentException("Null context");
- if (bundleState == null)
- throw new IllegalArgumentException("Null bundle state");
-
- this.context = context;
- this.bundleState = bundleState;
- }
-
- ControllerContext getContext()
- {
- return context;
- }
-
- public Object getProperty(String key)
- {
- return MDRUtils.getProperty(context, key, Object.class);
- }
-
- public String[] getPropertyKeys()
- {
- Dictionary<String, Object> dictionary = MDRUtils.getProperties(context);
- String[] keys = new String[dictionary.size()];
- int i = 0;
- Enumeration<String> e = dictionary.keys();
- while (e.hasMoreElements())
- keys[i++] = e.nextElement();
- return keys;
- }
-
- public Bundle getBundle()
- {
- if (OSGiBundleManager.isUnregistered(context))
- return null;
-
- return bundleState.getBundleInternal();
- }
-
- public Bundle[] getUsingBundles()
- {
- if (context instanceof ContextTracking)
- {
- ContextTracking tracking = (ContextTracking)context;
- ContextTracker ct = tracking.getContextTracker();
- if (ct == null)
- return null;
-
- OSGiBundleManager manager = bundleState.getBundleManager();
- Set<Object> users = ct.getUsers(context);
- Set<Bundle> bundles = new HashSet<Bundle>();
- for (Object user : users)
- {
- AbstractBundleState abs = manager.getBundleForUser(user);
- bundles.add(abs.getBundleInternal());
- }
- if (bundles.isEmpty() == false)
- return bundles.toArray(new Bundle[bundles.size()]);
- }
- return null;
- }
-
- public boolean isAssignableTo(Bundle bundle, String className)
- {
- return MDRUtils.isAssignableTo(context, bundleState, bundle, className);
- }
-
- public int compareTo(Object obj)
- {
- return MDRUtils.compareTo(context, obj);
- }
-
- public int hashCode()
- {
- return context.hashCode();
- }
-
- public boolean equals(Object obj)
- {
- if (obj instanceof GenericServiceReferenceWrapper == false)
- return false;
-
- GenericServiceReferenceWrapper other = (GenericServiceReferenceWrapper)obj;
- return context == other.context;
- }
-
- public String toString()
- {
- return context.toString();
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java (from rev 99640, projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/GenericServiceReferenceWrapper.java 2010-01-20 09:27:43 UTC (rev 99648)
@@ -0,0 +1,135 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.framework.bundle;
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.tracker.ContextTracker;
+import org.jboss.dependency.spi.tracker.ContextTracking;
+import org.osgi.framework.Bundle;
+
+/**
+ * GenericServiceReferenceWrapper.
+ *
+ * @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
+ */
+class GenericServiceReferenceWrapper extends ControllerContextHandle
+{
+ private ControllerContext context;
+ private AbstractBundleState bundleState;
+
+ public GenericServiceReferenceWrapper(ControllerContext context, AbstractBundleState bundleState)
+ {
+ if (context == null)
+ throw new IllegalArgumentException("Null context");
+ if (bundleState == null)
+ throw new IllegalArgumentException("Null bundle state");
+
+ this.context = context;
+ this.bundleState = bundleState;
+ }
+
+ ControllerContext getContext()
+ {
+ return context;
+ }
+
+ public Object getProperty(String key)
+ {
+ return MDRUtils.getProperty(context, key, Object.class);
+ }
+
+ public String[] getPropertyKeys()
+ {
+ Dictionary<String, Object> dictionary = MDRUtils.getProperties(context);
+ String[] keys = new String[dictionary.size()];
+ int i = 0;
+ Enumeration<String> e = dictionary.keys();
+ while (e.hasMoreElements())
+ keys[i++] = e.nextElement();
+ return keys;
+ }
+
+ public Bundle getBundle()
+ {
+ if (OSGiBundleManager.isUnregistered(context))
+ return null;
+
+ return bundleState.getBundleInternal();
+ }
+
+ public Bundle[] getUsingBundles()
+ {
+ if (context instanceof ContextTracking)
+ {
+ ContextTracking tracking = (ContextTracking)context;
+ ContextTracker ct = tracking.getContextTracker();
+ if (ct == null)
+ return null;
+
+ OSGiBundleManager manager = bundleState.getBundleManager();
+ Set<Object> users = ct.getUsers(context);
+ Set<Bundle> bundles = new HashSet<Bundle>();
+ for (Object user : users)
+ {
+ AbstractBundleState abs = manager.getBundleForUser(user);
+ bundles.add(abs.getBundleInternal());
+ }
+ if (bundles.isEmpty() == false)
+ return bundles.toArray(new Bundle[bundles.size()]);
+ }
+ return null;
+ }
+
+ public boolean isAssignableTo(Bundle bundle, String className)
+ {
+ return MDRUtils.isAssignableTo(context, bundleState, bundle, className);
+ }
+
+ public int compareTo(Object obj)
+ {
+ return MDRUtils.compareTo(context, obj);
+ }
+
+ public int hashCode()
+ {
+ return context.hashCode();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof GenericServiceReferenceWrapper == false)
+ return false;
+
+ GenericServiceReferenceWrapper other = (GenericServiceReferenceWrapper)obj;
+ return context == other.context;
+ }
+
+ public String toString()
+ {
+ return context.toString();
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-01-20 09:27:43 UTC (rev 99648)
@@ -34,7 +34,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Dictionary;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
@@ -52,7 +51,6 @@
import org.jboss.dependency.spi.Controller;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.tracker.ContextTracker;
import org.jboss.deployers.client.spi.DeployerClient;
import org.jboss.deployers.client.spi.IncompleteDeploymentException;
import org.jboss.deployers.client.spi.IncompleteDeployments;
@@ -67,16 +65,7 @@
import org.jboss.deployers.vfs.spi.client.VFSDeployment;
import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
import org.jboss.kernel.Kernel;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.kernel.spi.qualifier.QualifierMatchers;
import org.jboss.logging.Logger;
-import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader;
-import org.jboss.metadata.spi.MutableMetaData;
-import org.jboss.metadata.spi.repository.MutableMetaDataRepository;
-import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
-import org.jboss.metadata.spi.retrieval.MetaDataRetrievalFactory;
-import org.jboss.metadata.spi.scope.CommonLevels;
-import org.jboss.metadata.spi.scope.ScopeKey;
import org.jboss.osgi.deployment.deployer.Deployment;
import org.jboss.osgi.deployment.deployer.DeploymentFactory;
import org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer;
@@ -90,7 +79,6 @@
import org.jboss.osgi.framework.plugins.Plugin;
import org.jboss.osgi.framework.plugins.ResolverPlugin;
import org.jboss.osgi.framework.plugins.ServicePlugin;
-import org.jboss.osgi.framework.util.NoFilter;
import org.jboss.osgi.framework.util.URLHelper;
import org.jboss.osgi.spi.util.BundleInfo;
import org.jboss.util.platform.Java;
@@ -102,12 +90,7 @@
import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
-import org.osgi.framework.Filter;
import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.Version;
import org.osgi.service.packageadmin.PackageAdmin;
@@ -149,12 +132,8 @@
private DeployerClient deployerClient;
/** The deployment structure */
private MainDeployerStructure deployerStructure;
- /** The deployment registry */
+ /** The deployment registry */
private DeploymentRegistry registry;
- /** The previous context tracker */
- private ContextTracker previousTracker;
- /** The instance metadata factory */
- private MetaDataRetrievalFactory factory;
/** The executor */
private Executor executor;
/** The system bundle */
@@ -242,205 +221,14 @@
// Create the system Bundle
systemBundle = new OSGiSystemState();
addBundle(systemBundle);
-
- applyMDRUsage(true);
}
public void stop()
{
- applyMDRUsage(false);
+ // nothing to do
}
/**
- * 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 applyMDRUsage(boolean register)
- {
- MutableMetaDataRepository repository = kernel.getMetaDataRepository().getMetaDataRepository();
- MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(ScopeKey.DEFAULT_SCOPE);
- if (register && retrieval == null)
- {
- retrieval = new MemoryMetaDataLoader(ScopeKey.DEFAULT_SCOPE);
- repository.addMetaDataRetrieval(retrieval);
- }
- if (retrieval != null && retrieval instanceof MutableMetaData)
- {
- MutableMetaData mmd = (MutableMetaData)retrieval;
- if (register)
- {
- previousTracker = mmd.addMetaData(systemBundle, ContextTracker.class);
- }
- else
- {
- if (previousTracker == null)
- {
- mmd.removeMetaData(ContextTracker.class);
- if (retrieval.isEmpty())
- repository.removeMetaDataRetrieval(retrieval.getScope());
- }
- else
- {
- mmd.addMetaData(previousTracker, ContextTracker.class);
- }
- }
- }
-
- // osgi ldap filter parsing and matching
- FilterParserAndMatcher fpm = FilterParserAndMatcher.INSTANCE;
- QualifierMatchers matchers = QualifierMatchers.getInstance();
-
- if (register)
- {
- matchers.addParser(fpm);
- matchers.addMatcher(fpm);
-
- MetaDataRetrievalFactory mdrFactory = factory;
- if (mdrFactory == null)
- {
- Controller controller = kernel.getController();
- InstanceMetaDataRetrievalFactory imdrf = new InstanceMetaDataRetrievalFactory(controller);
- imdrf.addFactory(new OSGiServiceStateDictionaryFactory());
- imdrf.addFactory(new KernelDictionaryFactory(kernel.getConfigurator()));
- // TODO - JMX?
- mdrFactory = imdrf;
- }
- repository.addMetaDataRetrievalFactory(CommonLevels.INSTANCE, mdrFactory);
- }
- else
- {
- repository.removeMetaDataRetrievalFactory(CommonLevels.INSTANCE);
-
- matchers.removeParser(fpm.getHandledContent());
- matchers.removeMatcher(fpm.getHandledType());
- }
- }
-
- /**
- * Set instance metadata factory.
- *
- * @param factory the instance metadata factory
- */
- public void setInstanceMetaDataFactory(MetaDataRetrievalFactory factory)
- {
- this.factory = factory;
- }
-
- /**
- * 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
- * @return bundle state
- */
- AbstractBundleState getBundleForUser(Object user)
- {
- if (user instanceof AbstractBundleState)
- return (AbstractBundleState)user;
- else if (user instanceof ControllerContext)
- return getBundleForContext((ControllerContext)user);
- else
- throw new IllegalArgumentException("Unknown tracker type: " + user);
- }
-
- /**
- * Get bundle for context.
- *
- * @param context the context
- * @return bundle state
- */
- AbstractBundleState getBundleForContext(ControllerContext context)
- {
- if (context instanceof OSGiServiceState)
- {
- OSGiServiceState service = (OSGiServiceState)context;
- return service.getBundleState();
- }
-
- DeploymentUnit unit = registry.getDeployment(context);
- if (unit != null)
- {
- synchronized (unit)
- {
- OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
- if (bundleState == null)
- {
- OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);
- if (osgiMetaData == null)
- {
- Manifest manifest = unit.getAttachment(Manifest.class);
- // [TODO] we need a mechanism to construct an OSGiMetaData from an easier factory
- if (manifest == null)
- manifest = new Manifest();
- // [TODO] populate some bundle information
- Attributes attributes = manifest.getMainAttributes();
- attributes.put(new Name(Constants.BUNDLE_SYMBOLICNAME), unit.getName());
- osgiMetaData = new AbstractOSGiMetaData(manifest);
- unit.addAttachment(OSGiMetaData.class, osgiMetaData);
- }
-
- try
- {
- bundleState = (OSGiBundleState)addDeployment(unit);
- bundleState.startInternal();
- }
- catch (Throwable t)
- {
- throw new RuntimeException("Cannot dynamically add generic bundle: " + unit, t);
- }
- }
- return bundleState;
- }
- }
-
- return systemBundle;
- }
-
- /**
- * Get service reference for context.
- *
- * @param context the context
- * @return service reference
- */
- ServiceReference getServiceReferenceForContext(ControllerContext context)
- {
- if (context instanceof OSGiServiceState)
- {
- OSGiServiceState service = (OSGiServiceState)context;
- return service.hasPermission() ? service.getReferenceInternal() : null;
- }
-
- AbstractBundleState bundleState = getBundleForContext(context);
- return new GenericServiceReferenceWrapper(context, bundleState);
- }
-
- /**
* Get the kernel
*
* @return the kernel
@@ -1519,7 +1307,7 @@
* @param clazz the class
* @return class or null
*/
- Class<?> loadClass(Bundle bundle, String clazz)
+ Class<?> loadClassFailsafe(Bundle bundle, String clazz)
{
try
{
@@ -1532,284 +1320,6 @@
}
/**
- * Do we have a permission to use context.
- *
- * @param context the context
- * @return true if allowed to use context, false otherwise
- */
- private boolean hasPermission(ControllerContext context)
- {
- // TODO - make thisa generic, w/o casting
- if (context instanceof OSGiServiceState)
- {
- OSGiServiceState serviceState = (OSGiServiceState)context;
- return serviceState.hasPermission();
- }
- return true;
- }
-
- /**
- * Get services
- *
- * @param bundle the referencing bundle
- * @param clazz any class
- * @param filter any filter
- * @param checkAssignable whether to check isAssignable
- * @return the services
- */
- Collection<ServiceReference> getServices(AbstractBundleState bundle, String clazz, Filter filter, boolean checkAssignable)
- {
- Set<ControllerContext> contexts;
- KernelController controller = kernel.getController();
-
- // Don't check assignabilty for the system bundle
- boolean isSystemBundle = (bundle.getBundleId() == 0);
- if (isSystemBundle)
- checkAssignable = false;
-
- // TODO - a bit slow for system bundle
- if (clazz != null && isSystemBundle == false)
- {
- Class<?> type = loadClass(bundle, clazz);
- if (type == null)
- return null; // or check all?
-
- contexts = controller.getContexts(type, ControllerState.INSTALLED);
- }
- else
- {
- contexts = controller.getContextsByState(ControllerState.INSTALLED);
- }
-
- if (contexts == null || contexts.isEmpty())
- return null;
-
- if (filter == null)
- filter = NoFilter.INSTANCE;
-
- List<ControllerContext> sorted = new ArrayList<ControllerContext>(contexts);
- Collections.sort(sorted, ContextComparator.INSTANCE); // Sort by the spec, should bubble up
- 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);
- if (filter.match(ref) && hasPermission(context))
- {
- if (clazz == null || isSystemBundle == false || MDRUtils.matchClass(context, clazz))
- {
- // Check the assignability
- if (checkAssignable == false || MDRUtils.isAssignableTo(context, bundle))
- result.add(ref);
- }
- }
- }
- }
- return result;
- }
-
- /**
- * Get service reference
- *
- * @param bundle the referencing bundle
- * @param clazz any class
- * @return the reference
- */
- ServiceReference getServiceReference(AbstractBundleState bundle, String clazz)
- {
- Collection<ServiceReference> services = getServices(bundle, clazz, null, true);
- if (services == null || services.isEmpty())
- return null;
-
- return services.iterator().next();
- }
-
- /**
- * Get service references
- *
- * @param bundle the referencing bundle
- * @param clazz any class
- * @param filter any filter
- * @param checkAssignable whether to check isAssignable
- * @return the services
- */
- ServiceReference[] getServiceReferences(AbstractBundleState bundle, String clazz, Filter filter, boolean checkAssignable)
- {
- Collection<ServiceReference> services = getServices(bundle, clazz, filter, checkAssignable);
- if (services == null || services.isEmpty())
- return null;
-
- return services.toArray(new ServiceReference[services.size()]);
- }
-
- /**
- * Get service references
- *
- * @param bundle the referencing bundle
- * @param clazz any class
- * @param filterStr any filter
- * @param checkAssignable whether to check isAssignable
- * @return the services
- * @throws InvalidSyntaxException when the filter is invalid
- */
- ServiceReference[] getServiceReferences(AbstractBundleState bundle, String clazz, String filterStr, boolean checkAssignable) throws InvalidSyntaxException
- {
- Filter filter = NoFilter.INSTANCE;
- if (filterStr != null)
- filter = FrameworkUtil.createFilter(filterStr);
-
- return getServiceReferences(bundle, clazz, filter, checkAssignable);
- }
-
- /**
- * Register a service
- *
- * @param bundleState the bundle
- * @param clazzes the classes to implement
- * @param service the service
- * @param properties the properties
- * @return the service state
- */
- @SuppressWarnings("rawtypes")
- OSGiServiceState registerService(AbstractBundleState bundleState, String[] clazzes, Object service, Dictionary properties)
- {
- OSGiServiceState result = new OSGiServiceState(bundleState, clazzes, service, properties);
- result.internalRegister();
- try
- {
- Controller controller = kernel.getController();
- controller.install(result);
- }
- catch (Throwable t)
- {
- fireError(bundleState, "installing service to MC in", t);
- throw new RuntimeException(t);
- }
-
- FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
- plugin.fireServiceEvent(bundleState, ServiceEvent.REGISTERED, result);
-
- return result;
- }
-
- /**
- * Get registered contexts for bundle.
- *
- * @param bundleState the owning bundle
- * @return registered contexts
- */
- Set<ControllerContext> getRegisteredContext(AbstractDeployedBundleState bundleState)
- {
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- return registry.getContexts(unit);
- }
-
- /**
- * Unregister a service
- *
- * @param serviceState the service state
- */
- void unregisterService(OSGiServiceState serviceState)
- {
- Controller controller = kernel.getController();
- controller.uninstall(serviceState.getName());
-
- serviceState.internalUnregister();
-
- FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
- plugin.fireServiceEvent(serviceState.getBundleState(), ServiceEvent.UNREGISTERING, serviceState);
- }
-
- /**
- * Unregister contexts.
- *
- * @param bundleState the stopping bundle
- */
- void unregisterContexts(AbstractDeployedBundleState bundleState)
- {
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- Set<ControllerContext> contexts = registry.getContexts(unit);
- for (ControllerContext context : contexts)
- {
- unregisterContext(context);
- }
- }
-
- /**
- * Unregister context.
- *
- * @param context the context
- */
- private static void unregisterContext(ControllerContext context)
- {
- if (context instanceof ServiceRegistration)
- {
- ServiceRegistration service = (ServiceRegistration)context;
- service.unregister();
- }
- }
-
- /**
- * Get a service
- *
- * @param bundleState the bundle that requests the service
- * @param reference the service reference
- * @return the service
- */
- Object getService(AbstractBundleState bundleState, ServiceReference reference)
- {
- ControllerContextHandle handle = (ControllerContextHandle)reference;
- ControllerContext context = handle.getContext();
- if (isUnregistered(context)) // we're probably not installed anymore
- return null;
-
- return bundleState.addContextInUse(context);
- }
-
- /**
- * Is the context undergisted.
- *
- * @param context the context
- * @return true if the context is unregisted, false otherwise
- */
- static boolean isUnregistered(ControllerContext context)
- {
- Controller controller = context.getController();
- return controller == null || controller.getStates().isBeforeState(context.getState(), ControllerState.INSTALLED);
- }
-
- /**
- * Unget a service
- *
- * @param bundleState the bundle state
- * @param reference the service reference
- * @return true when the service is still in use by the bundle
- */
- boolean ungetService(AbstractBundleState bundleState, ServiceReference reference)
- {
- if (reference == null)
- throw new IllegalArgumentException("Null reference");
-
- ControllerContextHandle serviceReference = (ControllerContextHandle)reference;
- ControllerContext context = serviceReference.getContext();
- return ungetContext(bundleState, context);
- }
-
- /**
- * Unget a context
- *
- * @param bundleState the bundle state
- * @param context the context
- * @return true when the context is still in use by the bundle
- */
- boolean ungetContext(AbstractBundleState bundleState, ControllerContext context)
- {
- return bundleState.removeContextInUse(context);
- }
-
- /**
* Get the executor.
*
* @return the executor.
@@ -2071,6 +1581,164 @@
}
}
+ /**
+ * 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 registered contexts for bundle.
+ *
+ * @param bundleState the owning bundle
+ * @return registered contexts
+ */
+ Set<ControllerContext> getRegisteredContext(AbstractDeployedBundleState bundleState)
+ {
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ return registry.getContexts(unit);
+ }
+
+ /**
+ * Is the context undergisted.
+ *
+ * @param context the context
+ * @return true if the context is unregisted, false otherwise
+ */
+ public static boolean isUnregistered(ControllerContext context)
+ {
+ Controller controller = context.getController();
+ return controller == null || controller.getStates().isBeforeState(context.getState(), ControllerState.INSTALLED);
+ }
+
+ /**
+ * Unregister contexts.
+ *
+ * @param bundleState the stopping bundle
+ */
+ void unregisterContexts(AbstractDeployedBundleState bundleState)
+ {
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ Set<ControllerContext> contexts = registry.getContexts(unit);
+ for (ControllerContext context : contexts)
+ {
+ unregisterContext(context);
+ }
+ }
+
+ /**
+ * Get bundle for user tracker.
+ *
+ * @param user the user tracker object
+ * @return bundle state
+ */
+ AbstractBundleState getBundleForUser(Object user)
+ {
+ if (user instanceof AbstractBundleState)
+ return (AbstractBundleState)user;
+ else if (user instanceof ControllerContext)
+ return getBundleForContext((ControllerContext)user);
+ else
+ throw new IllegalArgumentException("Unknown tracker type: " + user);
+ }
+
+ /**
+ * Unget a context
+ *
+ * @param bundleState the bundle state
+ * @param context the context
+ * @return true when the context is still in use by the bundle
+ */
+ boolean ungetContext(AbstractBundleState bundleState, ControllerContext context)
+ {
+ return bundleState.removeContextInUse(context);
+ }
+
+ /**
+ * Unregister context.
+ *
+ * @param context the context
+ */
+ private static void unregisterContext(ControllerContext context)
+ {
+ if (context instanceof ServiceRegistration)
+ {
+ ServiceRegistration service = (ServiceRegistration)context;
+ service.unregister();
+ }
+ }
+
+ /**
+ * Get bundle for context.
+ *
+ * @param context the context
+ * @return bundle state
+ */
+ public AbstractBundleState getBundleForContext(ControllerContext context)
+ {
+ if (context instanceof OSGiServiceState)
+ {
+ OSGiServiceState service = (OSGiServiceState)context;
+ return service.getBundleState();
+ }
+
+ DeploymentUnit unit = registry.getDeployment(context);
+ if (unit != null)
+ {
+ synchronized (unit)
+ {
+ OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
+ if (bundleState == null)
+ {
+ OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);
+ if (osgiMetaData == null)
+ {
+ Manifest manifest = unit.getAttachment(Manifest.class);
+ // [TODO] we need a mechanism to construct an OSGiMetaData from an easier factory
+ if (manifest == null)
+ manifest = new Manifest();
+ // [TODO] populate some bundle information
+ Attributes attributes = manifest.getMainAttributes();
+ attributes.put(new Name(Constants.BUNDLE_SYMBOLICNAME), unit.getName());
+ osgiMetaData = new AbstractOSGiMetaData(manifest);
+ unit.addAttachment(OSGiMetaData.class, osgiMetaData);
+ }
+
+ try
+ {
+ bundleState = (OSGiBundleState)addDeployment(unit);
+ bundleState.startInternal();
+ }
+ catch (Throwable t)
+ {
+ throw new RuntimeException("Cannot dynamically add generic bundle: " + unit, t);
+ }
+ }
+ return bundleState;
+ }
+ }
+
+ return systemBundle;
+ }
+
private URL getLocationURL(String location) throws BundleException
{
// Try location as URL
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java 2010-01-20 09:27:43 UTC (rev 99648)
@@ -234,7 +234,7 @@
{
className = clazzes[0];
OSGiBundleManager manager = bundleState.getBundleManager();
- clazz = manager.loadClass(bundleState, className);
+ clazz = manager.loadClassFailsafe(bundleState, className);
}
ScopeInfo info = OSGiScopeInfo.createScopeInfo(getName(), className, clazz, this);
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java 2010-01-20 09:27:43 UTC (rev 99648)
@@ -0,0 +1,395 @@
+/*
+ * 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.framework.bundle;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.tracker.ContextTracker;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.qualifier.QualifierMatchers;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader;
+import org.jboss.metadata.spi.MutableMetaData;
+import org.jboss.metadata.spi.repository.MutableMetaDataRepository;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrievalFactory;
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
+import org.jboss.osgi.framework.plugins.ServiceManagerPlugin;
+import org.jboss.osgi.framework.plugins.internal.AbstractPlugin;
+import org.jboss.osgi.framework.util.NoFilter;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * A plugin that manages OSGi services
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 20-Jan-2010
+ */
+public class ServiceManagerPluginImpl extends AbstractPlugin implements ServiceManagerPlugin
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(ServiceManagerPluginImpl.class);
+
+ /** The kernel */
+ private Kernel kernel;
+ /** The previous context tracker */
+ private ContextTracker previousTracker;
+
+ public ServiceManagerPluginImpl(OSGiBundleManager bundleManager)
+ {
+ super(bundleManager);
+ }
+
+ public void start()
+ {
+ kernel = getBundleManager().getKernel();
+ applyMDRUsage(true);
+ }
+
+ public void stop()
+ {
+ applyMDRUsage(false);
+ }
+
+ public ServiceReference[] getRegisteredServices(AbstractBundleState bundleState)
+ {
+ Set<ControllerContext> contexts = bundleState.getRegisteredContexts();
+ if (contexts.isEmpty())
+ return null;
+
+ Set<ServiceReference> result = new HashSet<ServiceReference>();
+ for (ControllerContext context : contexts)
+ {
+ ServiceReference ref = getServiceReferenceForContext(context);
+ if (ref != null)
+ result.add(ref);
+ }
+ if (result.isEmpty())
+ return null;
+
+ return result.toArray(new ServiceReference[result.size()]);
+ }
+
+ public ServiceReference[] getServicesInUse(AbstractBundleState bundleState)
+ {
+ Set<ControllerContext> contexts = bundleState.getUsedContexts(bundleState);
+ if (contexts == null || contexts.isEmpty())
+ return null;
+
+ List<ServiceReference> references = new ArrayList<ServiceReference>();
+ for (ControllerContext context : contexts)
+ {
+ ServiceReference ref = getServiceReferenceForContext(context);
+ if (ref != null)
+ references.add(ref);
+ }
+
+ if (references.isEmpty())
+ return null;
+
+ return references.toArray(new ServiceReference[references.size()]);
+ }
+
+ public ServiceReference[] getAllServiceReferences(AbstractBundleState bundle, String clazz, String filterStr) throws InvalidSyntaxException
+ {
+ Filter filter = NoFilter.INSTANCE;
+ if (filterStr != null)
+ filter = FrameworkUtil.createFilter(filterStr);
+
+ Collection<ServiceReference> services = getServices(bundle, clazz, filter, false);
+ if (services == null || services.isEmpty())
+ return null;
+
+ return services.toArray(new ServiceReference[services.size()]);
+ }
+
+ /**
+ * Get a service
+ *
+ * @param bundleState the bundle that requests the service
+ * @param reference the service reference
+ * @return the service
+ */
+ public Object getService(AbstractBundleState bundleState, ServiceReference reference)
+ {
+ if (reference == null)
+ throw new IllegalArgumentException("Null reference");
+
+ ControllerContextHandle handle = (ControllerContextHandle)reference;
+ ControllerContext context = handle.getContext();
+ if (OSGiBundleManager.isUnregistered(context)) // we're probably not installed anymore
+ return null;
+
+ return bundleState.addContextInUse(context);
+ }
+
+ public ServiceReference getServiceReference(AbstractBundleState bundle, String clazz)
+ {
+ if (clazz == null)
+ throw new IllegalArgumentException("Null clazz");
+
+ Collection<ServiceReference> services = getServices(bundle, clazz, null, true);
+ if (services == null || services.isEmpty())
+ return null;
+
+ return services.iterator().next();
+ }
+
+ public ServiceReference[] getServiceReferences(AbstractBundleState bundle, String clazz, String filterStr) throws InvalidSyntaxException
+ {
+ Filter filter = NoFilter.INSTANCE;
+ if (filterStr != null)
+ filter = FrameworkUtil.createFilter(filterStr);
+
+ Collection<ServiceReference> services = getServices(bundle, clazz, filter, true);
+ if (services == null || services.isEmpty())
+ return null;
+
+ return services.toArray(new ServiceReference[services.size()]);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public OSGiServiceState registerService(AbstractBundleState bundleState, String[] clazzes, Object service, Dictionary properties)
+ {
+ OSGiServiceState result = new OSGiServiceState(bundleState, clazzes, service, properties);
+ result.internalRegister();
+ try
+ {
+ Controller controller = kernel.getController();
+ controller.install(result);
+ }
+ catch (Throwable t)
+ {
+ getBundleManager().fireError(bundleState, "installing service to MC in", t);
+ throw new RuntimeException(t);
+ }
+
+ FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+ plugin.fireServiceEvent(bundleState, ServiceEvent.REGISTERED, result);
+
+ return result;
+ }
+
+ public void unregisterService(OSGiServiceState serviceState)
+ {
+ AbstractBundleState bundleState = serviceState.getBundleState();
+
+ Controller controller = kernel.getController();
+ controller.uninstall(serviceState.getName());
+
+ serviceState.internalUnregister();
+
+ FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+ plugin.fireServiceEvent(bundleState, ServiceEvent.UNREGISTERING, serviceState);
+ }
+
+ public boolean ungetService(AbstractBundleState bundleState, ServiceReference reference)
+ {
+ if (reference == null)
+ throw new IllegalArgumentException("Null reference");
+
+ ControllerContextHandle serviceReference = (ControllerContextHandle)reference;
+ ControllerContext context = serviceReference.getContext();
+ if (OSGiBundleManager.isUnregistered(context))
+ return false;
+
+ return getBundleManager().ungetContext(bundleState, context);
+ }
+
+ /**
+ * 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
+ */
+ private void applyMDRUsage(boolean register)
+ {
+ MutableMetaDataRepository repository = kernel.getMetaDataRepository().getMetaDataRepository();
+ MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(ScopeKey.DEFAULT_SCOPE);
+ if (register && retrieval == null)
+ {
+ retrieval = new MemoryMetaDataLoader(ScopeKey.DEFAULT_SCOPE);
+ repository.addMetaDataRetrieval(retrieval);
+ }
+ if (retrieval != null && retrieval instanceof MutableMetaData)
+ {
+ MutableMetaData mmd = (MutableMetaData)retrieval;
+ if (register)
+ {
+ OSGiSystemState systemBundle = getBundleManager().getSystemBundle();
+ previousTracker = mmd.addMetaData(systemBundle, ContextTracker.class);
+ }
+ else
+ {
+ if (previousTracker == null)
+ {
+ mmd.removeMetaData(ContextTracker.class);
+ if (retrieval.isEmpty())
+ repository.removeMetaDataRetrieval(retrieval.getScope());
+ }
+ else
+ {
+ mmd.addMetaData(previousTracker, ContextTracker.class);
+ }
+ }
+ }
+
+ // osgi ldap filter parsing and matching
+ FilterParserAndMatcher fpm = FilterParserAndMatcher.INSTANCE;
+ QualifierMatchers matchers = QualifierMatchers.getInstance();
+
+ if (register)
+ {
+ matchers.addParser(fpm);
+ matchers.addMatcher(fpm);
+
+ MetaDataRetrievalFactory mdrFactory = getMetaDataRetrievalFactory();
+ repository.addMetaDataRetrievalFactory(CommonLevels.INSTANCE, mdrFactory);
+ }
+ else
+ {
+ repository.removeMetaDataRetrievalFactory(CommonLevels.INSTANCE);
+
+ matchers.removeParser(fpm.getHandledContent());
+ matchers.removeMatcher(fpm.getHandledType());
+ }
+ }
+
+ private MetaDataRetrievalFactory getMetaDataRetrievalFactory()
+ {
+ MetaDataRetrievalFactory mdrFactory;
+ Controller controller = kernel.getController();
+ InstanceMetaDataRetrievalFactory imdrf = new InstanceMetaDataRetrievalFactory(controller);
+ imdrf.addFactory(new OSGiServiceStateDictionaryFactory());
+ imdrf.addFactory(new KernelDictionaryFactory(kernel.getConfigurator()));
+ // TODO - JMX?
+ mdrFactory = imdrf;
+ return mdrFactory;
+ }
+
+ private Collection<ServiceReference> getServices(AbstractBundleState bundle, String clazz, Filter filter, boolean checkAssignable)
+ {
+ Set<ControllerContext> contexts;
+ KernelController controller = kernel.getController();
+
+ // Don't check assignabilty for the system bundle
+ boolean isSystemBundle = (bundle.getBundleId() == 0);
+ if (isSystemBundle)
+ checkAssignable = false;
+
+ // TODO - a bit slow for system bundle
+ if (clazz != null && isSystemBundle == false)
+ {
+ Class<?> type = getBundleManager().loadClassFailsafe(bundle, clazz);
+ if (type == null)
+ return null; // or check all?
+
+ contexts = controller.getContexts(type, ControllerState.INSTALLED);
+ }
+ else
+ {
+ contexts = controller.getContextsByState(ControllerState.INSTALLED);
+ }
+
+ if (contexts == null || contexts.isEmpty())
+ return null;
+
+ if (filter == null)
+ filter = NoFilter.INSTANCE;
+
+ List<ControllerContext> sorted = new ArrayList<ControllerContext>(contexts);
+ Collections.sort(sorted, ContextComparator.INSTANCE); // Sort by the spec, should bubble up
+ Collection<ServiceReference> result = new ArrayList<ServiceReference>();
+ for (ControllerContext context : sorted)
+ {
+ // re-check?? -- we already only get INSTALLED
+ if (OSGiBundleManager.isUnregistered(context) == false)
+ {
+ ServiceReference ref = getServiceReferenceForContext(context);
+ if (filter.match(ref) && hasPermission(context))
+ {
+ if (clazz == null || isSystemBundle == false || MDRUtils.matchClass(context, clazz))
+ {
+ // Check the assignability
+ if (checkAssignable == false || MDRUtils.isAssignableTo(context, bundle))
+ result.add(ref);
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get service reference for context.
+ *
+ * @param context the context
+ * @return service reference
+ */
+ private ServiceReference getServiceReferenceForContext(ControllerContext context)
+ {
+ if (context instanceof OSGiServiceState)
+ {
+ OSGiServiceState service = (OSGiServiceState)context;
+ return service.hasPermission() ? service.getReferenceInternal() : null;
+ }
+
+ AbstractBundleState bundleState = getBundleManager().getBundleForContext(context);
+ return new GenericServiceReferenceWrapper(context, bundleState);
+ }
+
+ /**
+ * Do we have a permission to use context.
+ *
+ * @param context the context
+ * @return true if allowed to use context, false otherwise
+ */
+ private boolean hasPermission(ControllerContext context)
+ {
+ // TODO - make thisa generic, w/o casting
+ if (context instanceof OSGiServiceState)
+ {
+ OSGiServiceState serviceState = (OSGiServiceState)context;
+ return serviceState.hasPermission();
+ }
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/ServiceManagerPlugin.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/ServiceManagerPlugin.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/ServiceManagerPlugin.java 2010-01-20 09:27:43 UTC (rev 99648)
@@ -0,0 +1,143 @@
+/*
+ * 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.framework.plugins;
+
+import java.util.Dictionary;
+
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.OSGiServiceState;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * A plugin that manages OSGi services
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 20-Jan-2010
+ */
+public interface ServiceManagerPlugin extends Plugin
+{
+ /**
+ * Returns this bundle's <code>ServiceReference</code> list for all
+ * services it has registered or <code>null</code> if this bundle has no
+ * registered services.
+ *
+ * @return An array of <code>ServiceReference</code> objects or <code>null</code>.
+ */
+ ServiceReference[] getRegisteredServices(AbstractBundleState bundleState);
+
+ /**
+ * Returns this bundle's <code>ServiceReference</code> list for all
+ * services it is using or returns <code>null</code> if this bundle is not
+ * using any services. A bundle is considered to be using a service if its
+ * use count for that service is greater than zero.
+ *
+ *
+ * @return An array of <code>ServiceReference</code> objects or <code>null</code>.
+ * @throws IllegalStateException If this bundle has been uninstalled.
+ */
+ ServiceReference[] getServicesInUse(AbstractBundleState bundleState);
+
+ /**
+ * Returns an array of <code>ServiceReference</code> objects. The returned
+ * array of <code>ServiceReference</code> objects contains services that
+ * were registered under the specified class and match the specified filter
+ * expression.
+ *
+ * @param clazz The class name with which the service was registered or <code>null</code> for all services.
+ * @param filter The filter expression or <code>null</code> for all services.
+ * @return An array of <code>ServiceReference</code> objects or <code>null</code>
+ * if no services are registered which satisfy the search.
+ */
+ ServiceReference[] getAllServiceReferences(AbstractBundleState bundleState, String clazz, String filter) throws InvalidSyntaxException;
+
+ /**
+ * Returns an array of <code>ServiceReference</code> objects. The returned
+ * array of <code>ServiceReference</code> objects contains services that
+ * were registered under the specified class, match the specified filter
+ * expression, and the packages for the class names under which the services
+ * were registered match the context bundle's packages as defined in
+ * {@link ServiceReference#isAssignableTo(Bundle, String)}.
+ *
+ *
+ * @param clazz The class name with which the service was registered or <code>null</code> for all services.
+ * @param filter The filter expression or <code>null</code> for all services.
+ */
+ ServiceReference[] getServiceReferences(AbstractBundleState bundleState, String clazz, String filter) throws InvalidSyntaxException;
+
+ /**
+ * Returns a <code>ServiceReference</code> object for a service that
+ * implements and was registered under the specified class.
+ *
+ * @param clazz The class name with which the service was registered.
+ * @return A <code>ServiceReference</code> object, or <code>null</code>
+ */
+ ServiceReference getServiceReference(AbstractBundleState bundleState, String clazz);
+
+ /**
+ * Returns the service object referenced by the specified
+ * <code>ServiceReference</code> object.
+ *
+ * @param reference A reference to the service.
+ * @return A service object for the service associated with <code>reference</code> or <code>null</code>
+ */
+ Object getService(AbstractBundleState bundleState, ServiceReference reference);
+
+ /**
+ * Releases the service object referenced by the specified
+ * <code>ServiceReference</code> object. If the context bundle's use count
+ * for the service is zero, this method returns <code>false</code>.
+ * Otherwise, the context bundle's use count for the service is decremented
+ * by one.
+ *
+ * @param reference A reference to the service to be released.
+ * @return <code>false</code> if the context bundle's use count for the service is zero or if the service has been unregistered;
+ * <code>true</code> otherwise.
+ */
+ boolean ungetService(AbstractBundleState bundleState, ServiceReference reference);
+
+ /**
+ * Registers the specified service object with the specified properties under the specified class names
+ * into the Framework. A <code>ServiceRegistration</code> object is returned. The <code>ServiceRegistration</code>
+ * object is for the private use of the bundle registering the service and should not be shared with other
+ * bundles. The registering bundle is defined to be the context bundle.
+ *
+ * @param clazzes The class names under which the service can be located.
+ * @param service The service object or a <code>ServiceFactory</code> object.
+ * @param properties The properties for this service.
+ * @return A <code>ServiceRegistration</code> object for use by the bundle registering the service
+ */
+ @SuppressWarnings("rawtypes")
+ ServiceRegistration registerService(AbstractBundleState bundleState, String[] clazzes, Object service, Dictionary properties);
+
+ /**
+ * Unregisters a service. Remove a <code>ServiceRegistration</code> object
+ * from the Framework service registry. All <code>ServiceReference</code>
+ * objects associated with this <code>ServiceRegistration</code> object
+ * can no longer be used to interact with the service once unregistration is
+ * complete.
+ *
+ */
+ void unregisterService(OSGiServiceState serviceState);
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/ServiceManagerPlugin.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/AbstractPlugin.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/AbstractPlugin.java 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/AbstractPlugin.java 2010-01-20 09:27:43 UTC (rev 99648)
@@ -34,7 +34,7 @@
*/
public abstract class AbstractPlugin implements Plugin
{
- protected OSGiBundleManager bundleManager;
+ private OSGiBundleManager bundleManager;
public AbstractPlugin(OSGiBundleManager bundleManager)
{
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/AbstractServicePlugin.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/AbstractServicePlugin.java 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/AbstractServicePlugin.java 2010-01-20 09:27:43 UTC (rev 99648)
@@ -42,6 +42,6 @@
public BundleContext getSystemContext()
{
- return bundleManager.getSystemContext();
+ return getBundleManager().getSystemContext();
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/AutoInstallPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/AutoInstallPluginImpl.java 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/AutoInstallPluginImpl.java 2010-01-20 09:27:43 UTC (rev 99648)
@@ -78,7 +78,7 @@
for (URL bundleURL : autoInstall)
{
- Bundle bundle = bundleManager.installBundle(bundleURL);
+ Bundle bundle = getBundleManager().installBundle(bundleURL);
autoBundles.put(bundleURL, bundle);
}
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/BundleStoragePluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/BundleStoragePluginImpl.java 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/BundleStoragePluginImpl.java 2010-01-20 09:27:43 UTC (rev 99648)
@@ -81,7 +81,7 @@
{
if (storageArea == null)
{
- String dirName = bundleManager.getProperty(Constants.FRAMEWORK_STORAGE);
+ String dirName = getBundleManager().getProperty(Constants.FRAMEWORK_STORAGE);
if (dirName == null)
{
try
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java 2010-01-20 09:27:43 UTC (rev 99648)
@@ -55,7 +55,7 @@
public void start()
{
- String systemPackages = bundleManager.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
+ String systemPackages = getBundleManager().getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
if (systemPackages != null)
{
allPackages.addAll(packagesAsList(systemPackages));
@@ -110,10 +110,10 @@
allPackages.add("org.osgi.service.packageadmin");
String asString = packagesAsString(allPackages);
- bundleManager.setProperty(Constants.FRAMEWORK_SYSTEMPACKAGES, asString);
+ getBundleManager().setProperty(Constants.FRAMEWORK_SYSTEMPACKAGES, asString);
}
- String extraPackages = bundleManager.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA);
+ String extraPackages = getBundleManager().getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA);
if (extraPackages != null)
{
allPackages.addAll(packagesAsList(extraPackages));
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2010-01-20 09:27:43 UTC (rev 99648)
@@ -66,7 +66,7 @@
protected InvocationContext getInvocationContext(Bundle bundle)
{
long bundleId = bundle.getBundleId();
- AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)bundleManager.getBundleById(bundleId);
+ AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)getBundleManager().getBundleById(bundleId);
if (bundle == null)
throw new IllegalStateException("Cannot obtain bundle for: " + bundle);
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java 2010-01-20 09:27:43 UTC (rev 99648)
@@ -133,7 +133,7 @@
public ExportedPackage[] getExportedPackages(Bundle bundle)
{
- AbstractBundleState abstractBundleState = bundleManager.getBundleState(bundle);
+ AbstractBundleState abstractBundleState = getBundleManager().getBundleState(bundle);
// [TODO] exported packages for the system bundle
if (abstractBundleState instanceof OSGiBundleState == false)
@@ -195,7 +195,7 @@
List<Bundle> unresolvedBundles = new ArrayList<Bundle>();
if (bundleArr == null)
{
- for (Bundle bundle : bundleManager.getBundles(Bundle.INSTALLED))
+ for (Bundle bundle : getBundleManager().getBundles(Bundle.INSTALLED))
{
AbstractBundleState bundleState = AbstractBundleState.assertBundleState(bundle);
if (bundleState.isFragment() == false)
@@ -217,7 +217,7 @@
List<OSGiBundleState> resolvableBundles = new ArrayList<OSGiBundleState>();
// Check if the external resolver plugin is available
- Resolver bundleResolver = bundleManager.getOptionalPlugin(ResolverPlugin.class);
+ Resolver bundleResolver = getBundleManager().getOptionalPlugin(ResolverPlugin.class);
if (bundleResolver != null)
{
// Resolve the bundles through the resolver
@@ -245,7 +245,7 @@
OSGiBundleState bundleState = it.next();
try
{
- boolean bundleResolved = bundleManager.resolveBundle(bundleState, false);
+ boolean bundleResolved = getBundleManager().resolveBundle(bundleState, false);
if (bundleResolved)
{
it.remove();
@@ -267,7 +267,7 @@
{
try
{
- bundleManager.resolveBundle(bundleState, true);
+ getBundleManager().resolveBundle(bundleState, true);
}
catch (Exception ex)
{
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java 2010-01-20 09:27:43 UTC (rev 99648)
@@ -36,7 +36,6 @@
import org.jboss.test.osgi.fragments.subA.SubBeanA;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml 2010-01-20 09:27:43 UTC (rev 99648)
@@ -50,6 +50,9 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-01-20 09:27:43 UTC (rev 99648)
@@ -103,12 +103,15 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiSystemPackages" class="org.jboss.osgi.framework.plugins.internal.SystemPackagesPluginImpl">
+ <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="OSGiSystemPackages" class="org.jboss.osgi.framework.plugins.internal.SystemPackagesPluginImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<!--
********************************
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml 2010-01-20 09:27:43 UTC (rev 99648)
@@ -94,6 +94,9 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
Modified: projects/jboss-osgi/trunk/reactor/blueprint/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/trunk/reactor/blueprint/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-20 09:27:43 UTC (rev 99648)
@@ -77,6 +77,9 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-20 09:27:43 UTC (rev 99648)
@@ -77,6 +77,9 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-20 09:22:33 UTC (rev 99647)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-20 09:27:43 UTC (rev 99648)
@@ -76,6 +76,9 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
16 years, 4 months
JBoss-OSGI SVN: r99584 - projects/jboss-osgi/projects/bundles/jboss-reflect/trunk.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-19 02:03:19 -0500 (Tue, 19 Jan 2010)
New Revision: 99584
Modified:
projects/jboss-osgi/projects/bundles/jboss-reflect/trunk/pom.xml
Log:
version.jboss.reflect=2.2.0.Alpha2
Modified: projects/jboss-osgi/projects/bundles/jboss-reflect/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-reflect/trunk/pom.xml 2010-01-19 06:59:53 UTC (rev 99583)
+++ projects/jboss-osgi/projects/bundles/jboss-reflect/trunk/pom.xml 2010-01-19 07:03:19 UTC (rev 99584)
@@ -40,7 +40,7 @@
<!-- Properties -->
<properties>
<version.javassist>3.9.0.GA</version.javassist>
- <version.jboss.reflect>2.2.0-SNAPSHOT</version.jboss.reflect>
+ <version.jboss.reflect>2.2.0.Alpha2</version.jboss.reflect>
</properties>
<!-- Dependencies -->
16 years, 4 months
JBoss-OSGI SVN: r99535 - in projects/jboss-osgi/projects/runtime/framework/trunk/src: test/java/org/jboss/test/osgi/bundle and 3 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-18 05:18:56 -0500 (Mon, 18 Jan 2010)
New Revision: 99535
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/SystemBundleUnitTestCase.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/resolver/NoExternalResolverTest.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java
Log:
Document jira references
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java 2010-01-18 10:16:37 UTC (rev 99534)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java 2010-01-18 10:18:56 UTC (rev 99535)
@@ -45,6 +45,7 @@
public class OSGiClassLoaderPolicy extends VFSClassLoaderPolicy
{
// Maps the lib name to native code archive
+ // https://jira.jboss.org/jira/browse/JBCL-136
private Map<String, File> libraryMap;
public OSGiClassLoaderPolicy(AbstractBundleState bundleState, VirtualFile[] roots)
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/SystemBundleUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/SystemBundleUnitTestCase.java 2010-01-18 10:16:37 UTC (rev 99534)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/SystemBundleUnitTestCase.java 2010-01-18 10:18:56 UTC (rev 99535)
@@ -67,12 +67,12 @@
public void testStartStop() throws Exception
{
- // TODO testStartStop
+ System.out.println("[JBOSGI-138] Proper system BundleContext implementation");
}
public void testUpdate() throws Exception
{
- // TODO testUpdate
+ System.out.println("[JBOSGI-138] Proper system BundleContext implementation");
}
public void testUninstall() throws Exception
@@ -108,31 +108,31 @@
public void testGetEntry()
{
- // TODO [JBOSGI-138] Proper system BundleContext implementation
+ System.out.println("[JBOSGI-138] Proper system BundleContext implementation");
}
public void testGetEntryPath()
{
- // TODO [JBOSGI-138] Proper system BundleContext implementation
+ System.out.println("[JBOSGI-138] Proper system BundleContext implementation");
}
public void testFindEntries()
{
- // TODO [JBOSGI-138] Proper system BundleContext implementation
+ System.out.println("[JBOSGI-138] Proper system BundleContext implementation");
}
public void testLoadClass()
{
- // TODO [JBOSGI-138] Proper system BundleContext implementation
+ System.out.println("[JBOSGI-138] Proper system BundleContext implementation");
}
public void testGetResource()
{
- // TODO [JBOSGI-138] Proper system BundleContext implementation
+ System.out.println("[JBOSGI-138] Proper system BundleContext implementation");
}
public void testGetResources()
{
- // TODO [JBOSGI-138] Proper system BundleContext implementation
+ System.out.println("[JBOSGI-138] Proper system BundleContext implementation");
}
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java 2010-01-18 10:16:37 UTC (rev 99534)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java 2010-01-18 10:18:56 UTC (rev 99535)
@@ -170,9 +170,14 @@
}
@Test
- @Ignore
- public void testHiddenPrivatePackage() throws Exception
+ public void testFragmentHidesPrivatePackage() throws Exception
{
+ if (context != null)
+ {
+ System.out.println("[JBCL-137] Add support for OSGi Fragments");
+ return;
+ }
+
// Bundle-SymbolicName: simple-hostA
// Private-Package: org.jboss.test.osgi.fragments.hostA, org.jboss.test.osgi.fragments.subA
Bundle hostA = context.installBundle(getTestArchivePath("fragments-simple-hostA.jar"));
@@ -210,9 +215,14 @@
}
@Test
- @Ignore
public void testFragmentExportsPackage() throws Exception
{
+ if (context != null)
+ {
+ System.out.println("[JBCL-137] Add support for OSGi Fragments");
+ return;
+ }
+
// Bundle-SymbolicName: simple-hostA
// Private-Package: org.jboss.test.osgi.fragments.hostA, org.jboss.test.osgi.fragments.subA
Bundle hostA = context.installBundle(getTestArchivePath("fragments-simple-hostA.jar"));
@@ -285,9 +295,14 @@
}
@Test
- @Ignore
public void testFragmentRequireBundle() throws Exception
{
+ if (context != null)
+ {
+ System.out.println("[JBCL-137] Add support for OSGi Fragments");
+ return;
+ }
+
// Bundle-SymbolicName: simple-hostA
// Private-Package: org.jboss.test.osgi.fragments.hostA, org.jboss.test.osgi.fragments.subA
Bundle hostA = context.installBundle(getTestArchivePath("fragments-simple-hostA.jar"));
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/resolver/NoExternalResolverTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/resolver/NoExternalResolverTest.java 2010-01-18 10:16:37 UTC (rev 99534)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/resolver/NoExternalResolverTest.java 2010-01-18 10:18:56 UTC (rev 99535)
@@ -42,6 +42,6 @@
@Override
public void testPreferredExporterHigherVersion() throws Exception
{
- System.out.println("[JBOSGI-209]: Implement resolver preferences");
+ System.out.println("[JBCL-133] Implement resolver preferences");
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java 2010-01-18 10:16:37 UTC (rev 99534)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java 2010-01-18 10:18:56 UTC (rev 99535)
@@ -56,13 +56,13 @@
public void testNoManifest() throws Exception
{
- // TODO [JBOSGI-203] Define non OSGi bundle handling by the Framework
+ System.out.println("[JBOSGI-203] Define non OSGi bundle handling by the Framework");
// testBundle("smoke-no-manifest", Bundle.ACTIVE);
}
public void testNonOSGiManifest() throws Exception
{
- // TODO [JBOSGI-203] Define non OSGi bundle handling by the Framework
+ System.out.println("[JBOSGI-203] Define non OSGi bundle handling by the Framework");
// testBundle("smoke-non-osgi-manifest", Bundle.ACTIVE);
}
@@ -90,13 +90,13 @@
public void testDeployedNoManifest() throws Exception
{
- // TODO [JBOSGI-203] Define non OSGi bundle handling by the Framework
+ System.out.println("[JBOSGI-203] Define non OSGi bundle handling by the Framework");
// testDeployedBundle("smoke-no-manifest", Bundle.ACTIVE);
}
public void testDeployedNonOSGiManifest() throws Exception
{
- // TODO [JBOSGI-203] Define non OSGi bundle handling by the Framework
+ System.out.println("[JBOSGI-203] Define non OSGi bundle handling by the Framework");
// testDeployedBundle("smoke-non-osgi-manifest", Bundle.ACTIVE);
}
@@ -128,7 +128,8 @@
public void testAssembledNonOSGiDeployment() throws Exception
{
- /* TODO [JBOSGI-203] Define non OSGi bundle handling by the Framework
+ System.out.println("[JBOSGI-203] Define non OSGi bundle handling by the Framework");
+ /*
Bundle bundle = deployBundle("smoke-non-osgi-deployment", A.class);
try
{
16 years, 4 months
JBoss-OSGI SVN: r99531 - 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: 2010-01-18 03:44:26 -0500 (Mon, 18 Jan 2010)
New Revision: 99531
Modified:
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java
Log:
In case of the 'bundle' and 'bundleentry' protocol, use a dummy URLStreamHandler
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 2010-01-18 08:42:36 UTC (rev 99530)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java 2010-01-18 08:44:26 UTC (rev 99531)
@@ -199,9 +199,9 @@
}
catch (MalformedURLException ex)
{
- // In case of the 'bundle' protocol, use a dummy URLStreamHandler
+ // In case of the 'bundle' and 'bundleentry' protocol, use a dummy URLStreamHandler
// Access to remote content via the bundle URL is invalid anyway
- if (sh == null && urlstr.startsWith("bundle:"))
+ if (sh == null && urlstr.startsWith("bundle"))
{
sh = new URLStreamHandler()
{
16 years, 4 months
JBoss-OSGI SVN: r99496 - in projects/jboss-osgi: projects/runtime/framework/trunk/scripts and 3 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-15 12:21:56 -0500 (Fri, 15 Jan 2010)
New Revision: 99496
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
projects/jboss-osgi/projects/runtime/framework/trunk/scripts/assembly-all.xml
projects/jboss-osgi/trunk/distribution/installer/pom.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml
projects/jboss-osgi/trunk/pom.xml
Log:
Fix standalone runtime
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-01-15 17:19:03 UTC (rev 99495)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-01-15 17:21:56 UTC (rev 99496)
@@ -50,7 +50,6 @@
<version.jboss.classloading>2.2.0-SNAPSHOT</version.jboss.classloading>
<version.jboss.deployers>2.2.0.Alpha1</version.jboss.deployers>
<version.jboss.kernel>2.2.0.Alpha2</version.jboss.kernel>
- <version.jboss.mdr>2.2.0.Alpha1</version.jboss.mdr>
<version.jboss.osgi.apache.xerces>2.9.1.SP3</version.jboss.osgi.apache.xerces>
<version.jboss.osgi.common>1.0.3</version.jboss.osgi.common>
<version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
@@ -77,11 +76,6 @@
<version>${version.drools}</version>
</dependency>
<dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-mdr</artifactId>
- <version>${version.jboss.mdr}</version>
- </dependency>
- <dependency>
<groupId>org.jboss.cl</groupId>
<artifactId>jboss-classloader</artifactId>
<version>${version.jboss.classloading}</version>
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/scripts/assembly-all.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/scripts/assembly-all.xml 2010-01-15 17:19:03 UTC (rev 99495)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/scripts/assembly-all.xml 2010-01-15 17:21:56 UTC (rev 99496)
@@ -13,6 +13,7 @@
<outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
<includes>
<include>*:args4j:jar</include>
+ <include>*:javax.inject:jar</include>
<include>*:jaxb-api:jar</include>
<include>*:jboss-classloader:jar</include>
<include>*:jboss-classloading:jar</include>
Modified: projects/jboss-osgi/trunk/distribution/installer/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/pom.xml 2010-01-15 17:19:03 UTC (rev 99495)
+++ projects/jboss-osgi/trunk/distribution/installer/pom.xml 2010-01-15 17:21:56 UTC (rev 99496)
@@ -30,6 +30,10 @@
<!-- Dependencies -->
<dependencies>
<dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.jboss.osgi.distribution</groupId>
<artifactId>jboss-osgi-javadoc</artifactId>
<version>${version}</version>
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml 2010-01-15 17:19:03 UTC (rev 99495)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml 2010-01-15 17:21:56 UTC (rev 99496)
@@ -301,6 +301,7 @@
<singlefile condition="isJBossMC" src="@{runtime.dir}/server/conf/jboss-osgi-bootstrap.xml" target="$INSTALL_PATH/runtime/server/all/conf/jboss-osgi-bootstrap.xml"
override="true" />
<fileset condition="isJBossMC" dir="@{deploy.artifacts.dir}/lib" targetdir="$INSTALL_PATH/runtime/lib" override="true">
+ <include name="javax.inject.jar" />
<include name="jaxb-api.jar" />
<include name="jboss-classloader.jar" />
<include name="jboss-classloading.jar" />
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2010-01-15 17:19:03 UTC (rev 99495)
+++ projects/jboss-osgi/trunk/pom.xml 2010-01-15 17:21:56 UTC (rev 99496)
@@ -43,6 +43,7 @@
<!-- Properties -->
<properties>
+ <version.apache.ant>1.7.0</version.apache.ant>
<version.apache.felix.configadmin>1.2.4</version.apache.felix.configadmin>
<version.apache.felix.core>1.4.0</version.apache.felix.core>
<version.apache.felix.eventadmin>1.0.0</version.apache.felix.eventadmin>
@@ -82,6 +83,13 @@
<dependencyManagement>
<dependencies>
+ <!-- apache ant -->
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>${version.apache.ant}</version>
+ </dependency>
+
<!-- jboss.osgi -->
<dependency>
<groupId>org.jboss.osgi</groupId>
16 years, 4 months
JBoss-OSGI SVN: r99495 - in projects/jboss-osgi/projects/runtime/deployers/trunk: src/main/java/org/jboss/osgi/deployer/helpers and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-15 12:19:03 -0500 (Fri, 15 Jan 2010)
New Revision: 99495
Modified:
projects/jboss-osgi/projects/runtime/deployers/trunk/pom.xml
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/PackageAdminDependencyItem.java
Log:
Update dependencies
Modified: projects/jboss-osgi/projects/runtime/deployers/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/pom.xml 2010-01-15 16:42:28 UTC (rev 99494)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/pom.xml 2010-01-15 17:19:03 UTC (rev 99495)
@@ -30,7 +30,7 @@
</parent>
<properties>
- <version.jboss.deployers>2.2.0-SNAPSHOT</version.jboss.deployers>
+ <version.jboss.deployers>2.2.0.Alpha1</version.jboss.deployers>
<version.jboss.osgi.deployment>1.0.1-SNAPSHOT</version.jboss.osgi.deployment>
<version.jboss.osgi.spi>1.0.4-SNAPSHOT</version.jboss.osgi.spi>
<version.osgi>4.2.0</version.osgi>
Modified: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/PackageAdminDependencyItem.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/PackageAdminDependencyItem.java 2010-01-15 16:42:28 UTC (rev 99494)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/PackageAdminDependencyItem.java 2010-01-15 17:19:03 UTC (rev 99495)
@@ -39,7 +39,7 @@
*/
public class PackageAdminDependencyItem extends AbstractDependencyItem
{
- private static final ControllerState CTRL_STATE = new ControllerState(DeploymentStages.CLASSLOADER.getName());
+ private static final ControllerState CTRL_STATE = ControllerState.getInstance(DeploymentStages.CLASSLOADER.getName());
private final PackageAdmin packageAdmin;
private final Bundle bundle;
16 years, 4 months
JBoss-OSGI SVN: r99461 - in projects: jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-15 07:18:02 -0500 (Fri, 15 Jan 2010)
New Revision: 99461
Modified:
projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoader.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentAttachmentDeployer.java
Log:
Delegate fragment resorce loading to VFSClassLoaderPolicy
Modified: projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java
===================================================================
--- projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java 2010-01-15 11:46:30 UTC (rev 99460)
+++ projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java 2010-01-15 12:18:02 UTC (rev 99461)
@@ -642,6 +642,27 @@
{
}
}
+
+ if (fragments != null)
+ {
+ for (VirtualFile root : fragments)
+ {
+ try
+ {
+ VirtualFile file = root.getChild(path);
+ if (file != null)
+ {
+ result = new VirtualFileInfo(file, root);
+ vfsCache.put(path, result);
+ return result;
+ }
+ }
+ catch (Exception ignored)
+ {
+ }
+ }
+ }
+
return null;
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoader.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoader.java 2010-01-15 11:46:30 UTC (rev 99460)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoader.java 2010-01-15 12:18:02 UTC (rev 99461)
@@ -23,10 +23,7 @@
// $Id: OSGiClassLoaderFactory.java 95177 2009-10-20 15:14:31Z thomas.diesler(a)jboss.com $
-import java.util.List;
-
import org.jboss.classloader.spi.ClassLoaderPolicy;
-import org.jboss.classloader.spi.DelegateLoader;
import org.jboss.classloader.spi.base.BaseClassLoader;
/**
@@ -62,31 +59,4 @@
return libraryPath;
}
-
- @Override
- public Class<?> loadClass(String className) throws ClassNotFoundException
- {
- try
- {
- Class<?> clazz = super.loadClass(className);
- return clazz;
- }
- catch (ClassNotFoundException ex)
- {
- // Try to load the class in the attached fragments
- List<DelegateLoader> fragmentLoaders = osgiPolicy.getFragmentLoaders();
- if (fragmentLoaders != null)
- {
- for (DelegateLoader fragLoader : fragmentLoaders)
- {
- Class<?> clazz = fragLoader.loadClass(className);
- if (clazz != null)
- return clazz;
- }
- }
-
- // Throw the ClassNotFoundException
- throw ex;
- }
- }
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java 2010-01-15 11:46:30 UTC (rev 99460)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java 2010-01-15 12:18:02 UTC (rev 99461)
@@ -24,13 +24,9 @@
// $Id$
import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
-import org.jboss.classloader.spi.DelegateLoader;
import org.jboss.classloading.spi.dependency.Module;
import org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy;
import org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule;
@@ -50,8 +46,6 @@
{
// Maps the lib name to native code archive
private Map<String, File> libraryMap;
- // The optional list of attached fragment loaders
- private List<DelegateLoader> fragmentLoaders;
public OSGiClassLoaderPolicy(AbstractBundleState bundleState, VirtualFile[] roots)
{
@@ -102,36 +96,4 @@
return (libfile != null ? libfile.getAbsolutePath() : null);
}
-
- public List<DelegateLoader> getFragmentLoaders()
- {
- return fragmentLoaders;
- }
-
- public void addFragmentLoader(DelegateLoader delegateLoader)
- {
- if (fragmentLoaders == null)
- fragmentLoaders = new ArrayList<DelegateLoader>();
-
- fragmentLoaders.add(delegateLoader);
- }
-
- @Override
- public URL getResource(String path)
- {
- URL resourceURL = super.getResource(path);
-
- // Try to find the resource in the attached fragments
- if (resourceURL == null && fragmentLoaders != null)
- {
- for (DelegateLoader fragLoader : fragmentLoaders)
- {
- resourceURL = fragLoader.getResource(path);
- if (resourceURL != null)
- break;
- }
- }
-
- return resourceURL;
- }
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentAttachmentDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentAttachmentDeployer.java 2010-01-15 11:46:30 UTC (rev 99460)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentAttachmentDeployer.java 2010-01-15 12:18:02 UTC (rev 99461)
@@ -24,7 +24,6 @@
// $Id$
import org.jboss.classloader.spi.ClassLoaderPolicy;
-import org.jboss.classloader.spi.DelegateLoader;
import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentStages;
@@ -91,10 +90,7 @@
OSGiBundleState hostState = fragState.getFragmentHost();
DeploymentUnit hostUnit = hostState.getDeploymentUnit();
OSGiClassLoaderPolicy hostPolicy = (OSGiClassLoaderPolicy)hostUnit.getAttachment(ClassLoaderPolicy.class);
-
- OSGiClassLoaderPolicy fragPolicy = (OSGiClassLoaderPolicy)unit.getAttachment(ClassLoaderPolicy.class);
- DelegateLoader fragLoader = new DelegateLoader(fragPolicy);
- hostPolicy.addFragmentLoader(fragLoader);
+ hostPolicy.attachFragment(fragState.getRoot());
}
}
}
16 years, 4 months
JBoss-OSGI SVN: r99460 - in projects/jboss-osgi/projects/runtime/framework/trunk: src/main/java/org/jboss/osgi/framework/bundle and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-15 06:46:30 -0500 (Fri, 15 Jan 2010)
New Revision: 99460
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/internal/AbstractReferenceMetaData.java
Log:
Update dependencies
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-01-15 11:44:45 UTC (rev 99459)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-01-15 11:46:30 UTC (rev 99460)
@@ -21,7 +21,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>JBossOSGi - Framework</name>
+ <name>JBossOSGi Core Framework</name>
<groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-framework</artifactId>
<packaging>bundle</packaging>
@@ -47,10 +47,10 @@
<version.apache.felix.log>1.0.0</version.apache.felix.log>
<version.apache.felix.metatype>1.0.2</version.apache.felix.metatype>
<version.drools>5.0.1</version.drools>
- <version.jboss.aop>2.1.0.CR3</version.jboss.aop>
- <version.jboss.classloading>2.0.8.GA</version.jboss.classloading>
+ <version.jboss.classloading>2.2.0-SNAPSHOT</version.jboss.classloading>
<version.jboss.deployers>2.2.0.Alpha1</version.jboss.deployers>
<version.jboss.kernel>2.2.0.Alpha2</version.jboss.kernel>
+ <version.jboss.mdr>2.2.0.Alpha1</version.jboss.mdr>
<version.jboss.osgi.apache.xerces>2.9.1.SP3</version.jboss.osgi.apache.xerces>
<version.jboss.osgi.common>1.0.3</version.jboss.osgi.common>
<version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
@@ -77,332 +77,64 @@
<version>${version.drools}</version>
</dependency>
<dependency>
- <groupId>org.jboss.aop</groupId>
- <artifactId>jboss-aop</artifactId>
- <version>${version.jboss.aop}</version>
- <exclusions>
- <exclusion>
- <groupId>ant</groupId>
- <artifactId>ant</artifactId>
- </exclusion>
- <exclusion>
- <groupId>apache-xerces</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-container</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-reflect</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-mdr</artifactId>
- </exclusion>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- </exclusion>
- </exclusions>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-mdr</artifactId>
+ <version>${version.jboss.mdr}</version>
</dependency>
<dependency>
<groupId>org.jboss.cl</groupId>
<artifactId>jboss-classloader</artifactId>
<version>${version.jboss.classloading}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.cl</groupId>
<artifactId>jboss-classloading</artifactId>
<version>${version.jboss.classloading}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.cl</groupId>
<artifactId>jboss-classloading-vfs</artifactId>
<version>${version.jboss.classloading}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.deployers</groupId>
<artifactId>jboss-deployers-impl</artifactId>
<version>${version.jboss.deployers}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.deployers</groupId>
<artifactId>jboss-deployers-vfs-spi</artifactId>
<version>${version.jboss.deployers}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.deployers</groupId>
<artifactId>jboss-deployers-vfs</artifactId>
<version>${version.jboss.deployers}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.kernel</groupId>
<artifactId>jboss-kernel</artifactId>
<version>${version.jboss.kernel}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.kernel</groupId>
<artifactId>jboss-dependency</artifactId>
<version>${version.jboss.kernel}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-spi</artifactId>
<version>${version.jboss.osgi.spi}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-deployers</artifactId>
<version>${version.jboss.osgi.runtime.deployers}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-deployment</artifactId>
<version>${version.jboss.osgi.deployment}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-dependency</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-kernel</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<!-- Provided Dependencies -->
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-01-15 11:44:45 UTC (rev 99459)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-01-15 11:46:30 UTC (rev 99460)
@@ -46,8 +46,8 @@
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.jar.Attributes;
+import java.util.jar.Manifest;
import java.util.jar.Attributes.Name;
-import java.util.jar.Manifest;
import org.jboss.dependency.spi.Controller;
import org.jboss.dependency.spi.ControllerContext;
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/internal/AbstractReferenceMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/internal/AbstractReferenceMetaData.java 2010-01-15 11:44:45 UTC (rev 99459)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/internal/AbstractReferenceMetaData.java 2010-01-15 11:46:30 UTC (rev 99460)
@@ -24,7 +24,6 @@
import java.util.List;
import java.util.Set;
-import org.jboss.aop.proxy.container.GeneratedAOPProxyFactory;
import org.jboss.beans.metadata.spi.MetaDataVisitor;
import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
import org.jboss.beans.metadata.spi.PropertyMetaData;
@@ -56,8 +55,8 @@
public Object getValue(BundleContext bundleContext) throws Throwable
{
- // tdo - add dynamic behaviour
- return GeneratedAOPProxyFactory.createProxy(null, null);
+ // [TODO] - add dynamic behaviour
+ return null;
}
public void visit(ServiceMetaDataVisitor visitor)
16 years, 4 months