JBoss-OSGI SVN: r100176 - projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-6.0.1.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-31 01:18:56 -0500 (Sun, 31 Jan 2010)
New Revision: 100176
Modified:
projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-6.0.1/config.xml
Log:
Fix zip source
Modified: projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-6.0.1/config.xml
===================================================================
--- projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-6.0.1/config.xml 2010-01-31 06:16:55 UTC (rev 100175)
+++ projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-6.0.1/config.xml 2010-01-31 06:18:56 UTC (rev 100176)
@@ -74,7 +74,7 @@
#
# Create new jboss.zip
#
-cd build/output
+cd $JBOSS_HOME/..
zip -r $JBOSS_ZIP $JBOSS_VERSION/*
</command>
14 years, 3 months
JBoss-OSGI SVN: r100175 - projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-6.0.1.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-31 01:16:55 -0500 (Sun, 31 Jan 2010)
New Revision: 100175
Modified:
projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-6.0.1/config.xml
Log:
cp --backup
Modified: projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-6.0.1/config.xml
===================================================================
--- projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-6.0.1/config.xml 2010-01-31 06:01:50 UTC (rev 100174)
+++ projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-6.0.1/config.xml 2010-01-31 06:16:55 UTC (rev 100175)
@@ -53,8 +53,7 @@
#
# Start JBossAS
#
-cp $JBOSS_HOME/bin/run.sh $JBOSS_HOME/bin/run.sh.org
-cp $HUDSONBIN/run-with-pid.sh $JBOSS_HOME/bin/run.sh
+cp --backup $HUDSONBIN/run-with-pid.sh $JBOSS_HOME/bin/run.sh
$HUDSONBIN/startup.sh $JBOSS_HOME start $SERVER_NAME $JBOSS_BINDADDR
#
14 years, 3 months
JBoss-OSGI SVN: r100174 - projects/jboss-osgi/trunk/hudson/hudson-home.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-31 01:01:50 -0500 (Sun, 31 Jan 2010)
New Revision: 100174
Modified:
projects/jboss-osgi/trunk/hudson/hudson-home/command.sh
Log:
cp --backup
Modified: projects/jboss-osgi/trunk/hudson/hudson-home/command.sh
===================================================================
--- projects/jboss-osgi/trunk/hudson/hudson-home/command.sh 2010-01-30 21:39:45 UTC (rev 100173)
+++ projects/jboss-osgi/trunk/hudson/hudson-home/command.sh 2010-01-31 06:01:50 UTC (rev 100174)
@@ -18,8 +18,7 @@
RUNTIME_HOME=$WORKSPACE/$JBOSS_BUILD
RUNTIME_LOG=$RUNTIME_HOME/server/$SERVER_NAME/log/server.log
rm -rf $RUNTIME_HOME; unzip -q $JBOSS_ZIP -d $WORKSPACE
- cp $RUNTIME_HOME/bin/run.sh $RUNTIME_HOME/bin/run.sh.org
- cp $HUDSONBIN/run-with-pid.sh $RUNTIME_HOME/bin/run.sh
+ cp --backup $HUDSONBIN/run-with-pid.sh $RUNTIME_HOME/bin/run.sh
;;
'jboss510')
SERVER_NAME=default
@@ -28,8 +27,7 @@
RUNTIME_HOME=$WORKSPACE/$JBOSS_BUILD
RUNTIME_LOG=$RUNTIME_HOME/server/$SERVER_NAME/log/server.log
rm -rf $RUNTIME_HOME; unzip -q $JBOSS_ZIP -d $WORKSPACE
- cp $RUNTIME_HOME/bin/run.sh $RUNTIME_HOME/bin/run.sh.org
- cp $HUDSONBIN/run-with-pid.sh $RUNTIME_HOME/bin/run.sh
+ cp --backup $HUDSONBIN/run-with-pid.sh $RUNTIME_HOME/bin/run.sh
;;
'jboss600')
SERVER_NAME=default
@@ -38,8 +36,7 @@
RUNTIME_HOME=$WORKSPACE/$JBOSS_BUILD
RUNTIME_LOG=$RUNTIME_HOME/server/$SERVER_NAME/log/server.log
rm -rf $RUNTIME_HOME; unzip -q $JBOSS_ZIP -d $WORKSPACE
- cp $RUNTIME_HOME/bin/run.sh $RUNTIME_HOME/bin/run.sh.org
- cp $HUDSONBIN/run-with-pid.sh $RUNTIME_HOME/bin/run.sh
+ cp --backup $HUDSONBIN/run-with-pid.sh $RUNTIME_HOME/bin/run.sh
;;
'jboss601')
SERVER_NAME=default
@@ -48,8 +45,7 @@
RUNTIME_HOME=$WORKSPACE/$JBOSS_BUILD
RUNTIME_LOG=$RUNTIME_HOME/server/$SERVER_NAME/log/server.log
rm -rf $RUNTIME_HOME; unzip -q $JBOSS_ZIP -d $WORKSPACE
- cp $RUNTIME_HOME/bin/run.sh $RUNTIME_HOME/bin/run.sh.org
- cp $HUDSONBIN/run-with-pid.sh $RUNTIME_HOME/bin/run.sh
+ cp --backup $HUDSONBIN/run-with-pid.sh $RUNTIME_HOME/bin/run.sh
;;
'runtime')
SERVER_NAME=all
14 years, 3 months
JBoss-OSGI SVN: r100151 - projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-29 19:17:13 -0500 (Fri, 29 Jan 2010)
New Revision: 100151
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BasicResolverImpl.java
Log:
Ignore the system bundle and fragments
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BasicResolverImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BasicResolverImpl.java 2010-01-30 00:04:38 UTC (rev 100150)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BasicResolverImpl.java 2010-01-30 00:17:13 UTC (rev 100151)
@@ -36,6 +36,7 @@
import org.jboss.classloading.spi.version.VersionRange;
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;
@@ -70,8 +71,9 @@
@Override
public ResolverBundle addBundle(Bundle bundle)
{
- // Ignore the system bundle
- if (bundle.getBundleId() == 0)
+ // Ignore the system bundle and fragments
+ AbstractBundleState bundleState = AbstractBundleState.assertBundleState(bundle);
+ if (bundleState instanceof OSGiBundleState == false)
return null;
return super.addBundle(bundle);
14 years, 3 months
JBoss-OSGI SVN: r100150 - projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-29 19:04:38 -0500 (Fri, 29 Jan 2010)
New Revision: 100150
Modified:
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
Log:
AS6 startup ok
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-01-29 23:27:19 UTC (rev 100149)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-01-30 00:04:38 UTC (rev 100150)
@@ -103,6 +103,9 @@
<parameter><inject bean="OSGiDeploymentRegistry" /></parameter>
</constructor>
</bean>
+ <bean name="OSGiBundleResolver" class="org.jboss.osgi.framework.resolver.internal.basic.BasicResolverImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
14 years, 3 months
JBoss-OSGI SVN: r100147 - in projects/jboss-osgi: trunk/distribution/installer/src/main/resources/jbossas and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-29 18:01:06 -0500 (Fri, 29 Jan 2010)
New Revision: 100147
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployerTempWorkaround.java
Modified:
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
Log:
Fix more AS6 integration issues
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployerTempWorkaround.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployerTempWorkaround.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployerTempWorkaround.java 2010-01-29 23:01:06 UTC (rev 100147)
@@ -0,0 +1,69 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.deployers;
+
+import org.jboss.classloading.spi.dependency.ClassLoading;
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.classloading.spi.dependency.policy.ClassLoaderPolicyModule;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer;
+import org.jboss.osgi.framework.classloading.OSGiClassLoadingMetaData;
+import org.jboss.osgi.framework.classloading.OSGiModule;
+
+/**
+ * [TODO] Remove this deployer when the VFSClassLoaderDescribeDeployer
+ * suports an already attached Module.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @version $Revision: 100143 $
+ */
+public class OSGiModuleDeployerTempWorkaround extends VFSClassLoaderDescribeDeployer
+{
+ public OSGiModuleDeployerTempWorkaround()
+ {
+ // Make sure we come after the ClassLoaderDescribeDeployer
+ setInput(Module.class);
+ }
+
+ @Override
+ public void deploy(DeploymentUnit unit, ClassLoadingMetaData metaData) throws DeploymentException
+ {
+ // If there is already a module attached and this is an OSGi deployment
+ // remove the old module and create a new OSGiModule
+ if (metaData instanceof OSGiClassLoadingMetaData)
+ {
+ Module module = unit.removeAttachment(Module.class);
+ ClassLoading classLoading = getClassLoading();
+ classLoading.removeModule(module);
+ unit.removeAttachment(Module.class);
+ super.deploy(unit, metaData);
+ }
+ }
+
+ @Override
+ protected ClassLoaderPolicyModule createModule(DeploymentUnit unit, ClassLoadingMetaData metaData)
+ {
+ return new OSGiModule(unit, metaData);
+ }
+}
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-01-29 22:59:14 UTC (rev 100146)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-01-29 23:01:06 UTC (rev 100147)
@@ -177,6 +177,7 @@
<bean name="OSGiBundleStateRemoveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateRemoveDeployer">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="OSGiBundleStructure" class="org.jboss.osgi.deployer.BundleStructureDeployer" />
<bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
<bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />
@@ -207,10 +208,9 @@
<property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
</bean>
<bean name="OSGiFragmentAttachmentDeployer" class="org.jboss.osgi.framework.deployers.OSGiFragmentAttachmentDeployer"/>
-
- <!-- bean name="OSGiModuleDeployer" class="org.jboss.osgi.framework.deployers.OSGiModuleDeployer">
+ <bean name="OSGiModuleDeployer" class="org.jboss.osgi.framework.deployers.OSGiModuleDeployerTempWorkaround">
<property name="classLoading"><inject bean="ClassLoading" /></property>
- </bean -->
+ </bean>
<!--
********************************
14 years, 3 months
JBoss-OSGI SVN: r100143 - in projects/jboss-osgi: trunk/distribution/installer/src/main/resources/jbossas and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-29 13:35:27 -0500 (Fri, 29 Jan 2010)
New Revision: 100143
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployer.java
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-6.0.1/config.xml
Log:
AS6 integration - WIP
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployer.java 2010-01-29 18:33:01 UTC (rev 100142)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployer.java 2010-01-29 18:35:27 UTC (rev 100143)
@@ -23,7 +23,6 @@
import org.jboss.classloading.spi.dependency.policy.ClassLoaderPolicyModule;
import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer;
import org.jboss.osgi.framework.classloading.OSGiModule;
@@ -36,8 +35,31 @@
*/
public class OSGiModuleDeployer extends VFSClassLoaderDescribeDeployer
{
+ /* [TODO] We don't need to overwrite deploy if the base class can handle an already attached Module
+ public void deploy(DeploymentUnit unit, ClassLoadingMetaData metaData) throws DeploymentException
+ {
+ // If there is no module attached proceed as normal
+ Module module = unit.getAttachment(Module.class);
+ if (module == null)
+ {
+ super.deploy(unit, metaData);
+ return;
+ }
+
+ // If there is already a module attached and this is an OSGi deployment
+ // remove the old module and create a new OSGiModule
+ if (metaData instanceof OSGiClassLoadingMetaData)
+ {
+ ClassLoading classLoading = getClassLoading();
+ classLoading.removeModule(module);
+ unit.removeAttachment(Module.class);
+ super.deploy(unit, metaData);
+ }
+ }
+ */
+
@Override
- protected ClassLoaderPolicyModule createModule(DeploymentUnit unit, ClassLoadingMetaData metaData) throws DeploymentException
+ protected ClassLoaderPolicyModule createModule(DeploymentUnit unit, ClassLoadingMetaData metaData)
{
return new OSGiModule(unit, metaData);
}
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-01-29 18:33:01 UTC (rev 100142)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-01-29 18:35:27 UTC (rev 100143)
@@ -207,6 +207,10 @@
<property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
</bean>
<bean name="OSGiFragmentAttachmentDeployer" class="org.jboss.osgi.framework.deployers.OSGiFragmentAttachmentDeployer"/>
+
+ <!-- bean name="OSGiModuleDeployer" class="org.jboss.osgi.framework.deployers.OSGiModuleDeployer">
+ <property name="classLoading"><inject bean="ClassLoading" /></property>
+ </bean -->
<!--
********************************
Modified: projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-6.0.1/config.xml
===================================================================
--- projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-6.0.1/config.xml 2010-01-29 18:33:01 UTC (rev 100142)
+++ projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-6.0.1/config.xml 2010-01-29 18:35:27 UTC (rev 100143)
@@ -40,7 +40,7 @@
JBOSS_VERSION=jboss-6.0.0-SNAPSHOT
SERVER_NAME=default
-JBOSS_HOME=$WORKSPACE/jbossas/build/output/$JBOSS_VERSION
+JBOSS_HOME=$WORKSPACE/jbossas/build/target/$JBOSS_VERSION
JBOSS_ZIP=$HUDSON_HOME/../jboss/$JBOSS_VERSION.zip
JBOSS_BINDADDR=(a)jboss.bind.address@
14 years, 3 months
JBoss-OSGI SVN: r100130 - in projects/jboss-osgi: trunk/distribution/installer/src/main/resources/jbossas and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-29 11:04:52 -0500 (Fri, 29 Jan 2010)
New Revision: 100130
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
Log:
Add switch to disableMDRUsage
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java 2010-01-29 16:03:53 UTC (rev 100129)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java 2010-01-29 16:04:52 UTC (rev 100130)
@@ -78,21 +78,30 @@
private Kernel kernel;
/** The previous context tracker */
private ContextTracker previousTracker;
+ /** Enable MDR usage */
+ private boolean enableMDRUsage = true;
public ServiceManagerPluginImpl(OSGiBundleManager bundleManager)
{
super(bundleManager);
}
+ public void setEnableMDRUsage(boolean mdrUsage)
+ {
+ this.enableMDRUsage = mdrUsage;
+ }
+
public void start()
{
kernel = getBundleManager().getKernel();
- applyMDRUsage(true);
+ if (enableMDRUsage == true)
+ applyMDRUsage(true);
}
public void stop()
{
- applyMDRUsage(false);
+ if (enableMDRUsage == true)
+ applyMDRUsage(false);
}
public ServiceReference[] getRegisteredServices(AbstractBundleState bundleState)
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-01-29 16:03:53 UTC (rev 100129)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-01-29 16:04:52 UTC (rev 100130)
@@ -96,6 +96,7 @@
</property>
</bean>
-->
+
<bean name="OSGiControllerContextPlugin" class="org.jboss.osgi.framework.bundle.ControllerContextPluginImpl">
<constructor>
<parameter><inject bean="OSGiBundleManager" /></parameter>
@@ -107,6 +108,7 @@
</bean>
<bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ <property name="enableMDRUsage">false</property>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
@@ -159,7 +161,6 @@
********************************
-->
- <!-- The deployment registry -->
<bean name="OSGiDeploymentRegistry" class="org.jboss.deployers.structure.spi.helpers.AbstractDeploymentRegistry"/>
<bean name="OSGiDeployersWrapper" class="org.jboss.osgi.framework.deployers.OSGiDeployersWrapper" >
@@ -169,7 +170,6 @@
</constructor>
</bean>
- <!-- OSGI Deployment -->
<bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
<bean name="OSGiBundleStateAddDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateAddDeployer">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
@@ -215,7 +215,7 @@
* *
********************************
-->
-
+
<bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.framework.launch.OSGiFramework">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
14 years, 3 months
JBoss-OSGI SVN: r100123 - in projects/jboss-osgi: projects/runtime/framework/trunk/src/etc/osgitck and 6 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-29 09:52:04 -0500 (Fri, 29 Jan 2010)
New Revision: 100123
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java
Removed:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextServiceManager.java
Modified:
projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
Log:
Restore ServiceManagerPluginImpl
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-01-29 14:30:22 UTC (rev 100122)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-29 14:52:04 UTC (rev 100123)
@@ -82,7 +82,7 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ControllerContextServiceManager">
+ <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml 2010-01-29 14:30:22 UTC (rev 100122)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml 2010-01-29 14:52:04 UTC (rev 100123)
@@ -62,7 +62,7 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiServiceManagerPlugin" class="org.jboss.osgi.framework.bundle.ControllerContextServiceManager">
+ <bean name="OSGiServiceManagerPlugin" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextServiceManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextServiceManager.java 2010-01-29 14:30:22 UTC (rev 100122)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextServiceManager.java 2010-01-29 14:52:04 UTC (rev 100123)
@@ -1,403 +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.bundle;
-
-//$Id$
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.tracker.ContextTracker;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.kernel.spi.qualifier.QualifierMatchers;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader;
-import org.jboss.metadata.spi.MutableMetaData;
-import org.jboss.metadata.spi.repository.MutableMetaDataRepository;
-import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
-import org.jboss.metadata.spi.retrieval.MetaDataRetrievalFactory;
-import org.jboss.metadata.spi.scope.CommonLevels;
-import org.jboss.metadata.spi.scope.ScopeKey;
-import org.jboss.osgi.framework.plugins.ControllerContextPlugin;
-import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
-import org.jboss.osgi.framework.plugins.ServiceManagerPlugin;
-import org.jboss.osgi.framework.plugins.internal.AbstractPlugin;
-import org.jboss.osgi.framework.util.KernelUtils;
-import org.jboss.osgi.framework.util.NoFilter;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceReference;
-
-/**
- * A plugin that manages OSGi services.
- *
- * This implementation handles service integration with the MC.
- *
- *
- * @author thomas.diesler(a)jboss.com
- * @since 20-Jan-2010
- */
-public class ControllerContextServiceManager extends AbstractPlugin implements ServiceManagerPlugin
-{
- // Provide logging
- final Logger log = Logger.getLogger(ControllerContextServiceManager.class);
-
- /** The kernel */
- private Kernel kernel;
- /** The previous context tracker */
- private ContextTracker previousTracker;
-
- public ControllerContextServiceManager(OSGiBundleManager bundleManager)
- {
- super(bundleManager);
- }
-
- public void start()
- {
- kernel = getBundleManager().getKernel();
- applyMDRUsage(true);
- }
-
- public void stop()
- {
- applyMDRUsage(false);
- }
-
- public ServiceReference[] getRegisteredServices(AbstractBundleState bundleState)
- {
- ControllerContextPlugin plugin = getBundleManager().getPlugin(ControllerContextPlugin.class);
- Set<ControllerContext> contexts = plugin.getRegisteredContexts(bundleState);
- if (contexts.isEmpty())
- return null;
-
- Set<ServiceReference> result = new HashSet<ServiceReference>();
- for (ControllerContext context : contexts)
- {
- ServiceReference ref = getServiceReferenceForContext(context);
- if (ref != null)
- result.add(ref);
- }
- if (result.isEmpty())
- return null;
-
- return result.toArray(new ServiceReference[result.size()]);
- }
-
- public ServiceReference[] getServicesInUse(AbstractBundleState bundleState)
- {
- Set<ControllerContext> contexts = bundleState.getUsedContexts(bundleState);
- if (contexts == null || contexts.isEmpty())
- return null;
-
- List<ServiceReference> references = new ArrayList<ServiceReference>();
- for (ControllerContext context : contexts)
- {
- ServiceReference ref = getServiceReferenceForContext(context);
- if (ref != null)
- references.add(ref);
- }
-
- if (references.isEmpty())
- return null;
-
- return references.toArray(new ServiceReference[references.size()]);
- }
-
- public ServiceReference[] getAllServiceReferences(AbstractBundleState bundle, String clazz, String filterStr) throws InvalidSyntaxException
- {
- Filter filter = NoFilter.INSTANCE;
- if (filterStr != null)
- filter = FrameworkUtil.createFilter(filterStr);
-
- Collection<ServiceReference> services = getServices(bundle, clazz, filter, false);
- if (services == null || services.isEmpty())
- return null;
-
- return services.toArray(new ServiceReference[services.size()]);
- }
-
- /**
- * Get a service
- *
- * @param bundleState the bundle that requests the service
- * @param reference the service reference
- * @return the service
- */
- public Object getService(AbstractBundleState bundleState, ServiceReference reference)
- {
- if (reference == null)
- throw new IllegalArgumentException("Null reference");
-
- ControllerContextHandle handle = (ControllerContextHandle)reference;
- ControllerContext context = handle.getContext();
- if (KernelUtils.isUnregistered(context)) // we're probably not installed anymore
- return null;
-
- return bundleState.addContextInUse(context);
- }
-
- public ServiceReference getServiceReference(AbstractBundleState bundle, String clazz)
- {
- if (clazz == null)
- throw new IllegalArgumentException("Null clazz");
-
- Collection<ServiceReference> services = getServices(bundle, clazz, null, true);
- if (services == null || services.isEmpty())
- return null;
-
- return services.iterator().next();
- }
-
- public ServiceReference[] getServiceReferences(AbstractBundleState bundle, String clazz, String filterStr) throws InvalidSyntaxException
- {
- Filter filter = NoFilter.INSTANCE;
- if (filterStr != null)
- filter = FrameworkUtil.createFilter(filterStr);
-
- Collection<ServiceReference> services = getServices(bundle, clazz, filter, true);
- if (services == null || services.isEmpty())
- return null;
-
- return services.toArray(new ServiceReference[services.size()]);
- }
-
- @SuppressWarnings("rawtypes")
- public OSGiServiceState registerService(AbstractBundleState bundleState, String[] clazzes, Object service, Dictionary properties)
- {
- OSGiServiceState result = new OSGiServiceState(bundleState, clazzes, service, properties);
- result.internalRegister();
- try
- {
- Controller controller = kernel.getController();
- controller.install(result);
- }
- catch (Throwable t)
- {
- getBundleManager().fireError(bundleState, "installing service to MC in", t);
- throw new RuntimeException(t);
- }
-
- FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
- plugin.fireServiceEvent(bundleState, ServiceEvent.REGISTERED, result);
-
- return result;
- }
-
- public void unregisterService(OSGiServiceState serviceState)
- {
- AbstractBundleState bundleState = serviceState.getBundleState();
-
- Controller controller = kernel.getController();
- controller.uninstall(serviceState.getName());
-
- serviceState.internalUnregister();
-
- FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
- plugin.fireServiceEvent(bundleState, ServiceEvent.UNREGISTERING, serviceState);
- }
-
- public boolean ungetService(AbstractBundleState bundleState, ServiceReference reference)
- {
- if (reference == null)
- throw new IllegalArgumentException("Null reference");
-
- ControllerContextHandle serviceReference = (ControllerContextHandle)reference;
- ControllerContext context = serviceReference.getContext();
- if (KernelUtils.isUnregistered(context))
- return false;
-
- return bundleState.removeContextInUse(context);
- }
-
- /**
- * Apply OSGi's MDR usage:
- * - add/remove system bundle as default context tracker
- * - add/remove instance metadata retrieval factory
- *
- * @param register do we register or unregister
- */
- private void applyMDRUsage(boolean register)
- {
- MutableMetaDataRepository repository = kernel.getMetaDataRepository().getMetaDataRepository();
- MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(ScopeKey.DEFAULT_SCOPE);
- if (register && retrieval == null)
- {
- retrieval = new MemoryMetaDataLoader(ScopeKey.DEFAULT_SCOPE);
- repository.addMetaDataRetrieval(retrieval);
- }
- if (retrieval != null && retrieval instanceof MutableMetaData)
- {
- MutableMetaData mmd = (MutableMetaData)retrieval;
- if (register)
- {
- OSGiSystemState systemBundle = getBundleManager().getSystemBundle();
- previousTracker = mmd.addMetaData(systemBundle, ContextTracker.class);
- }
- else
- {
- if (previousTracker == null)
- {
- mmd.removeMetaData(ContextTracker.class);
- if (retrieval.isEmpty())
- repository.removeMetaDataRetrieval(retrieval.getScope());
- }
- else
- {
- mmd.addMetaData(previousTracker, ContextTracker.class);
- }
- }
- }
-
- // osgi ldap filter parsing and matching
- FilterParserAndMatcher fpm = FilterParserAndMatcher.INSTANCE;
- QualifierMatchers matchers = QualifierMatchers.getInstance();
-
- if (register)
- {
- matchers.addParser(fpm);
- matchers.addMatcher(fpm);
-
- MetaDataRetrievalFactory mdrFactory = getMetaDataRetrievalFactory();
- repository.addMetaDataRetrievalFactory(CommonLevels.INSTANCE, mdrFactory);
- }
- else
- {
- repository.removeMetaDataRetrievalFactory(CommonLevels.INSTANCE);
-
- matchers.removeParser(fpm.getHandledContent());
- matchers.removeMatcher(fpm.getHandledType());
- }
- }
-
- private MetaDataRetrievalFactory getMetaDataRetrievalFactory()
- {
- MetaDataRetrievalFactory mdrFactory;
- Controller controller = kernel.getController();
- InstanceMetaDataRetrievalFactory imdrf = new InstanceMetaDataRetrievalFactory(controller);
- imdrf.addFactory(new OSGiServiceStateDictionaryFactory());
- imdrf.addFactory(new KernelDictionaryFactory(kernel.getConfigurator()));
- // TODO - JMX?
- mdrFactory = imdrf;
- return mdrFactory;
- }
-
- private Collection<ServiceReference> getServices(AbstractBundleState bundle, String clazz, Filter filter, boolean checkAssignable)
- {
- Set<ControllerContext> contexts;
- KernelController controller = kernel.getController();
-
- // Don't check assignabilty for the system bundle
- boolean isSystemBundle = (bundle.getBundleId() == 0);
- if (isSystemBundle)
- checkAssignable = false;
-
- // TODO - a bit slow for system bundle
- if (clazz != null && isSystemBundle == false)
- {
- Class<?> type = getBundleManager().loadClassFailsafe(bundle, clazz);
- if (type == null)
- return null; // or check all?
-
- contexts = controller.getContexts(type, ControllerState.INSTALLED);
- }
- else
- {
- contexts = controller.getContextsByState(ControllerState.INSTALLED);
- }
-
- if (contexts == null || contexts.isEmpty())
- return null;
-
- if (filter == null)
- filter = NoFilter.INSTANCE;
-
- List<ControllerContext> sorted = new ArrayList<ControllerContext>(contexts);
- Collections.sort(sorted, ContextComparator.INSTANCE); // Sort by the spec, should bubble up
- Collection<ServiceReference> result = new ArrayList<ServiceReference>();
- for (ControllerContext context : sorted)
- {
- // re-check?? -- we already only get INSTALLED
- if (KernelUtils.isUnregistered(context) == false)
- {
- ServiceReference ref = getServiceReferenceForContext(context);
- if (filter.match(ref) && hasPermission(context))
- {
- if (clazz == null || isSystemBundle == false || MDRUtils.matchClass(context, clazz))
- {
- // Check the assignability
- if (checkAssignable == false || MDRUtils.isAssignableTo(context, bundle))
- result.add(ref);
- }
- }
- }
- }
- return result;
- }
-
- /**
- * Get service reference for context.
- *
- * @param context the context
- * @return service reference
- */
- private ServiceReference getServiceReferenceForContext(ControllerContext context)
- {
- if (context instanceof OSGiServiceState)
- {
- OSGiServiceState service = (OSGiServiceState)context;
- return service.hasPermission() ? service.getReferenceInternal() : null;
- }
-
- OSGiBundleManager manager = getBundleManager();
- ControllerContextPlugin plugin = manager.getPlugin(ControllerContextPlugin.class);
- AbstractBundleState bundleState = plugin.getBundleForContext(context);
- return new GenericServiceReferenceWrapper(context, bundleState);
- }
-
- /**
- * Do we have a permission to use context.
- *
- * @param context the context
- * @return true if allowed to use context, false otherwise
- */
- private boolean hasPermission(ControllerContext context)
- {
- // TODO - make thisa generic, w/o casting
- if (context instanceof OSGiServiceState)
- {
- OSGiServiceState serviceState = (OSGiServiceState)context;
- return serviceState.hasPermission();
- }
- return true;
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java (from rev 100121, projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextServiceManager.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java 2010-01-29 14:52:04 UTC (rev 100123)
@@ -0,0 +1,405 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.framework.bundle;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.tracker.ContextTracker;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.qualifier.QualifierMatchers;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader;
+import org.jboss.metadata.spi.MutableMetaData;
+import org.jboss.metadata.spi.repository.MutableMetaDataRepository;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrievalFactory;
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.osgi.framework.plugins.ControllerContextPlugin;
+import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
+import org.jboss.osgi.framework.plugins.ServiceManagerPlugin;
+import org.jboss.osgi.framework.plugins.internal.AbstractPlugin;
+import org.jboss.osgi.framework.util.KernelUtils;
+import org.jboss.osgi.framework.util.NoFilter;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * A plugin that manages OSGi services.
+ *
+ * This implementation handles service integration with the MC.
+ *
+ * [JBOSGI-141] Service integration with MC
+ *
+ * @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
+ * @author thomas.diesler(a)jboss.com
+ * @since 20-Jan-2010
+ */
+public class ServiceManagerPluginImpl extends AbstractPlugin implements ServiceManagerPlugin
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(ServiceManagerPluginImpl.class);
+
+ /** The kernel */
+ private Kernel kernel;
+ /** The previous context tracker */
+ private ContextTracker previousTracker;
+
+ public ServiceManagerPluginImpl(OSGiBundleManager bundleManager)
+ {
+ super(bundleManager);
+ }
+
+ public void start()
+ {
+ kernel = getBundleManager().getKernel();
+ applyMDRUsage(true);
+ }
+
+ public void stop()
+ {
+ applyMDRUsage(false);
+ }
+
+ public ServiceReference[] getRegisteredServices(AbstractBundleState bundleState)
+ {
+ ControllerContextPlugin plugin = getBundleManager().getPlugin(ControllerContextPlugin.class);
+ Set<ControllerContext> contexts = plugin.getRegisteredContexts(bundleState);
+ if (contexts.isEmpty())
+ return null;
+
+ Set<ServiceReference> result = new HashSet<ServiceReference>();
+ for (ControllerContext context : contexts)
+ {
+ ServiceReference ref = getServiceReferenceForContext(context);
+ if (ref != null)
+ result.add(ref);
+ }
+ if (result.isEmpty())
+ return null;
+
+ return result.toArray(new ServiceReference[result.size()]);
+ }
+
+ public ServiceReference[] getServicesInUse(AbstractBundleState bundleState)
+ {
+ Set<ControllerContext> contexts = bundleState.getUsedContexts(bundleState);
+ if (contexts == null || contexts.isEmpty())
+ return null;
+
+ List<ServiceReference> references = new ArrayList<ServiceReference>();
+ for (ControllerContext context : contexts)
+ {
+ ServiceReference ref = getServiceReferenceForContext(context);
+ if (ref != null)
+ references.add(ref);
+ }
+
+ if (references.isEmpty())
+ return null;
+
+ return references.toArray(new ServiceReference[references.size()]);
+ }
+
+ public ServiceReference[] getAllServiceReferences(AbstractBundleState bundle, String clazz, String filterStr) throws InvalidSyntaxException
+ {
+ Filter filter = NoFilter.INSTANCE;
+ if (filterStr != null)
+ filter = FrameworkUtil.createFilter(filterStr);
+
+ Collection<ServiceReference> services = getServices(bundle, clazz, filter, false);
+ if (services == null || services.isEmpty())
+ return null;
+
+ return services.toArray(new ServiceReference[services.size()]);
+ }
+
+ /**
+ * Get a service
+ *
+ * @param bundleState the bundle that requests the service
+ * @param reference the service reference
+ * @return the service
+ */
+ public Object getService(AbstractBundleState bundleState, ServiceReference reference)
+ {
+ if (reference == null)
+ throw new IllegalArgumentException("Null reference");
+
+ ControllerContextHandle handle = (ControllerContextHandle)reference;
+ ControllerContext context = handle.getContext();
+ if (KernelUtils.isUnregistered(context)) // we're probably not installed anymore
+ return null;
+
+ return bundleState.addContextInUse(context);
+ }
+
+ public ServiceReference getServiceReference(AbstractBundleState bundle, String clazz)
+ {
+ if (clazz == null)
+ throw new IllegalArgumentException("Null clazz");
+
+ Collection<ServiceReference> services = getServices(bundle, clazz, null, true);
+ if (services == null || services.isEmpty())
+ return null;
+
+ return services.iterator().next();
+ }
+
+ public ServiceReference[] getServiceReferences(AbstractBundleState bundle, String clazz, String filterStr) throws InvalidSyntaxException
+ {
+ Filter filter = NoFilter.INSTANCE;
+ if (filterStr != null)
+ filter = FrameworkUtil.createFilter(filterStr);
+
+ Collection<ServiceReference> services = getServices(bundle, clazz, filter, true);
+ if (services == null || services.isEmpty())
+ return null;
+
+ return services.toArray(new ServiceReference[services.size()]);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public OSGiServiceState registerService(AbstractBundleState bundleState, String[] clazzes, Object service, Dictionary properties)
+ {
+ OSGiServiceState result = new OSGiServiceState(bundleState, clazzes, service, properties);
+ result.internalRegister();
+ try
+ {
+ Controller controller = kernel.getController();
+ controller.install(result);
+ }
+ catch (Throwable t)
+ {
+ getBundleManager().fireError(bundleState, "installing service to MC in", t);
+ throw new RuntimeException(t);
+ }
+
+ FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+ plugin.fireServiceEvent(bundleState, ServiceEvent.REGISTERED, result);
+
+ return result;
+ }
+
+ public void unregisterService(OSGiServiceState serviceState)
+ {
+ AbstractBundleState bundleState = serviceState.getBundleState();
+
+ Controller controller = kernel.getController();
+ controller.uninstall(serviceState.getName());
+
+ serviceState.internalUnregister();
+
+ FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+ plugin.fireServiceEvent(bundleState, ServiceEvent.UNREGISTERING, serviceState);
+ }
+
+ public boolean ungetService(AbstractBundleState bundleState, ServiceReference reference)
+ {
+ if (reference == null)
+ throw new IllegalArgumentException("Null reference");
+
+ ControllerContextHandle serviceReference = (ControllerContextHandle)reference;
+ ControllerContext context = serviceReference.getContext();
+ if (KernelUtils.isUnregistered(context))
+ return false;
+
+ return bundleState.removeContextInUse(context);
+ }
+
+ /**
+ * Apply OSGi's MDR usage:
+ * - add/remove system bundle as default context tracker
+ * - add/remove instance metadata retrieval factory
+ *
+ * @param register do we register or unregister
+ */
+ private void applyMDRUsage(boolean register)
+ {
+ MutableMetaDataRepository repository = kernel.getMetaDataRepository().getMetaDataRepository();
+ MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(ScopeKey.DEFAULT_SCOPE);
+ if (register && retrieval == null)
+ {
+ retrieval = new MemoryMetaDataLoader(ScopeKey.DEFAULT_SCOPE);
+ repository.addMetaDataRetrieval(retrieval);
+ }
+ if (retrieval != null && retrieval instanceof MutableMetaData)
+ {
+ MutableMetaData mmd = (MutableMetaData)retrieval;
+ if (register)
+ {
+ OSGiSystemState systemBundle = getBundleManager().getSystemBundle();
+ previousTracker = mmd.addMetaData(systemBundle, ContextTracker.class);
+ }
+ else
+ {
+ if (previousTracker == null)
+ {
+ mmd.removeMetaData(ContextTracker.class);
+ if (retrieval.isEmpty())
+ repository.removeMetaDataRetrieval(retrieval.getScope());
+ }
+ else
+ {
+ mmd.addMetaData(previousTracker, ContextTracker.class);
+ }
+ }
+ }
+
+ // osgi ldap filter parsing and matching
+ FilterParserAndMatcher fpm = FilterParserAndMatcher.INSTANCE;
+ QualifierMatchers matchers = QualifierMatchers.getInstance();
+
+ if (register)
+ {
+ matchers.addParser(fpm);
+ matchers.addMatcher(fpm);
+
+ MetaDataRetrievalFactory mdrFactory = getMetaDataRetrievalFactory();
+ repository.addMetaDataRetrievalFactory(CommonLevels.INSTANCE, mdrFactory);
+ }
+ else
+ {
+ repository.removeMetaDataRetrievalFactory(CommonLevels.INSTANCE);
+
+ matchers.removeParser(fpm.getHandledContent());
+ matchers.removeMatcher(fpm.getHandledType());
+ }
+ }
+
+ private MetaDataRetrievalFactory getMetaDataRetrievalFactory()
+ {
+ MetaDataRetrievalFactory mdrFactory;
+ Controller controller = kernel.getController();
+ InstanceMetaDataRetrievalFactory imdrf = new InstanceMetaDataRetrievalFactory(controller);
+ imdrf.addFactory(new OSGiServiceStateDictionaryFactory());
+ imdrf.addFactory(new KernelDictionaryFactory(kernel.getConfigurator()));
+ // TODO - JMX?
+ mdrFactory = imdrf;
+ return mdrFactory;
+ }
+
+ private Collection<ServiceReference> getServices(AbstractBundleState bundle, String clazz, Filter filter, boolean checkAssignable)
+ {
+ Set<ControllerContext> contexts;
+ KernelController controller = kernel.getController();
+
+ // Don't check assignabilty for the system bundle
+ boolean isSystemBundle = (bundle.getBundleId() == 0);
+ if (isSystemBundle)
+ checkAssignable = false;
+
+ // TODO - a bit slow for system bundle
+ if (clazz != null && isSystemBundle == false)
+ {
+ Class<?> type = getBundleManager().loadClassFailsafe(bundle, clazz);
+ if (type == null)
+ return null; // or check all?
+
+ contexts = controller.getContexts(type, ControllerState.INSTALLED);
+ }
+ else
+ {
+ contexts = controller.getContextsByState(ControllerState.INSTALLED);
+ }
+
+ if (contexts == null || contexts.isEmpty())
+ return null;
+
+ if (filter == null)
+ filter = NoFilter.INSTANCE;
+
+ List<ControllerContext> sorted = new ArrayList<ControllerContext>(contexts);
+ Collections.sort(sorted, ContextComparator.INSTANCE); // Sort by the spec, should bubble up
+ Collection<ServiceReference> result = new ArrayList<ServiceReference>();
+ for (ControllerContext context : sorted)
+ {
+ // re-check?? -- we already only get INSTALLED
+ if (KernelUtils.isUnregistered(context) == false)
+ {
+ ServiceReference ref = getServiceReferenceForContext(context);
+ if (filter.match(ref) && hasPermission(context))
+ {
+ if (clazz == null || isSystemBundle == false || MDRUtils.matchClass(context, clazz))
+ {
+ // Check the assignability
+ if (checkAssignable == false || MDRUtils.isAssignableTo(context, bundle))
+ result.add(ref);
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get service reference for context.
+ *
+ * @param context the context
+ * @return service reference
+ */
+ private ServiceReference getServiceReferenceForContext(ControllerContext context)
+ {
+ if (context instanceof OSGiServiceState)
+ {
+ OSGiServiceState service = (OSGiServiceState)context;
+ return service.hasPermission() ? service.getReferenceInternal() : null;
+ }
+
+ OSGiBundleManager manager = getBundleManager();
+ ControllerContextPlugin plugin = manager.getPlugin(ControllerContextPlugin.class);
+ AbstractBundleState bundleState = plugin.getBundleForContext(context);
+ return new GenericServiceReferenceWrapper(context, bundleState);
+ }
+
+ /**
+ * Do we have a permission to use context.
+ *
+ * @param context the context
+ * @return true if allowed to use context, false otherwise
+ */
+ private boolean hasPermission(ControllerContext context)
+ {
+ // TODO - make thisa generic, w/o casting
+ if (context instanceof OSGiServiceState)
+ {
+ OSGiServiceState serviceState = (OSGiServiceState)context;
+ return serviceState.hasPermission();
+ }
+ return true;
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml 2010-01-29 14:30:22 UTC (rev 100122)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml 2010-01-29 14:52:04 UTC (rev 100123)
@@ -55,7 +55,7 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiServiceManagerPlugin" class="org.jboss.osgi.framework.bundle.ControllerContextServiceManager">
+ <bean name="OSGiServiceManagerPlugin" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-01-29 14:30:22 UTC (rev 100122)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-01-29 14:52:04 UTC (rev 100123)
@@ -105,7 +105,7 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ControllerContextServiceManager">
+ <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml 2010-01-29 14:30:22 UTC (rev 100122)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml 2010-01-29 14:52:04 UTC (rev 100123)
@@ -99,7 +99,7 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ControllerContextServiceManager">
+ <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-29 14:30:22 UTC (rev 100122)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-29 14:52:04 UTC (rev 100123)
@@ -82,7 +82,7 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ControllerContextServiceManager">
+ <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-29 14:30:22 UTC (rev 100122)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-29 14:52:04 UTC (rev 100123)
@@ -81,7 +81,7 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiServiceManagerPlugin" class="org.jboss.osgi.framework.bundle.ControllerContextServiceManager">
+ <bean name="OSGiServiceManagerPlugin" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
14 years, 3 months
JBoss-OSGI SVN: r100122 - 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-01-29 09:30:22 -0500 (Fri, 29 Jan 2010)
New Revision: 100122
Modified:
projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
Log:
Fix initial AS integration issues
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-01-29 14:29:43 UTC (rev 100121)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-29 14:30:22 UTC (rev 100122)
@@ -82,7 +82,7 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
+ <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ControllerContextServiceManager">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
14 years, 3 months