JBoss-OSGI SVN: r101113 - in projects/jboss-osgi/projects/runtime/framework/trunk/src: main/java/org/jboss/osgi/framework/deployers and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-18 09:10:57 -0500 (Thu, 18 Feb 2010)
New Revision: 101113
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/AbstractDeployedBundleState.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/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/OSGiFragmentState.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/deployers/AbstractOSGiClassLoadingDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateAddDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java
Log:
[JBOSGI-292] PackageAdmin cannot obtain classloading metadata
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-02-18 13:57:45 UTC (rev 101112)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-02-18 14:10:57 UTC (rev 101113)
@@ -113,15 +113,25 @@
}
/**
+ * Create a new abstract bundle state.
+ *
+ * @throws IllegalArgumentException for a null parameter
+ */
+ public AbstractBundleState(OSGiBundleManager bundleManager)
+ {
+ this.bundleManager = bundleManager;
+
+ if (bundleManager == null)
+ throw new IllegalArgumentException("Null bundle manager");
+ }
+
+ /**
* Get the bundleManager.
*
* @return the bundleManager.
*/
public OSGiBundleManager getBundleManager()
{
- if (bundleManager == null)
- throw new IllegalStateException("Bundle not installed: " + getCanonicalName());
-
return bundleManager;
}
@@ -638,19 +648,6 @@
}
/**
- * Set the bundle manager
- *
- * @param bundleManager the bundle manager or null to uninstall the bundle
- */
- void setBundleManager(OSGiBundleManager bundleManager)
- {
- if (bundleManager != null && this.bundleManager != null)
- throw new IllegalStateException("Bundle " + this + " is already installed");
-
- this.bundleManager = bundleManager;
- }
-
- /**
* Change the state of the bundle
*
* @param state the new state
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java 2010-02-18 13:57:45 UTC (rev 101112)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java 2010-02-18 14:10:57 UTC (rev 101113)
@@ -69,12 +69,12 @@
/**
* Create a new BundleState.
- *
- * @param unit the deployment unit
* @throws IllegalArgumentException for a null parameter
*/
- public AbstractDeployedBundleState(DeploymentUnit unit)
+ public AbstractDeployedBundleState(OSGiBundleManager bundleManager, DeploymentUnit unit)
{
+ super(bundleManager);
+
if (unit == null)
throw new IllegalArgumentException("Null deployment unit");
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-02-18 13:57:45 UTC (rev 101112)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java 2010-02-18 14:10:57 UTC (rev 101113)
@@ -139,6 +139,7 @@
try
{
bundleState = (OSGiBundleState)bundleManager.addDeployment(unit);
+ bundleManager.addBundle(bundleState);
bundleState.startInternal();
}
catch (Throwable t)
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-02-18 13:57:45 UTC (rev 101112)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-02-18 14:10:57 UTC (rev 101113)
@@ -190,7 +190,7 @@
throw new IllegalArgumentException("Null deployerClient");
if (deployerClient instanceof MainDeployerStructure == false)
throw new IllegalArgumentException("Deployer client does not implement " + MainDeployerStructure.class.getName());
-
+
this.kernel = kernel;
this.deployerClient = deployerClient;
@@ -204,7 +204,7 @@
public void start()
{
// Create the system Bundle
- systemBundle = new OSGiSystemState();
+ systemBundle = new OSGiSystemState(this);
addBundle(systemBundle);
}
@@ -813,20 +813,15 @@
if (fragmentHost != null)
{
// Create a new OSGiFragmentState
- OSGiFragmentState fragmentState = new OSGiFragmentState(unit);
+ OSGiFragmentState fragmentState = new OSGiFragmentState(this, unit);
absBundle = fragmentState;
- addBundle(fragmentState);
}
else
{
// Create a new OSGiBundleState
- AbstractDeployedBundleState bundleState = new OSGiBundleState(unit);
+ AbstractDeployedBundleState bundleState = new OSGiBundleState(this, unit);
absBundle = bundleState;
- addBundle(bundleState);
}
-
- // Attach the abstract bundle state
- unit.addAttachment(AbstractBundleState.class, absBundle);
}
// Attach the abstract bundle state
@@ -839,8 +834,12 @@
}
/**
- * Add a bundle
+ * Add a bundle to the manager.
*
+ * Note, the bundle must be metadata complete when it is added to the manager.
+ * An extender might pickup the INSTALLED event and use PackageAdmin to examine the
+ * exported packages for example.
+ *
* @param bundleState the bundle state
* @throws IllegalArgumentException for a null bundle state
*/
@@ -849,21 +848,20 @@
if (bundleState == null)
throw new IllegalArgumentException("Null bundle state");
- validateBundle(bundleState);
-
- bundleState.setBundleManager(this);
- allBundles.add(bundleState);
-
- // Only fire the INSTALLED event if this is not an update
- boolean fireEvent = true;
+ // Do nothing if this is a bundle update
if (bundleState instanceof OSGiBundleState)
{
DeploymentUnit unit = ((AbstractDeployedBundleState)bundleState).getDeploymentUnit();
Deployment dep = unit.getAttachment(Deployment.class);
- fireEvent = (dep == null || dep.isBundleUpdate() == false);
+ if (dep != null && dep.isBundleUpdate())
+ return;
}
- bundleState.changeState(Bundle.INSTALLED, fireEvent);
+ validateBundle(bundleState);
+
+ allBundles.add(bundleState);
+
+ bundleState.changeState(Bundle.INSTALLED, true);
// Add the bundle to the resolver
// Note, plugins are not registered when the system bundle is added
@@ -885,10 +883,13 @@
if (osgiMetaData == null)
return;
+ OSGiBundleValidator validator;
+
// Delegate to the validator for the appropriate revision
- OSGiBundleValidator validator = new OSGiBundleValidatorR3(this);
if (osgiMetaData.getBundleManifestVersion() > 1)
validator = new OSGiBundleValidatorR4(this);
+ else
+ validator = new OSGiBundleValidatorR3(this);
validator.validateBundle(bundleState);
}
@@ -905,7 +906,6 @@
throw new IllegalArgumentException("Null bundle state");
bundleState.uninstallInternal();
- bundleState.setBundleManager(null);
// Remove the bundle from the resolver
ResolverPlugin bundleResolver = getOptionalPlugin(ResolverPlugin.class);
@@ -1135,7 +1135,7 @@
{
deployerClient.change(unitName, DeploymentStages.CLASSLOADER);
deployerClient.checkComplete(unitName);
-
+
// Advance the attached fragments to CLASSLOADER
for (OSGiFragmentState fragment : bundleState.getAttachedFragments())
{
@@ -1143,11 +1143,11 @@
deployerClient.change(fragUnitName, DeploymentStages.CLASSLOADER);
deployerClient.checkComplete(fragUnitName);
}
-
+
bundleState.changeState(Bundle.RESOLVED);
for (OSGiFragmentState fragment : bundleState.getAttachedFragments())
fragment.changeState(Bundle.RESOLVED);
-
+
return true;
}
catch (DeploymentException ex)
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-02-18 13:57:45 UTC (rev 101112)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2010-02-18 14:10:57 UTC (rev 101113)
@@ -61,13 +61,10 @@
/**
* Create a new BundleState.
- *
- * @param unit the deployment unit
- * @throws IllegalArgumentException for a null parameter
*/
- public OSGiBundleState(DeploymentUnit unit)
+ public OSGiBundleState(OSGiBundleManager bundleManager, DeploymentUnit unit)
{
- super(unit);
+ super(bundleManager, unit);
}
/**
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiFragmentState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiFragmentState.java 2010-02-18 13:57:45 UTC (rev 101112)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiFragmentState.java 2010-02-18 14:10:57 UTC (rev 101113)
@@ -42,9 +42,9 @@
// The host that this fragment is attached to
private OSGiBundleState fragmentHost;
- public OSGiFragmentState(DeploymentUnit unit)
+ public OSGiFragmentState(OSGiBundleManager bundleManager, DeploymentUnit unit)
{
- super(unit);
+ super(bundleManager, unit);
}
public OSGiBundleState getFragmentHost()
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-02-18 13:57:45 UTC (rev 101112)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java 2010-02-18 14:10:57 UTC (rev 101113)
@@ -50,8 +50,10 @@
/**
* Create a new OSGiSystemBundle.
*/
- public OSGiSystemState()
+ public OSGiSystemState(OSGiBundleManager bundleManager)
{
+ super(bundleManager);
+
Manifest manifest = new Manifest();
Attributes attributes = manifest.getMainAttributes();
attributes.put(new Name(Constants.BUNDLE_SYMBOLICNAME), Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java 2010-02-18 13:57:45 UTC (rev 101112)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java 2010-02-18 14:10:57 UTC (rev 101113)
@@ -141,6 +141,9 @@
}
unit.addAttachment(ClassLoadingMetaData.class, classLoadingMetaData);
+
+ // Add the bundle to the manager when the class loading metadata is available
+ bundleManager.addBundle(bundleState);
// AnnotationMetaDataDeployer.ANNOTATION_META_DATA_COMPLETE
unit.addAttachment("org.jboss.deployment.annotation.metadata.complete", Boolean.TRUE);
@@ -149,4 +152,15 @@
if (factory != null)
unit.addAttachment(ClassLoaderFactory.class, factory);
}
+
+ @Override
+ public void undeploy(DeploymentUnit unit, OSGiMetaData deployment)
+ {
+ AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
+ if (bundleState != null)
+ {
+ OSGiBundleManager bundleManager = bundleState.getBundleManager();
+ bundleManager.removeBundle(bundleState);
+ }
+ }
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateAddDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateAddDeployer.java 2010-02-18 13:57:45 UTC (rev 101112)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateAddDeployer.java 2010-02-18 14:10:57 UTC (rev 101113)
@@ -24,6 +24,7 @@
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
@@ -58,6 +59,8 @@
// [TODO] look at manifest headers and persistent state for this
unit.setRequiredStage(DeploymentStages.DESCRIBE);
- bundleManager.addDeployment(unit);
+ // Attach the abstract bundle state
+ AbstractBundleState bundleState = bundleManager.addDeployment(unit);
+ unit.addAttachment(AbstractBundleState.class, bundleState);
}
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java 2010-02-18 13:57:45 UTC (rev 101112)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java 2010-02-18 14:10:57 UTC (rev 101113)
@@ -146,7 +146,7 @@
AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)absBundleState;
ClassLoadingMetaData metaData = bundleState.getDeploymentUnit().getAttachment(ClassLoadingMetaData.class);
if (metaData == null)
- throw new IllegalStateException("Cannot obtain ClassLoadingMetaData");
+ throw new IllegalStateException("Cannot obtain ClassLoadingMetaData for: " + bundle);
CapabilitiesMetaData capabilities = metaData.getCapabilities();
for (Capability capability : capabilities.getCapabilities())
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java 2010-02-18 13:57:45 UTC (rev 101112)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java 2010-02-18 14:10:57 UTC (rev 101113)
@@ -44,6 +44,7 @@
*
* TODO test security
* @author <a href="adrian(a)jboss.com">Adrian Brock</a>
+ * @author Thomas.Diesler(a)jboss.com
* @version $Revision: 1.1 $
*/
public class BundleUnitTestCase extends FrameworkTest
14 years, 4 months
JBoss-OSGI SVN: r101090 - projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-17 15:12:50 -0500 (Wed, 17 Feb 2010)
New Revision: 101090
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java
Log:
Prevent invalid bundle context in PackageAdminImpl.getFragments(PackageAdminImpl.java:207)
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java 2010-02-17 20:12:04 UTC (rev 101089)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java 2010-02-17 20:12:50 UTC (rev 101090)
@@ -204,7 +204,7 @@
OSGiBundleState bundleState = (OSGiBundleState)absBundleState;
List<OSGiFragmentState> fragments = bundleState.getAttachedFragments();
for (OSGiFragmentState aux : fragments)
- bundles.add(aux.getBundle());
+ bundles.add(aux.getBundleInternal());
if (bundles.isEmpty())
return null;
14 years, 4 months
JBoss-OSGI SVN: r101081 - projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-17 11:23:52 -0500 (Wed, 17 Feb 2010)
New Revision: 101081
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java
Log:
Prevent NPE when bundle does not export packages
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java 2010-02-17 16:15:09 UTC (rev 101080)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java 2010-02-17 16:23:52 UTC (rev 101081)
@@ -173,10 +173,14 @@
for (AbstractBundleState auxBundle : getBundleManager().getBundles())
{
- for (ExportedPackage auxPackage : getExportedPackages(auxBundle))
+ ExportedPackage[] exportedPackages = getExportedPackages(auxBundle);
+ if (exportedPackages != null)
{
- if (auxPackage.getName().equals(name))
- exported.add(auxPackage);
+ for (ExportedPackage auxPackage : exportedPackages)
+ {
+ if (auxPackage.getName().equals(name))
+ exported.add(auxPackage);
+ }
}
}
14 years, 4 months
JBoss-OSGI SVN: r101073 - in projects/jboss-osgi/trunk: distribution/installer/src/main/resources/installer and 11 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-17 08:56:24 -0500 (Wed, 17 Feb 2010)
New Revision: 101073
Removed:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/javax/xml/
Modified:
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-equinox.properties
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-felix.properties
projects/jboss-osgi/trunk/distribution/pom.xml
projects/jboss-osgi/trunk/testsuite/example/.classpath
projects/jboss-osgi/trunk/testsuite/example/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/enterprise/jmx/JMXEnterpriseTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/.classpath
projects/jboss-osgi/trunk/testsuite/functional/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGi36TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/OSGi58TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/ejb/StatelessBean.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/ejb/StatelessBeanImpl.java
Log:
[JBOSGI-126] Replace the SPI JMX functionality by RFC-139 API
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-02-17 13:55:15 UTC (rev 101072)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml 2010-02-17 13:56:24 UTC (rev 101073)
@@ -209,6 +209,8 @@
<include name="jboss-osgi-jmx.jar" />
<include name="jboss-osgi-jndi.jar" />
<include name="org.apache.felix.eventadmin.jar" />
+ <include name="org.apache.aries.jmx.jar" />
+ <include name="org.apache.aries.util.jar" />
</fileset>
<!-- Server Web -->
@@ -219,6 +221,8 @@
<include name="jboss-osgi-jmx.jar" />
<include name="jboss-osgi-jndi.jar" />
<include name="org.apache.felix.eventadmin.jar" />
+ <include name="org.apache.aries.jmx.jar" />
+ <include name="org.apache.aries.util.jar" />
<!-- web -->
<include name="org.apache.felix.configadmin.jar" />
<include name="org.apache.felix.metatype.jar" />
@@ -234,6 +238,8 @@
<include name="jboss-osgi-jmx.jar" />
<include name="jboss-osgi-jndi.jar" />
<include name="org.apache.felix.eventadmin.jar" />
+ <include name="org.apache.aries.jmx.jar" />
+ <include name="org.apache.aries.util.jar" />
<!-- web -->
<include name="jboss-osgi-webconsole.jar" />
<include name="org.apache.felix.configadmin.jar" />
@@ -247,7 +253,6 @@
<include name="jboss-osgi-jta.jar" />
<include name="jboss-osgi-reflect.jar" />
<include name="jboss-osgi-xml-binding.jar" />
- <include name="org.apache.aries.util.jar" />
</fileset>
<!-- Felix Integration -->
@@ -410,6 +415,7 @@
<include name="jboss-osgi-webconsole.jar" />
<include name="jboss-osgi-reflect.jar" />
<include name="jboss-osgi-xml-binding.jar" />
+ <include name="org.apache.aries.jmx.jar" />
<include name="org.apache.aries.util.jar" />
<include name="org.apache.felix.log.jar" />
<include name="pax-web-jetty-bundle.jar" />
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-equinox.properties
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-equinox.properties 2010-02-17 13:55:15 UTC (rev 101072)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-equinox.properties 2010-02-17 13:56:24 UTC (rev 101073)
@@ -17,28 +17,28 @@
# Extra System Packages
org.osgi.framework.system.packages.extra=\
org.apache.log4j;version=1.2, \
- org.jboss.logging;version=2.1, \
- org.jboss.net.protocol, \
- org.jboss.osgi.deployment.common;version=1.0, \
- org.jboss.osgi.deployment.deployer;version=1.0, \
- org.jboss.osgi.deployment.interceptor;version=1.0, \
+ org.jboss.logging;version=2.1, \
+ org.jboss.net.protocol, \
+ org.jboss.osgi.deployment.common;version=1.0, \
+ org.jboss.osgi.deployment.deployer;version=1.0, \
+ org.jboss.osgi.deployment.interceptor;version=1.0, \
org.jboss.osgi.deployment.internal;version=1.0, \
- org.jboss.osgi.spi;version=1.0, \
- org.jboss.osgi.spi.capability;version=1.0, \
- org.jboss.osgi.spi.framework;version=1.0, \
- org.jboss.osgi.spi.management;version=1.0, \
- org.jboss.osgi.spi.service;version=1.0, \
- org.jboss.osgi.spi.util;version=1.0, \
- org.jboss.virtual;version=2.1, \
- org.jboss.virtual.plugins.registry;version=2.1, \
- org.jboss.virtual.plugins.context.jar;version=2.1, \
- org.jboss.virtual.plugins.vfs.helpers;version=2.1, \
- org.jboss.virtual.protocol;version=2.1, \
- org.osgi.framework;version=1.5
+ org.jboss.osgi.spi;version=1.0, \
+ org.jboss.osgi.spi.capability;version=1.0, \
+ org.jboss.osgi.spi.framework;version=1.0, \
+ org.jboss.osgi.spi.management;version=1.0, \
+ org.jboss.osgi.spi.service;version=1.0, \
+ org.jboss.osgi.spi.util;version=1.0, \
+ org.jboss.virtual;version=2.1, \
+ org.jboss.virtual.plugins.registry;version=2.1, \
+ org.jboss.virtual.plugins.context.jar;version=2.1, \
+ org.jboss.virtual.plugins.vfs.helpers;version=2.1, \
+ org.jboss.virtual.protocol;version=2.1, \
+ org.osgi.framework;version=1.5
# Bundles that need to be installed with the Framework automatically
org.jboss.osgi.spi.framework.autoInstall=\
- file://${osgi.home}/server/minimal/deploy/org.eclipse.osgi.services.jar \
+ file://${osgi.home}/server/minimal/deploy/org.eclipse.osgi.services.jar \
file://${osgi.home}/server/minimal/deploy/org.eclipse.osgi.util.jar
# Bundles that need to be started automatically
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-felix.properties 2010-02-17 13:55:15 UTC (rev 101072)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-felix.properties 2010-02-17 13:56:24 UTC (rev 101073)
@@ -17,28 +17,28 @@
# Extra System Packages
org.osgi.framework.system.packages.extra=\
org.apache.log4j;version=1.2, \
- org.jboss.logging;version=2.1, \
- org.jboss.net.protocol, \
- org.jboss.osgi.deployment.common;version=1.0, \
- org.jboss.osgi.deployment.deployer;version=1.0, \
- org.jboss.osgi.deployment.interceptor;version=1.0, \
+ org.jboss.logging;version=2.1, \
+ org.jboss.net.protocol, \
+ org.jboss.osgi.deployment.common;version=1.0, \
+ org.jboss.osgi.deployment.deployer;version=1.0, \
+ org.jboss.osgi.deployment.interceptor;version=1.0, \
org.jboss.osgi.deployment.internal;version=1.0, \
- org.jboss.osgi.spi;version=1.0, \
- org.jboss.osgi.spi.capability;version=1.0, \
- org.jboss.osgi.spi.framework;version=1.0, \
- org.jboss.osgi.spi.management;version=1.0, \
- org.jboss.osgi.spi.service;version=1.0, \
- org.jboss.osgi.spi.util;version=1.0, \
- org.jboss.virtual;version=2.1, \
- org.jboss.virtual.plugins.registry;version=2.1, \
- org.jboss.virtual.plugins.context.jar;version=2.1, \
- org.jboss.virtual.plugins.vfs.helpers;version=2.1, \
- org.jboss.virtual.protocol;version=2.1, \
- org.osgi.framework;version=1.5
+ org.jboss.osgi.spi;version=1.0, \
+ org.jboss.osgi.spi.capability;version=1.0, \
+ org.jboss.osgi.spi.framework;version=1.0, \
+ org.jboss.osgi.spi.management;version=1.0, \
+ org.jboss.osgi.spi.service;version=1.0, \
+ org.jboss.osgi.spi.util;version=1.0, \
+ org.jboss.virtual;version=2.1, \
+ org.jboss.virtual.plugins.registry;version=2.1, \
+ org.jboss.virtual.plugins.context.jar;version=2.1, \
+ org.jboss.virtual.plugins.vfs.helpers;version=2.1, \
+ org.jboss.virtual.protocol;version=2.1, \
+ org.osgi.framework;version=1.5
# Bundles that need to be installed with the Framework automatically
org.jboss.osgi.spi.framework.autoInstall=\
- file://${osgi.home}/server/minimal/deploy/org.osgi.compendium.jar
+ file://${osgi.home}/server/minimal/deploy/org.osgi.compendium.jar
# Bundles that need to be started automatically
org.jboss.osgi.spi.framework.autoStart=\
Modified: projects/jboss-osgi/trunk/distribution/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/pom.xml 2010-02-17 13:55:15 UTC (rev 101072)
+++ projects/jboss-osgi/trunk/distribution/pom.xml 2010-02-17 13:56:24 UTC (rev 101073)
@@ -346,6 +346,14 @@
<!-- Aries Dependencies -->
<dependency>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>org.apache.aries.jmx</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.jndi</groupId>
+ <artifactId>org.apache.aries.jndi</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.aries</groupId>
<artifactId>org.apache.aries.util</artifactId>
</dependency>
Modified: projects/jboss-osgi/trunk/testsuite/example/.classpath
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/.classpath 2010-02-17 13:55:15 UTC (rev 101072)
+++ projects/jboss-osgi/trunk/testsuite/example/.classpath 2010-02-17 13:56:24 UTC (rev 101073)
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: projects/jboss-osgi/trunk/testsuite/example/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:55:15 UTC (rev 101072)
+++ projects/jboss-osgi/trunk/testsuite/example/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:56:24 UTC (rev 101073)
@@ -1,5 +1,12 @@
-#Wed Feb 04 11:13:20 CET 2009
+#Wed Feb 17 12:16:57 CET 2010
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/enterprise/jmx/JMXEnterpriseTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/enterprise/jmx/JMXEnterpriseTestCase.java 2010-02-17 13:55:15 UTC (rev 101072)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/enterprise/jmx/JMXEnterpriseTestCase.java 2010-02-17 13:56:24 UTC (rev 101073)
@@ -59,10 +59,6 @@
OSGiTestHelper helper = new OSGiTestHelper();
runtime = helper.getDefaultRuntime();
runtime.addCapability(new JMXCapability());
-
- // Optionally install/start the Apache Aries JMX bundle
- if (runtime.getBundle("org.apache.aries.jmx", null) == null)
- runtime.installBundle("bundles/org.apache.aries.jmx.jar").start();
}
@AfterClass
Modified: projects/jboss-osgi/trunk/testsuite/functional/.classpath
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/.classpath 2010-02-17 13:55:15 UTC (rev 101072)
+++ projects/jboss-osgi/trunk/testsuite/functional/.classpath 2010-02-17 13:56:24 UTC (rev 101073)
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: projects/jboss-osgi/trunk/testsuite/functional/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:55:15 UTC (rev 101072)
+++ projects/jboss-osgi/trunk/testsuite/functional/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:56:24 UTC (rev 101073)
@@ -1,5 +1,12 @@
-#Wed Feb 04 11:13:20 CET 2009
+#Wed Feb 17 12:17:20 CET 2010
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Modified: projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml 2010-02-17 13:55:15 UTC (rev 101072)
+++ projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml 2010-02-17 13:56:24 UTC (rev 101073)
@@ -27,6 +27,8 @@
<include>*:jboss-osgi-webapp:jar</include>
<include>*:jboss-osgi-xml-binding:jar</include>
<include>*:org.apache.aries.blueprint:jar</include>
+ <include>*:org.apache.aries.jmx:jar</include>
+ <include>*:org.apache.aries.jndi:jar</include>
<include>*:org.apache.aries.util:jar</include>
<include>*:org.apache.felix.configadmin:jar</include>
<include>*:org.apache.felix.eventadmin:jar</include>
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGi36TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGi36TestCase.java 2010-02-17 13:55:15 UTC (rev 101072)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGi36TestCase.java 2010-02-17 13:56:24 UTC (rev 101073)
@@ -28,7 +28,6 @@
import org.jboss.osgi.jmx.JMXCapability;
import org.jboss.osgi.spi.management.MBeanProxy;
-import org.jboss.osgi.spi.management.MBeanProxyException;
import org.jboss.osgi.testing.OSGiTest;
import org.jboss.osgi.testing.OSGiTestHelper;
import org.jboss.osgi.testing.internal.RemoteRuntime;
@@ -104,7 +103,7 @@
}
}
- private FooMBean getFooMBean() throws MBeanProxyException
+ private FooMBean getFooMBean()
{
FooMBean foo = (FooMBean)MBeanProxy.get(runtime.getMBeanServer(), FooMBean.OBJECT_NAME, FooMBean.class);
return foo;
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/OSGi58TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/OSGi58TestCase.java 2010-02-17 13:55:15 UTC (rev 101072)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/OSGi58TestCase.java 2010-02-17 13:56:24 UTC (rev 101073)
@@ -56,7 +56,7 @@
try
{
StatelessBean bean = getRemoteBean(StatelessBean.class);
- String symbolicName = bean.getFraemworkSymbolicName();
+ String symbolicName = bean.getFrameworkSymbolicName();
assertEquals("foo", symbolicName);
}
finally
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/ejb/StatelessBean.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/ejb/StatelessBean.java 2010-02-17 13:55:15 UTC (rev 101072)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/ejb/StatelessBean.java 2010-02-17 13:56:24 UTC (rev 101073)
@@ -26,5 +26,5 @@
public interface StatelessBean
{
- String getFraemworkSymbolicName();
+ String getFrameworkSymbolicName();
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/ejb/StatelessBeanImpl.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/ejb/StatelessBeanImpl.java 2010-02-17 13:55:15 UTC (rev 101072)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/ejb/StatelessBeanImpl.java 2010-02-17 13:56:24 UTC (rev 101073)
@@ -23,24 +23,30 @@
//$Id$
+import java.io.IOException;
+
import javax.ejb.Remote;
import javax.ejb.Stateless;
-import javax.management.ObjectName;
import org.jboss.ejb3.annotation.Depends;
-import org.jboss.osgi.spi.management.ManagedBundle;
-import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
+import org.osgi.jmx.framework.BundleStateMBean;
@Remote
@Stateless(name="StatelessBean")
public class StatelessBeanImpl implements StatelessBean
{
- @Depends("jboss.osgi:service=ManagedFramework")
- ManagedFrameworkMBean framework;
+ @Depends(BundleStateMBean.OBJECTNAME)
+ BundleStateMBean framework;
- public String getFraemworkSymbolicName()
+ public String getFrameworkSymbolicName()
{
- ObjectName bundle = framework.getBundle(0);
- return bundle.getKeyProperty(ManagedBundle.PROPERTY_SYMBOLIC_NAME);
+ try
+ {
+ return framework.getSymbolicName(0);
+ }
+ catch (IOException ex)
+ {
+ throw new IllegalStateException(ex);
+ }
}
}
\ No newline at end of file
14 years, 4 months
JBoss-OSGI SVN: r101072 - in projects/jboss-osgi/projects: bundles/apache-xerces/trunk/.settings and 35 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-17 08:55:15 -0500 (Wed, 17 Feb 2010)
New Revision: 101072
Added:
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/MainDeployerClient.java
projects/jboss-osgi/projects/bundles/jmx/trunk/EEG-Feedback-JMX.txt
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ObjectNameFactory.java
Removed:
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/DeployerServiceClient.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxyException.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ObjectNameFactory.java
Modified:
projects/jboss-osgi/projects/bundles/apache-xerces/trunk/.classpath
projects/jboss-osgi/projects/bundles/apache-xerces/trunk/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/bundles/apache-xerces/trunk/src/main/java/org/jboss/osgi/xml/internal/XMLParserActivator.java
projects/jboss-osgi/projects/bundles/blueprint/trunk/.classpath
projects/jboss-osgi/projects/bundles/blueprint/trunk/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/bundles/blueprint/trunk/src/main/java/org/jboss/osgi/blueprint/internal/BlueprintEventDispatcher.java
projects/jboss-osgi/projects/bundles/common/trunk/.classpath
projects/jboss-osgi/projects/bundles/common/trunk/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/log/LoggingCapability.java
projects/jboss-osgi/projects/bundles/husky/trunk/.classpath
projects/jboss-osgi/projects/bundles/husky/trunk/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/bundles/husky/trunk/pom.xml
projects/jboss-osgi/projects/bundles/husky/trunk/scripts/assembly-bundles.xml
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/HuskyCapability.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/internal/AbstractInvoker.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnector.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiRuntime.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiBundleImpl.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteFramework.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/test/resources/jboss-osgi-framework.properties
projects/jboss-osgi/projects/bundles/jmx/trunk/.classpath
projects/jboss-osgi/projects/bundles/jmx/trunk/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/JMXCapability.java
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/RMIAdaptor.java
projects/jboss-osgi/projects/bundles/jndi/trunk/.classpath
projects/jboss-osgi/projects/bundles/jndi/trunk/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/bundles/jndi/trunk/pom.xml
projects/jboss-osgi/projects/runtime/deployment/trunk/.classpath
projects/jboss-osgi/projects/runtime/deployment/trunk/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/runtime/deployment/trunk/src/test/java/org/jboss/test/osgi/deployment/simple/DeploymentSerializationTestCase.java
projects/jboss-osgi/projects/runtime/felix/trunk/.classpath
projects/jboss-osgi/projects/runtime/felix/trunk/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/spi/trunk/.classpath
projects/jboss-osgi/projects/spi/trunk/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/Capability.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/ConfigAdminCapability.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/HttpServiceCapability.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/LogServiceCapability.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/internal/OSGiBootstrapBean.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundleMBean.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFramework.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFrameworkMBean.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/MicrocontainerService.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java
Log:
[JBOSGI-126] Replace the SPI JMX functionality by RFC-139 API
Modified: projects/jboss-osgi/projects/bundles/apache-xerces/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/bundles/apache-xerces/trunk/.classpath 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/apache-xerces/trunk/.classpath 2010-02-17 13:55:15 UTC (rev 101072)
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: projects/jboss-osgi/projects/bundles/apache-xerces/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/bundles/apache-xerces/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/apache-xerces/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,5 +1,12 @@
-#Mon May 25 10:37:04 CEST 2009
+#Wed Feb 17 12:13:47 CET 2010
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Modified: projects/jboss-osgi/projects/bundles/apache-xerces/trunk/src/main/java/org/jboss/osgi/xml/internal/XMLParserActivator.java
===================================================================
--- projects/jboss-osgi/projects/bundles/apache-xerces/trunk/src/main/java/org/jboss/osgi/xml/internal/XMLParserActivator.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/apache-xerces/trunk/src/main/java/org/jboss/osgi/xml/internal/XMLParserActivator.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -85,47 +85,47 @@
* be added by extending this class and overriding the
* <code>setSAXProperties</code> and <code>setDOMProperties</code> methods.
*/
-public class XMLParserActivator implements BundleActivator, ServiceFactory {
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public class XMLParserActivator implements BundleActivator, ServiceFactory
+{
/** Context of this bundle */
- private BundleContext context;
+ private BundleContext context;
/**
* Filename containing the SAX Parser Factory Class name. Also used as the
* basis for the <code>SERVICE_PID<code> registration property.
*/
- public static final String SAXFACTORYNAME = "javax.xml.parsers.SAXParserFactory";
+ public static final String SAXFACTORYNAME = "javax.xml.parsers.SAXParserFactory";
/**
* Filename containing the DOM Parser Factory Class name. Also used as the
* basis for the <code>SERVICE_PID</code> registration property.
*/
- public static final String DOMFACTORYNAME = "javax.xml.parsers.DocumentBuilderFactory";
+ public static final String DOMFACTORYNAME = "javax.xml.parsers.DocumentBuilderFactory";
/** Path to the factory class name files */
- private static final String PARSERCLASSFILEPATH = "/META-INF/services/";
+ private static final String PARSERCLASSFILEPATH = "/META-INF/services/";
/** Fully qualified path name of SAX Parser Factory Class Name file */
- public static final String SAXCLASSFILE = PARSERCLASSFILEPATH
- + SAXFACTORYNAME;
+ public static final String SAXCLASSFILE = PARSERCLASSFILEPATH + SAXFACTORYNAME;
/** Fully qualified path name of DOM Parser Factory Class Name file */
- public static final String DOMCLASSFILE = PARSERCLASSFILEPATH
- + DOMFACTORYNAME;
+ public static final String DOMCLASSFILE = PARSERCLASSFILEPATH + DOMFACTORYNAME;
/** SAX Factory Service Description */
- private static final String SAXFACTORYDESCRIPTION = "A JAXP Compliant SAX Parser";
+ private static final String SAXFACTORYDESCRIPTION = "A JAXP Compliant SAX Parser";
/** DOM Factory Service Description */
- private static final String DOMFACTORYDESCRIPTION = "A JAXP Compliant DOM Parser";
+ private static final String DOMFACTORYDESCRIPTION = "A JAXP Compliant DOM Parser";
/**
* Service property specifying if factory is configured to support
* validating parsers. The value is of type <code>Boolean</code>.
*/
- public static final String PARSER_VALIDATING = "parser.validating";
+ public static final String PARSER_VALIDATING = "parser.validating";
/**
* Service property specifying if factory is configured to support namespace
* aware parsers. The value is of type <code>Boolean</code>.
*/
- public static final String PARSER_NAMESPACEAWARE = "parser.namespaceAware";
+ public static final String PARSER_NAMESPACEAWARE = "parser.namespaceAware";
/**
* Key for parser factory name property - this must be saved in the parsers
* properties hashtable so that the parser factory can be instantiated from
* a ServiceReference
*/
- private static final String FACTORYNAMEKEY = "parser.factoryname";
+ private static final String FACTORYNAMEKEY = "parser.factoryname";
/**
* Called when this bundle is started so the Framework can perform the
@@ -146,18 +146,19 @@
* bundle's listeners, unregister all services registered by this
* bundle, and release all services used by this bundle.
*/
- public void start(BundleContext context) throws Exception {
+ public void start(BundleContext context) throws Exception
+ {
this.context = context;
Bundle parserBundle = context.getBundle();
- try {
+ try
+ {
// check for sax parsers
- registerSAXParsers(getParserFactoryClassNames(parserBundle
- .getResource(SAXCLASSFILE)));
+ registerSAXParsers(getParserFactoryClassNames(parserBundle.getResource(SAXCLASSFILE)));
// check for dom parsers
- registerDOMParsers(getParserFactoryClassNames(parserBundle
- .getResource(DOMCLASSFILE)));
+ registerDOMParsers(getParserFactoryClassNames(parserBundle.getResource(DOMCLASSFILE)));
}
- catch (IOException ioe) {
+ catch (IOException ioe)
+ {
// if there were any IO errors accessing the resource files
// containing the class names
ioe.printStackTrace();
@@ -175,7 +176,8 @@
* the bundle's listeners, unregister all services registered by the
* bundle, and release all services used by the bundle.
*/
- public void stop(BundleContext context) throws Exception {
+ public void stop(BundleContext context) throws Exception
+ {
}
/**
@@ -189,36 +191,44 @@
* parserUrl is null
* @throws IOException if there is a problem reading the URL input stream
*/
- private Vector getParserFactoryClassNames(URL parserUrl) throws IOException {
+ private Vector getParserFactoryClassNames(URL parserUrl) throws IOException
+ {
Vector v = new Vector(1);
- if (parserUrl != null) {
+ if (parserUrl != null)
+ {
String parserFactoryClassName = null;
InputStream is = parserUrl.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
- while (true) {
+ while (true)
+ {
parserFactoryClassName = br.readLine();
- if (parserFactoryClassName == null) {
+ if (parserFactoryClassName == null)
+ {
break; // end of file reached
}
String pfcName = parserFactoryClassName.trim();
- if (pfcName.length() == 0) {
+ if (pfcName.length() == 0)
+ {
continue; // blank line
}
int commentIdx = pfcName.indexOf("#");
- if (commentIdx == 0) { // comment line
+ if (commentIdx == 0)
+ { // comment line
continue;
}
+ else if (commentIdx < 0)
+ { // no comment on this line
+ v.addElement(pfcName);
+ }
else
- if (commentIdx < 0) { // no comment on this line
- v.addElement(pfcName);
- }
- else {
- v.addElement(pfcName.substring(0, commentIdx).trim());
- }
+ {
+ v.addElement(pfcName.substring(0, commentIdx).trim());
+ }
}
return v;
}
- else {
+ else
+ {
return null;
}
}
@@ -231,18 +241,20 @@
* Factory Classes
* @throws FactoryConfigurationError if thrown from <code>getFactory</code>
*/
- private void registerSAXParsers(Vector parserFactoryClassNames)
- throws FactoryConfigurationError {
- if (parserFactoryClassNames != null) {
+ private void registerSAXParsers(Vector parserFactoryClassNames) throws FactoryConfigurationError
+ {
+ if (parserFactoryClassNames != null)
+ {
Enumeration e = parserFactoryClassNames.elements();
int index = 0;
- while (e.hasMoreElements()) {
- String parserFactoryClassName = (String) e.nextElement();
+ while (e.hasMoreElements())
+ {
+ String parserFactoryClassName = (String)e.nextElement();
// create a sax parser factory just to get it's default
// properties. It will never be used since
// this class will operate as a service factory and give each
// service requestor it's own SaxParserFactory
- SAXParserFactory factory = (SAXParserFactory) getFactory(parserFactoryClassName);
+ SAXParserFactory factory = (SAXParserFactory)getFactory(parserFactoryClassName);
Hashtable properties = new Hashtable(7);
// figure out the default properties of the parser
setDefaultSAXProperties(factory, properties, index);
@@ -275,11 +287,10 @@
* @param factory The <code>SAXParserFactory</code> object
* @param props <code>Hashtable</code> of service properties.
*/
- private void setDefaultSAXProperties(SAXParserFactory factory,
- Hashtable props, int index) {
+ private void setDefaultSAXProperties(SAXParserFactory factory, Hashtable props, int index)
+ {
props.put(Constants.SERVICE_DESCRIPTION, SAXFACTORYDESCRIPTION);
- props.put(Constants.SERVICE_PID, SAXFACTORYNAME + "."
- + context.getBundle().getBundleId() + "." + index);
+ props.put(Constants.SERVICE_PID, SAXFACTORYNAME + "." + context.getBundle().getBundleId() + "." + index);
setSAXProperties(factory, props);
}
@@ -304,25 +315,30 @@
* @param factory - the SAXParserFactory object
* @param properties - the properties object for the service
*/
- public void setSAXProperties(SAXParserFactory factory, Hashtable properties) {
+ public void setSAXProperties(SAXParserFactory factory, Hashtable properties)
+ {
// check if this parser can be configured to validate
boolean validating = true;
factory.setValidating(true);
factory.setNamespaceAware(false);
- try {
+ try
+ {
factory.newSAXParser();
}
- catch (Exception pce_val) {
+ catch (Exception pce_val)
+ {
validating = false;
}
// check if this parser can be configured to be namespaceaware
boolean namespaceaware = true;
factory.setValidating(false);
factory.setNamespaceAware(true);
- try {
+ try
+ {
factory.newSAXParser();
}
- catch (Exception pce_nsa) {
+ catch (Exception pce_nsa)
+ {
namespaceaware = false;
}
// set the factory values
@@ -341,18 +357,20 @@
* Factory Classes
* @throws FactoryConfigurationError if thrown from <code>getFactory</code>
*/
- private void registerDOMParsers(Vector parserFactoryClassNames)
- throws FactoryConfigurationError {
- if (parserFactoryClassNames != null) {
+ private void registerDOMParsers(Vector parserFactoryClassNames) throws FactoryConfigurationError
+ {
+ if (parserFactoryClassNames != null)
+ {
Enumeration e = parserFactoryClassNames.elements();
int index = 0;
- while (e.hasMoreElements()) {
- String parserFactoryClassName = (String) e.nextElement();
+ while (e.hasMoreElements())
+ {
+ String parserFactoryClassName = (String)e.nextElement();
// create a dom parser factory just to get it's default
// properties. It will never be used since
// this class will operate as a service factory and give each
// service requestor it's own DocumentBuilderFactory
- DocumentBuilderFactory factory = (DocumentBuilderFactory) getFactory(parserFactoryClassName);
+ DocumentBuilderFactory factory = (DocumentBuilderFactory)getFactory(parserFactoryClassName);
Hashtable properties = new Hashtable(7);
// figure out the default properties of the parser
setDefaultDOMProperties(factory, properties, index);
@@ -383,11 +401,10 @@
* @param factory The <code>DocumentBuilderFactory</code> object
* @param props <code>Hashtable</code> of service properties.
*/
- private void setDefaultDOMProperties(DocumentBuilderFactory factory,
- Hashtable props, int index) {
+ private void setDefaultDOMProperties(DocumentBuilderFactory factory, Hashtable props, int index)
+ {
props.put(Constants.SERVICE_DESCRIPTION, DOMFACTORYDESCRIPTION);
- props.put(Constants.SERVICE_PID, DOMFACTORYNAME + "."
- + context.getBundle().getBundleId() + "." + index);
+ props.put(Constants.SERVICE_PID, DOMFACTORYNAME + "." + context.getBundle().getBundleId() + "." + index);
setDOMProperties(factory, props);
}
@@ -412,25 +429,30 @@
* @param factory - the DocumentBuilderFactory object
* @param props - Hashtable of service properties.
*/
- public void setDOMProperties(DocumentBuilderFactory factory, Hashtable props) {
+ public void setDOMProperties(DocumentBuilderFactory factory, Hashtable props)
+ {
// check if this parser can be configured to validate
boolean validating = true;
factory.setValidating(true);
factory.setNamespaceAware(false);
- try {
+ try
+ {
factory.newDocumentBuilder();
}
- catch (Exception pce_val) {
+ catch (Exception pce_val)
+ {
validating = false;
}
// check if this parser can be configured to be namespaceaware
boolean namespaceaware = true;
factory.setValidating(false);
factory.setNamespaceAware(true);
- try {
+ try
+ {
factory.newDocumentBuilder();
}
- catch (Exception pce_nsa) {
+ catch (Exception pce_nsa)
+ {
namespaceaware = false;
}
// set the factory values
@@ -449,19 +471,23 @@
* @return a parserFactoryClass Object
* @pre parserFactoryClassName!=null
*/
- private Object getFactory(String parserFactoryClassName)
- throws FactoryConfigurationError {
+ private Object getFactory(String parserFactoryClassName) throws FactoryConfigurationError
+ {
Exception e = null;
- try {
+ try
+ {
return Class.forName(parserFactoryClassName).newInstance();
}
- catch (ClassNotFoundException cnfe) {
+ catch (ClassNotFoundException cnfe)
+ {
e = cnfe;
}
- catch (InstantiationException ie) {
+ catch (InstantiationException ie)
+ {
e = ie;
}
- catch (IllegalAccessException iae) {
+ catch (IllegalAccessException iae)
+ {
e = iae;
}
throw new FactoryConfigurationError(e);
@@ -488,33 +514,28 @@
* @return A new, configured XML Parser Factory object or null if a
* configuration error was encountered
*/
- public Object getService(Bundle bundle, ServiceRegistration registration) {
+ public Object getService(Bundle bundle, ServiceRegistration registration)
+ {
ServiceReference sref = registration.getReference();
- String parserFactoryClassName = (String) sref
- .getProperty(FACTORYNAMEKEY);
- try {
+ String parserFactoryClassName = (String)sref.getProperty(FACTORYNAMEKEY);
+ try
+ {
// need to set factory properties
Object factory = getFactory(parserFactoryClassName);
- if (factory instanceof SAXParserFactory) {
- ((SAXParserFactory) factory).setValidating(((Boolean) sref
- .getProperty(PARSER_VALIDATING)).booleanValue());
- ((SAXParserFactory) factory).setNamespaceAware(((Boolean) sref
- .getProperty(PARSER_NAMESPACEAWARE)).booleanValue());
+ if (factory instanceof SAXParserFactory)
+ {
+ ((SAXParserFactory)factory).setValidating(((Boolean)sref.getProperty(PARSER_VALIDATING)).booleanValue());
+ ((SAXParserFactory)factory).setNamespaceAware(((Boolean)sref.getProperty(PARSER_NAMESPACEAWARE)).booleanValue());
}
- else
- if (factory instanceof DocumentBuilderFactory) {
- ((DocumentBuilderFactory) factory)
- .setValidating(((Boolean) sref
- .getProperty(PARSER_VALIDATING))
- .booleanValue());
- ((DocumentBuilderFactory) factory)
- .setNamespaceAware(((Boolean) sref
- .getProperty(PARSER_NAMESPACEAWARE))
- .booleanValue());
- }
+ else if (factory instanceof DocumentBuilderFactory)
+ {
+ ((DocumentBuilderFactory)factory).setValidating(((Boolean)sref.getProperty(PARSER_VALIDATING)).booleanValue());
+ ((DocumentBuilderFactory)factory).setNamespaceAware(((Boolean)sref.getProperty(PARSER_NAMESPACEAWARE)).booleanValue());
+ }
return factory;
}
- catch (FactoryConfigurationError fce) {
+ catch (FactoryConfigurationError fce)
+ {
fce.printStackTrace();
return null;
}
@@ -529,7 +550,7 @@
* @param service The XML Parser Factory object returned by a previous call
* to the <code>getService</code> method.
*/
- public void ungetService(Bundle bundle, ServiceRegistration registration,
- Object service) {
+ public void ungetService(Bundle bundle, ServiceRegistration registration, Object service)
+ {
}
}
Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/.classpath 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/.classpath 2010-02-17 13:55:15 UTC (rev 101072)
@@ -4,7 +4,7 @@
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,6 +1,13 @@
-#Thu Feb 04 08:05:44 CET 2010
+#Wed Feb 17 12:14:28 CET 2010
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/src/main/java/org/jboss/osgi/blueprint/internal/BlueprintEventDispatcher.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/src/main/java/org/jboss/osgi/blueprint/internal/BlueprintEventDispatcher.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/src/main/java/org/jboss/osgi/blueprint/internal/BlueprintEventDispatcher.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -151,7 +151,6 @@
}
}
- @SuppressWarnings({"ThrowableResultOfMethodCallIgnored"})
private static String toString(BlueprintEvent event) {
return "BlueprintEvent[type=" + getEventType(event.getType())
+ (event.getDependencies() != null ? ", dependencies=" + Arrays.asList(event.getDependencies()) : "")
@@ -241,7 +240,6 @@
tracker.open();
}
- @SuppressWarnings({"ThrowableResultOfMethodCallIgnored"})
public void blueprintEvent(BlueprintEvent event) {
EventAdmin eventAdmin = (EventAdmin) tracker.getService();
if (eventAdmin == null) {
Modified: projects/jboss-osgi/projects/bundles/common/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/bundles/common/trunk/.classpath 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/common/trunk/.classpath 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: projects/jboss-osgi/projects/bundles/common/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/bundles/common/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/common/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,5 +1,12 @@
-#Tue Apr 14 17:48:49 CEST 2009
+#Wed Feb 17 12:14:50 CET 2010
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Modified: projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/log/LoggingCapability.java
===================================================================
--- projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/log/LoggingCapability.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/log/LoggingCapability.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -29,6 +29,7 @@
*
* It is ignored if the {@link LoggingService} is already registered.
*
+ * Dependent Capability: {@link CompendiumCapability}
* Installed bundles: jboss-osgi-common.jar
*
* @author thomas.diesler(a)jboss.com
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/.classpath 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/.classpath 2010-02-17 13:55:15 UTC (rev 101072)
@@ -3,7 +3,7 @@
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,6 +1,13 @@
-#Mon Nov 30 15:53:56 CET 2009
+#Wed Feb 17 12:15:46 CET 2010
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/pom.xml 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/pom.xml 2010-02-17 13:55:15 UTC (rev 101072)
@@ -40,6 +40,9 @@
<!-- Properties -->
<properties>
+ <version.apache.aries.jmx>1.0.0-incubating-SNAPSHOT</version.apache.aries.jmx>
+ <version.apache.felix.log>1.0.0</version.apache.felix.log>
+ <version.jboss.osgi.jmx>1.0.4-SNAPSHOT</version.jboss.osgi.jmx>
<version.jboss.osgi.runtime.felix>2.0.2.SP1-SNAPSHOT</version.jboss.osgi.runtime.felix>
<version.jboss.osgi.deployment>1.0.2-SNAPSHOT</version.jboss.osgi.deployment>
<version.osgi>4.2.0</version.osgi>
@@ -52,17 +55,51 @@
<artifactId>bnd</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>org.apache.aries.jmx.api</artifactId>
+ <version>${version.apache.aries.jmx}</version>
+ </dependency>
+ <dependency>
<groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-deployment</artifactId>
<version>${version.jboss.osgi.deployment}</version>
</dependency>
<dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <version>${version.jboss.osgi.jmx}</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<!-- Provided Dependencies -->
<dependency>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>org.apache.aries.jmx</artifactId>
+ <version>${version.apache.aries.jmx}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <version>${version.apache.felix.log}</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- OSGi Dependencies -->
+ <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>${version.osgi}</version>
@@ -98,20 +135,21 @@
org.jboss.osgi.testing;version=${version},
</Export-Package>
<Import-Package>
- javax.management,
+ javax.management*,
javax.naming,
- org.jboss.logging;version="[2.1,2.2)",
- org.jboss.osgi.deployment.interceptor;version="[1.0,1.1)",
- org.jboss.osgi.spi;version="[1.0,1.1)",
- org.jboss.osgi.spi.capability;version="[1.0,1.1)",
- org.jboss.osgi.spi.management;version="[1.0,1.1)",
- org.jboss.osgi.spi.util;version="[1.0,1.1)",
- org.jboss.virtual;version="[2.1,2.2)",
+ org.jboss.logging;version="[2.1,3.0)",
+ org.jboss.virtual;version="[2.1,3.0)",
org.junit;version="[4.6,5.0)",
- org.osgi.framework,
- org.osgi.util.tracker,
+ org.jboss.osgi.deployment*;version="[1.0,2.0)",
+ org.jboss.osgi.jmx*;version="[1.0,2.0)",
+ org.jboss.osgi.spi*;version="[1.0,2.0)",
+
+ org.osgi.framework;version="[1.5,2.0)",
+ org.osgi.jmx.framework;version="[1.0,2.0)",
+ org.osgi.util.tracker;version="[1.4,2.0)",
+
<!-- ignore client side -->
!org.jboss.osgi.deployment.deployer,
!org.jboss.osgi.spi.framework,
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/scripts/assembly-bundles.xml 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/scripts/assembly-bundles.xml 2010-02-17 13:55:15 UTC (rev 101072)
@@ -15,6 +15,21 @@
<outputDirectory>bundles</outputDirectory>
<outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
<includes>
+ <include>*:jboss-osgi-common-core:jar</include>
+ <include>*:jboss-osgi-common:jar</include>
+ <include>*:jboss-osgi-jmx:jar</include>
+ <include>*:jboss-osgi-jndi:jar</include>
+ </includes>
+ <useStrictFiltering>true</useStrictFiltering>
+ <scope>compile</scope>
+ <unpack>false</unpack>
+ </dependencySet>
+ <dependencySet>
+ <outputDirectory>bundles</outputDirectory>
+ <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+ <includes>
+ <include>*:org.apache.aries.jmx:jar</include>
+ <include>*:org.apache.felix.log:jar</include>
<include>*:org.osgi.compendium:jar</include>
</includes>
<useStrictFiltering>true</useStrictFiltering>
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/HuskyCapability.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/HuskyCapability.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/HuskyCapability.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -24,6 +24,7 @@
//$Id$
import org.jboss.osgi.husky.runtime.Connector;
+import org.jboss.osgi.jmx.JMXCapability;
import org.jboss.osgi.spi.capability.Capability;
import org.jboss.osgi.testing.OSGiRuntime;
@@ -33,6 +34,7 @@
*
* It is ignored if a Husky connector is already registered.
*
+ * Dependent Capability: {@link JMXCapability}
* Installed bundles: jboss-osgi-husky.jar
*
* @author thomas.diesler(a)jboss.com
@@ -44,6 +46,8 @@
{
super(Connector.class.getName());
+ addDependency(new JMXCapability());
+
addBundle("bundles/jboss-osgi-husky.jar");
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/internal/AbstractInvoker.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/internal/AbstractInvoker.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/internal/AbstractInvoker.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -82,7 +82,6 @@
}
}
- @SuppressWarnings("unchecked")
private MBeanServerConnection getMBeanServer()
{
ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnector.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnector.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnector.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -100,7 +100,6 @@
return super.process(reqStream);
}
- @SuppressWarnings("unchecked")
private MBeanServer getMBeanServer()
{
MBeanServer mbeanServer = null;
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiRuntime.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiRuntime.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiRuntime.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -28,6 +28,10 @@
import org.jboss.osgi.spi.capability.Capability;
import org.osgi.framework.BundleException;
import org.osgi.framework.Version;
+import org.osgi.jmx.framework.BundleStateMBean;
+import org.osgi.jmx.framework.FrameworkMBean;
+import org.osgi.jmx.framework.PackageStateMBean;
+import org.osgi.jmx.framework.ServiceStateMBean;
import org.osgi.service.packageadmin.PackageAdmin;
/**
@@ -59,6 +63,26 @@
OSGiBundle installBundle(String location) throws BundleException;
/**
+ * Get the FrameworkMBean
+ */
+ FrameworkMBean getFrameworkMBean();
+
+ /**
+ * Get the BundleStateMBean
+ */
+ BundleStateMBean getBundleStateMBean();
+
+ /**
+ * Get the PackageStateMBean
+ */
+ PackageStateMBean getPackageStateMBean();
+
+ /**
+ * Get the ServiceStateMBean
+ */
+ ServiceStateMBean getServiceStateMBean();
+
+ /**
* Get the array of installed {@link OSGiBundle}s
*/
OSGiBundle[] getBundles();
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -123,7 +123,7 @@
try
{
File resourceFile = getResourceFile(resource);
- resURL = resourceFile.toURL();
+ resURL = resourceFile.toURI().toURL();
}
catch (MalformedURLException e)
{
@@ -151,7 +151,7 @@
{
try
{
- return getTestArchiveFile(archive).toURL();
+ return getTestArchiveFile(archive).toURI().toURL();
}
catch (MalformedURLException ex)
{
Deleted: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/DeployerServiceClient.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/DeployerServiceClient.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/DeployerServiceClient.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,99 +0,0 @@
-/*
- * 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.testing.internal;
-
-// $Id$
-
-import java.net.URL;
-import java.util.Arrays;
-
-import javax.management.MBeanException;
-import javax.management.ObjectName;
-
-import org.jboss.osgi.deployment.deployer.AbstractDeployerService;
-import org.jboss.osgi.deployment.deployer.Deployment;
-import org.jboss.osgi.testing.OSGiRuntime;
-import org.osgi.framework.BundleException;
-
-/**
- * An abstract implementation of the {@link OSGiRuntime}
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Sep-2008
- */
-class DeployerServiceClient extends AbstractDeployerService
-{
- private final OSGiRuntime runtime;
- private ObjectName oname;
-
- DeployerServiceClient(OSGiRuntime runtime, ObjectName oname)
- {
- this.runtime = runtime;
- this.oname = oname;
- }
-
- public void deploy(Deployment[] deps) throws BundleException
- {
- invokeDeployerMBean(oname, "deploy", deps, Deployment[].class.getName());
- }
-
- public void deploy(URL url) throws BundleException
- {
- invokeDeployerMBean(oname, "deploy", url, URL.class.getName());
- }
-
- public void undeploy(Deployment[] deps) throws BundleException
- {
- invokeDeployerMBean(oname, "undeploy", deps, Deployment[].class.getName());
- }
-
- public void undeploy(URL url) throws BundleException
- {
- invokeDeployerMBean(oname, "undeploy", url, URL.class.getName());
- }
-
- private void invokeDeployerMBean(ObjectName oname, String method, Object arg, String type) throws BundleException
- {
- try
- {
- this.runtime.getMBeanServer().invoke(oname, method, new Object[] { arg }, new String[] { type });
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- if (ex instanceof MBeanException)
- {
- ex = ((MBeanException)ex).getTargetException();
- if (ex instanceof BundleException)
- throw (BundleException)ex;
- }
-
- if (arg instanceof Deployment[])
- arg = Arrays.asList((Deployment[])arg);
-
- throw new BundleException("Cannot " + method + ": " + arg, ex);
- }
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -25,8 +25,6 @@
import java.net.URL;
import java.util.Dictionary;
-import org.jboss.logging.Logger;
-import org.jboss.osgi.deployment.deployer.DeployerService;
import org.jboss.osgi.spi.util.ExportedPackageHelper;
import org.jboss.osgi.testing.OSGiBundle;
import org.osgi.framework.Bundle;
@@ -44,9 +42,6 @@
*/
public class EmbeddedBundle extends OSGiBundleImpl
{
- // Provide logging
- private static final Logger log = Logger.getLogger(EmbeddedBundle.class);
-
private Bundle bundle;
public EmbeddedBundle(OSGiRuntimeImpl runtime, Bundle bundle)
@@ -158,31 +153,11 @@
public void uninstall() throws BundleException
{
assertNotUninstalled();
- try
- {
- BundleContext context = ((EmbeddedRuntime)getRuntime()).getSystemContext();
- ServiceReference sref = context.getServiceReference(DeployerService.class.getName());
- if (sref != null)
- {
- DeployerService service = (DeployerService)context.getService(sref);
- service.undeploy(new URL(getLocation()));
- }
- else
- {
- bundle.uninstall();
- }
-
- OSGiRuntimeImpl runtimeImpl = (OSGiRuntimeImpl)getRuntime();
- runtimeImpl.unregisterBundle(this);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- log.error("Cannot uninstall: " + getLocation(), ex);
- }
+
+ bundle.uninstall();
+
+ OSGiRuntimeImpl runtimeImpl = (OSGiRuntimeImpl)getRuntime();
+ runtimeImpl.unregisterBundle(this);
}
private PackageAdmin getPackageAdmin()
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -33,9 +33,6 @@
import javax.management.MBeanServerFactory;
import org.jboss.logging.Logger;
-import org.jboss.osgi.deployment.deployer.DeployerService;
-import org.jboss.osgi.deployment.deployer.Deployment;
-import org.jboss.osgi.deployment.deployer.DeploymentFactory;
import org.jboss.osgi.spi.capability.Capability;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.spi.util.BundleInfo;
@@ -49,7 +46,6 @@
import org.osgi.framework.BundleException;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Version;
import org.osgi.framework.launch.Framework;
import org.osgi.service.packageadmin.PackageAdmin;
@@ -72,27 +68,11 @@
public OSGiBundle installBundle(String location) throws BundleException
{
BundleInfo info = BundleInfo.createBundleInfo(location);
- Deployment dep = DeploymentFactory.createDeployment(info);
- String symbolicName = info.getSymbolicName();
- Version version = info.getVersion();
- OSGiBundle bundle;
-
BundleContext context = getSystemContext();
- ServiceReference sref = context.getServiceReference(DeployerService.class.getName());
- if (sref != null)
- {
- DeployerService service = (DeployerService)context.getService(sref);
- log.debug("Install using DeployerService: " + service.getClass().getName());
- service.deploy(new Deployment[] { dep });
- bundle = getBundle(symbolicName, version, true);
- }
- else
- {
- log.debug("Install using system context");
- Bundle auxBundle = context.installBundle(info.getLocation());
- bundle = new EmbeddedBundle(this, auxBundle);
- }
+ Bundle auxBundle = context.installBundle(info.getLocation());
+ OSGiBundle bundle = new EmbeddedBundle(this, auxBundle);
+
return registerBundle(bundle.getLocation(), bundle);
}
@@ -183,7 +163,6 @@
}
}
- @SuppressWarnings("unchecked")
public MBeanServerConnection getMBeanServer()
{
ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
Copied: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/MainDeployerClient.java (from rev 101012, projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/DeployerServiceClient.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/MainDeployerClient.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/MainDeployerClient.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -0,0 +1,83 @@
+/*
+ * 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.testing.internal;
+
+// $Id$
+
+import java.net.URL;
+
+import javax.management.MBeanException;
+import javax.management.ObjectName;
+
+import org.jboss.osgi.spi.management.ObjectNameFactory;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.osgi.framework.BundleException;
+
+/**
+ * An abstract implementation of the {@link OSGiRuntime}
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+class MainDeployerClient
+{
+ private final OSGiRuntime runtime;
+
+ MainDeployerClient(OSGiRuntime runtime)
+ {
+ this.runtime = runtime;
+ }
+
+ public void deploy(URL url) throws BundleException
+ {
+ invokeDeployerMBean("deploy", url);
+ }
+
+ public void undeploy(URL url) throws BundleException
+ {
+ invokeDeployerMBean("undeploy", url);
+ }
+
+ private void invokeDeployerMBean(String method, URL url) throws BundleException
+ {
+ try
+ {
+ ObjectName objectName = ObjectNameFactory.create("jboss.system:service=MainDeployer");
+ runtime.getMBeanServer().invoke(objectName, method, new Object[] { url }, new String[] { URL.class.getName() });
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ if (ex instanceof MBeanException)
+ {
+ ex = ((MBeanException)ex).getTargetException();
+ if (ex instanceof BundleException)
+ throw (BundleException)ex;
+ }
+
+ throw new BundleException("Cannot " + method + ": " + url, ex);
+ }
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiBundleImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiBundleImpl.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiBundleImpl.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -35,9 +35,9 @@
*/
public abstract class OSGiBundleImpl extends OSGiBundle
{
- private OSGiRuntimeImpl runtime;
+ private OSGiRuntime runtime;
- OSGiBundleImpl(OSGiRuntimeImpl runtime)
+ OSGiBundleImpl(OSGiRuntime runtime)
{
this.runtime = runtime;
}
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -36,12 +36,14 @@
import java.util.jar.JarFile;
import java.util.jar.Manifest;
+import javax.management.ObjectName;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.jboss.logging.Logger;
-import org.jboss.osgi.deployment.deployer.DeployerService;
import org.jboss.osgi.spi.capability.Capability;
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.ObjectNameFactory;
import org.jboss.osgi.spi.util.BundleInfo;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
@@ -50,6 +52,10 @@
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.Version;
+import org.osgi.jmx.framework.BundleStateMBean;
+import org.osgi.jmx.framework.FrameworkMBean;
+import org.osgi.jmx.framework.PackageStateMBean;
+import org.osgi.jmx.framework.ServiceStateMBean;
/**
* An abstract implementation of the {@link OSGiRuntime}
@@ -65,6 +71,11 @@
private OSGiTestHelper helper;
private Map<String, OSGiBundle> bundles = new LinkedHashMap<String, OSGiBundle>();
private List<Capability> capabilities = new ArrayList<Capability>();
+
+ private ServiceStateMBean serviceState;
+ private PackageStateMBean packageState;
+ private BundleStateMBean bundleState;
+ private FrameworkMBean framework;
public OSGiRuntimeImpl(OSGiTestHelper helper)
{
@@ -170,16 +181,56 @@
log.debug("End Shutdown");
}
+ public FrameworkMBean getFrameworkMBean()
+ {
+ if (framework == null)
+ {
+ ObjectName objectName = ObjectNameFactory.create(FrameworkMBean.OBJECTNAME);
+ framework = MBeanProxy.get(getMBeanServer(), objectName, FrameworkMBean.class);
+ }
+ return framework;
+ }
+
+ public BundleStateMBean getBundleStateMBean()
+ {
+ if (bundleState == null)
+ {
+ ObjectName objectName = ObjectNameFactory.create(BundleStateMBean.OBJECTNAME);
+ bundleState = MBeanProxy.get(getMBeanServer(), objectName, BundleStateMBean.class);
+ }
+ return bundleState;
+ }
+
+ public PackageStateMBean getPackageStateMBean()
+ {
+ if (packageState == null)
+ {
+ ObjectName objectName = ObjectNameFactory.create(PackageStateMBean.OBJECTNAME);
+ packageState = MBeanProxy.get(getMBeanServer(), objectName, PackageStateMBean.class);
+ }
+ return packageState;
+ }
+
+ public ServiceStateMBean getServiceStateMBean()
+ {
+ if (serviceState == null)
+ {
+ ObjectName objectName = ObjectNameFactory.create(ServiceStateMBean.OBJECTNAME);
+ serviceState = MBeanProxy.get(getMBeanServer(), objectName, ServiceStateMBean.class);
+ }
+ return serviceState;
+ }
+
void deploy(URL archiveURL) throws Exception
{
- DeployerServiceClient deployer = new DeployerServiceClient(this, DeployerService.MBEAN_DEPLOYER_SERVICE);
- deployer.deploy(archiveURL);
+ //DeployerServiceClient deployer = new DeployerServiceClient(this, DeployerService.MBEAN_DEPLOYER_SERVICE);
+ //deployer.deploy(archiveURL);
}
void undeploy(URL archiveURL) throws Exception
{
- DeployerServiceClient deployer = new DeployerServiceClient(this, DeployerService.MBEAN_DEPLOYER_SERVICE);
- deployer.undeploy(archiveURL);
+ //DeployerServiceClient deployer = new DeployerServiceClient(this, DeployerService.MBEAN_DEPLOYER_SERVICE);
+ //deployer.undeploy(archiveURL);
}
public InitialContext getInitialContext() throws NamingException
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-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -35,15 +35,16 @@
import javax.management.ObjectName;
import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.management.ManagedBundle;
import org.jboss.osgi.spi.management.ManagedBundleMBean;
-import org.jboss.osgi.spi.util.BundleInfo;
import org.jboss.osgi.spi.util.UnmodifiableDictionary;
import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
import org.osgi.framework.Version;
+import org.osgi.jmx.framework.BundleStateMBean;
/**
* An implementation of a remote {@link OSGiBundle}
@@ -56,41 +57,42 @@
// Provide logging
private static final Logger log = Logger.getLogger(RemoteBundle.class);
- private ManagedBundleMBean bundle;
+ private long bundleId;
private String location;
-
- private long bundleId;
private String symbolicName;
private ObjectName objectName;
+ private ManagedBundleMBean bundleMBean;
private Dictionary<String, String> defaultHeaders;
private Dictionary<String, String> rawHeaders;
private Version version;
boolean uninstalled;
- public RemoteBundle(OSGiRuntimeImpl runtime, ManagedBundleMBean bundle, BundleInfo info)
+ public RemoteBundle(OSGiRuntime runtime, long bundleId)
{
- this(runtime, bundle);
- this.location = info.getLocation();
- }
-
- public RemoteBundle(OSGiRuntimeImpl runtime, ManagedBundleMBean bundle)
- {
super(runtime);
- this.bundle = bundle;
+ this.bundleId = bundleId;
+ BundleStateMBean bundleState = runtime.getBundleStateMBean();
+ try
+ {
+ symbolicName = bundleState.getSymbolicName(bundleId);
+ location = bundleState.getLocation(bundleId);
+
+ String versionStr = bundleState.getVersion(bundleId);
+ version = Version.parseVersion(versionStr);
+ }
+ catch (IOException ex)
+ {
+ throw new IllegalStateException("Cannot initialize remote bundle", ex);
+ }
+
+ objectName = ManagedBundle.getObjectName(bundleId, symbolicName, version);
+ bundleMBean = MBeanProxy.get(runtime.getMBeanServer(), objectName, ManagedBundleMBean.class);
+
// The getHeaders methods must continue to provide the manifest header
// information after the bundle enters the UNINSTALLED state.
-
- bundleId = bundle.getBundleId();
- symbolicName = bundle.getSymbolicName();
- objectName = bundle.getObjectName();
- location = bundle.getLocation();
-
- defaultHeaders = bundle.getHeaders(null);
- rawHeaders = bundle.getHeaders("");
-
- String versionStr = defaultHeaders.get(Constants.BUNDLE_VERSION);
- version = Version.parseVersion(versionStr);
+ defaultHeaders = bundleMBean.getHeaders(null);
+ rawHeaders = bundleMBean.getHeaders("");
}
@Override
@@ -101,13 +103,27 @@
try
{
- return bundle.getState();
+ BundleStateMBean bundleState = getRuntime().getBundleStateMBean();
+ String state = bundleState.getState(bundleId);
+ if ("INSTALLED".equals(state))
+ return Bundle.INSTALLED;
+ if ("RESOLVED".equals(state))
+ return Bundle.RESOLVED;
+ if ("STARTING".equals(state))
+ return Bundle.STARTING;
+ if ("ACTIVE".equals(state))
+ return Bundle.ACTIVE;
+ if ("STOPPING".equals(state))
+ return Bundle.STOPPING;
+ if ("UNINSTALLED".equals(state))
+ return Bundle.UNINSTALLED;
+
}
- catch (RuntimeException rte)
+ catch (Exception rte)
{
Throwable cause = rte.getCause() != null ? rte.getCause() : rte;
if (cause instanceof InstanceNotFoundException == false)
- log.warn("Cannot get state for: " + objectName, cause);
+ log.warn("Cannot get state for bundle: " + bundleId, cause);
}
return Bundle.UNINSTALLED;
}
@@ -152,42 +168,42 @@
else if (locale.length() == 0)
return new UnmodifiableDictionary(rawHeaders);
else
- return bundle.getHeaders(locale);
+ return bundleMBean.getHeaders(locale);
}
@Override
public String getProperty(String key)
{
assertNotUninstalled();
- return bundle.getProperty(key);
+ return bundleMBean.getProperty(key);
}
@Override
public URL getEntry(String path)
{
assertNotUninstalled();
- return toURL(bundle.getEntry(path), null);
+ return toURL(bundleMBean.getEntry(path), null);
}
@Override
public URL getResource(String name)
{
assertNotUninstalled();
- return toURL(bundle.getResource(name), null);
+ return toURL(bundleMBean.getResource(name), null);
}
@Override
public File getDataFile(String filename)
{
assertNotUninstalled();
- return bundle.getDataFile(filename);
+ return bundleMBean.getDataFile(filename);
}
@Override
public OSGiBundle loadClass(String name) throws ClassNotFoundException
{
assertNotUninstalled();
- ObjectName providerBundle = bundle.loadClass(name);
+ ObjectName providerBundle = bundleMBean.loadClass(name);
if (providerBundle == null)
return null;
@@ -199,14 +215,28 @@
public void start() throws BundleException
{
assertNotUninstalled();
- bundle.start();
+ try
+ {
+ getRuntime().getFrameworkMBean().startBundle(bundleId);
+ }
+ catch (IOException ex)
+ {
+ throw new BundleException("Cannot start bundle: " + objectName, ex);
+ }
}
@Override
public void stop() throws BundleException
{
assertNotUninstalled();
- bundle.stop();
+ try
+ {
+ getRuntime().getFrameworkMBean().stopBundle(bundleId);
+ }
+ catch (IOException ex)
+ {
+ throw new BundleException("Cannot stop bundle: " + objectName, ex);
+ }
}
@Override
@@ -216,7 +246,7 @@
try
{
OSGiRuntimeImpl runtimeImpl = (OSGiRuntimeImpl)getRuntime();
- runtimeImpl.undeploy(new URL(location));
+ runtimeImpl.getFrameworkMBean().uninstallBundle(bundleId);
runtimeImpl.unregisterBundle(this);
uninstalled = true;
}
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteFramework.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteFramework.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteFramework.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -23,9 +23,6 @@
//$Id$
-import java.util.Set;
-
-import org.jboss.osgi.spi.management.ManagedBundleMBean;
import org.jboss.osgi.spi.management.ManagedServiceReference;
/**
@@ -37,28 +34,11 @@
public interface RemoteFramework
{
/**
- * Get the list of all installed bundles
- */
- Set<ManagedBundleMBean> getBundles();
-
- /**
- * Get the installed bundle
- * @return A managed bundle MBean or null if the identifier does not match any installed bundle.
- */
- ManagedBundleMBean getBundle(String symbolicName, String version);
-
- /**
- * Get the installed bundle by id
- * @return A managed bundle MBean or null if the identifier does not match any installed bundle.
- */
- ManagedBundleMBean getBundle(long bundleId);
-
- /**
* Returns a ServiceReference object for a service that implements and was registered
* under the specified class.
*/
ManagedServiceReference getServiceReference(String clazz);
-
+
/**
* Returns an array of ManagedServiceReference objects.
* The returned array of ManagedServiceReference objects contains services
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -21,15 +21,14 @@
*/
package org.jboss.osgi.testing.internal;
-import javax.management.ObjectName;
+import java.io.IOException;
import org.jboss.osgi.spi.management.MBeanProxy;
-import org.jboss.osgi.spi.management.MBeanProxyException;
-import org.jboss.osgi.spi.management.ManagedBundle;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiPackageAdmin;
-import org.osgi.framework.Version;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.osgi.jmx.framework.FrameworkMBean;
/**
* A remote implementation of the {@link OSGiPackageAdmin}
@@ -39,56 +38,64 @@
*/
public class RemotePackageAdmin implements OSGiPackageAdmin
{
- private OSGiRuntimeImpl runtime;
+ private OSGiRuntime runtime;
- public RemotePackageAdmin(OSGiRuntimeImpl runtime)
+ public RemotePackageAdmin(OSGiRuntime runtime)
{
this.runtime = runtime;
}
public boolean resolveBundles(OSGiBundle[] bundles)
{
- ObjectName[] bundleArr = getBundleNames(bundles);
- try
+ // JMX FrameworkMBean does not allow to resolve/refresh all bundles
+ // https://www.osgi.org/members/bugzilla/show_bug.cgi?id=1586
+ if (bundles == null)
{
ManagedFrameworkMBean mbeanProxy = MBeanProxy.get(runtime.getMBeanServer(), ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, ManagedFrameworkMBean.class);
- return mbeanProxy.resolveBundles(bundleArr);
+ return mbeanProxy.resolveAllBundles();
}
- catch (MBeanProxyException ex)
+
+ FrameworkMBean framework = runtime.getFrameworkMBean();
+ try
{
- throw new IllegalStateException("Cannot refresh packages", ex);
+ long[] ids = getBundleIds(bundles);
+ return framework.resolveBundles(ids);
}
+ catch (IOException ex)
+ {
+ throw new IllegalStateException("Cannot resolve bundles", ex);
+ }
}
public void refreshPackages(OSGiBundle[] bundles)
{
- ObjectName[] bundleArr = getBundleNames(bundles);
- try
+ // JMX FrameworkMBean does not allow to resolve/refresh all bundles
+ // https://www.osgi.org/members/bugzilla/show_bug.cgi?id=1586
+ if (bundles == null)
{
ManagedFrameworkMBean mbeanProxy = MBeanProxy.get(runtime.getMBeanServer(), ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, ManagedFrameworkMBean.class);
- mbeanProxy.refreshPackages(bundleArr);
+ mbeanProxy.refreshAllPackages();
+ return;
}
- catch (MBeanProxyException ex)
+
+ FrameworkMBean framework = runtime.getFrameworkMBean();
+ try
{
- throw new IllegalStateException("Cannot refresh packages", ex);
+ long[] ids = getBundleIds(bundles);
+ framework.refreshPackages(ids);
}
+ catch (IOException ex)
+ {
+ throw new IllegalStateException("Cannot resolve bundles", ex);
+ }
}
- private ObjectName[] getBundleNames(OSGiBundle[] bundles)
+ private long[] getBundleIds(OSGiBundle[] bundles)
{
- ObjectName[] bundleArr = null;
- if (bundles != null)
- {
- bundleArr = new ObjectName[bundles.length];
- for (int i=0; i < bundles.length; i++)
- {
- OSGiBundle bundle = bundles[i];
- long id = bundle.getBundleId();
- String symbolicName = bundle.getSymbolicName();
- Version version = bundle.getVersion();
- bundleArr[i] = ManagedBundle.getObjectName(id, symbolicName, version);
- }
- }
- return bundleArr;
+ long[] ids = new long[bundles.length];
+ for (int i = 0; i < bundles.length; i++)
+ ids[i] = bundles[i].getBundleId();
+
+ return ids;
}
}
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -25,20 +25,17 @@
import java.net.URL;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Set;
import javax.management.MBeanServerConnection;
-import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.TabularData;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import org.jboss.osgi.deployment.deployer.DeployerService;
-import org.jboss.osgi.deployment.deployer.Deployment;
-import org.jboss.osgi.deployment.deployer.DeploymentFactory;
import org.jboss.osgi.spi.management.MBeanProxy;
-import org.jboss.osgi.spi.management.MBeanProxyException;
-import org.jboss.osgi.spi.management.ManagedBundleMBean;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
import org.jboss.osgi.spi.management.ManagedServiceReference;
import org.jboss.osgi.spi.util.BundleInfo;
@@ -48,6 +45,7 @@
import org.jboss.osgi.testing.OSGiServiceReference;
import org.jboss.osgi.testing.OSGiTestHelper;
import org.osgi.framework.BundleException;
+import org.osgi.jmx.framework.BundleStateMBean;
/**
* A remote implementation of the {@link OSGiRuntime}
@@ -58,8 +56,7 @@
public class RemoteRuntime extends OSGiRuntimeImpl
{
private MBeanServerConnection mbeanServer;
- private ManagedFrameworkMBean managedFramework;
-
+
public RemoteRuntime(OSGiTestHelper helper)
{
super(helper);
@@ -71,29 +68,11 @@
{
// Get the bundle info from the location
BundleInfo info = BundleInfo.createBundleInfo(location);
- Deployment dep = DeploymentFactory.createDeployment(info);
- dep.setAutoStart(false);
+ String rootURL = info.getRootURL().toExternalForm();
- // Deploy the deployemnt through the DeployerService
- DeployerServiceClient deployer = new DeployerServiceClient(this, DeployerService.MBEAN_DEPLOYER_SERVICE);
- deployer.deploy(new Deployment[] { dep });
-
- String symbolicName = info.getSymbolicName();
- String version = info.getVersion().toString();
+ long bundleId = getFrameworkMBean().installBundle(rootURL);
- // The remote framework uses a BundleTracker that works of an asynchronous
- // event to register the installed bundle. It is not available immediately.
- int timeout = 50;
- ManagedBundleMBean bundleMBean = getRemoteFramework().getBundle(symbolicName, version);
- while (bundleMBean == null && 0 < timeout--)
- {
- Thread.sleep(200);
- bundleMBean = getRemoteFramework().getBundle(symbolicName, version);
- }
- if (bundleMBean == null)
- throw new IllegalStateException("Cannot find installed bundle: " + symbolicName + "-" + version);
-
- RemoteBundle bundle = new RemoteBundle(this, bundleMBean, info);
+ RemoteBundle bundle = new RemoteBundle(this, bundleId);
return registerBundle(bundle.getLocation(), bundle);
}
catch (RuntimeException rte)
@@ -113,27 +92,30 @@
public void deploy(String location) throws Exception
{
URL archiveURL = getTestHelper().getTestArchiveURL(location);
- ObjectName oname = getDeployerServiceName(archiveURL);
- DeployerServiceClient deployer = new DeployerServiceClient(this, oname);
+ MainDeployerClient deployer = new MainDeployerClient(this);
deployer.deploy(archiveURL);
}
public void undeploy(String location) throws Exception
{
URL archiveURL = getTestHelper().getTestArchiveURL(location);
- ObjectName oname = getDeployerServiceName(archiveURL);
- DeployerServiceClient deployer = new DeployerServiceClient(this, oname);
+ MainDeployerClient deployer = new MainDeployerClient(this);
deployer.undeploy(archiveURL);
}
public OSGiBundle[] getBundles()
{
+ Set<OSGiBundle> bundles = new HashSet<OSGiBundle>();
try
{
- Set<ManagedBundleMBean> remoteBundles = getRemoteFramework().getBundles();
- Set<OSGiBundle> bundles = new HashSet<OSGiBundle>();
- for (ManagedBundleMBean remoteBundle : remoteBundles)
- bundles.add(new RemoteBundle(this, remoteBundle));
+ TabularData listBundles = getBundleStateMBean().listBundles();
+ Iterator<?> iterator = listBundles.values().iterator();
+ while(iterator.hasNext())
+ {
+ CompositeData next = (CompositeData)iterator.next();
+ Object bundleId = next.get(BundleStateMBean.IDENTIFIER);
+ bundles.add(new RemoteBundle(this, (Long)bundleId));
+ }
OSGiBundle[] bundleArr = new OSGiBundle[bundles.size()];
bundles.toArray(bundleArr);
@@ -147,8 +129,12 @@
public OSGiBundle getBundle(long bundleId)
{
- ManagedBundleMBean bundle = getRemoteFramework().getBundle(bundleId);
- return bundle != null ? new RemoteBundle(this, bundle) : null;
+ for (OSGiBundle bundle : getBundles())
+ {
+ if (bundleId == bundle.getBundleId())
+ return bundle;
+ }
+ return null;
}
public OSGiServiceReference getServiceReference(String clazz)
@@ -196,72 +182,11 @@
private RemoteFramework getRemoteFramework()
{
- try
- {
- if (managedFramework == null)
- managedFramework = MBeanProxy.get(getMBeanServer(), ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, ManagedFrameworkMBean.class);
- }
- catch (MBeanProxyException ex)
- {
- throw new RemoteFrameworkException(ex);
- }
+ ObjectName objectName = ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK;
+ final ManagedFrameworkMBean managedFramework = MBeanProxy.get(getMBeanServer(), objectName, ManagedFrameworkMBean.class);
return new RemoteFramework()
{
- public ManagedBundleMBean getBundle(String name, String version)
- {
- ManagedBundleMBean bundleMBean = null;
- ObjectName oname = managedFramework.getBundle(name, version);
- if (oname != null)
- {
- try
- {
- bundleMBean = MBeanProxy.get(getMBeanServer(), oname, ManagedBundleMBean.class);
- }
- catch (MBeanProxyException ex)
- {
- throw new RemoteFrameworkException(ex);
- }
- }
- return bundleMBean;
- }
-
- public ManagedBundleMBean getBundle(long bundleId)
- {
- ManagedBundleMBean bundleMBean = null;
- ObjectName oname = managedFramework.getBundle(bundleId);
- if (oname != null)
- {
- try
- {
- bundleMBean = MBeanProxy.get(getMBeanServer(), oname, ManagedBundleMBean.class);
- }
- catch (MBeanProxyException ex)
- {
- throw new RemoteFrameworkException(ex);
- }
- }
- return bundleMBean;
- }
-
- public Set<ManagedBundleMBean> getBundles()
- {
- Set<ManagedBundleMBean> remBundles = new HashSet<ManagedBundleMBean>();
- for (ObjectName bundleOName : managedFramework.getBundles())
- {
- try
- {
- ManagedBundleMBean remBundle = MBeanProxy.get(getMBeanServer(), bundleOName, ManagedBundleMBean.class);
- remBundles.add(remBundle);
- }
- catch (MBeanProxyException ex)
- {
- throw new RemoteFrameworkException(ex);
- }
- }
- return remBundles;
- }
-
public ManagedServiceReference getServiceReference(String clazz)
{
return managedFramework.getServiceReference(clazz);
@@ -278,23 +203,4 @@
{
return true;
}
-
- /**
- * Return ObjectName of the DeployerService MBean if hte archive is a bundle
- * otherwise if returns the ObjectName of the MainDeployer
- */
- private ObjectName getDeployerServiceName(URL archiveURL) throws MalformedObjectNameException
- {
- ObjectName oname;
- try
- {
- BundleInfo.createBundleInfo(archiveURL);
- oname = DeployerService.MBEAN_DEPLOYER_SERVICE;
- }
- catch (Exception e)
- {
- oname = new ObjectName("jboss.system:service=MainDeployer");
- }
- return oname;
- }
}
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/test/resources/jboss-osgi-framework.properties 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/test/resources/jboss-osgi-framework.properties 2010-02-17 13:55:15 UTC (rev 101072)
@@ -17,13 +17,16 @@
# Extra System Packages
org.osgi.framework.system.packages.extra=\
+ org.apache.log4j;version=1.2, \
+ org.jboss.logging;version=2.1, \
+ org.jboss.osgi.deployment.deployer;version=1.0, \
org.jboss.osgi.deployment.interceptor;version=1.0, \
org.jboss.osgi.spi;version=1.0, \
org.jboss.osgi.spi.capability;version=1.0, \
+ org.jboss.osgi.spi.framework;version=1.0, \
org.jboss.osgi.spi.management;version=1.0, \
org.jboss.osgi.spi.service;version=1.0, \
org.jboss.osgi.spi.util;version=1.0, \
- org.jboss.logging;version=2.1, \
org.jboss.virtual;version=2.1, \
org.osgi.framework;version=1.5
@@ -32,5 +35,6 @@
file://${test.archive.directory}/bundles/org.osgi.compendium.jar
# Bundles that need to be started automatically
-#org.jboss.osgi.spi.framework.autoStart=\
-# file://${test.archive.directory}/bundles/jboss-osgi-common.jar
+org.jboss.osgi.spi.framework.autoStart=\
+ file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-common.jar
\ No newline at end of file
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/.classpath 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/.classpath 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,5 +1,12 @@
-#Tue Apr 14 17:48:49 CEST 2009
+#Tue Feb 16 17:21:12 CET 2010
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/EEG-Feedback-JMX.txt
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/EEG-Feedback-JMX.txt (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/EEG-Feedback-JMX.txt 2010-02-17 13:55:15 UTC (rev 101072)
@@ -0,0 +1,15 @@
+$Id$
+
+------------------------------------------------------------------------------------------
+JMX FrameworkMBean does not allow to resolve/refresh all bundles
+https://www.osgi.org/members/bugzilla/show_bug.cgi?id=1586
+
+The signature and API docs of
+
+FrameworkMBean.refreshBundles(long[] bundleIdentifiers)
+FrameworkMBean.resolveBundles(long[] bundleIdentifiers)
+
+does not obviously allow to resolve/refresh all bundles.
+
+A client would be forced to collect all ids before making the call.
+PackageAdmin however uses a null paramter to mean 'all bundles'.
Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/EEG-Feedback-JMX.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml 2010-02-17 13:55:15 UTC (rev 101072)
@@ -41,7 +41,6 @@
<properties>
<version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
<version.jboss.osgi.jndi>1.0.3-SNAPSHOT</version.jboss.osgi.jndi>
- <version.jboss.osgi.spi>1.0.5-SNAPSHOT</version.jboss.osgi.spi>
<version.osgi>4.2.0</version.osgi>
</properties>
@@ -57,11 +56,6 @@
<artifactId>jboss-osgi-jndi</artifactId>
<version>${version.jboss.osgi.jndi}</version>
</dependency>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-spi</artifactId>
- <version>${version.jboss.osgi.spi}</version>
- </dependency>
<!-- OSGi Dependencies -->
<dependency>
@@ -99,16 +93,14 @@
javax.naming.spi,
<!-- jboss-osgi -->
- org.jboss.osgi.spi.capability;version=1.0,
- org.jboss.osgi.spi.management;version=1.0,
+ org.jboss.osgi.spi*;version="[1.0,2.0)",
<!-- osgi -->
- org.osgi.framework;version=1.4,
- org.osgi.service.log,
- org.osgi.service.packageadmin,
- org.osgi.util.tracker,
+ org.osgi.framework;version="[1.5,2.0)",
+ org.osgi.service.packageadmin;version="[1.2,2.0)",
+ org.osgi.util.tracker;version="[1.4,2.0)",
- <!-- FIXME optional -->
+ <!-- FIXME: make optional -->
org.jboss.osgi.jndi,
org.jboss.net.sockets,
org.jnp.interfaces,
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/JMXCapability.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/JMXCapability.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/JMXCapability.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -34,6 +34,7 @@
*
* It is ignored if the {@link MBeanServer} is already registered.
*
+ * Dependent Capability: {@link JNDICapability}
* Installed bundles: jboss-osgi-jmx.jar
*
* Default properties set by this capability
@@ -59,5 +60,6 @@
addDependency(new JNDICapability());
addBundle("bundles/jboss-osgi-jmx.jar");
+ addBundle("bundles/org.apache.aries.jmx.jar");
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -50,7 +50,6 @@
this.context = context;
}
- @SuppressWarnings("unchecked")
public MBeanServer registerMBeanServer()
{
MBeanServer mbeanServer = null;
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -23,31 +23,18 @@
//$Id$
-import static org.jboss.osgi.spi.OSGiConstants.DOMAIN_NAME;
-import static org.jboss.osgi.spi.management.ManagedBundle.PROPERTY_ID;
-import static org.jboss.osgi.spi.management.ManagedBundle.PROPERTY_SYMBOLIC_NAME;
-import static org.jboss.osgi.spi.management.ManagedBundle.PROPERTY_VERSION;
-
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.management.JMException;
import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.management.QueryExp;
import javax.management.StandardMBean;
import org.jboss.logging.Logger;
-import org.jboss.osgi.spi.management.ManagedBundle;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
import org.jboss.osgi.spi.management.ManagedServiceReference;
-import org.jboss.osgi.spi.management.ObjectNameFactory;
-import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
@@ -80,83 +67,13 @@
this.context = context;
this.mbeanServer = mbeanServer;
-
this.bundleTracker = new ManagedBundleTracker(context, mbeanServer);
}
- public BundleContext getBundleContext()
- {
- return context;
- }
-
- @SuppressWarnings("unchecked")
- public ObjectName getBundle(String symbolicName, String version)
- {
- ObjectName oname = null;
-
- String namestr = DOMAIN_NAME + ":" + PROPERTY_SYMBOLIC_NAME + "=" + symbolicName + "," + PROPERTY_VERSION + "=" + version + ",*";
- Set<ObjectName> names = mbeanServer.queryNames(ObjectNameFactory.create(namestr), null);
-
- if (names.size() > 0)
- {
- if (names.size() > 1)
- log.warn("Multiple bundles found: " + names);
-
- // Use the bundle with the highest id
- for (ObjectName aux : names)
- {
- if (oname == null)
- oname = aux;
-
- Integer bestId = new Integer(oname.getKeyProperty(PROPERTY_ID));
- Integer auxId = new Integer(aux.getKeyProperty(PROPERTY_ID));
- if (bestId < auxId)
- oname = aux;
- }
- }
-
- if (log.isTraceEnabled())
- log.trace("getBundle(" + symbolicName + "," + version + ") => " + oname);
-
- return oname;
- }
-
- @SuppressWarnings("unchecked")
- public ObjectName getBundle(long bundleId)
- {
- ObjectName oname = null;
-
- ObjectName pattern = ObjectNameFactory.create(DOMAIN_NAME + ":" + PROPERTY_ID + "=" + bundleId + ",*");
- Set<ObjectName> names = mbeanServer.queryNames(pattern, null);
-
- if (names.size() > 0)
- oname = names.iterator().next();
-
- if (log.isTraceEnabled())
- log.trace("getBundle(" + bundleId + ") => " + oname);
-
- return oname;
- }
-
- @SuppressWarnings("unchecked")
- public Set<ObjectName> getBundles()
- {
- // [JBAS-6571] JMX filtering does not work with wildcards
- // ObjectName pattern = ObjectNameFactory.create(Constants.DOMAIN_NAME + ":name=*,*");
- // Set<ObjectName> names = mbeanServer.queryNames(pattern, null);
-
- ObjectName pattern = ObjectNameFactory.create(DOMAIN_NAME + ":*");
- Set<ObjectName> names = mbeanServer.queryNames(pattern, new IsBundleQueryExp());
-
- if (log.isTraceEnabled())
- log.trace("getBundles() => " + names);
-
- return names;
- }
-
+ @Override
public ManagedServiceReference getServiceReference(String clazz)
{
- ServiceReference sref = getBundleContext().getServiceReference(clazz);
+ ServiceReference sref = context.getServiceReference(clazz);
if (sref == null)
return null;
@@ -173,6 +90,7 @@
return msref;
}
+ @Override
public ManagedServiceReference[] getServiceReferences(String clazz, String filter)
{
List<ManagedServiceReference> foundRefs = new ArrayList<ManagedServiceReference>();
@@ -180,7 +98,7 @@
ServiceReference[] srefs;
try
{
- srefs = getBundleContext().getServiceReferences(clazz, filter);
+ srefs = context.getServiceReferences(clazz, filter);
}
catch (InvalidSyntaxException e)
{
@@ -209,51 +127,30 @@
return msrefs;
}
- public void refreshPackages(ObjectName[] objectNames)
+ @Override
+ public void refreshAllPackages()
{
if (log.isTraceEnabled())
- log.trace("refreshPackages(" + (objectNames != null ? Arrays.asList(objectNames) : null) +")");
+ log.trace("refreshPackages(null)");
- Bundle[] bundleArr = getBundles(objectNames);
- ServiceReference sref = getBundleContext().getServiceReference(PackageAdmin.class.getName());
- PackageAdmin service = (PackageAdmin)getBundleContext().getService(sref);
- service.refreshPackages(bundleArr);
+ ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
+ PackageAdmin service = (PackageAdmin)context.getService(sref);
+ service.refreshPackages(null);
}
- public boolean resolveBundles(ObjectName[] objectNames)
+ @Override
+ public boolean resolveAllBundles()
{
if (log.isTraceEnabled())
- log.trace("resolveBundles(" + (objectNames != null ? Arrays.asList(objectNames) : null) +")");
+ log.trace("resolveBundles(null)");
- Bundle[] bundleArr = getBundles(objectNames);
- ServiceReference sref = getBundleContext().getServiceReference(PackageAdmin.class.getName());
- PackageAdmin service = (PackageAdmin)getBundleContext().getService(sref);
- return service.resolveBundles(bundleArr);
+ ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
+ PackageAdmin service = (PackageAdmin)context.getService(sref);
+ return service.resolveBundles(null);
}
- private Bundle[] getBundles(ObjectName[] objectNames)
+ void start()
{
- Bundle[] bundleArr = null;
- if (objectNames != null)
- {
- List<String> symbolicNames = new ArrayList<String>();
- for (ObjectName oname : objectNames)
- symbolicNames.add(oname.getKeyProperty(PROPERTY_SYMBOLIC_NAME));
-
- Set<Bundle> bundleSet = new HashSet<Bundle>();
- for (Bundle bundle : getBundleContext().getBundles())
- {
- if (symbolicNames.contains(bundle.getSymbolicName()))
- bundleSet.add(bundle);
- }
- bundleArr = new Bundle[bundleSet.size()];
- bundleSet.toArray(bundleArr);
- }
- return bundleArr;
- }
-
- public void start()
- {
// Start tracking the bundles
bundleTracker.open();
@@ -271,7 +168,7 @@
}
}
- public void stop()
+ void stop()
{
try
{
@@ -283,19 +180,4 @@
log.warn("Cannot register: " + ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK);
}
}
-
- // Accept names like "jboss.osgi:id=*"
- static class IsBundleQueryExp implements QueryExp
- {
- private static final long serialVersionUID = 1L;
-
- public boolean apply(ObjectName name)
- {
- return name.getKeyProperty(ManagedBundle.PROPERTY_SYMBOLIC_NAME) != null;
- }
-
- public void setMBeanServer(MBeanServer server)
- {
- }
- }
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/RMIAdaptor.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/RMIAdaptor.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/RMIAdaptor.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -130,13 +130,13 @@
return delegate.isRegistered(name);
}
- @SuppressWarnings({ "rawtypes" })
+ @SuppressWarnings({ "rawtypes", "unchecked" })
public Set queryMBeans(ObjectName name, QueryExp query) throws IOException
{
return delegate.queryMBeans(name, query);
}
- @SuppressWarnings({ "rawtypes" })
+ @SuppressWarnings({ "rawtypes", "unchecked" })
public Set queryNames(ObjectName name, QueryExp query) throws IOException
{
return delegate.queryNames(name, query);
Modified: projects/jboss-osgi/projects/bundles/jndi/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/bundles/jndi/trunk/.classpath 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/jndi/trunk/.classpath 2010-02-17 13:55:15 UTC (rev 101072)
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: projects/jboss-osgi/projects/bundles/jndi/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/bundles/jndi/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/jndi/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,5 +1,12 @@
-#Tue Apr 14 17:48:49 CEST 2009
+#Wed Feb 17 12:16:11 CET 2010
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
Modified: projects/jboss-osgi/projects/bundles/jndi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jndi/trunk/pom.xml 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/bundles/jndi/trunk/pom.xml 2010-02-17 13:55:15 UTC (rev 101072)
@@ -45,14 +45,13 @@
<artifactId>jboss-osgi-spi</artifactId>
<version>${version.jboss.osgi.spi}</version>
</dependency>
-
- <!-- Provided Dependencies -->
<dependency>
<groupId>org.jboss.osgi.bundles</groupId>
<artifactId>jboss-osgi-common</artifactId>
<version>${version.jboss.osgi.common}</version>
- <scope>provided</scope>
</dependency>
+
+ <!-- Provided Dependencies -->
<dependency>
<groupId>org.jboss.naming</groupId>
<artifactId>jnpserver</artifactId>
@@ -93,14 +92,13 @@
javax.net,
org.jboss.logging,
org.jboss.net.sockets,
- org.jboss.osgi.common.log;version=1.0,
- org.jboss.osgi.spi.capability;version="1.0",
- org.jboss.osgi.spi.util;version="1.0",
org.jboss.util.naming,
- org.jboss.util.threadpool,
+ org.jboss.util.threadpool,
org.jnp.interfaces,
- org.osgi.framework,
- org.osgi.service.log,
+
+ org.jboss.osgi.common*;version="[1.0,2.0)",
+ org.jboss.osgi.spi*;version="[1.0,2.0)",
+ org.osgi.framework;version="[1.5,2.0)",
</Import-Package>
<Embed-Dependency>
jnpserver;inline=false,
Modified: projects/jboss-osgi/projects/runtime/deployment/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/runtime/deployment/trunk/.classpath 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/runtime/deployment/trunk/.classpath 2010-02-17 13:55:15 UTC (rev 101072)
@@ -3,7 +3,7 @@
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: projects/jboss-osgi/projects/runtime/deployment/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/runtime/deployment/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/runtime/deployment/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,6 +1,13 @@
-#Tue Nov 24 12:10:53 CET 2009
+#Wed Feb 17 12:15:07 CET 2010
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5
Modified: projects/jboss-osgi/projects/runtime/deployment/trunk/src/test/java/org/jboss/test/osgi/deployment/simple/DeploymentSerializationTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployment/trunk/src/test/java/org/jboss/test/osgi/deployment/simple/DeploymentSerializationTestCase.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/runtime/deployment/trunk/src/test/java/org/jboss/test/osgi/deployment/simple/DeploymentSerializationTestCase.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -87,7 +87,7 @@
File file = new File("target/test-libs/simple-bundle.jar");
assertTrue("File exists: " + file, file.exists());
- BundleInfo info = BundleInfo.createBundleInfo(file.toURL());
+ BundleInfo info = BundleInfo.createBundleInfo(file.toURI().toURL());
return info;
}
}
Modified: projects/jboss-osgi/projects/runtime/felix/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/.classpath 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/.classpath 2010-02-17 13:55:15 UTC (rev 101072)
@@ -3,7 +3,7 @@
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: projects/jboss-osgi/projects/runtime/felix/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,12 +1,12 @@
-#Tue Feb 17 14:10:44 CET 2009
+#Wed Feb 17 12:16:33 CET 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
Modified: projects/jboss-osgi/projects/spi/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/.classpath 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/.classpath 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: projects/jboss-osgi/projects/spi/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,6 +1,13 @@
-#Fri Dec 11 16:24:04 CET 2009
+#Tue Feb 16 17:08:55 CET 2010
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/Capability.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/Capability.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/Capability.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -33,7 +33,7 @@
import org.osgi.framework.BundleException;
/**
- * An abstract OSGi capability that can be installed in an {@link OSGiRuntime}.
+ * An abstract OSGi capability that can be installed in an OSGiRuntime.
*
* The capability is only installed if the service name given in the constructor is not already registered with the OSGi framework.
*
@@ -54,7 +54,7 @@
/**
* Construct a capability that is identified by the given service name.
*
- * If the service name is already registered with the {@link OSGiRuntime} adding this capability
+ * If the service name is already registered with the OSGiRuntime adding this capability
* does nothing.
*
* If the service name is null the capability will install each associated bundle unless a bundle with the
@@ -70,7 +70,7 @@
/**
* Construct a capability that is identified by the given service name and filter string.
*
- * If the service is already registered with the {@link OSGiRuntime} adding this capability
+ * If the service is already registered with the OSGiRuntime adding this capability
* does nothing.
*/
public Capability(String serviceName, String filter)
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/ConfigAdminCapability.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/ConfigAdminCapability.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/ConfigAdminCapability.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -26,7 +26,7 @@
import org.osgi.service.cm.ConfigurationAdmin;
/**
- * Adds the OSGi compedium ConfigAdmin capability to the {@link OSGiRuntime}
+ * Adds the OSGi compedium ConfigAdmin capability to the OSGiRuntime
* under test.
*
* It is ignored if the {@link ConfigurationAdmin} is already registered.
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/HttpServiceCapability.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/HttpServiceCapability.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/HttpServiceCapability.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -26,7 +26,7 @@
import org.osgi.service.http.HttpService;
/**
- * Adds the {@link HttpService} capability to the {@link OSGiRuntime}
+ * Adds the {@link HttpService} capability to the OSGiRuntime
* under test.
*
* It is ignored if the {@link HttpService} is already registered.
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/LogServiceCapability.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/LogServiceCapability.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/LogServiceCapability.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -24,7 +24,7 @@
import org.osgi.service.log.LogService;
/**
- * Adds the OSGi compedium LogService capability to the {@link OSGiRuntime}
+ * Adds the OSGi compedium LogService capability to the OSGiRuntime
* under test.
*
* It is ignored if the {@link LogService} is already registered.
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -368,7 +368,7 @@
File propsFile = new File(extraPropsValue);
try
{
- extraPropsURL = propsFile.toURL();
+ extraPropsURL = propsFile.toURI().toURL();
}
catch (MalformedURLException e)
{
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/internal/OSGiBootstrapBean.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/internal/OSGiBootstrapBean.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/internal/OSGiBootstrapBean.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -162,7 +162,7 @@
{
try
{
- return file.toURL();
+ return file.toURI().toURL();
}
catch (MalformedURLException e)
{
Deleted: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.spi.management;
-
-// $Id$
-
-import javax.management.MBeanServerConnection;
-import javax.management.MBeanServerInvocationHandler;
-import javax.management.ObjectName;
-
-/**
- * A simple MBeanProxy
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 24-Feb-2009
- */
-public class MBeanProxy
-{
- @SuppressWarnings({ "unchecked" })
- public static <T> T get(MBeanServerConnection server, ObjectName name, Class<T> interf) throws MBeanProxyException
- {
- return (T)MBeanServerInvocationHandler.newProxyInstance(server, name, interf, false);
- }
-}
Copied: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java (from rev 101012, projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java)
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java (rev 0)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.spi.management;
+
+// $Id$
+
+import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.ObjectName;
+
+/**
+ * A simple MBeanProxy
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 24-Feb-2009
+ */
+public class MBeanProxy
+{
+ public static <T> T get(MBeanServerConnection server, ObjectName name, Class<T> interf)
+ {
+ return (T)MBeanServerInvocationHandler.newProxyInstance(server, name, interf, false);
+ }
+}
Deleted: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxyException.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxyException.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxyException.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.spi.management;
-
-// $Id: $
-
-import javax.management.JMException;
-
-public class MBeanProxyException extends JMException
-{
- private static final long serialVersionUID = 2796580582557329145L;
-
- public MBeanProxyException()
- {
- }
-
- public MBeanProxyException(String msg)
- {
- super(msg);
- }
-}
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -34,7 +34,6 @@
import javax.management.ObjectName;
import org.jboss.logging.Logger;
-import org.jboss.osgi.spi.util.ConstantsHelper;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -93,11 +92,13 @@
return ObjectNameFactory.create(oname);
}
+ @Override
public ObjectName getObjectName()
{
return oname;
}
+ @Override
public String getProperty(String key)
{
String value = bundle.getBundleContext().getProperty(key);
@@ -108,41 +109,13 @@
return value;
}
- public int getState()
- {
- int state = bundle.getState();
-
- if (log.isTraceEnabled())
- log.trace("getState[" + oname + "] => " + ConstantsHelper.bundleState(state));
-
- return state;
- }
-
- public long getBundleId()
- {
- return bundle.getBundleId();
- }
-
- public String getSymbolicName()
- {
- return bundle.getSymbolicName();
- }
-
- public String getLocation()
- {
- String location = bundle.getLocation();
-
- if (log.isTraceEnabled())
- log.trace("getLocation[" + oname + "] => " + location);
-
- return location;
- }
-
+ @Override
public Dictionary<String, String> getHeaders()
{
return getHeaders(null);
}
+ @Override
@SuppressWarnings("rawtypes")
public Dictionary<String, String> getHeaders(String locale)
{
@@ -162,6 +135,7 @@
return retHeaders;
}
+ @Override
public String getEntry(String path)
{
URL url = bundle.getEntry(path);
@@ -173,6 +147,7 @@
return entry;
}
+ @Override
public String getResource(String name)
{
URL url = bundle.getResource(name);
@@ -184,6 +159,7 @@
return resource;
}
+ @Override
public ObjectName loadClass(String name) throws ClassNotFoundException
{
Class<?> clazz = bundle.loadClass(name);
@@ -196,6 +172,7 @@
return oname;
}
+ @Override
public File getDataFile(String filename)
{
BundleContext context = bundle.getBundleContext();
@@ -207,22 +184,7 @@
return dataFile;
}
- public void start() throws BundleException
- {
- if (log.isTraceEnabled())
- log.trace("start[" + oname + "]");
-
- bundle.start();
- }
-
- public void stop() throws BundleException
- {
- if (log.isTraceEnabled())
- log.trace("stop[" + oname + "]");
-
- bundle.stop();
- }
-
+ @Override
public void update() throws BundleException
{
if (log.isTraceEnabled())
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundleMBean.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundleMBean.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundleMBean.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -48,28 +48,6 @@
ObjectName getObjectName();
/**
- * Returns this bundle's current state. A bundle can be in only one state at any time.
- *
- * @return An element of UNINSTALLED,INSTALLED, RESOLVED,STARTING, STOPPING,ACTIVE.
- */
- int getState();
-
- /**
- * Returns this bundle's unique identifier.
- */
- long getBundleId();
-
- /**
- * Returns the symbolic name of this bundle as specified by its Bundle-SymbolicName manifest header
- */
- String getSymbolicName();
-
- /**
- * Returns the location of this bundle
- */
- String getLocation();
-
- /**
* Returns the bundle manifest headers
*/
Dictionary<String, String> getHeaders();
@@ -96,7 +74,7 @@
/**
* Returns a string encoded URL to the entry at the specified path in this bundle.
*
- * @param name The path name of the entry
+ * @param path The path name of the entry
* @return A URL to the entry, or null if no entry could be found
*/
String getEntry(String path);
@@ -114,16 +92,6 @@
File getDataFile(String filename);
/**
- * Starts this bundle with no options
- */
- void start() throws BundleException;
-
- /**
- * Stops this bundle with no options.
- */
- void stop() throws BundleException;
-
- /**
* Update this bundle.
*/
void update() throws BundleException;
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFramework.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFramework.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFramework.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -21,36 +21,21 @@
*/
package org.jboss.osgi.spi.management;
+
//$Id$
-import java.util.Set;
-import javax.management.ObjectName;
-
/**
* The managed view of an OSGi Framework
*
+ * Deprecated: Use FrameworkMBean
+ *
* @author thomas.diesler(a)jboss.com
* @since 04-Mar-2009
*/
public interface ManagedFramework
{
/**
- * Get the list of all installed bundles
- */
- Set<ObjectName> getBundles();
-
- /**
- * Get the installed bundle
- */
- ObjectName getBundle(String symbolicName, String version);
-
- /**
- * Get the installed bundle
- */
- ObjectName getBundle(long bundleId);
-
- /**
* Returns a ServiceReference object for a service that implements and was registered
* under the specified class.
*/
@@ -66,11 +51,17 @@
/**
* Refresh packages through the PackageAdmin service
+ *
+ * JMX FrameworkMBean does not allow to resolve/refresh all bundles
+ * https://www.osgi.org/members/bugzilla/show_bug.cgi?id=1586
*/
- void refreshPackages(ObjectName[] bundles);
+ void refreshAllPackages();
/**
* Resolve bundles through the PackageAdmin service
+ *
+ * JMX FrameworkMBean does not allow to resolve/refresh all bundles
+ * https://www.osgi.org/members/bugzilla/show_bug.cgi?id=1586
*/
- boolean resolveBundles(ObjectName[] bundles);
+ boolean resolveAllBundles();
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFrameworkMBean.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFrameworkMBean.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFrameworkMBean.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -25,6 +25,7 @@
import javax.management.ObjectName;
+
/**
* The managed view of an OSGi Framework
*
Deleted: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.spi.management;
-
-//$Id$
-
-import java.util.List;
-
-import javax.management.ObjectName;
-
-
-/**
- * An OSGi Service the gives access to the Kernel and MBeanServer.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 23-Jan-2009
- */
-public interface MicrocontainerServiceMBean
-{
- /**
- * The object name under which the MicrocontainerService is registered: 'jboss.osgi:service=MicrocontainerService'
- */
- ObjectName MBEAN_MICROCONTAINER_SERVICE = ObjectNameFactory.create("jboss.osgi:service=MicrocontainerService");
-
- /**
- * Get the list of registered beans.
- */
- List<String> getRegisteredBeans();
-}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java (from rev 101012, projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java)
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java (rev 0)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.management;
+
+//$Id$
+
+import java.util.List;
+
+import javax.management.ObjectName;
+
+
+
+/**
+ * An OSGi Service the gives access to the Kernel and MBeanServer.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Jan-2009
+ */
+public interface MicrocontainerServiceMBean
+{
+ /**
+ * The object name under which the MicrocontainerService is registered: 'jboss.osgi:service=MicrocontainerService'
+ */
+ ObjectName MBEAN_MICROCONTAINER_SERVICE = ObjectNameFactory.create("jboss.osgi:service=MicrocontainerService");
+
+ /**
+ * Get the list of registered beans.
+ */
+ List<String> listRegisteredBeans();
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ObjectNameFactory.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ObjectNameFactory.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ObjectNameFactory.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.spi.management;
-
-// $Id$
-
-import java.util.Hashtable;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-/**
- * A simple factory for creating safe object names.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 08-May-2006
- */
-public class ObjectNameFactory
-{
- public static ObjectName create(String name)
- {
- try
- {
- return new ObjectName(name);
- }
- catch (MalformedObjectNameException e)
- {
- throw new Error("Invalid ObjectName: " + name + "; " + e);
- }
- }
-
- public static ObjectName create(String domain, String key, String value)
- {
- try
- {
- return new ObjectName(domain, key, value);
- }
- catch (MalformedObjectNameException e)
- {
- throw new Error("Invalid ObjectName: " + domain + "," + key + "," + value + "; " + e);
- }
- }
-
- public static ObjectName create(String domain, Hashtable<String, String> table)
- {
- try
- {
- return new ObjectName(domain, table);
- }
- catch (MalformedObjectNameException e)
- {
- throw new Error("Invalid ObjectName: " + domain + "," + table + "; " + e);
- }
- }
-}
Copied: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ObjectNameFactory.java (from rev 101012, projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ObjectNameFactory.java)
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ObjectNameFactory.java (rev 0)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ObjectNameFactory.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.management;
+
+// $Id$
+
+import java.util.Hashtable;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+/**
+ * A simple factory for creating safe object names.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 08-May-2006
+ */
+public class ObjectNameFactory
+{
+ public static ObjectName create(String name)
+ {
+ try
+ {
+ return new ObjectName(name);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new Error("Invalid ObjectName: " + name + "; " + e);
+ }
+ }
+
+ public static ObjectName create(String domain, String key, String value)
+ {
+ try
+ {
+ return new ObjectName(domain, key, value);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new Error("Invalid ObjectName: " + domain + "," + key + "," + value + "; " + e);
+ }
+ }
+
+ public static ObjectName create(String domain, Hashtable<String, String> table)
+ {
+ try
+ {
+ return new ObjectName(domain, table);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new Error("Invalid ObjectName: " + domain + "," + table + "; " + e);
+ }
+ }
+}
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/MicrocontainerService.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/MicrocontainerService.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/MicrocontainerService.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -56,7 +56,7 @@
/**
* Get the list of registered beans.
*/
- List<String> getRegisteredBeans();
+ List<String> listRegisteredBeans();
/**
* Get a registered bean from the Kernel.
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java 2010-02-17 13:28:37 UTC (rev 101071)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java 2010-02-17 13:55:15 UTC (rev 101072)
@@ -66,7 +66,7 @@
URL url = getRealLocation(location);
if (url == null)
- throw new IllegalArgumentException("Cannot obtain root url from: " + location);
+ throw new IllegalArgumentException("Cannot obtain real location for: " + location);
return new BundleInfo(toVirtualFile(url), url.toExternalForm());
}
14 years, 4 months
JBoss-OSGI SVN: r101068 - in projects/jboss-osgi/projects/runtime/framework/trunk: .settings and 7 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-17 07:05:52 -0500 (Wed, 17 Feb 2010)
New Revision: 101068
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/.classpath
projects/jboss-osgi/projects/runtime/framework/trunk/.settings/org.eclipse.jdt.core.prefs
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/main/java/org/jboss/osgi/framework/packageadmin/AbstractExportedPackage.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/FrameworkEventsPluginImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/MicrocontainerServiceImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServiceMixUnitTestCase.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServicesTest.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/support/MockInvokerMBean.java
Log:
Service events must be delivered synchronously
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/.classpath 2010-02-17 12:02:30 UTC (rev 101067)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/.classpath 2010-02-17 12:05:52 UTC (rev 101068)
@@ -4,7 +4,7 @@
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 12:02:30 UTC (rev 101067)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-17 12:05:52 UTC (rev 101068)
@@ -1,6 +1,13 @@
-#Fri Dec 18 11:03:28 CET 2009
+#Wed Feb 17 12:15:31 CET 2010
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
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-02-17 12:02:30 UTC (rev 101067)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java 2010-02-17 12:05:52 UTC (rev 101068)
@@ -528,6 +528,7 @@
else
this.properties = new CaseInsensitiveDictionary(properties);
+ // This event is synchronously delivered after the service properties have been modified.
FrameworkEventsPlugin plugin = bundleState.getBundleManager().getPlugin(FrameworkEventsPlugin.class);
plugin.fireServiceEvent(bundleState, ServiceEvent.MODIFIED, this);
}
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-02-17 12:02:30 UTC (rev 101067)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java 2010-02-17 12:05:52 UTC (rev 101068)
@@ -233,6 +233,7 @@
putContext(result, ((OSGiBundleState)bundleState).getDeploymentUnit());
}
+ // This event is synchronously delivered after the service has been registered with the Framework.
FrameworkEventsPlugin eventsPlugin = getPlugin(FrameworkEventsPlugin.class);
eventsPlugin.fireServiceEvent(bundleState, ServiceEvent.REGISTERED, result);
@@ -242,6 +243,11 @@
public void unregisterService(OSGiServiceState serviceState)
{
AbstractBundleState bundleState = serviceState.getBundleState();
+
+ // This event is synchronously delivered before the service has completed unregistering.
+ FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+ plugin.fireServiceEvent(bundleState, ServiceEvent.UNREGISTERING, serviceState);
+
if (bundleState instanceof OSGiBundleState)
{
removeContext(serviceState, ((OSGiBundleState)bundleState).getDeploymentUnit());
@@ -250,9 +256,6 @@
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)
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/AbstractExportedPackage.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/AbstractExportedPackage.java 2010-02-17 12:02:30 UTC (rev 101067)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/AbstractExportedPackage.java 2010-02-17 12:05:52 UTC (rev 101068)
@@ -23,7 +23,6 @@
//$Id: StartLevelImpl.java 93118 2009-09-02 08:24:44Z thomas.diesler(a)jboss.com $
-import org.jboss.logging.Logger;
import org.jboss.osgi.framework.bundle.AbstractBundleState;
import org.osgi.framework.Bundle;
import org.osgi.framework.Version;
@@ -37,9 +36,6 @@
*/
abstract class AbstractExportedPackage implements ExportedPackage
{
- /** The log */
- private static final Logger log = Logger.getLogger(AbstractExportedPackage.class);
-
private AbstractBundleState bundle;
private String packageName;
private Version version;
@@ -64,7 +60,6 @@
public Bundle[] getImportingBundles()
{
// [TODO] Not implemented getImportingBundles
- log.info("Not implemented getImportingBundles");
return null;
}
@@ -76,7 +71,6 @@
public String getSpecificationVersion()
{
// [TODO] Not implemented getSpecificationVersion
- log.info("Not implemented getSpecificationVersion");
return null;
}
@@ -88,7 +82,6 @@
public boolean isRemovalPending()
{
// [TODO] Not implemented isRemovalPending
- log.info("Not implemented isRemovalPending");
return false;
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java 2010-02-17 12:02:30 UTC (rev 101067)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java 2010-02-17 12:05:52 UTC (rev 101068)
@@ -233,14 +233,12 @@
public RequiredBundle[] getRequiredBundles(String symbolicName)
{
// [TODO] getRequiredBundles(String symbolicName)
- log.info("Not implemented getRequiredBundles");
return null;
}
public void refreshPackages(Bundle[] bundles)
{
// [TODO] refreshPackages(Bundle[] bundles)
- log.debug("Ignore refreshPackages");
}
public boolean resolveBundles(Bundle[] bundleArr)
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/FrameworkEventsPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/FrameworkEventsPluginImpl.java 2010-02-17 12:02:30 UTC (rev 101067)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/FrameworkEventsPluginImpl.java 2010-02-17 12:05:52 UTC (rev 101068)
@@ -429,32 +429,29 @@
if (getBundleManager().isFrameworkActive() == false)
return;
- Runnable runnable = new Runnable()
+ // Call the listeners. All service events are synchronously delivered
+ for (ServiceListenerRegistration registration : listeners)
{
- public void run()
+ try
{
- // Call the listeners
- for (ServiceListenerRegistration registration : listeners)
+ // [TODO] MODIFIED_ENDMATCH
+ // This event is synchronously delivered after the service properties have been modified.
+ // This event is only delivered to listeners which were added with a non-null filter where
+ // the filter matched the service properties prior to the modification but the filter does
+ // not match the modified service properties.
+
+ if (registration.filter.match(service))
{
- try
- {
- if (registration.filter.match(service))
- {
- AccessControlContext accessControlContext = registration.accessControlContext;
- if (accessControlContext == null || service.hasPermission(accessControlContext))
- registration.listener.serviceChanged(event);
- }
- }
- catch (Throwable t)
- {
- log.warn("Error while firing " + typeName + " for service " + service, t);
- }
+ AccessControlContext accessControlContext = registration.accessControlContext;
+ if (accessControlContext == null || service.hasPermission(accessControlContext))
+ registration.listener.serviceChanged(event);
}
}
- };
-
- // Fire the event in a runnable
- fireEvent(runnable, synchronous);
+ catch (Throwable t)
+ {
+ log.warn("Error while firing " + typeName + " for service " + service, t);
+ }
+ }
}
private Bundle assertBundle(Bundle bundle)
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/MicrocontainerServiceImpl.java 2010-02-17 12:02:30 UTC (rev 101067)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/MicrocontainerServiceImpl.java 2010-02-17 12:05:52 UTC (rev 101068)
@@ -116,7 +116,7 @@
return (T)target;
}
- public List<String> getRegisteredBeans()
+ public List<String> listRegisteredBeans()
{
List<String> names = new ArrayList<String>();
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java 2010-02-17 12:02:30 UTC (rev 101067)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java 2010-02-17 12:05:52 UTC (rev 101068)
@@ -106,6 +106,7 @@
super.undeploy();
}
+ @SuppressWarnings("unchecked")
protected void deployBundles() throws Exception
{
try
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServiceMixUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServiceMixUnitTestCase.java 2010-02-17 12:02:30 UTC (rev 101067)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServiceMixUnitTestCase.java 2010-02-17 12:05:52 UTC (rev 101068)
@@ -21,7 +21,6 @@
*/
package org.jboss.test.osgi.service;
-import java.lang.reflect.Method;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.List;
@@ -33,7 +32,6 @@
import org.jboss.dependency.spi.ControllerState;
import org.jboss.deployers.client.spi.Deployment;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.test.osgi.DeployersTest;
import org.jboss.test.osgi.service.support.LazyBundle;
import org.jboss.test.osgi.service.support.a.A;
import org.jboss.test.osgi.service.support.c.C;
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServicesTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServicesTest.java 2010-02-17 12:02:30 UTC (rev 101067)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServicesTest.java 2010-02-17 12:05:52 UTC (rev 101068)
@@ -21,28 +21,10 @@
*/
package org.jboss.test.osgi.service;
-import junit.framework.Test;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.deployers.client.spi.Deployment;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.test.osgi.DeployersTest;
-import org.jboss.test.osgi.service.support.LazyBundle;
-import org.jboss.test.osgi.service.support.a.A;
-import org.jboss.test.osgi.service.support.c.C;
-import org.jboss.test.osgi.service.support.d.D;
-import org.jboss.virtual.AssembledDirectory;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-
import java.lang.reflect.Method;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
+import org.jboss.test.osgi.DeployersTest;
+
/**
* Test MC's services.
*
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/support/MockInvokerMBean.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/support/MockInvokerMBean.java 2010-02-17 12:02:30 UTC (rev 101067)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/support/MockInvokerMBean.java 2010-02-17 12:05:52 UTC (rev 101068)
@@ -21,7 +21,6 @@
*/
package org.jboss.test.osgi.service.support;
-import javax.management.MBeanRegistration;
import javax.management.MBeanServer;
import javax.management.ObjectName;
14 years, 4 months
JBoss-OSGI SVN: r101016 - projects/jboss-osgi/projects/runtime/framework/branches/alesj_service-mix/src/main/java/org/jboss/osgi/framework/metadata/internal.
by jboss-osgi-commits@lists.jboss.org
Author: alesj
Date: 2010-02-16 06:59:19 -0500 (Tue, 16 Feb 2010)
New Revision: 101016
Modified:
projects/jboss-osgi/projects/runtime/framework/branches/alesj_service-mix/src/main/java/org/jboss/osgi/framework/metadata/internal/OSGiPojoMetaData.java
Log:
Remove cast.
Modified: projects/jboss-osgi/projects/runtime/framework/branches/alesj_service-mix/src/main/java/org/jboss/osgi/framework/metadata/internal/OSGiPojoMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/alesj_service-mix/src/main/java/org/jboss/osgi/framework/metadata/internal/OSGiPojoMetaData.java 2010-02-16 11:50:25 UTC (rev 101015)
+++ projects/jboss-osgi/projects/runtime/framework/branches/alesj_service-mix/src/main/java/org/jboss/osgi/framework/metadata/internal/OSGiPojoMetaData.java 2010-02-16 11:59:19 UTC (rev 101016)
@@ -90,6 +90,6 @@
initialized = true;
}
- return Collections.singletonList((BeanMetaData)this);
+ return Collections.<BeanMetaData>singletonList(this);
}
}
14 years, 4 months
JBoss-OSGI SVN: r101012 - in projects/jboss-osgi: projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management and 5 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-16 01:32:28 -0500 (Tue, 16 Feb 2010)
New Revision: 101012
Modified:
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/enterprise/jmx/JMXEnterpriseTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGi108TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGi36TestCase.java
Log:
Allign signature with MBeanServerInvocationHandler.newProxyInstance
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java 2010-02-16 06:28:53 UTC (rev 101011)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java 2010-02-16 06:32:28 UTC (rev 101012)
@@ -51,7 +51,7 @@
ObjectName[] bundleArr = getBundleNames(bundles);
try
{
- ManagedFrameworkMBean mbeanProxy = MBeanProxy.get(ManagedFrameworkMBean.class, ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, runtime.getMBeanServer());
+ ManagedFrameworkMBean mbeanProxy = MBeanProxy.get(runtime.getMBeanServer(), ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, ManagedFrameworkMBean.class);
return mbeanProxy.resolveBundles(bundleArr);
}
catch (MBeanProxyException ex)
@@ -65,7 +65,7 @@
ObjectName[] bundleArr = getBundleNames(bundles);
try
{
- ManagedFrameworkMBean mbeanProxy = MBeanProxy.get(ManagedFrameworkMBean.class, ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, runtime.getMBeanServer());
+ ManagedFrameworkMBean mbeanProxy = MBeanProxy.get(runtime.getMBeanServer(), ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, ManagedFrameworkMBean.class);
mbeanProxy.refreshPackages(bundleArr);
}
catch (MBeanProxyException ex)
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java 2010-02-16 06:28:53 UTC (rev 101011)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java 2010-02-16 06:32:28 UTC (rev 101012)
@@ -199,7 +199,7 @@
try
{
if (managedFramework == null)
- managedFramework = MBeanProxy.get(ManagedFrameworkMBean.class, ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, getMBeanServer());
+ managedFramework = MBeanProxy.get(getMBeanServer(), ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, ManagedFrameworkMBean.class);
}
catch (MBeanProxyException ex)
{
@@ -216,7 +216,7 @@
{
try
{
- bundleMBean = MBeanProxy.get(ManagedBundleMBean.class, oname, getMBeanServer());
+ bundleMBean = MBeanProxy.get(getMBeanServer(), oname, ManagedBundleMBean.class);
}
catch (MBeanProxyException ex)
{
@@ -234,7 +234,7 @@
{
try
{
- bundleMBean = MBeanProxy.get(ManagedBundleMBean.class, oname, getMBeanServer());
+ bundleMBean = MBeanProxy.get(getMBeanServer(), oname, ManagedBundleMBean.class);
}
catch (MBeanProxyException ex)
{
@@ -251,7 +251,7 @@
{
try
{
- ManagedBundleMBean remBundle = MBeanProxy.get(ManagedBundleMBean.class, bundleOName, getMBeanServer());
+ ManagedBundleMBean remBundle = MBeanProxy.get(getMBeanServer(), bundleOName, ManagedBundleMBean.class);
remBundles.add(remBundle);
}
catch (MBeanProxyException ex)
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java 2010-02-16 06:28:53 UTC (rev 101011)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java 2010-02-16 06:32:28 UTC (rev 101012)
@@ -23,25 +23,9 @@
// $Id$
-import java.io.Serializable;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.UndeclaredThrowableException;
-import java.util.HashMap;
-
-import javax.management.Attribute;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanOperationInfo;
import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerInvocationHandler;
import javax.management.ObjectName;
-import javax.management.ReflectionException;
-import javax.management.RuntimeErrorException;
-import javax.management.RuntimeMBeanException;
-import javax.management.RuntimeOperationsException;
/**
* A simple MBeanProxy
@@ -52,351 +36,8 @@
public class MBeanProxy
{
@SuppressWarnings({ "unchecked" })
- public static <T> T get(Class<T> interf, ObjectName name, MBeanServerConnection server) throws MBeanProxyException
+ public static <T> T get(MBeanServerConnection server, ObjectName name, Class<T> interf) throws MBeanProxyException
{
- return (T)get(new Class[] { interf }, name, server);
+ return (T)MBeanServerInvocationHandler.newProxyInstance(server, name, interf, false);
}
-
- @SuppressWarnings({ "rawtypes" })
- public static Object get(Class[] interfaces, ObjectName name, MBeanServerConnection server) throws MBeanProxyException
- {
- if (interfaces == null || interfaces.length == 0)
- throw new IllegalArgumentException("Null interfaces");
-
- ClassLoader classLoader = interfaces[0].getClassLoader();
- return Proxy.newProxyInstance(classLoader, interfaces, new JMXInvocationHandler(server, name));
- }
-
- /**
- * Invocation handler for MBean proxies.
- *
- * @author <a href="mailto:juha@jboss.org">Juha Lindfors</a>
- * @author Thomas.Diesler(a)jboss.com
- * @since 24-Feb-2009
- */
- static class JMXInvocationHandler implements InvocationHandler, Serializable
- {
- private static final long serialVersionUID = 3714728148040623702L;
-
- // Attributes -------------------------------------------------
-
- /*
- * Reference to the MBean server this proxy connects to.
- */
- protected MBeanServerConnection server = null;
-
- /*
- * The object name of the MBean this proxy represents.
- */
- protected ObjectName objectName = null;
-
- /*
- * MBean attribute meta data.
- */
- private HashMap<String, MBeanAttributeInfo> attributeMap = new HashMap<String, MBeanAttributeInfo>();
-
- /*
- * Indicates whether Object.toString() should be delegated to the resource or handled by the proxy.
- */
- private boolean delegateToStringToResource = false;
-
- /*
- * Indicates whether Object.equals() should be delegated to the resource or handled by the proxy.
- */
- private boolean delegateEqualsToResource = false;
-
- /*
- * Indicates whether Object.hashCode() should be delegated to the resource or handled by the proxy.
- */
- private boolean delegateHashCodeToResource = false;
-
- // Constructors -----------------------------------------------
-
- /*
- * Constructs a new JMX MBean Proxy invocation handler.
- * @param server reference to the MBean server this proxy connects to
- * @param name object name of the MBean this proxy represents
- * @throws MBeanProxyCreationException wraps underlying JMX exceptions in case the proxy creation fails
- */
- public JMXInvocationHandler(MBeanServerConnection server, ObjectName name) throws MBeanProxyException
- {
- try
- {
- if (server == null)
- throw new MBeanProxyException("null agent reference");
-
- if (name == null)
- throw new MBeanProxyException("null object name");
-
- this.server = server;
- this.objectName = name;
-
- MBeanInfo info = server.getMBeanInfo(objectName);
- MBeanAttributeInfo[] attributes = info.getAttributes();
- MBeanOperationInfo[] operations = info.getOperations();
-
- // collect the MBean attribute metadata for standard mbean proxies
- for (int i = 0; i < attributes.length; ++i)
- attributeMap.put(attributes[i].getName(), attributes[i]);
-
- // Check whether the target resource exposes the common object methods.
- // Dynamic Proxy will delegate these methods automatically to the
- // invoke() implementation.
- for (int i = 0; i < operations.length; ++i)
- {
- if (operations[i].getName().equals("toString") && operations[i].getReturnType().equals("java.lang.String")
- && operations[i].getSignature().length == 0)
- {
- delegateToStringToResource = true;
- }
-
- else if (operations[i].getName().equals("equals") && operations[i].getReturnType().equals(Boolean.TYPE.getName())
- && operations[i].getSignature().length == 1 && operations[i].getSignature()[0].getType().equals("java.lang.Object"))
- {
- delegateEqualsToResource = true;
- }
-
- else if (operations[i].getName().equals("hashCode") && operations[i].getReturnType().equals(Integer.TYPE.getName())
- && operations[i].getSignature().length == 0)
- {
- delegateHashCodeToResource = true;
- }
- }
- }
- catch (InstanceNotFoundException e)
- {
- throw new MBeanProxyException("Object name " + name + " not found: " + e.toString());
- }
- catch (Exception ex)
- {
- throw new MBeanProxyException(ex.toString());
- }
- }
-
- // InvocationHandler implementation ---------------------------
-
- @SuppressWarnings("rawtypes")
- public Object invoke(Object proxy, Method method, Object[] args) throws Exception
- {
- Class<?> declaringClass = method.getDeclaringClass();
-
- // Handle methods from Object class. If the target resource exposes
- // operation metadata with same signature then the invocations will be
- // delegated to the target. Otherwise this instance of invocation handler
- // will execute them.
- if (declaringClass == Object.class)
- return handleObjectMethods(method, args);
-
- try
- {
- String methodName = method.getName();
-
- // Assume a get/setAttribute convention on the typed proxy interface.
- // If the MBean metadata exposes a matching attribute then use the
- // MBeanServer attribute accessors to read/modify the value. If not,
- // fallback to MBeanServer.invoke() assuming this is an operation
- // invocation despite the accessor naming convention.
-
- // getter
- if (methodName.startsWith("get") && args == null)
- {
- String attrName = methodName.substring(3, methodName.length());
-
- // check that the metadata exists
- MBeanAttributeInfo info = (MBeanAttributeInfo)attributeMap.get(attrName);
- if (info != null)
- {
- String retType = method.getReturnType().getName();
-
- // check for correct return type on the getter
- if (retType.equals(info.getType()))
- {
- return server.getAttribute(objectName, attrName);
- }
- }
- }
-
- // boolean getter
- else if (methodName.startsWith("is") && args == null)
- {
- String attrName = methodName.substring(2, methodName.length());
-
- // check that the metadata exists
- MBeanAttributeInfo info = (MBeanAttributeInfo)attributeMap.get(attrName);
- if (info != null && info.isIs())
- {
- Class<?> retType = method.getReturnType();
-
- // check for correct return type on the getter
- if (retType.equals(Boolean.class) || retType.equals(Boolean.TYPE))
- {
- return server.getAttribute(objectName, attrName);
- }
- }
- }
-
- // setter
- else if (methodName.startsWith("set") && args != null && args.length == 1)
- {
- String attrName = methodName.substring(3, methodName.length());
-
- // check that the metadata exists
- MBeanAttributeInfo info = (MBeanAttributeInfo)attributeMap.get(attrName);
- if (info != null && method.getReturnType().equals(Void.TYPE))
- {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
-
- Class<?> signatureClass = null;
- String classType = info.getType();
-
- if (isPrimitive(classType))
- signatureClass = getPrimitiveClass(classType);
- else
- signatureClass = cl.loadClass(info.getType());
-
- if (signatureClass.isAssignableFrom(args[0].getClass()))
- {
- server.setAttribute(objectName, new Attribute(attrName, args[0]));
- return null;
- }
- }
- }
-
- String[] signature = null;
-
- if (args != null)
- {
- signature = new String[args.length];
- Class[] sign = method.getParameterTypes();
-
- for (int i = 0; i < sign.length; ++i)
- signature[i] = sign[i].getName();
- }
-
- return server.invoke(objectName, methodName, args, signature);
- }
- catch (Exception ex)
- {
- throw (Exception)decodeJMXException(ex);
- }
- }
-
- /*
- * Attempt to decode the given Throwable.
- * If it is a container JMX exception, then the target is returned.
- * Otherwise the argument is returned.
- */
- private Throwable decodeJMXException(final Exception ex)
- {
- Throwable result = ex;
-
- while (true)
- {
- if (result instanceof MBeanException)
- result = ((MBeanException)result).getTargetException();
- else if (result instanceof ReflectionException)
- result = ((ReflectionException)result).getTargetException();
- else if (result instanceof RuntimeOperationsException)
- result = ((RuntimeOperationsException)result).getTargetException();
- else if (result instanceof RuntimeMBeanException)
- result = ((RuntimeMBeanException)result).getTargetException();
- else if (result instanceof RuntimeErrorException)
- result = ((RuntimeErrorException)result).getTargetError();
- else if (result instanceof UndeclaredThrowableException)
- result = ((UndeclaredThrowableException)result).getUndeclaredThrowable();
- else
- // can't decode
- break;
- }
-
- return result;
- }
-
- private Object handleObjectMethods(Method method, Object[] args) throws Exception
- {
- if (method.getName().equals("toString"))
- {
- if (delegateToStringToResource)
- return server.invoke(objectName, "toString", null, null);
- else
- return toString();
- }
-
- else if (method.getName().equals("equals"))
- {
- if (delegateEqualsToResource)
- {
- return server.invoke(objectName, "equals", new Object[] { args[0] }, new String[] { "java.lang.Object" });
- }
- else if (Proxy.isProxyClass(args[0].getClass()))
- {
- Proxy prxy = (Proxy)args[0];
- return new Boolean(this.equals(Proxy.getInvocationHandler(prxy)));
- }
- else
- {
- return new Boolean(this.equals(args[0]));
- }
- }
-
- else if (method.getName().equals("hashCode"))
- {
- if (delegateHashCodeToResource)
- return server.invoke(objectName, "hashCode", null, null);
- else
- return new Integer(this.hashCode());
- }
-
- else
- throw new Error("Unexpected method invocation!");
- }
-
- private boolean isPrimitive(String type)
- {
- if (type.equals(Integer.TYPE.getName()))
- return true;
- if (type.equals(Long.TYPE.getName()))
- return true;
- if (type.equals(Boolean.TYPE.getName()))
- return true;
- if (type.equals(Byte.TYPE.getName()))
- return true;
- if (type.equals(Character.TYPE.getName()))
- return true;
- if (type.equals(Short.TYPE.getName()))
- return true;
- if (type.equals(Float.TYPE.getName()))
- return true;
- if (type.equals(Double.TYPE.getName()))
- return true;
- if (type.equals(Void.TYPE.getName()))
- return true;
-
- return false;
- }
-
- private Class<?> getPrimitiveClass(String type)
- {
- if (type.equals(Integer.TYPE.getName()))
- return Integer.TYPE;
- if (type.equals(Long.TYPE.getName()))
- return Long.TYPE;
- if (type.equals(Boolean.TYPE.getName()))
- return Boolean.TYPE;
- if (type.equals(Byte.TYPE.getName()))
- return Byte.TYPE;
- if (type.equals(Character.TYPE.getName()))
- return Character.TYPE;
- if (type.equals(Short.TYPE.getName()))
- return Short.TYPE;
- if (type.equals(Float.TYPE.getName()))
- return Float.TYPE;
- if (type.equals(Double.TYPE.getName()))
- return Double.TYPE;
- if (type.equals(Void.TYPE.getName()))
- return Void.TYPE;
-
- return null;
- }
- }
}
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/enterprise/jmx/JMXEnterpriseTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/enterprise/jmx/JMXEnterpriseTestCase.java 2010-02-16 06:28:53 UTC (rev 101011)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/enterprise/jmx/JMXEnterpriseTestCase.java 2010-02-16 06:32:28 UTC (rev 101012)
@@ -94,7 +94,7 @@
{
if (mbeanServer.isRegistered(objectName))
{
- bundleState = MBeanProxy.get(BundleStateMBean.class, objectName, mbeanServer);
+ bundleState = MBeanProxy.get(mbeanServer, objectName, BundleStateMBean.class);
break;
}
Thread.sleep(200);
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java 2010-02-16 06:28:53 UTC (rev 101011)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java 2010-02-16 06:32:28 UTC (rev 101012)
@@ -68,7 +68,7 @@
OSGiBundle bundle = runtime.installBundle("example-jmx.jar");
bundle.start();
- FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, MBEAN_NAME, runtime.getMBeanServer());
+ FooMBean foo = (FooMBean)MBeanProxy.get(runtime.getMBeanServer(), MBEAN_NAME, FooMBean.class);
assertEquals("hello", foo.echo("hello"));
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java 2010-02-16 06:28:53 UTC (rev 101011)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java 2010-02-16 06:32:28 UTC (rev 101012)
@@ -68,14 +68,14 @@
@Test
public void testBeanAccess() throws Exception
{
- SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, MBEAN_NAME, runtime.getMBeanServer());
+ SomeBeanMBean someBean = MBeanProxy.get(runtime.getMBeanServer(), MBEAN_NAME, SomeBeanMBean.class);
assertEquals("hello", someBean.echo("hello"));
}
@Test
public void testServiceAccess() throws Exception
{
- SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, MBEAN_NAME, runtime.getMBeanServer());
+ SomeBeanMBean someBean = MBeanProxy.get(runtime.getMBeanServer(), MBEAN_NAME, SomeBeanMBean.class);
assertEquals("hello", someBean.callSomeService("hello"));
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGi108TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGi108TestCase.java 2010-02-16 06:28:53 UTC (rev 101011)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGi108TestCase.java 2010-02-16 06:32:28 UTC (rev 101012)
@@ -83,7 +83,7 @@
bundleA.start();
- SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, SomeBeanMBean.MBEAN_NAME, runtime.getMBeanServer());
+ SomeBeanMBean someBean = MBeanProxy.get(runtime.getMBeanServer(), SomeBeanMBean.MBEAN_NAME, SomeBeanMBean.class);
List<String> messages = report(someBean.getMessages());
assertEquals("Start messages", 1, messages.size());
@@ -110,7 +110,7 @@
bundleA.start();
bundleB.start();
- SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, SomeBeanMBean.MBEAN_NAME, runtime.getMBeanServer());
+ SomeBeanMBean someBean = MBeanProxy.get(runtime.getMBeanServer(), SomeBeanMBean.MBEAN_NAME, SomeBeanMBean.class);
List<String> messages = report(someBean.getMessages());
assertEquals("Start messages", 2, messages.size());
@@ -141,7 +141,7 @@
bundleA.start();
bundleB.start();
- SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, SomeBeanMBean.MBEAN_NAME, runtime.getMBeanServer());
+ SomeBeanMBean someBean = MBeanProxy.get(runtime.getMBeanServer(), SomeBeanMBean.MBEAN_NAME, SomeBeanMBean.class);
List<String> messages = report(someBean.getMessages());
assertEquals("Start messages", 2, messages.size());
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGi36TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGi36TestCase.java 2010-02-16 06:28:53 UTC (rev 101011)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGi36TestCase.java 2010-02-16 06:32:28 UTC (rev 101012)
@@ -106,7 +106,7 @@
private FooMBean getFooMBean() throws MBeanProxyException
{
- FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, FooMBean.OBJECT_NAME, runtime.getMBeanServer());
+ FooMBean foo = (FooMBean)MBeanProxy.get(runtime.getMBeanServer(), FooMBean.OBJECT_NAME, FooMBean.class);
return foo;
}
}
\ No newline at end of file
14 years, 4 months
JBoss-OSGI SVN: r101011 - projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/resources/META-INF.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-16 01:28:53 -0500 (Tue, 16 Feb 2010)
New Revision: 101011
Modified:
projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
Log:
Initial Aries JMX integration
Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-02-16 06:21:31 UTC (rev 101010)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-02-16 06:28:53 UTC (rev 101011)
@@ -107,7 +107,7 @@
<bean name="StartLevelService" class="org.jboss.osgi.framework.service.internal.StartLevelImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="PackageAdminService" class="org.jboss.osgi.framework.service.internal.PackageAdminImpl">
+ <bean name="PackageAdminService" class="org.jboss.osgi.framework.packageadmin.PackageAdminImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="DeployerService" class="org.jboss.osgi.framework.service.internal.DeployerServiceImpl">
14 years, 4 months
JBoss-OSGI SVN: r100995 - in projects/jboss-osgi: projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin and 13 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-15 16:18:31 -0500 (Mon, 15 Feb 2010)
New Revision: 100995
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/AbstractExportedPackage.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/CapabilityExportedPackage.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/SystemExportedPackage.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/enterprise/
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/enterprise/jmx/
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/enterprise/jmx/JMXEnterpriseTestCase.java
Removed:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/compendium/PackageAdminTestCase.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/pom.xml
projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.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
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
Initial Aries JMX integration
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/AbstractExportedPackage.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/AbstractExportedPackage.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/AbstractExportedPackage.java 2010-02-15 21:18:31 UTC (rev 100995)
@@ -0,0 +1,94 @@
+/*
+ * 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.packageadmin;
+
+//$Id: StartLevelImpl.java 93118 2009-09-02 08:24:44Z thomas.diesler(a)jboss.com $
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
+import org.osgi.service.packageadmin.ExportedPackage;
+
+/**
+ * An implementation of the {@link ExportedPackage}.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Feb-2010
+ */
+abstract class AbstractExportedPackage implements ExportedPackage
+{
+ /** The log */
+ private static final Logger log = Logger.getLogger(AbstractExportedPackage.class);
+
+ private AbstractBundleState bundle;
+ private String packageName;
+ private Version version;
+
+ AbstractExportedPackage(AbstractBundleState bundle, String packageName)
+ {
+ this.bundle = bundle;
+ this.packageName = packageName;
+ this.version = Version.emptyVersion;
+ }
+
+ void setVersion(Version version)
+ {
+ this.version = version;
+ }
+
+ public Bundle getExportingBundle()
+ {
+ return bundle;
+ }
+
+ public Bundle[] getImportingBundles()
+ {
+ // [TODO] Not implemented getImportingBundles
+ log.info("Not implemented getImportingBundles");
+ return null;
+ }
+
+ public String getName()
+ {
+ return packageName;
+ }
+
+ public String getSpecificationVersion()
+ {
+ // [TODO] Not implemented getSpecificationVersion
+ log.info("Not implemented getSpecificationVersion");
+ return null;
+ }
+
+ public Version getVersion()
+ {
+ return version;
+ }
+
+ public boolean isRemovalPending()
+ {
+ // [TODO] Not implemented isRemovalPending
+ log.info("Not implemented isRemovalPending");
+ return false;
+ }
+}
\ No newline at end of file
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/CapabilityExportedPackage.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/CapabilityExportedPackage.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/CapabilityExportedPackage.java 2010-02-15 21:18:31 UTC (rev 100995)
@@ -0,0 +1,44 @@
+/*
+ * 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.packageadmin;
+
+//$Id: StartLevelImpl.java 93118 2009-09-02 08:24:44Z thomas.diesler(a)jboss.com $
+
+import org.jboss.classloading.plugins.metadata.PackageCapability;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.osgi.framework.Version;
+import org.osgi.service.packageadmin.ExportedPackage;
+
+/**
+ * An implementation of the {@link ExportedPackage} that is backed by a {@link PackageCapability}.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Feb-2010
+ */
+class CapabilityExportedPackage extends AbstractExportedPackage
+{
+ CapabilityExportedPackage(AbstractBundleState bundle, PackageCapability capability)
+ {
+ super(bundle, capability.getName());
+ setVersion(Version.parseVersion(capability.getVersion().toString()));
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java (from rev 100981, 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/packageadmin/PackageAdminImpl.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/PackageAdminImpl.java 2010-02-15 21:18:31 UTC (rev 100995)
@@ -0,0 +1,336 @@
+/*
+ * 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.packageadmin;
+
+//$Id: StartLevelImpl.java 93118 2009-09-02 08:24:44Z thomas.diesler(a)jboss.com $
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.classloading.plugins.metadata.PackageCapability;
+import org.jboss.classloading.spi.dependency.ClassLoading;
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.classloading.spi.metadata.CapabilitiesMetaData;
+import org.jboss.classloading.spi.metadata.Capability;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.deployers.plugins.classloading.AbstractDeploymentClassLoaderPolicyModule;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.bundle.OSGiFragmentState;
+import org.jboss.osgi.framework.bundle.OSGiSystemState;
+import org.jboss.osgi.framework.plugins.PackageAdminPlugin;
+import org.jboss.osgi.framework.plugins.ResolverPlugin;
+import org.jboss.osgi.framework.plugins.SystemPackagesPlugin;
+import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
+import org.jboss.osgi.framework.resolver.Resolver;
+import org.jboss.osgi.framework.resolver.ResolverBundle;
+import org.jboss.osgi.spi.NotImplementedException;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.service.packageadmin.RequiredBundle;
+
+/**
+ * An implementation of the {@link PackageAdmin}.
+ *
+ * [TODO] [JBOSGI-149] Fully implement PackageAdmin
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 03-Sep-2009
+ */
+public class PackageAdminImpl extends AbstractServicePlugin implements PackageAdminPlugin
+{
+ /** The log */
+ private static final Logger log = Logger.getLogger(PackageAdminImpl.class);
+
+ public PackageAdminImpl(OSGiBundleManager bundleManager)
+ {
+ super(bundleManager);
+ }
+
+ public void startService()
+ {
+ BundleContext sysContext = getSystemContext();
+ sysContext.registerService(PackageAdmin.class.getName(), this, null);
+ }
+
+ public void stopService()
+ {
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Bundle getBundle(Class clazz)
+ {
+ if (clazz == null)
+ throw new IllegalArgumentException("Null class");
+
+ ClassLoader classLoader = clazz.getClassLoader();
+ Module module = ClassLoading.getModuleForClassLoader(classLoader);
+ if (module instanceof AbstractDeploymentClassLoaderPolicyModule)
+ {
+ AbstractDeploymentClassLoaderPolicyModule deploymentModule = (AbstractDeploymentClassLoaderPolicyModule)module;
+ DeploymentUnit unit = deploymentModule.getDeploymentUnit();
+ AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
+ if (bundleState != null)
+ {
+ // Return the fragment's host bundle
+ if (bundleState.isFragment())
+ bundleState = ((OSGiFragmentState)bundleState).getFragmentHost();
+
+ return bundleState.getBundleInternal();
+ }
+ }
+ return null;
+ }
+
+ public int getBundleType(Bundle bundle)
+ {
+ AbstractBundleState bundleState = AbstractBundleState.assertBundleState(bundle);
+ return bundleState.isFragment() ? BUNDLE_TYPE_FRAGMENT : 0;
+ }
+
+ public Bundle[] getBundles(String symbolicName, String versionRange)
+ {
+ throw new NotImplementedException();
+ }
+
+ public ExportedPackage getExportedPackage(String name)
+ {
+ throw new NotImplementedException();
+ }
+
+ public ExportedPackage[] getExportedPackages(Bundle bundle)
+ {
+ List<ExportedPackage> exported = new ArrayList<ExportedPackage>();
+
+ AbstractBundleState absBundleState = AbstractBundleState.assertBundleState(bundle);
+ if (absBundleState instanceof OSGiSystemState)
+ {
+ OSGiSystemState bundleState = (OSGiSystemState)absBundleState;
+ SystemPackagesPlugin plugin = bundleState.getBundleManager().getPlugin(SystemPackagesPlugin.class);
+
+ // [TODO] include package versions
+ for (String packageName : plugin.getSystemPackages(false))
+ {
+ exported.add(new SystemExportedPackage(bundleState, packageName));
+ }
+ }
+ else
+ {
+ AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)absBundleState;
+ ClassLoadingMetaData metaData = bundleState.getDeploymentUnit().getAttachment(ClassLoadingMetaData.class);
+ if (metaData == null)
+ throw new IllegalStateException("Cannot obtain ClassLoadingMetaData");
+
+ CapabilitiesMetaData capabilities = metaData.getCapabilities();
+ for (Capability capability : capabilities.getCapabilities())
+ {
+ if (capability instanceof PackageCapability)
+ {
+ exported.add(new CapabilityExportedPackage(bundleState, (PackageCapability)capability));
+ }
+ }
+ }
+
+ if (exported.size() == 0)
+ return null;
+
+ ExportedPackage[] result = new ExportedPackage[exported.size()];
+ exported.toArray(result);
+
+ return result;
+ }
+
+ public ExportedPackage[] getExportedPackages(String name)
+ {
+ List<ExportedPackage> exported = new ArrayList<ExportedPackage>();
+
+ for (AbstractBundleState auxBundle : getBundleManager().getBundles())
+ {
+ for (ExportedPackage auxPackage : getExportedPackages(auxBundle))
+ {
+ if (auxPackage.getName().equals(name))
+ exported.add(auxPackage);
+ }
+ }
+
+ if (exported.size() == 0)
+ return null;
+
+ ExportedPackage[] result = new ExportedPackage[exported.size()];
+ exported.toArray(result);
+
+ return result;
+ }
+
+ public Bundle[] getFragments(Bundle bundle)
+ {
+ AbstractBundleState absBundleState = AbstractBundleState.assertBundleState(bundle);
+ if (absBundleState instanceof OSGiBundleState == false)
+ return null;
+
+ List<Bundle> bundles = new ArrayList<Bundle>();
+
+ OSGiBundleState bundleState = (OSGiBundleState)absBundleState;
+ List<OSGiFragmentState> fragments = bundleState.getAttachedFragments();
+ for (OSGiFragmentState aux : fragments)
+ bundles.add(aux.getBundle());
+
+ if (bundles.isEmpty())
+ return null;
+
+ return bundles.toArray(new Bundle[bundles.size()]);
+ }
+
+ public Bundle[] getHosts(Bundle bundle)
+ {
+ AbstractBundleState absBundleState = AbstractBundleState.assertBundleState(bundle);
+ if (absBundleState instanceof OSGiFragmentState == false)
+ return null;
+
+ List<Bundle> bundles = new ArrayList<Bundle>();
+
+ // [TODO] Add support for multiple hosts
+ OSGiFragmentState bundleState = (OSGiFragmentState)absBundleState;
+ OSGiBundleState fragmentHost = bundleState.getFragmentHost();
+ if (fragmentHost != null)
+ {
+ bundles.add(fragmentHost.getBundle());
+ }
+
+ if (bundles.isEmpty())
+ return null;
+
+ return bundles.toArray(new Bundle[bundles.size()]);
+ }
+
+ public RequiredBundle[] getRequiredBundles(String symbolicName)
+ {
+ // [TODO] getRequiredBundles(String symbolicName)
+ log.info("Not implemented getRequiredBundles");
+ return null;
+ }
+
+ public void refreshPackages(Bundle[] bundles)
+ {
+ // [TODO] refreshPackages(Bundle[] bundles)
+ log.debug("Ignore refreshPackages");
+ }
+
+ public boolean resolveBundles(Bundle[] bundleArr)
+ {
+ // Collect the bundles that are in state INSTALLED
+ List<Bundle> unresolvedBundles = new ArrayList<Bundle>();
+ if (bundleArr == null)
+ {
+ for (Bundle bundle : getBundleManager().getBundles(Bundle.INSTALLED))
+ {
+ AbstractBundleState bundleState = AbstractBundleState.assertBundleState(bundle);
+ if (bundleState.isFragment() == false)
+ unresolvedBundles.add(bundleState);
+ }
+ }
+ else
+ {
+ for (Bundle bundle : bundleArr)
+ {
+ if (bundle.getState() == Bundle.INSTALLED)
+ unresolvedBundles.add(OSGiBundleState.assertBundleState(bundle));
+ }
+ }
+
+ if (unresolvedBundles.isEmpty())
+ return true;
+
+ List<OSGiBundleState> resolvableBundles = new ArrayList<OSGiBundleState>();
+
+ // Check if the external resolver plugin is available
+ Resolver bundleResolver = getBundleManager().getOptionalPlugin(ResolverPlugin.class);
+ if (bundleResolver != null)
+ {
+ // Resolve the bundles through the resolver
+ for (ResolverBundle aux : bundleResolver.resolve(unresolvedBundles))
+ resolvableBundles.add(OSGiBundleState.assertBundleState(aux.getBundle()));
+ }
+ else
+ {
+ // Every unresolved bundle is automatically copied
+ // to the list of externaly resolved bundles
+ for (Bundle aux : unresolvedBundles)
+ resolvableBundles.add(OSGiBundleState.assertBundleState(aux));
+ }
+
+ boolean allResolved = resolvableBundles.containsAll(unresolvedBundles);
+
+ // TODO [JBDEPLOY-226] Allow multiple deployments to change state at once
+ int resolved = 1;
+ while (resolved > 0)
+ {
+ resolved = 0;
+ Iterator<OSGiBundleState> it = resolvableBundles.iterator();
+ while (it.hasNext())
+ {
+ OSGiBundleState bundleState = it.next();
+ try
+ {
+ boolean bundleResolved = getBundleManager().resolveBundle(bundleState, false);
+ if (bundleResolved)
+ {
+ it.remove();
+ resolved++;
+ }
+ }
+ catch (BundleException ex)
+ {
+ // ignore
+ }
+ }
+ }
+
+ // Sanity check, that the controller could actually also resolve these bundles
+ if (resolvableBundles.isEmpty() == false)
+ {
+ log.error("Controller could not resolve: " + resolvableBundles);
+ for (OSGiBundleState bundleState : resolvableBundles)
+ {
+ try
+ {
+ getBundleManager().resolveBundle(bundleState, true);
+ }
+ catch (Exception ex)
+ {
+ log.debug("Cannot resolve: " + bundleState, ex);
+ }
+ }
+ }
+
+ allResolved = allResolved && resolvableBundles.isEmpty();
+ return allResolved;
+ }
+}
\ No newline at end of file
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/SystemExportedPackage.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/SystemExportedPackage.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/packageadmin/SystemExportedPackage.java 2010-02-15 21:18:31 UTC (rev 100995)
@@ -0,0 +1,41 @@
+/*
+ * 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.packageadmin;
+
+//$Id: StartLevelImpl.java 93118 2009-09-02 08:24:44Z thomas.diesler(a)jboss.com $
+
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.osgi.service.packageadmin.ExportedPackage;
+
+/**
+ * An implementation of the {@link ExportedPackage} for packages exported by the system bundle..
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Feb-2010
+ */
+class SystemExportedPackage extends AbstractExportedPackage
+{
+ SystemExportedPackage(AbstractBundleState bundle, String packageName)
+ {
+ super(bundle, packageName);
+ }
+}
\ No newline at end of file
Deleted: 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-02-15 21:12:39 UTC (rev 100994)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java 2010-02-15 21:18:31 UTC (rev 100995)
@@ -1,324 +0,0 @@
-/*
- * 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.service.internal;
-
-//$Id: StartLevelImpl.java 93118 2009-09-02 08:24:44Z thomas.diesler(a)jboss.com $
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jboss.classloading.plugins.metadata.PackageCapability;
-import org.jboss.classloading.spi.dependency.ClassLoading;
-import org.jboss.classloading.spi.dependency.Module;
-import org.jboss.classloading.spi.metadata.CapabilitiesMetaData;
-import org.jboss.classloading.spi.metadata.Capability;
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.deployers.plugins.classloading.AbstractDeploymentClassLoaderPolicyModule;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.logging.Logger;
-import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
-import org.jboss.osgi.framework.bundle.OSGiFragmentState;
-import org.jboss.osgi.framework.plugins.PackageAdminPlugin;
-import org.jboss.osgi.framework.plugins.ResolverPlugin;
-import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
-import org.jboss.osgi.framework.resolver.Resolver;
-import org.jboss.osgi.framework.resolver.ResolverBundle;
-import org.jboss.osgi.spi.NotImplementedException;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.framework.Version;
-import org.osgi.service.packageadmin.ExportedPackage;
-import org.osgi.service.packageadmin.PackageAdmin;
-import org.osgi.service.packageadmin.RequiredBundle;
-
-/**
- * An implementation of the {@link PackageAdmin}.
- *
- * [TODO] [JBOSGI-149] Fully implement PackageAdmin
- *
- * @author thomas.diesler(a)jboss.com
- * @since 03-Sep-2009
- */
-public class PackageAdminImpl extends AbstractServicePlugin implements PackageAdminPlugin
-{
- /** The log */
- private static final Logger log = Logger.getLogger(PackageAdminImpl.class);
-
- private ServiceRegistration registration;
-
- public PackageAdminImpl(OSGiBundleManager bundleManager)
- {
- super(bundleManager);
- }
-
- public void startService()
- {
- BundleContext sysContext = getSystemContext();
- registration = sysContext.registerService(PackageAdmin.class.getName(), this, null);
- }
-
- public void stopService()
- {
- if (registration != null)
- {
- registration.unregister();
- registration = null;
- }
- }
-
- @SuppressWarnings("rawtypes")
- public Bundle getBundle(Class clazz)
- {
- if (clazz == null)
- throw new IllegalArgumentException("Null class");
-
- ClassLoader classLoader = clazz.getClassLoader();
- Module module = ClassLoading.getModuleForClassLoader(classLoader);
- if (module instanceof AbstractDeploymentClassLoaderPolicyModule)
- {
- AbstractDeploymentClassLoaderPolicyModule deploymentModule = (AbstractDeploymentClassLoaderPolicyModule)module;
- DeploymentUnit unit = deploymentModule.getDeploymentUnit();
- AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
- if (bundleState != null)
- {
- // Return the fragment's host bundle
- if (bundleState.isFragment())
- bundleState = ((OSGiFragmentState)bundleState).getFragmentHost();
-
- return bundleState.getBundleInternal();
- }
- }
- return null;
- }
-
- public int getBundleType(Bundle bundle)
- {
- throw new NotImplementedException();
- }
-
- public Bundle[] getBundles(String symbolicName, String versionRange)
- {
- throw new NotImplementedException();
- }
-
- public ExportedPackage getExportedPackage(String name)
- {
- throw new NotImplementedException();
- }
-
- public ExportedPackage[] getExportedPackages(Bundle bundle)
- {
- AbstractBundleState abstractBundleState = getBundleManager().getBundleState(bundle);
-
- // [TODO] exported packages for the system bundle
- if (abstractBundleState instanceof OSGiBundleState == false)
- throw new UnsupportedOperationException("FIXME: getExportedPackages for System bundle");
-
- AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)abstractBundleState;
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- ClassLoadingMetaData metaData = unit.getAttachment(ClassLoadingMetaData.class);
- if (metaData == null)
- throw new IllegalStateException("Cannot obtain ClassLoadingMetaData");
-
- List<ExportedPackage> exported = new ArrayList<ExportedPackage>();
- CapabilitiesMetaData capabilities = metaData.getCapabilities();
- for (Capability capability : capabilities.getCapabilities())
- {
- if (capability instanceof PackageCapability)
- {
- exported.add(new ExportedPackageImpl(bundleState, (PackageCapability)capability));
- }
- }
- if (exported.size() == 0)
- return null;
-
- ExportedPackage[] result = new ExportedPackage[exported.size()];
- exported.toArray(result);
-
- return result;
- }
-
- public ExportedPackage[] getExportedPackages(String name)
- {
- throw new NotImplementedException();
- }
-
- public Bundle[] getFragments(Bundle bundle)
- {
- throw new NotImplementedException();
- }
-
- public Bundle[] getHosts(Bundle bundle)
- {
- throw new NotImplementedException();
- }
-
- public RequiredBundle[] getRequiredBundles(String symbolicName)
- {
- throw new NotImplementedException();
- }
-
- public void refreshPackages(Bundle[] bundles)
- {
- // [TODO] refreshPackages(Bundle[] bundles)
- log.debug("Ignore refreshPackages");
- }
-
- public boolean resolveBundles(Bundle[] bundleArr)
- {
- // Collect the bundles that are in state INSTALLED
- List<Bundle> unresolvedBundles = new ArrayList<Bundle>();
- if (bundleArr == null)
- {
- for (Bundle bundle : getBundleManager().getBundles(Bundle.INSTALLED))
- {
- AbstractBundleState bundleState = AbstractBundleState.assertBundleState(bundle);
- if (bundleState.isFragment() == false)
- unresolvedBundles.add(bundleState);
- }
- }
- else
- {
- for (Bundle bundle : bundleArr)
- {
- if (bundle.getState() == Bundle.INSTALLED)
- unresolvedBundles.add(OSGiBundleState.assertBundleState(bundle));
- }
- }
-
- if (unresolvedBundles.isEmpty())
- return true;
-
- List<OSGiBundleState> resolvableBundles = new ArrayList<OSGiBundleState>();
-
- // Check if the external resolver plugin is available
- Resolver bundleResolver = getBundleManager().getOptionalPlugin(ResolverPlugin.class);
- if (bundleResolver != null)
- {
- // Resolve the bundles through the resolver
- for (ResolverBundle aux : bundleResolver.resolve(unresolvedBundles))
- resolvableBundles.add(OSGiBundleState.assertBundleState(aux.getBundle()));
- }
- else
- {
- // Every unresolved bundle is automatically copied
- // to the list of externaly resolved bundles
- for (Bundle aux : unresolvedBundles)
- resolvableBundles.add(OSGiBundleState.assertBundleState(aux));
- }
-
- boolean allResolved = resolvableBundles.containsAll(unresolvedBundles);
-
- // TODO [JBDEPLOY-226] Allow multiple deployments to change state at once
- int resolved = 1;
- while (resolved > 0)
- {
- resolved = 0;
- Iterator<OSGiBundleState> it = resolvableBundles.iterator();
- while (it.hasNext())
- {
- OSGiBundleState bundleState = it.next();
- try
- {
- boolean bundleResolved = getBundleManager().resolveBundle(bundleState, false);
- if (bundleResolved)
- {
- it.remove();
- resolved++;
- }
- }
- catch (BundleException ex)
- {
- // ignore
- }
- }
- }
-
- // Sanity check, that the controller could actually also resolve these bundles
- if (resolvableBundles.isEmpty() == false)
- {
- log.error("Controller could not resolve: " + resolvableBundles);
- for (OSGiBundleState bundleState : resolvableBundles)
- {
- try
- {
- getBundleManager().resolveBundle(bundleState, true);
- }
- catch (Exception ex)
- {
- log.debug("Cannot resolve: " + bundleState, ex);
- }
- }
- }
-
- allResolved = allResolved && resolvableBundles.isEmpty();
- return allResolved;
- }
-
- private static class ExportedPackageImpl implements ExportedPackage
- {
- private Bundle bundle;
- private PackageCapability capability;
-
- public ExportedPackageImpl(AbstractBundleState bundle, PackageCapability capability)
- {
- this.bundle = bundle.getBundle();
- this.capability = capability;
- }
-
- public Bundle getExportingBundle()
- {
- return bundle;
- }
-
- public Bundle[] getImportingBundles()
- {
- throw new NotImplementedException();
- }
-
- public String getName()
- {
- return capability.getName();
- }
-
- public String getSpecificationVersion()
- {
- throw new NotImplementedException();
- }
-
- public Version getVersion()
- {
- return Version.parseVersion(capability.getVersion().toString());
- }
-
- public boolean isRemovalPending()
- {
- throw new NotImplementedException();
- }
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/compendium/PackageAdminTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/compendium/PackageAdminTestCase.java 2010-02-15 21:12:39 UTC (rev 100994)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/compendium/PackageAdminTestCase.java 2010-02-15 21:18:31 UTC (rev 100995)
@@ -23,7 +23,7 @@
import junit.framework.Test;
-import org.jboss.osgi.framework.service.internal.PackageAdminImpl;
+import org.jboss.osgi.framework.packageadmin.PackageAdminImpl;
import org.jboss.test.osgi.FrameworkTest;
import org.jboss.test.osgi.compendium.support.b.Other;
import org.jboss.test.osgi.compendium.support.a.PA;
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-02-15 21:12:39 UTC (rev 100994)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml 2010-02-15 21:18:31 UTC (rev 100995)
@@ -95,7 +95,7 @@
<bean name="StartLevelService" class="org.jboss.osgi.framework.service.internal.StartLevelImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="PackageAdminService" class="org.jboss.osgi.framework.service.internal.PackageAdminImpl">
+ <bean name="PackageAdminService" class="org.jboss.osgi.framework.packageadmin.PackageAdminImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="DeployerService" class="org.jboss.osgi.framework.service.internal.DeployerServiceImpl">
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-02-15 21:12:39 UTC (rev 100994)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-02-15 21:18:31 UTC (rev 100995)
@@ -132,7 +132,7 @@
<bean name="StartLevelService" class="org.jboss.osgi.framework.service.internal.StartLevelImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="PackageAdminService" class="org.jboss.osgi.framework.service.internal.PackageAdminImpl">
+ <bean name="PackageAdminService" class="org.jboss.osgi.framework.packageadmin.PackageAdminImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="DeployerService" class="org.jboss.osgi.framework.service.internal.DeployerServiceImpl">
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-02-15 21:12:39 UTC (rev 100994)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml 2010-02-15 21:18:31 UTC (rev 100995)
@@ -125,7 +125,7 @@
<bean name="StartLevelService" class="org.jboss.osgi.framework.service.internal.StartLevelImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="PackageAdminService" class="org.jboss.osgi.framework.service.internal.PackageAdminImpl">
+ <bean name="PackageAdminService" class="org.jboss.osgi.framework.packageadmin.PackageAdminImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="DeployerService" class="org.jboss.osgi.framework.service.internal.DeployerServiceImpl">
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2010-02-15 21:12:39 UTC (rev 100994)
+++ projects/jboss-osgi/trunk/pom.xml 2010-02-15 21:18:31 UTC (rev 100995)
@@ -44,8 +44,10 @@
<!-- Properties -->
<properties>
<version.apache.ant>1.7.0</version.apache.ant>
- <version.apache.aries.blueprint>1.0.0.20100120</version.apache.aries.blueprint>
- <version.apache.aries.util>1.0.0.20100120</version.apache.aries.util>
+ <version.apache.aries.blueprint>1.0.0-incubating-SNAPSHOT</version.apache.aries.blueprint>
+ <version.apache.aries.jmx>1.0.0-incubating-SNAPSHOT</version.apache.aries.jmx>
+ <version.apache.aries.jndi>1.0.0-incubating-SNAPSHOT</version.apache.aries.jndi>
+ <version.apache.aries.util>1.0.0-incubating-SNAPSHOT</version.apache.aries.util>
<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>
@@ -101,6 +103,16 @@
<version>${version.apache.aries.blueprint}</version>
</dependency>
<dependency>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>org.apache.aries.jmx</artifactId>
+ <version>${version.apache.aries.jmx}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.jndi</groupId>
+ <artifactId>org.apache.aries.jndi</artifactId>
+ <version>${version.apache.aries.jndi}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.aries</groupId>
<artifactId>org.apache.aries.util</artifactId>
<version>${version.apache.aries.util}</version>
Modified: projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml 2010-02-15 21:12:39 UTC (rev 100994)
+++ projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml 2010-02-15 21:18:31 UTC (rev 100995)
@@ -29,6 +29,8 @@
<include>*:jboss-osgi-webapp:jar</include>
<include>*:jboss-osgi-xml-binding:jar</include>
<include>*:org.apache.aries.blueprint:jar</include>
+ <include>*:org.apache.aries.jmx:jar</include>
+ <include>*:org.apache.aries.jndi:jar</include>
<include>*:org.apache.aries.util:jar</include>
<include>*:org.apache.felix.configadmin:jar</include>
<include>*:org.apache.felix.eventadmin:jar</include>
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/enterprise/jmx/JMXEnterpriseTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/enterprise/jmx/JMXEnterpriseTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/enterprise/jmx/JMXEnterpriseTestCase.java 2010-02-15 21:18:31 UTC (rev 100995)
@@ -0,0 +1,105 @@
+/*
+ * 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.test.osgi.example.enterprise.jmx;
+
+//$Id: JMXTestCase.java 95465 2009-10-23 05:59:57Z thomas.diesler(a)jboss.com $
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.openmbean.TabularData;
+
+import org.jboss.osgi.jmx.JMXCapability;
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.ObjectNameFactory;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.jboss.osgi.testing.OSGiTestHelper;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osgi.jmx.framework.BundleStateMBean;
+
+/**
+ * A test that deployes a bundle that registeres an MBean
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Feb-2010
+ */
+public class JMXEnterpriseTestCase extends OSGiTest
+{
+ private static OSGiRuntime runtime;
+
+ private BundleStateMBean bundleState;
+
+ @BeforeClass
+ public static void setUpClass() throws Exception
+ {
+ OSGiTestHelper helper = new OSGiTestHelper();
+ runtime = helper.getDefaultRuntime();
+ runtime.addCapability(new JMXCapability());
+
+ // Optionally install/start the Apache Aries JMX bundle
+ if (runtime.getBundle("org.apache.aries.jmx", null) == null)
+ runtime.installBundle("bundles/org.apache.aries.jmx.jar").start();
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception
+ {
+ runtime.shutdown();
+ runtime = null;
+ }
+
+ @Test
+ public void testBundleStateMBean() throws Exception
+ {
+ BundleStateMBean bundleState = getBundleStateMBean();
+ assertNotNull("BundleStateMBean not null", bundleState);
+
+ TabularData bundleData = bundleState.listBundles();
+ assertNotNull("TabularData not null", bundleData);
+ assertFalse("TabularData not empty", bundleData.isEmpty());
+ }
+
+ private BundleStateMBean getBundleStateMBean() throws Exception
+ {
+ if (bundleState == null)
+ {
+ int timeout = 5000;
+ MBeanServerConnection mbeanServer = runtime.getMBeanServer();
+ ObjectName objectName = ObjectNameFactory.create(BundleStateMBean.OBJECTNAME);
+ while (bundleState == null && 0 < (timeout -= 200))
+ {
+ if (mbeanServer.isRegistered(objectName))
+ {
+ bundleState = MBeanProxy.get(BundleStateMBean.class, objectName, mbeanServer);
+ break;
+ }
+ Thread.sleep(200);
+ }
+ }
+ return bundleState;
+ }
+}
\ No newline at end of file
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-02-15 21:12:39 UTC (rev 100994)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-02-15 21:18:31 UTC (rev 100995)
@@ -108,7 +108,7 @@
<bean name="StartLevelService" class="org.jboss.osgi.framework.service.internal.StartLevelImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="PackageAdminService" class="org.jboss.osgi.framework.service.internal.PackageAdminImpl">
+ <bean name="PackageAdminService" class="org.jboss.osgi.framework.packageadmin.PackageAdminImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="DeployerService" class="org.jboss.osgi.framework.service.internal.DeployerServiceImpl">
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-02-15 21:12:39 UTC (rev 100994)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-02-15 21:18:31 UTC (rev 100995)
@@ -94,7 +94,7 @@
<bean name="StartLevelService" class="org.jboss.osgi.framework.service.internal.StartLevelImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="PackageAdminService" class="org.jboss.osgi.framework.service.internal.PackageAdminImpl">
+ <bean name="PackageAdminService" class="org.jboss.osgi.framework.packageadmin.PackageAdminImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="DeployerService" class="org.jboss.osgi.framework.service.internal.DeployerServiceImpl">
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2010-02-15 21:12:39 UTC (rev 100994)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2010-02-15 21:18:31 UTC (rev 100995)
@@ -55,8 +55,8 @@
<groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-deployment</artifactId>
</dependency>
-
- <!-- Bundle Dependencies -->
+
+ <!-- Apache Aries Dependencies -->
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint</artifactId>
@@ -69,6 +69,18 @@
</exclusions>
</dependency>
<dependency>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>org.apache.aries.jmx</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.jndi</groupId>
+ <artifactId>org.apache.aries.jndi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Bundle Dependencies -->
+ <dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.log</artifactId>
<scope>provided</scope>
14 years, 4 months