[jboss-cvs] JBossAS SVN: r87996 - in projects/jboss-osgi/trunk/bundle: common and 14 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Apr 29 09:43:30 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-04-29 09:43:29 -0400 (Wed, 29 Apr 2009)
New Revision: 87996
Added:
projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeployersActivator.java
projects/jboss-osgi/trunk/bundle/deployment/src/main/resources/
projects/jboss-osgi/trunk/bundle/deployment/src/main/resources/META-INF/
projects/jboss-osgi/trunk/bundle/deployment/src/main/resources/META-INF/jboss-osgi-deployers.xml
Removed:
projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployer/
projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleClassLoaderDeployer.java
projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleManagementDeployer.java
projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleMetaData.java
projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleMetaDataDeployer.java
projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleRealDeployer.java
projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleStartStopDeployer.java
projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleStructureDeployer.java
projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/DeploymentService.java
projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/BundleClassLoader.java
projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/BundleDeploymentUnitFilter.java
projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentProvidedDeploymentUnitFilter.java
projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentServiceImpl.java
projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/PackageAdminDependencyItem.java
projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/ServiceActivator.java
Modified:
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/deployment/DeploymentServiceTestCase.java
projects/jboss-osgi/trunk/bundle/common/pom.xml
projects/jboss-osgi/trunk/bundle/deployment/pom.xml
projects/jboss-osgi/trunk/bundle/jmx/pom.xml
projects/jboss-osgi/trunk/bundle/logging/pom.xml
projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
projects/jboss-osgi/trunk/bundle/remotelog/pom.xml
projects/jboss-osgi/trunk/bundle/webconsole/pom.xml
Log:
More work on MC deployment
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/deployment/DeploymentServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/deployment/DeploymentServiceTestCase.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/deployment/DeploymentServiceTestCase.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -23,7 +23,13 @@
//$Id$
+import static org.jboss.osgi.microcontainer.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
+
+import java.util.List;
+
+import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.test.osgi.blueprint.BlueprintTest;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -43,9 +49,12 @@
{
BundleContext sysContext = framework.getSystemBundleContext();
- Bundle bundle = installBundle(sysContext, "bundles/jboss-osgi-deployment.jar", true);
- assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
-
+// Bundle bundle = installBundle(sysContext, "bundles/jboss-osgi-deployment.jar", true);
+// assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
+//
+// MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
+// List<String> registeredBeans = mcService.getRegisteredBeans();
+// System.out.println(registeredBeans);
}
finally
{
Modified: projects/jboss-osgi/trunk/bundle/common/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/common/pom.xml 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/common/pom.xml 2009-04-29 13:43:29 UTC (rev 87996)
@@ -44,7 +44,7 @@
<extensions>true</extensions>
<configuration>
<instructions>
- <Bundle-SymbolicName>org.jboss.osgi.common</Bundle-SymbolicName>
+ <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Export-Package>
org.jboss.osgi.common,
org.jboss.osgi.common.log
Modified: projects/jboss-osgi/trunk/bundle/deployment/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/pom.xml 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/deployment/pom.xml 2009-04-29 13:43:29 UTC (rev 87996)
@@ -26,6 +26,11 @@
<version>${version}</version>
</dependency>
<dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-runtime-deployer</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
<groupId>org.jboss.osgi.bundles</groupId>
<artifactId>jboss-osgi-microcontainer</artifactId>
<version>${version}</version>
@@ -64,31 +69,37 @@
<extensions>true</extensions>
<configuration>
<instructions>
- <Bundle-SymbolicName>jboss-osgi-deployment</Bundle-SymbolicName>
- <Bundle-Activator>org.jboss.osgi.deployment.internal.ServiceActivator</Bundle-Activator>
- <Export-Package>
- org.jboss.osgi.deployment;version=${version}
- </Export-Package>
+ <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
+ <Bundle-Activator>org.jboss.osgi.deployment.internal.DeployersActivator</Bundle-Activator>
<Private-Package>
org.jboss.osgi.deployment.internal
</Private-Package>
<Import-Package>
- <!-- system -->
- javax.management,
-
- <!-- import -->
- org.jboss.dependency.*,
- org.jboss.deployers.*,
- org.jboss.logging,
- org.jboss.osgi.common.log,
- org.jboss.osgi.spi.management,
- org.jboss.virtual,
-
- <!-- osgi -->
- org.osgi.framework,
- org.osgi.service.log,
- org.osgi.service.packageadmin
+ <!-- system -->
+ javax.management,
+
+ <!-- import -->
+ org.jboss.dependency.*,
+ org.jboss.deployers.*,
+ org.jboss.logging,
+ org.jboss.osgi.common.log,
+ org.jboss.osgi.microcontainer,
+ org.jboss.osgi.spi.management,
+ org.jboss.virtual,
+
+ <!-- osgi -->
+ org.osgi.framework,
+ org.osgi.service.packageadmin,
+ org.osgi.service.log,
+ org.osgi.util.tracker,
</Import-Package>
+ <Embed-Transitive>true</Embed-Transitive>
+ <Embed-Dependency>
+ jboss-osgi-runtime-deployer;inline=false,
+ </Embed-Dependency>
+ <_exportcontents>
+ org.jboss.osgi.deployer
+ </_exportcontents>
</instructions>
</configuration>
</plugin>
Deleted: projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleClassLoaderDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleClassLoaderDeployer.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleClassLoaderDeployer.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -1,110 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployment;
-
-// $Id$
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.ClassLoaderFactory;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.structure.spi.DeploymentUnitFilter;
-import org.jboss.osgi.deployment.internal.BundleClassLoader;
-import org.jboss.osgi.deployment.internal.BundleDeploymentUnitFilter;
-import org.jboss.osgi.deployment.internal.PackageAdminDependencyItem;
-import org.jboss.osgi.spi.Constants;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-/**
- * A deployer that attaches a {@link ClassLoaderFactory} that creates a
- * {@link BundleClassLoader} for the deployed Bundle.
- *
- * @author Ales.Justin at jboss.org
- * @author Thomas.Diesler at jboss.org
- * @since 03-Feb-2009
- */
-public class BundleClassLoaderDeployer extends AbstractSimpleRealDeployer<Bundle>
-{
- private DeploymentUnitFilter filter = new BundleDeploymentUnitFilter();
- private BundleContext systemContext;
-
- public BundleClassLoaderDeployer()
- {
- super(Bundle.class);
- addOutput(ClassLoaderFactory.class);
- setStage(DeploymentStages.POST_PARSE);
- }
-
- public void setSystemContext(BundleContext systemContext)
- {
- this.systemContext = systemContext;
- }
-
- public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- // create bundle delegate classloader
- ClassLoaderFactory factory = createClassLoaderFactory(bundle);
- unit.addAttachment(ClassLoaderFactory.class, factory);
-
- // create dependency items
- String propStart = systemContext.getProperty(Constants.PROPERTY_DEFERRED_START);
- if (Boolean.parseBoolean(propStart != null ? propStart : "true") == false)
- unit.addIDependOn(new PackageAdminDependencyItem(systemContext, bundle));
-
- // skip annotations scanning, if filter is set
- if (filter != null)
- unit.addAttachment(DeploymentUnitFilter.class, filter);
- }
-
- /**
- * Create classloader factory.
- *
- * @param bundle the bundle
- * @return new classloader factory
- */
- protected ClassLoaderFactory createClassLoaderFactory(final Bundle bundle)
- {
- return new ClassLoaderFactory()
- {
- public ClassLoader createClassLoader(DeploymentUnit unit) throws Exception
- {
- return BundleClassLoader.createBundleClassLoader(bundle);
- }
-
- public void removeClassLoader(DeploymentUnit unit) throws Exception
- {
- }
- };
- }
-
- /**
- * Set deployment filter.
- *
- * @param filter the deployment filter
- */
- public void setFilter(DeploymentUnitFilter filter)
- {
- this.filter = filter;
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleManagementDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleManagementDeployer.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleManagementDeployer.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -1,90 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployment;
-
-// $Id: $
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.spi.management.ManagedBundle;
-import org.osgi.framework.Bundle;
-
-/**
- * Register the Bundle as MBean with JMX.
- *
- * @author Thomas.Diesler at jboss.com
- * @since 04-Mar-2009
- */
-public class BundleManagementDeployer extends AbstractSimpleRealDeployer<Bundle>
-{
- private MBeanServer mbeanServer;
-
- public BundleManagementDeployer()
- {
- super(Bundle.class);
- }
-
- public void setMbeanServer(MBeanServer mbeanServer)
- {
- this.mbeanServer = mbeanServer;
- }
-
- public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- if (mbeanServer != null)
- {
- ManagedBundle mb = new ManagedBundle(bundle);
- ObjectName oname = mb.getObjectName();
- try
- {
- mbeanServer.registerMBean(mb, oname);
- unit.addAttachment(ManagedBundle.class, mb);
- }
- catch (Exception ex)
- {
- DeploymentException.rethrowAsDeploymentException(ex.getMessage(), ex);
- }
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, Bundle bundle)
- {
- if (mbeanServer != null)
- {
- try
- {
- ManagedBundle mb = unit.getAttachment(ManagedBundle.class);
- if (mb != null && mbeanServer.isRegistered(mb.getObjectName()))
- mbeanServer.unregisterMBean(mb.getObjectName());
- }
- catch (Exception ex)
- {
- log.warn("Cannot unregister: " + bundle, ex);
- }
- }
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleMetaData.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleMetaData.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployment;
-
-//$Id$
-
-import java.net.URL;
-
-import org.jboss.deployers.vfs.spi.deployer.helpers.AbstractManifestMetaData;
-
-
-/**
- * The Bundle metadata.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 03-Feb-2009
- */
-public class BundleMetaData extends AbstractManifestMetaData
-{
- private String symbolicName;
- private URL bundleLocation;
-
- // exteralizable usage
- public BundleMetaData()
- {
- }
-
- public BundleMetaData(String symbolicName)
- {
- this.symbolicName = symbolicName;
- }
-
- public String getSymbolicName()
- {
- return symbolicName;
- }
-
- public URL getBundleLocation()
- {
- return bundleLocation;
- }
-
- public void setBundleLocation(URL bundleLocation)
- {
- this.bundleLocation = bundleLocation;
- }
-
- public String toString()
- {
- return "Bundle[name=" + symbolicName + "]";
- }
-}
Deleted: projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleMetaDataDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleMetaDataDeployer.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleMetaDataDeployer.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployment;
-
-//$Id$
-
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-import org.jboss.deployers.vfs.spi.deployer.ManifestDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Constants;
-
-/**
- * Create {@link BundleMetaData} from Manifest Headers.
- *
- * If the manifest does not contain a header (named "Bundle-SymbolicName") this deployer does nothing.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 03-Feb-2009
- */
-public class BundleMetaDataDeployer extends ManifestDeployer<BundleMetaData>
-{
- public BundleMetaDataDeployer()
- {
- super(BundleMetaData.class);
- }
-
- @Override
- protected BundleMetaData parse(VFSDeploymentUnit unit, VirtualFile file, BundleMetaData root) throws Exception
- {
- BundleMetaData metaData = super.parse(unit, file, root);
- if (metaData != null)
- {
- metaData.setBundleLocation(unit.getRoot().toURL());
- log.debug("Bundle-SymbolicName: " + metaData.getSymbolicName() + " in " + file);
- }
- return metaData;
- }
-
- @Override
- protected BundleMetaData createMetaData(Manifest manifest) throws Exception
- {
- Attributes attribs = manifest.getMainAttributes();
- String symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
- if (symbolicName != null)
- return new BundleMetaData(symbolicName);
-
- return null;
- }
-}
Deleted: projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleRealDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleRealDeployer.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleRealDeployer.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -1,125 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployment;
-
-//$Id$
-
-import java.net.URL;
-import java.util.List;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-/**
- * Installs the Bundle into the Framework's SystemContext.
- *
- * This deployer does not start the bundle. It leaves it in state INSTALLED.
- * On undeploy the Bundle gets uninstalled from the Framework's SystemContext.
- *
- * @author Thomas.Diesler at jboss.org
- * @author Ales.Justin at jboss.org
- * @since 03-Feb-2009
- */
-public class BundleRealDeployer extends AbstractSimpleRealDeployer<BundleMetaData>
-{
- private BundleContext systemContext;
- private List<URL> skipBundles;
-
- public BundleRealDeployer()
- {
- super(BundleMetaData.class);
- addOutput(Bundle.class);
- setStage(DeploymentStages.POST_PARSE);
- }
-
- public void setSystemContext(BundleContext bundleContext)
- {
- this.systemContext = bundleContext;
- }
-
- public void setSkipBundles(List<URL> skipBundles)
- {
- this.skipBundles = skipBundles;
- }
-
- public void deploy(DeploymentUnit unit, BundleMetaData metadata) throws DeploymentException
- {
- URL bundleURL = metadata.getBundleLocation();
- if (bundleURL == null)
- throw new IllegalStateException("Cannot obtain bundle location for: " + metadata);
-
- String bundlePath = bundleURL.getPath();
- if (bundlePath.endsWith("/"))
- bundlePath = bundlePath.substring(0, bundlePath.length() - 1);
-
- try
- {
- if (skipBundles != null)
- {
- boolean skipBundle = false;
- for (URL skip : skipBundles)
- {
- String skipPath = skip.getPath();
- if (skipPath.equals(bundlePath))
- {
- skipBundle = true;
- break;
- }
- }
- if (skipBundle == false)
- {
- Bundle bundle = systemContext.installBundle(bundleURL.toString());
- unit.addAttachment(Bundle.class, bundle);
-
- log.info("Installed: " + bundle);
- }
- }
- }
- catch (BundleException ex)
- {
- throw DeploymentException.rethrowAsDeploymentException("Cannot install bundle: " + metadata, ex);
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, BundleMetaData osGiMetaData)
- {
- Bundle bundle = unit.getAttachment(Bundle.class);
- if (bundle != null)
- {
- try
- {
- bundle.uninstall();
- log.info("Uninstalled: " + bundle);
- }
- catch (BundleException ex)
- {
- log.warn(ex);
- }
- }
- }
-}
Deleted: projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleStartStopDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleStartStopDeployer.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleStartStopDeployer.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -1,152 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployment;
-
-// $Id: $
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.spi.Constants;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * This is the Bundle start/stop Deployer
- *
- * @author Ales.Justin at jboss.org
- * @author Thomas.Diesler at jboss.com
- * @since 27-Feb-2009
- */
-public class BundleStartStopDeployer extends AbstractSimpleRealDeployer<Bundle>
-{
- private BundleContext systemContext;
- private PackageAdmin packageAdmin;
-
- // The list of unresolved bundles
- private List<Bundle> unresolvedBundles = new ArrayList<Bundle>();
-
- public BundleStartStopDeployer()
- {
- super(Bundle.class);
- }
-
- public void setSystemContext(BundleContext systemContext)
- {
- this.systemContext = systemContext;
- }
-
- public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- String propStart = systemContext.getProperty(Constants.PROPERTY_DEFERRED_START);
- if (Boolean.parseBoolean(propStart != null ? propStart : "true") == true)
- {
- deferredStart(unit, bundle);
- }
- else
- {
- simpleStart(unit, bundle);
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, Bundle bundle)
- {
- try
- {
- bundle.stop();
-
- unresolvedBundles.remove(bundle);
-
- log.info("Stoped: " + bundle);
- }
- catch (BundleException e)
- {
- log.warn("Cannot stop bundle: " + e);
- }
- }
-
- private void simpleStart(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- try
- {
- bundle.start();
- log.info("Started: " + bundle);
- }
- catch (BundleException e)
- {
- log.warn("Cannot start bundle", e);
- }
- }
-
- private void deferredStart(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- // Get the required dependency on the PackageAdmin service
- if (packageAdmin == null)
- {
- ServiceReference sref = systemContext.getServiceReference(PackageAdmin.class.getName());
- packageAdmin = (PackageAdmin)systemContext.getService(sref);
- if (packageAdmin == null)
- throw new IllegalStateException("Cannot obtain PackageAdmin service");
- }
-
- // Always add the bundle as unresolved
- unresolvedBundles.add(bundle);
-
- Bundle[] bundleArr = new Bundle[unresolvedBundles.size()];
- unresolvedBundles.toArray(bundleArr);
-
- // Try to resolve the bundles
- packageAdmin.resolveBundles(bundleArr);
-
- // Find resolved bundles and start them
- Iterator<Bundle> it = unresolvedBundles.iterator();
- while (it.hasNext())
- {
- Bundle auxBundle = it.next();
- if ((Bundle.RESOLVED & auxBundle.getState()) == Bundle.RESOLVED)
- {
- it.remove();
- try
- {
- auxBundle.start();
- log.info("Started: " + bundle);
- }
- catch (BundleException e)
- {
- log.warn("Cannot start bundle", e);
- }
- }
- }
-
- // Report unresolved bundles
- if (unresolvedBundles.size() > 0)
- log.info("Unresolved: " + unresolvedBundles);
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleStructureDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleStructureDeployer.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/BundleStructureDeployer.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployment;
-
-// $Id$
-
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.structure.ContextInfo;
-import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
-import org.jboss.deployers.vfs.spi.structure.StructureContext;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Constants;
-
-/**
- * Determine the structure of a Bundle deployment.
- *
- * @author Thomas.Diesler at jboss.com
- * @since 16-Apr-2009
- */
-public class BundleStructureDeployer extends AbstractVFSStructureDeployer
-{
- /**
- * Sets the default relative order 9000.
- */
- public BundleStructureDeployer()
- {
- setRelativeOrder(9000);
- }
-
- /**
- * Determine the structure of a bundle deployment
- *
- * @param context the structure context
- * @return true when it recognised the context
- * @throws DeploymentException for an error
- */
- public boolean determineStructure(StructureContext structureContext) throws DeploymentException
- {
- ContextInfo context = null;
- VirtualFile file = structureContext.getFile();
- VirtualFile root = structureContext.getRoot();
-
- try
- {
- // This file is not for me, because I'm only interested
- // in root deployments that contain a MANIFEST.MF
- Manifest manifest = VFSUtils.getManifest(file);
- if (file != root || manifest == null)
- return false;
-
- // This file is also not for me, because I need to see Bundle-SymbolicName
- Attributes attribs = manifest.getMainAttributes();
- String symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
- if (symbolicName == null)
- return false;
-
- // Create a context for this jar file with META-INF as the location for metadata
- context = createContext(structureContext, "META-INF");
-
- return true;
- }
- catch (Exception e)
- {
- // Remove the invalid context
- if (context != null)
- structureContext.removeChild(context);
-
- throw DeploymentException.rethrowAsDeploymentException("Error determining structure: " + file.getName(), e);
- }
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/DeploymentService.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/DeploymentService.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/DeploymentService.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployment;
-
-// $Id$
-
-/**
- * The JBossOSGi deployment service
- *
- * @author Thomas.Diesler at jboss.com
- * @since 28-Apr-2009
- */
-public interface DeploymentService
-{
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/BundleClassLoader.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/BundleClassLoader.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/BundleClassLoader.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -1,115 +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.deployment.internal;
-
-// $Id: $
-
-import java.io.IOException;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Dictionary;
-import java.util.Enumeration;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-
-/**
- * A BundleClassLoader delegates all classloading concerns to the underlying Bundle.
- *
- * @author Ales.Justin at jboss.org
- * @author thomas.Diesler at jboss.org
- * @since 03-Feb-2009
- */
-public class BundleClassLoader extends ClassLoader
-{
- private final Bundle bundle;
-
- public static BundleClassLoader createBundleClassLoader(final Bundle bundle)
- {
- if (bundle == null)
- throw new IllegalArgumentException("Null bundle");
-
- return AccessController.doPrivileged(new PrivilegedAction<BundleClassLoader>()
- {
- public BundleClassLoader run()
- {
- return new BundleClassLoader(bundle);
- }
- });
- }
-
- private BundleClassLoader(Bundle bundle)
- {
- this.bundle = bundle;
- }
-
- protected Class<?> findClass(String name) throws ClassNotFoundException
- {
- return bundle.loadClass(name);
- }
-
- protected URL findResource(String name)
- {
- return bundle.getResource(name);
- }
-
- @SuppressWarnings("unchecked")
- protected Enumeration<URL> findResources(String name) throws IOException
- {
- return bundle.getResources(name);
- }
-
- public URL getResource(String name)
- {
- return findResource(name);
- }
-
- public Class<?> loadClass(String name) throws ClassNotFoundException
- {
- return findClass(name);
- }
-
- public boolean equals(Object o)
- {
- if (this == o)
- return true;
-
- if (o instanceof BundleClassLoader == false)
- return false;
-
- final BundleClassLoader bundleClassLoader = (BundleClassLoader)o;
- return bundle.equals(bundleClassLoader.bundle);
- }
-
- public int hashCode()
- {
- return bundle.hashCode();
- }
-
- public String toString()
- {
- Dictionary<?, ?> dictionary = bundle.getHeaders();
- String bname = dictionary.get(Constants.BUNDLE_NAME) + "(" + dictionary.get(Constants.BUNDLE_SYMBOLICNAME) + ")";
- return "BundleClassLoader for [" + bname + "]";
- }
-}
Deleted: projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/BundleDeploymentUnitFilter.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/BundleDeploymentUnitFilter.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/BundleDeploymentUnitFilter.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployment.internal;
-
-// $Id$
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.structure.spi.DeploymentUnitFilter;
-import org.osgi.framework.Bundle;
-
-/**
- * A DeploymentUnitFilter that rejects OSGi bundle deployments.
- *
- * @author Thomas.Diesler at jboss.com
- * @since 27-Feb-2009
- */
-public class BundleDeploymentUnitFilter implements DeploymentUnitFilter
-{
- public boolean accepts(DeploymentUnit unit)
- {
- Bundle bundle = unit.getTopLevel().getAttachment(Bundle.class);
- return bundle == null;
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeployersActivator.java (from rev 87977, projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/ServiceActivator.java)
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeployersActivator.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeployersActivator.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -0,0 +1,75 @@
+/*
+ * 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.deployment.internal;
+
+//$Id$
+
+import java.net.URL;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.osgi.microcontainer.MicrocontainerService;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * A BundleActivator that installs the OSGi deployers with the MC
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 24-Apr-2009
+ */
+public class DeployersActivator implements BundleActivator
+{
+ private URL deployersURL;
+
+ public void start(BundleContext context)
+ {
+ deployersURL = context.getBundle().getResource("META-INF/jboss-osgi-deployers.xml");
+
+ MicrocontainerService service = getMicrocontainerService(context);
+ if (service == null)
+ throw new IllegalStateException("MicrocontainerService not available");
+
+ try
+ {
+ service.deploy(deployersURL);
+ }
+ catch (DeploymentException ex)
+ {
+ throw new IllegalStateException("Cannot deploy: " + deployersURL, ex);
+ }
+ }
+
+ public void stop(BundleContext context)
+ {
+ MicrocontainerService service = getMicrocontainerService(context);
+ if (service != null)
+ service.undeploy(deployersURL);
+ }
+
+ private MicrocontainerService getMicrocontainerService(BundleContext context)
+ {
+ ServiceReference sref = context.getServiceReference(MicrocontainerService.class.getName());
+ MicrocontainerService service = (MicrocontainerService)context.getService(sref);
+ return service;
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentProvidedDeploymentUnitFilter.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentProvidedDeploymentUnitFilter.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentProvidedDeploymentUnitFilter.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployment.internal;
-
-// $Id$
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.structure.spi.DeploymentUnitFilter;
-import org.jboss.deployers.vfs.spi.structure.helpers.VFS2BaseBridgeDeploymentUnitFilter;
-
-/**
- * A DeploymentUnitFilter that delegates its work the DeploymentUnitFilter that
- * is attached to the DeploymentUnit.
- *
- * A Deployer can attach a DeploymentUnitFilter to a DeploymentUnit which controlls whether
- * the DeploymentUnit is to be processed by following Deployers
- *
- * [TODO] Remove this class when this functionallity is natively supported by all target containers
- *
- * @author Thomas.Diesler at jboss.com
- * @since 27-Feb-2009
- */
-public class DeploymentProvidedDeploymentUnitFilter extends VFS2BaseBridgeDeploymentUnitFilter
-{
- @Override
- protected boolean doAccepts(DeploymentUnit unit)
- {
- DeploymentUnitFilter filter = unit.getTopLevel().getAttachment(DeploymentUnitFilter.class);
- return filter == null || filter.accepts(unit);
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentServiceImpl.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentServiceImpl.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -1,40 +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.deployment.internal;
-
-//$Id$
-
-import org.jboss.osgi.deployment.DeploymentService;
-import org.osgi.framework.BundleContext;
-
-/**
- * The DeploymentService implementation
- *
- * @author thomas.diesler at jboss.com
- * @since 28-Apr-2009
- */
-public class DeploymentServiceImpl implements DeploymentService
-{
- public DeploymentServiceImpl(BundleContext context)
- {
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/PackageAdminDependencyItem.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/PackageAdminDependencyItem.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/PackageAdminDependencyItem.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -1,74 +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.deployment.internal;
-
-import org.jboss.dependency.plugins.AbstractDependencyItem;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.Controller;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * This dependency item uses the OSGi PackageAdmin to trigger a bundle resolve attempt.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- * @author Thomas.Diesler at jboss.com
- * @since 04-Mar-2009
- */
-public class PackageAdminDependencyItem extends AbstractDependencyItem
-{
- private static final ControllerState CTRL_STATE = new ControllerState(DeploymentStages.CLASSLOADER.getName());
- private final PackageAdmin packageAdmin;
- private final Bundle bundle;
-
- public PackageAdminDependencyItem(BundleContext systemContext, Bundle bundle)
- {
- super(bundle.getSymbolicName(), null, CTRL_STATE, null);
- if (bundle == null)
- throw new IllegalArgumentException("Null bundle");
-
- this.bundle = bundle;
-
- ServiceReference sref = systemContext.getServiceReference(PackageAdmin.class.getName());
- packageAdmin = (PackageAdmin)systemContext.getService(sref);
- if (packageAdmin == null)
- throw new IllegalStateException("Cannot obtain PackageAdmin service");
- }
-
- @Override
- public boolean resolve(Controller controller)
- {
- if (packageAdmin.resolveBundles(new Bundle[] { bundle }))
- setResolved(true);
-
- return isResolved();
- }
-
- @Override
- protected void toHumanReadableString(StringBuilder builder)
- {
- builder.append("Bundle: ").append(bundle);
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/ServiceActivator.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/deployment/src/main/java/org/jboss/osgi/deployment/internal/ServiceActivator.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -1,62 +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.deployment.internal;
-
-//$Id$
-
-import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.osgi.deployment.DeploymentService;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.log.LogService;
-
-/**
- * A BundleActivator that registers the {@link DeploymentService}
- *
- * @author thomas.diesler at jboss.com
- * @since 24-Apr-2009
- */
-public class ServiceActivator implements BundleActivator
-{
- private ServiceRegistration registration;
- private LogService log;
-
- public void start(BundleContext context)
- {
- log = new LogServiceTracker(context);
-
- log.log(LogService.LOG_DEBUG, "Register DeploymentService");
- DeploymentServiceImpl service = new DeploymentServiceImpl(context);
- registration = context.registerService(DeploymentService.class.getName(), service, null);
- }
-
- public void stop(BundleContext context)
- {
- if (registration != null)
- {
- log.log(LogService.LOG_DEBUG, "Unregister DeploymentService");
- registration.unregister();
- registration = null;
- }
- }
-}
\ No newline at end of file
Added: projects/jboss-osgi/trunk/bundle/deployment/src/main/resources/META-INF/jboss-osgi-deployers.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/deployment/src/main/resources/META-INF/jboss-osgi-deployers.xml (rev 0)
+++ projects/jboss-osgi/trunk/bundle/deployment/src/main/resources/META-INF/jboss-osgi-deployers.xml 2009-04-29 13:43:29 UTC (rev 87996)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- The Framework Management -->
+ <bean name="jboss.osgi:service=ManagedFramework" class="org.jboss.osgi.spi.management.ManagedFramework">
+ <property name="mbeanServer"><inject bean="jboss.osgi:service=MBeanServer"/></property>
+ </bean>
+
+ <!-- The OSGi MetaData Deployer -->
+ <bean name="jboss.osgi:service=BundleMetaDataDeployer" class="org.jboss.osgi.deployer.BundleMetaDataDeployer" />
+
+ <!-- The OSGi Bundle Structure Deployer -->
+ <bean name="jboss.osgi:service=BundleStructureDeployer" class="org.jboss.osgi.deployer.BundleStructureDeployer" />
+
+ <!-- The OSGi Bundle Deployer -->
+ <bean name="jboss.osgi:service=BundleRealDeployer" class="org.jboss.osgi.deployer.BundleRealDeployer">
+ <property name="systemContext"><inject bean="jboss.osgi:service=BundleContext" /></property>
+ </bean>
+
+ <!-- The Bundle ClassLoader Deployer -->
+ <bean name="jboss.osgi:service=BundleClassLoaderDeployer" class="org.jboss.osgi.deployer.BundleClassLoaderDeployer">
+ <property name="systemContext"><inject bean="jboss.osgi:service=BundleContext" /></property>
+ </bean>
+
+ <!-- The Bundle Start/Stop Deployer -->
+ <bean name="jboss.osgi:service=BundleStartStopDeployer" class="org.jboss.osgi.deployer.BundleStartStopDeployer">
+ <property name="systemContext"><inject bean="jboss.osgi:service=BundleContext" /></property>
+ </bean>
+
+ <!-- The Bundle Management Deployer -->
+ <bean name="jboss.osgi:service=BundleManagementDeployer" class="org.jboss.osgi.deployer.BundleManagementDeployer">
+ <property name="mbeanServer"><inject bean="jboss.osgi:service=MBeanServer"/></property>
+ </bean>
+
+</deployment>
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/deployment/src/main/resources/META-INF/jboss-osgi-deployers.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/bundle/jmx/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/jmx/pom.xml 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/jmx/pom.xml 2009-04-29 13:43:29 UTC (rev 87996)
@@ -59,7 +59,7 @@
<extensions>true</extensions>
<configuration>
<instructions>
- <Bundle-SymbolicName>jboss-osgi-jmx</Bundle-SymbolicName>
+ <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Bundle-Activator>org.jboss.osgi.jmx.ServiceActivator</Bundle-Activator>
<Import-Package>
org.jboss.osgi.common.log,
Modified: projects/jboss-osgi/trunk/bundle/logging/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/logging/pom.xml 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/logging/pom.xml 2009-04-29 13:43:29 UTC (rev 87996)
@@ -46,7 +46,7 @@
<extensions>true</extensions>
<configuration>
<instructions>
- <Bundle-SymbolicName>org.jboss.osgi.service.logging</Bundle-SymbolicName>
+ <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Bundle-Activator>org.jboss.osgi.service.logging.LoggingActivator</Bundle-Activator>
<Private-Package>org.jboss.osgi.service.logging</Private-Package>
<Import-Package>
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml 2009-04-29 13:43:29 UTC (rev 87996)
@@ -77,7 +77,7 @@
<extensions>true</extensions>
<configuration>
<instructions>
- <Bundle-SymbolicName>jboss-osgi-microcontainer</Bundle-SymbolicName>
+ <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Bundle-Activator>org.jboss.osgi.microcontainer.internal.ServiceActivator</Bundle-Activator>
<Export-Package>
org.jboss.osgi.microcontainer;version=${version.jboss.microcontainer}
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -26,6 +26,7 @@
import java.net.URL;
import java.util.List;
+import org.jboss.deployers.spi.DeploymentException;
import org.jboss.kernel.Kernel;
/**
@@ -37,9 +38,9 @@
public interface MicrocontainerService
{
/**
- * The name under which the system bundle context is registered: 'jboss.osgi:service=SystemBundleContext'
+ * The name under which the system bundle context is registered: 'jboss.osgi:service=BundleContext'
*/
- String BEAN_SYSTEM_BUNDLE_CONTEXT = "jboss.osgi:service=SystemBundleContext";
+ String BEAN_SYSTEM_BUNDLE_CONTEXT = "jboss.osgi:service=BundleContext";
/**
* The name under which the MBeanServer is registered: 'jboss.osgi:service=MBeanServer'
@@ -75,7 +76,7 @@
/**
* Deploy MC beans from URL
*/
- void deploy(URL url);
+ void deploy(URL url) throws DeploymentException;
/**
* Undeploy MC beans from URL
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -28,6 +28,7 @@
import javax.management.ObjectName;
+import org.jboss.deployers.spi.DeploymentException;
import org.jboss.osgi.jmx.ObjectNameFactory;
/**
@@ -51,7 +52,7 @@
/**
* Deploy MC beans from URL
*/
- void deploy(URL url);
+ void deploy(URL url) throws DeploymentException;
/**
* Undeploy MC beans from URL
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-04-29 13:43:29 UTC (rev 87996)
@@ -23,14 +23,16 @@
//$Id$
+import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.management.MBeanServer;
import javax.management.StandardMBean;
-import javax.xml.parsers.SAXParserFactory;
import org.jboss.dependency.plugins.AbstractController;
import org.jboss.dependency.plugins.AbstractControllerContext;
@@ -40,12 +42,16 @@
import org.jboss.dependency.spi.ControllerContextActions;
import org.jboss.dependency.spi.ControllerState;
import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.osgi.common.log.LogServiceTracker;
import org.jboss.osgi.microcontainer.MicrocontainerService;
import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
-import org.jboss.osgi.spi.NotImplementedException;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
@@ -60,13 +66,14 @@
*/
public class MicrocontainerServiceImpl implements MicrocontainerService, MicrocontainerServiceMBean
{
- private static final SAXParserFactory saxFactory = SAXParserFactory.newInstance();
-
private BundleContext context;
private EmbeddedBeansDeployer deployer;
private MBeanServerTracker mbeanServerTracker;
private ServiceRegistration registration;
private LogService log;
+
+ private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
+ private Map<URL, String> contextMap = Collections.synchronizedMap(new HashMap<URL, String>());
public MicrocontainerServiceImpl(BundleContext context)
{
@@ -98,14 +105,45 @@
return context != null ? context.getTarget() : null;
}
- public void deploy(URL url)
+ public void deploy(URL url) throws DeploymentException
{
- MainDeployer mainDeployer = (MainDeployer)getRegisteredBean(BEAN_MAIN_DEPLOYER);
+ try
+ {
+ MainDeployer mainDeployer = (MainDeployer)getRegisteredBean(BEAN_MAIN_DEPLOYER);
+ VirtualFile file = VFS.createNewRoot(url);
+ VFSDeployment deployment = deploymentFactory.createVFSDeployment(file);
+ mainDeployer.addDeployment(deployment);
+ String deploymentName = deployment.getName();
+ mainDeployer.process();
+ contextMap.put(url, deploymentName);
+ mainDeployer.checkComplete(deployment);
+ }
+ catch (IOException ex)
+ {
+ DeploymentException.rethrowAsDeploymentException("Cannot deploy: " + url, ex);
+ }
}
public void undeploy(URL url)
{
- throw new NotImplementedException();
+ String deploymentName = contextMap.remove(url);
+ if (deploymentName != null)
+ {
+ try
+ {
+ MainDeployer mainDeployer = (MainDeployer)getRegisteredBean(BEAN_MAIN_DEPLOYER);
+ mainDeployer.removeDeployment(deploymentName);
+ mainDeployer.process();
+ }
+ catch (DeploymentException ex)
+ {
+ log.log(LogService.LOG_ERROR, "Cannot undeploy: " + url, ex);
+ }
+ }
+ else
+ {
+ log.log(LogService.LOG_WARNING, "Package not deployed: " + url);
+ }
}
void start()
Modified: projects/jboss-osgi/trunk/bundle/remotelog/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/remotelog/pom.xml 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/remotelog/pom.xml 2009-04-29 13:43:29 UTC (rev 87996)
@@ -77,7 +77,7 @@
<extensions>true</extensions>
<configuration>
<instructions>
- <Bundle-SymbolicName>org.jboss.osgi.service.remotelog</Bundle-SymbolicName>
+ <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Bundle-Activator>org.jboss.osgi.service.remotelog.RemoteLogActivator</Bundle-Activator>
<Export-Package>org.jboss.osgi.service.remotelog;version=${version}</Export-Package>
<Import-Package>
Modified: projects/jboss-osgi/trunk/bundle/webconsole/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/webconsole/pom.xml 2009-04-29 11:55:49 UTC (rev 87995)
+++ projects/jboss-osgi/trunk/bundle/webconsole/pom.xml 2009-04-29 13:43:29 UTC (rev 87996)
@@ -106,7 +106,7 @@
<extensions>true</extensions>
<configuration>
<instructions>
- <Bundle-SymbolicName>org.jboss.osgi.service.webconsole</Bundle-SymbolicName>
+ <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Bundle-Activator>org.jboss.osgi.service.webconsole.internal.WebConsoleActivator</Bundle-Activator>
<Export-Package>
org.apache.felix.webconsole;version=${version.felix.webconsole},
More information about the jboss-cvs-commits
mailing list