[jboss-osgi-commits] JBoss-OSGI SVN: r86377 - in projects/jboss-osgi/trunk: build/docbook/en/images and 4 other directories.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Thu Mar 26 07:17:32 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-03-26 07:17:31 -0400 (Thu, 26 Mar 2009)
New Revision: 86377
Added:
projects/jboss-osgi/trunk/build/docbook/en/images/hudson-home.png
projects/jboss-osgi/trunk/build/docbook/en/images/webconsole.png
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java
Removed:
projects/jboss-osgi/trunk/build/docbook/en/images/hudson_home.png
projects/jboss-osgi/trunk/build/docbook/en/images/webconsole.jpg
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiClassLoadingMetaDataDeployer.java
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiMetaData.java
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiMetaDataDeployer.java
Modified:
projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml
projects/jboss-osgi/trunk/build/docbook/en/modules/devguide.xml
projects/jboss-osgi/trunk/build/docbook/en/modules/frameworkintegration.xml
projects/jboss-osgi/trunk/build/docbook/en/modules/gettingstarted.xml
projects/jboss-osgi/trunk/build/docbook/en/modules/introduction.xml
projects/jboss-osgi/trunk/build/docbook/en/modules/references.xml
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDeployer.java
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/helpers/BundleClassLoader.java
projects/jboss-osgi/trunk/runtime/deployer/src/main/resources/osgi-deployers-jboss-beans.xml
Log:
docbook deployers
Modified: projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml 2009-03-26 08:38:07 UTC (rev 86376)
+++ projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml 2009-03-26 11:17:31 UTC (rev 86377)
@@ -139,6 +139,7 @@
<!-- JBossOSGi Runtime -->
<fileset dir="@{jboss.runtime.dir}" targetdir="$INSTALL_PATH/runtime" override="true"/>
+ <executable targetfile="$INSTALL_PATH/runtime/bin/run.sh" stage="never" keep="true"/>
<!-- JBossOSGi Runtime deployers/osgi.deployer -->
<fileset dir="@{deploy.artifacts.dir}/lib" targetdir="$INSTALL_PATH/runtime/server/default/deployers/osgi.deployer" override="true">
Copied: projects/jboss-osgi/trunk/build/docbook/en/images/hudson-home.png (from rev 86375, projects/jboss-osgi/trunk/build/docbook/en/images/hudson_home.png)
===================================================================
(Binary files differ)
Property changes on: projects/jboss-osgi/trunk/build/docbook/en/images/hudson-home.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:mergeinfo
+
Deleted: projects/jboss-osgi/trunk/build/docbook/en/images/hudson_home.png
===================================================================
(Binary files differ)
Deleted: projects/jboss-osgi/trunk/build/docbook/en/images/webconsole.jpg
===================================================================
(Binary files differ)
Added: projects/jboss-osgi/trunk/build/docbook/en/images/webconsole.png
===================================================================
(Binary files differ)
Property changes on: projects/jboss-osgi/trunk/build/docbook/en/images/webconsole.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: projects/jboss-osgi/trunk/build/docbook/en/modules/devguide.xml
===================================================================
--- projects/jboss-osgi/trunk/build/docbook/en/modules/devguide.xml 2009-03-26 08:38:07 UTC (rev 86376)
+++ projects/jboss-osgi/trunk/build/docbook/en/modules/devguide.xml 2009-03-26 11:17:31 UTC (rev 86377)
@@ -1,11 +1,11 @@
<!--
$Id$
-->
-<chapter id="ChapDeveloperGuide">
+<chapter xml:id="ChapDeveloperGuide">
<title>Developer Documentation</title>
- <sect1 id="SecSPI">
+ <sect1 xml:id="SecSPI">
<title>Service Provider Interface</title>
<para>The JBossOSGi Service Provider Interface (SPI) is the integration point between the supported OSGi Frameworks and
@@ -79,22 +79,82 @@
part of the JBossOSGi SPI.</para>
<tip>
- <title>Using the SPI from within an JBossAS deployed components</title>
+ <title>Using the SPI from within JBossAS deployed components</title>
<para>If you need access to the OSGi Framework from within an JBossAS deployed component (e.g. servlet, ejb, mbean) you
<emphasis role="bold">would not</emphasis> bootstrap JBossOSGi through the SPI. Instead, you would inject the already bootstrapped
- OSGi Framework instance in your component.</para>
+ OSGi Framework instance into your component.</para>
</tip>
</sect1>
- <sect1 id="SecDeployers">
+ <sect1 xml:id="SecDeployers">
<title>Bundle Deployers</title>
- <note>
- <title>TODO: Document the Deployers</title>
- </note>
+ <para>JBossOSGi comes with a number of <ulink url="http://www.jboss.org/jbossmc">JBoss Microcontainer</ulink> based deployers. Each deployer
+ takes care of a specific aspect of bundle deployment.</para>
+
+ <itemizedlist>
+ <listitem><emphasis role="bold">BundleMetaDataDeployer</emphasis> - Create BundleMetaData from Manifest Headers</listitem>
+ <listitem><emphasis role="bold">BundleRealDeployer</emphasis> - Installs the Bundle into the Framework's SystemContext</listitem>
+ <listitem><emphasis role="bold">BundleClassLoaderDeployer</emphasis> - Creates a BundleClassLoader for the deployed Bundle</listitem>
+ <listitem><emphasis role="bold">BundleStartStopDeployer</emphasis> - Starts the Bundle when dependencies are resolved</listitem>
+ <listitem><emphasis role="bold">BundleManagementDeployer</emphasis> - Register the Bundle as MBean with JMX</listitem>
+ </itemizedlist>
+
+ <emphasis role="bold">BundleMetaDataDeployer</emphasis>
+
+ <para>The BundleMetaDataDeployer creates the BundleMetaData from Manifest Headers. If the manifest does not contain
+ a header named <emphasis role="bold">Bundle-SymbolicName</emphasis> this deployer does nothing. </para>
+
+ <emphasis role="bold">BundleRealDeployer</emphasis>
+
+ <para>The BundleRealDeployer installs the Bundle into the Framework's SystemContext. Optionally you can configure a list of
+ bundle locations that should be skipped and hence not installed. Typically, these bundles are already installed during
+ Framework startup.</para>
+
+ <para>On undeploy the Bundle gets uninstalled from the Framework's SystemContext.</para>
+
+ <emphasis role="bold">BundleClassLoaderDeployer</emphasis>
+
+ <para>The BundleClassLoaderDeployer attaches a ClassLoaderFactory that creates a BundleClassLoader for the deployed Bundle.
+ A BundleClassLoader delegates all classloading concerns to the underlying Bundle.</para>
+
+ <emphasis role="bold">BundleStartStopDeployer</emphasis>
+
+ <para>The BundleStartStopDeployer currently works in two modes:</para>
+
+ <itemizedlist>
+ <listitem>deferredStart (default)</listitem>
+ <listitem>simpleStart</listitem>
+ </itemizedlist>
+
+ <para>In mode <emphasis role="bold">deferredStart</emphasis> the Bundle is added to a list of unresolved Bundles, which then get passed
+ on to <ulink url="http://www.osgi.org/javadoc/r4v41/org/osgi/service/packageadmin/PackageAdmin.html#resolveBundles(org.osgi.framework.Bundle[])"><code>PackageAdmin.resolveBundles(Bundle[])</code></ulink>.
+ The deployer then iterates over the unresolved Bundles and only starts those Bundles that are in state
+ <ulink url="http://www.osgi.org/javadoc/r4v41/org/osgi/framework/Bundle.html#RESOLVED"><code>RESOLVED</code></ulink>.
+ In this mode Bundles can be deployed in any order and only get started when all their respective dependencies can be resolved.</para>
+
+ <para>In mode <emphasis role="bold">simpleStart</emphasis> the deployer attempts to start the Bundle regardless of whether its
+ dependencies can get resolved. In case the Bundle has a dependency oin a package that is not yet available, deployment will fail.
+ In this mode Bundles must be deployed in the order required to start them.</para>
+
+ <para>The start mode is a configurable property on the Framework's SystemContext.</para>
+
+ <programlisting role="XML"><![CDATA[
+ <!--
+ If set to 'true' bundles can be deployed in any order. Deployed bundle will get started when their dependencies can be resolved.
+ If set to 'false' bundles must be deployed in the order that is required to start them.
+ -->
+ <entry><key>org.jboss.osgi.deferred.start</key><value>true</value></entry>
+ ]]></programlisting>
+
+ <emphasis role="bold">BundleManagementDeployer</emphasis>
+
+ <para>The BundleManagementDeployer registers the Bundle as <ulink url="http://java.sun.com/j2se/1.5.0/docs/api/javax/management/StandardMBean.html">StandardMBean</ulink> with JMX.
+ Please see the section on <ulink url="#SecJMXView">Management View</ulink> for details.</para>
+
</sect1>
- <sect1 id="SecJMXView">
+ <sect1 xml:id="SecJMXView">
<title>Management View</title>
<note>
@@ -102,7 +162,7 @@
</note>
</sect1>
- <sect1 id="SecClassLoading">
+ <sect1 xml:id="SecClassLoading">
<title>Class Loading</title>
<note>
@@ -110,7 +170,7 @@
</note>
</sect1>
- <sect1 id="SecLoggingBridge">
+ <sect1 xml:id="SecLoggingBridge">
<title>Logging Bridge</title>
<note>
@@ -118,7 +178,7 @@
</note>
</sect1>
- <sect1 id="SecMicrocontainerService">
+ <sect1 xml:id="SecMicrocontainerService">
<title>Microcontainer Service</title>
<note>
Modified: projects/jboss-osgi/trunk/build/docbook/en/modules/frameworkintegration.xml
===================================================================
--- projects/jboss-osgi/trunk/build/docbook/en/modules/frameworkintegration.xml 2009-03-26 08:38:07 UTC (rev 86376)
+++ projects/jboss-osgi/trunk/build/docbook/en/modules/frameworkintegration.xml 2009-03-26 11:17:31 UTC (rev 86377)
@@ -1,11 +1,11 @@
<!--
$Id$
-->
-<chapter id="ChapFrameworkIntegration">
+<chapter xml:id="ChapFrameworkIntegration">
<title>Framework Integration</title>
- <sect1 id="SecIntFelix">
+ <sect1 xml:id="SecIntFelix">
<title>Apache Felix Integration</title>
<para>JBossOSGi provides integration for the <ulink url="http://felix.apache.org">Apache Felix</ulink> OSGi Framework and some
@@ -77,7 +77,7 @@
</table>
</sect1>
- <sect1 id="SecIntEquinox">
+ <sect1 xml:id="SecIntEquinox">
<title>Equinox Integration</title>
<note>
@@ -85,7 +85,7 @@
</note>
</sect1>
- <sect1 id="SecIntKnopflerfish">
+ <sect1 xml:id="SecIntKnopflerfish">
<title>Knopflerfish Integration</title>
<note>
Modified: projects/jboss-osgi/trunk/build/docbook/en/modules/gettingstarted.xml
===================================================================
--- projects/jboss-osgi/trunk/build/docbook/en/modules/gettingstarted.xml 2009-03-26 08:38:07 UTC (rev 86376)
+++ projects/jboss-osgi/trunk/build/docbook/en/modules/gettingstarted.xml 2009-03-26 11:17:31 UTC (rev 86377)
@@ -1,14 +1,14 @@
<!--
$Id$
-->
-<chapter id="ChapGettingStarted">
+<chapter xml:id="ChapGettingStarted">
<title>Getting Started</title>
<para>This chapter takes you through the first steps of getting JBossOSGi and
provides the initial pointers to get up and running.</para>
- <sect1 id="SecInstall">
+ <sect1 xml:id="SecInstall">
<title>Installing JBossOSGi</title>
<para>JBossOSGi is distributed as an <ulink url="http://izpack.org">IzPack</ulink> installer archive.
@@ -89,7 +89,7 @@
</mediaobject>
</sect1>
- <sect1 id="SecRuntime">
+ <sect1 xml:id="SecRuntime">
<title>JBossOSGi Runtime</title>
<para>If you selected 'JBossOSGi Runtime' during installation you should see a <emphasis role="bold">runtime</emphasis> folder, which contains
@@ -160,11 +160,12 @@
<para>JBossOSGi comes with a simple Web Console, which is currently based on the
<ulink url="http://felix.apache.org/site/apache-felix-web-console.html">Apache Felix Web Console</ulink> project.
- By default the JBossOSGi Web Console is available at <ulink url="http://localhost:8090/jboss-osgi">http://localhost:8090/jboss-osgi</ulink></para>
+ By default the JBossOSGi Web Console is available at <ulink url="http://localhost:8090/jboss-osgi">http://localhost:8090/jboss-osgi</ulink>.
+ </para>
<mediaobject>
<imageobject>
- <imagedata fileref="images/webconsole.jpg" contentwidth="120%"/>
+ <imagedata fileref="images/webconsole.png" contentwidth="450"/>
</imageobject>
</mediaobject>
@@ -173,7 +174,7 @@
</note>
</sect1>
- <sect1 id="SecHudson">
+ <sect1 xml:id="SecHudson">
<title>Hudson QA Environment</title>
<emphasis role="bold">Setup the Hudson QA Environment</emphasis>
@@ -191,7 +192,7 @@
<mediaobject>
<imageobject>
- <imagedata fileref="images/hudson_home.png" contentwidth="120%"/>
+ <imagedata fileref="images/hudson-home.png" contentwidth="450"/>
</imageobject>
</mediaobject>
Modified: projects/jboss-osgi/trunk/build/docbook/en/modules/introduction.xml
===================================================================
--- projects/jboss-osgi/trunk/build/docbook/en/modules/introduction.xml 2009-03-26 08:38:07 UTC (rev 86376)
+++ projects/jboss-osgi/trunk/build/docbook/en/modules/introduction.xml 2009-03-26 11:17:31 UTC (rev 86377)
@@ -1,11 +1,11 @@
<!--
$Id$
-->
-<chapter id="ChapIntroduction">
+<chapter xml:id="ChapIntroduction">
<title>Introduction</title>
- <sect1 id="SecWhatIsOsgi">
+ <sect1 xml:id="SecWhatIsOsgi">
<title>What is OSGi</title>
<para>The <ulink url="http://www2.osgi.org/Release4/HomePage">Open Services Gateway Initiative (OSGi)</ulink>,
@@ -51,7 +51,7 @@
</sect1>
- <sect1 id="SecFramworkOverview">
+ <sect1 xml:id="SecFramworkOverview">
<title>OSGi Framework Overview</title>
<para>The functionality of the Framework is divided in the following layers:</para>
@@ -197,7 +197,7 @@
</mediaobject>
</sect1>
- <sect1 id="SecServiceCompendium">
+ <sect1 xml:id="SecServiceCompendium">
<title>OSGi Service Compendium</title>
<para>The OSGi Service Compendium specifies a number of services that may be available in an OSGi runtime environment.
Modified: projects/jboss-osgi/trunk/build/docbook/en/modules/references.xml
===================================================================
--- projects/jboss-osgi/trunk/build/docbook/en/modules/references.xml 2009-03-26 08:38:07 UTC (rev 86376)
+++ projects/jboss-osgi/trunk/build/docbook/en/modules/references.xml 2009-03-26 11:17:31 UTC (rev 86377)
@@ -1,7 +1,7 @@
<!--
$Id$
-->
-<chapter id="ChapReferences">
+<chapter xml:id="ChapReferences">
<title>References</title>
Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDeployer.java 2009-03-26 08:38:07 UTC (rev 86376)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDeployer.java 2009-03-26 11:17:31 UTC (rev 86377)
@@ -21,6 +21,8 @@
*/
package org.jboss.osgi.deployer;
+// $Id$
+
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
@@ -35,13 +37,15 @@
import org.osgi.framework.BundleContext;
/**
- * This is the Bundle Deployer
+ * 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>
{
- /** Deployment filter */
private DeploymentUnitFilter filter = new BundleDeploymentUnitFilter();
private BundleContext systemContext;
@@ -85,7 +89,7 @@
{
public ClassLoader createClassLoader(DeploymentUnit unit) throws Exception
{
- return BundleClassLoader.createBundleClassLoaderFor(bundle);
+ return BundleClassLoader.createBundleClassLoader(bundle);
}
public void removeClassLoader(DeploymentUnit unit) throws Exception
Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java 2009-03-26 08:38:07 UTC (rev 86376)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java 2009-03-26 11:17:31 UTC (rev 86377)
@@ -33,7 +33,7 @@
import org.osgi.framework.Bundle;
/**
- * Register the bundle for management
+ * Register the Bundle as MBean with JMX.
*
* @author Thomas.Diesler at jboss.com
* @since 04-Mar-2009
Copied: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java (from rev 86375, projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiMetaData.java)
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java 2009-03-26 11:17:31 UTC (rev 86377)
@@ -0,0 +1,71 @@
+/*
+ * 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.deployer;
+
+//$Id$
+
+import java.net.URI;
+
+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 URI bundleLocation;
+
+ // exteralizable usage
+ public BundleMetaData()
+ {
+ }
+
+ public BundleMetaData(String symbolicName)
+ {
+ this.symbolicName = symbolicName;
+ }
+
+ public String getSymbolicName()
+ {
+ return symbolicName;
+ }
+
+ public URI getBundleLocation()
+ {
+ return bundleLocation;
+ }
+
+ public void setBundleLocation(URI bundleLocation)
+ {
+ this.bundleLocation = bundleLocation;
+ }
+
+ public String toString()
+ {
+ return "Bundle[name=" + symbolicName + "]";
+ }
+}
Property changes on: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java (from rev 86375, projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiMetaDataDeployer.java)
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java 2009-03-26 11:17:31 UTC (rev 86377)
@@ -0,0 +1,71 @@
+/*
+ * 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.deployer;
+
+//$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().toURI());
+ 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;
+ }
+}
Property changes on: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java (from rev 86375, projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java)
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java 2009-03-26 11:17:31 UTC (rev 86377)
@@ -0,0 +1,128 @@
+/*
+ * 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.deployer;
+
+//$Id$
+
+import java.net.URI;
+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.jboss.osgi.spi.framework.OSGiStateFormat;
+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<URI> 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<URI> skipBundles)
+ {
+ this.skipBundles = skipBundles;
+ }
+
+ public void deploy(DeploymentUnit unit, BundleMetaData metadata) throws DeploymentException
+ {
+ URI bundleUri = metadata.getBundleLocation();
+ if (bundleUri == null)
+ throw new IllegalStateException("Cannot obtain bundle location for: " + metadata);
+
+ String bundlePath = bundleUri.getPath();
+ if (bundlePath.endsWith("/"))
+ bundlePath = bundlePath.substring(0, bundlePath.length() - 1);
+
+ try
+ {
+ if (skipBundles != null)
+ {
+ boolean skipBundle = false;
+ for (URI skip : skipBundles)
+ {
+ String skipPath = skip.getPath();
+ if (skipPath.equals(bundlePath))
+ {
+ skipBundle = true;
+ break;
+ }
+ }
+ if (skipBundle == false)
+ {
+ Bundle bundle = systemContext.installBundle(bundleUri.toString());
+ unit.addAttachment(Bundle.class, bundle);
+
+ String state = OSGiStateFormat.formatBundleState(bundle.getState());
+ log.info("Installed: " + bundle + state);
+ }
+ }
+ }
+ 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();
+ String state = OSGiStateFormat.formatBundleState(bundle.getState());
+ log.info("Uninstalled: " + bundle + state);
+ }
+ catch (BundleException ex)
+ {
+ log.warn(ex);
+ }
+ }
+ }
+}
Property changes on: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiClassLoadingMetaDataDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiClassLoadingMetaDataDeployer.java 2009-03-26 08:38:07 UTC (rev 86376)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiClassLoadingMetaDataDeployer.java 2009-03-26 11:17:31 UTC (rev 86377)
@@ -1,57 +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.deployer;
-
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-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;
-
-/**
- * This creates limited CLMD.
- *
- * @author Ales.Justin at jboss.org
- */
-public class OSGiClassLoadingMetaDataDeployer extends AbstractSimpleRealDeployer<Bundle>
-{
- private ClassLoadingMetaData metaData;
-
- public OSGiClassLoadingMetaDataDeployer(ClassLoadingMetaData metaData)
- {
- super(Bundle.class);
- if (metaData == null)
- throw new IllegalArgumentException("Null metadata");
-
- addOutput(ClassLoadingMetaData.class);
- setStage(DeploymentStages.POST_PARSE);
- this.metaData = metaData;
- }
-
- public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- // override in any case
- ClassLoadingMetaData cloned = metaData.clone();
- unit.addAttachment(ClassLoadingMetaData.class, cloned);
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java 2009-03-26 08:38:07 UTC (rev 86376)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java 2009-03-26 11:17:31 UTC (rev 86377)
@@ -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.deployer;
-
-//$Id$
-
-import java.net.URI;
-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.jboss.osgi.spi.framework.OSGiStateFormat;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-/**
- * This is the OSGi Deployer
- *
- * @author Thomas.Diesler at jboss.org
- * @author Ales.Justin at jboss.org
- * @since 03-Feb-2009
- */
-public class OSGiDeployer extends AbstractSimpleRealDeployer<OSGiMetaData>
-{
- private BundleContext systemContext;
- private List<URI> skipBundles;
-
- public OSGiDeployer()
- {
- super(OSGiMetaData.class);
- addOutput(Bundle.class);
- setStage(DeploymentStages.POST_PARSE);
- }
-
- public void setSystemContext(BundleContext bundleContext)
- {
- this.systemContext = bundleContext;
- }
-
- public void setSkipBundles(List<URI> skipBundles)
- {
- this.skipBundles = skipBundles;
- }
-
- public void deploy(DeploymentUnit unit, OSGiMetaData metadata) throws DeploymentException
- {
- URI bundleUri = metadata.getBundleLocation();
- if (bundleUri == null)
- throw new IllegalStateException("Cannot obtain bundle location for: " + metadata);
-
- String bundlePath = bundleUri.getPath();
- if (bundlePath.endsWith("/"))
- bundlePath = bundlePath.substring(0, bundlePath.length() - 1);
-
- try
- {
- if (skipBundles != null)
- {
- boolean skipBundle = false;
- for (URI skip : skipBundles)
- {
- String skipPath = skip.getPath();
- if (skipPath.equals(bundlePath))
- {
- skipBundle = true;
- break;
- }
- }
- if (skipBundle == false)
- {
- Bundle bundle = systemContext.installBundle(bundleUri.toString());
- unit.addAttachment(Bundle.class, bundle);
-
- String state = OSGiStateFormat.formatBundleState(bundle.getState());
- log.info("Installed: " + bundle + state);
- }
- }
- }
- catch (BundleException ex)
- {
- throw DeploymentException.rethrowAsDeploymentException("Cannot install bundle: " + metadata, ex);
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, OSGiMetaData osGiMetaData)
- {
- Bundle bundle = unit.getAttachment(Bundle.class);
- if (bundle != null)
- {
- try
- {
- bundle.uninstall();
- String state = OSGiStateFormat.formatBundleState(bundle.getState());
- log.info("Uninstalled: " + bundle + state);
- }
- catch (BundleException ex)
- {
- log.warn(ex);
- }
- }
- }
-}
Deleted: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiMetaData.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiMetaData.java 2009-03-26 08:38:07 UTC (rev 86376)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiMetaData.java 2009-03-26 11:17:31 UTC (rev 86377)
@@ -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.deployer;
-
-//$Id$
-
-import java.net.URI;
-
-import org.jboss.deployers.vfs.spi.deployer.helpers.AbstractManifestMetaData;
-
-
-/**
- * This are the OSGi Meta Data
- *
- * @author Thomas.Diesler at jboss.org
- * @since 03-Feb-2009
- */
-public class OSGiMetaData extends AbstractManifestMetaData
-{
- private String symbolicName;
- private URI bundleLocation;
-
- // exteralizable usage
- public OSGiMetaData()
- {
- }
-
- public OSGiMetaData(String symbolicName)
- {
- this.symbolicName = symbolicName;
- }
-
- public String getSymbolicName()
- {
- return symbolicName;
- }
-
- public URI getBundleLocation()
- {
- return bundleLocation;
- }
-
- public void setBundleLocation(URI bundleLocation)
- {
- this.bundleLocation = bundleLocation;
- }
-
- public String toString()
- {
- return "Bundle[name=" + symbolicName + "]";
- }
-}
Deleted: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiMetaDataDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiMetaDataDeployer.java 2009-03-26 08:38:07 UTC (rev 86376)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiMetaDataDeployer.java 2009-03-26 11:17:31 UTC (rev 86377)
@@ -1,69 +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.deployer;
-
-//$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;
-
-/**
- * This is the OSGi Deployer
- *
- * @author Thomas.Diesler at jboss.org
- * @since 03-Feb-2009
- */
-public class OSGiMetaDataDeployer extends ManifestDeployer<OSGiMetaData>
-{
- public OSGiMetaDataDeployer()
- {
- super(OSGiMetaData.class);
- }
-
- @Override
- protected OSGiMetaData parse(VFSDeploymentUnit unit, VirtualFile file, OSGiMetaData root) throws Exception
- {
- OSGiMetaData metaData = super.parse(unit, file, root);
- if (metaData != null)
- {
- metaData.setBundleLocation(unit.getRoot().toURI());
- log.debug("Bundle-SymbolicName: " + metaData.getSymbolicName() + " in " + file);
- }
- return metaData;
- }
-
- @Override
- protected OSGiMetaData createMetaData(Manifest manifest) throws Exception
- {
- Attributes attribs = manifest.getMainAttributes();
- String symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
- if (symbolicName != null)
- return new OSGiMetaData(symbolicName);
-
- return null;
- }
-}
Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/helpers/BundleClassLoader.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/helpers/BundleClassLoader.java 2009-03-26 08:38:07 UTC (rev 86376)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/helpers/BundleClassLoader.java 2009-03-26 11:17:31 UTC (rev 86377)
@@ -21,6 +21,8 @@
*/
package org.jboss.osgi.deployer.helpers;
+// $Id: $
+
import java.io.IOException;
import java.net.URL;
import java.security.AccessController;
@@ -32,15 +34,17 @@
import org.osgi.framework.Constants;
/**
- * Bundle backed classloader.
+ * A BundleClassLoader delegates all classloading concerns to the underlying Bundle.
*
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ * @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 createBundleClassLoaderFor(final Bundle bundle)
+ public static BundleClassLoader createBundleClassLoader(final Bundle bundle)
{
if (bundle == null)
throw new IllegalArgumentException("Null bundle");
Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/resources/osgi-deployers-jboss-beans.xml 2009-03-26 08:38:07 UTC (rev 86376)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/resources/osgi-deployers-jboss-beans.xml 2009-03-26 11:17:31 UTC (rev 86377)
@@ -52,10 +52,10 @@
</bean>
<!-- The OSGi Meta Data Deployer -->
- <bean name="jboss.osgi:service=MetaDataDeployer" class="org.jboss.osgi.deployer.OSGiMetaDataDeployer" />
+ <bean name="jboss.osgi:service=BundleMetaDataDeployer" class="org.jboss.osgi.deployer.BundleMetaDataDeployer" />
- <!-- The OSGi Deployer -->
- <bean name="jboss.osgi:service=Deployer" class="org.jboss.osgi.deployer.OSGiDeployer">
+ <!-- The OSGi Bundle Deployer -->
+ <bean name="jboss.osgi:service=BundleRealDeployer" class="org.jboss.osgi.deployer.BundleRealDeployer">
<property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext" /></property>
<property name="skipBundles"><inject bean="jboss.osgi:service=Framework" property="autoInstall" /></property>
</bean>
@@ -65,14 +65,14 @@
<property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext" /></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=Framework" property="systemBundleContext" /></property>
+ </bean>
+
<!-- The Bundle Management Deployer -->
<bean name="jboss.osgi:service=BundleManagementDeployer" class="org.jboss.osgi.deployer.BundleManagementDeployer">
<property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></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=Framework" property="systemBundleContext" /></property>
- </bean>
-
</deployment>
\ No newline at end of file
More information about the jboss-osgi-commits
mailing list