[jboss-cvs] JBossAS SVN: r86381 - in projects/jboss-osgi/trunk: build/docbook/en/modules and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 26 09:40:34 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-03-26 09:40:34 -0400 (Thu, 26 Mar 2009)
New Revision: 86381

Added:
   projects/jboss-osgi/trunk/build/docbook/en/modules/providedservices.xml
Modified:
   projects/jboss-osgi/trunk/build/docbook/en/master.xml
   projects/jboss-osgi/trunk/build/docbook/en/modules/devguide.xml
   projects/jboss-osgi/trunk/runtime/deployer/src/main/resources/osgi-deployers-jboss-beans.xml
   projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/service/MicrocontainerService.java
   projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/MBeanTestService.java
Log:
docbook mc service

Modified: projects/jboss-osgi/trunk/build/docbook/en/master.xml
===================================================================
--- projects/jboss-osgi/trunk/build/docbook/en/master.xml	2009-03-26 12:50:09 UTC (rev 86380)
+++ projects/jboss-osgi/trunk/build/docbook/en/master.xml	2009-03-26 13:40:34 UTC (rev 86381)
@@ -8,6 +8,7 @@
 <!ENTITY ChapGettingStarted SYSTEM "modules/gettingstarted.xml">
 <!ENTITY ChapFrameworkIntegration SYSTEM "modules/frameworkintegration.xml">
 <!ENTITY ChapDeveloperGuide SYSTEM "modules/devguide.xml">
+<!ENTITY ChapProvidedServices SYSTEM "modules/providedservices.xml">
 <!ENTITY ChapReferences SYSTEM "modules/references.xml">
 <!ENTITY version "1.0.0.Alpha3">
 ]>
@@ -35,6 +36,7 @@
   &ChapGettingStarted;
   &ChapFrameworkIntegration;
   &ChapDeveloperGuide;
+  &ChapProvidedServices;
   &ChapReferences;
   
 </book>
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/build/docbook/en/modules/devguide.xml
===================================================================
--- projects/jboss-osgi/trunk/build/docbook/en/modules/devguide.xml	2009-03-26 12:50:09 UTC (rev 86380)
+++ projects/jboss-osgi/trunk/build/docbook/en/modules/devguide.xml	2009-03-26 13:40:34 UTC (rev 86381)
@@ -14,7 +14,7 @@
     
     <mediaobject>
       <imageobject>
-        <imagedata fileref="images/jboss-osgi.png"/> 
+        <imagedata fileref="images/jboss-osgi.png" contentwidth="450"/> 
       </imageobject>
     </mediaobject>
     
@@ -244,7 +244,7 @@
     
     <mediaobject>
       <imageobject>
-        <imagedata fileref="images/jmx-agent-view.png"/> 
+        <imagedata fileref="images/jmx-agent-view.png" contentwidth="450"/> 
       </imageobject>
     </mediaobject>
     
@@ -253,59 +253,4 @@
     </note> 
   </sect1>
   
-  <sect1 xml:id="SecLoggingBridge">  
-    <title>Logging Bridge</title>
-    
-    <para>The JBossOSGi <emphasis role="bold">jboss-osgi-service-logging.jar</emphasis> Bundle contains a simple Logging Bridge Service to
-    <ulink url="http://www.jboss.org/community/docs/DOC-11280">JBoss Logging</ulink>. It registers a trivial 
-    <ulink url="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogListener.html">LogListener</ulink> with the 
-    <ulink url="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogReaderService.html">LogReaderService</ulink> in case that service
-    is registered with the Framework.</para>
-    
-    <para>The <ulink url="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogReaderService.html">LogReaderService</ulink> is part of the 
-    standard <ulink url="http://www.osgi.org/Download/File?url=/download/r4v41/r4.cmpn.pdf">OSGi Compendium Services</ulink>. JBossOSGi currently
-    uses the (not yet released) LogService from <ulink url="http://felix.apache.org">Apache Felix</ulink>, which gets deployed as Bundle
-    <emphasis role="bold">org.apache.felix.log.jar</emphasis></para>
-    
-    <para>The <ulink url="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogListener.html">LogListener</ulink> itself logs messages 
-    under the Bundle's symbolic name.</para>
-    
-    <programlisting role="JAVA">
-    public class JBossLoggingLogListener implements LogListener
-    {
-       public void logged(LogEntry entry)
-       {
-          Bundle bundle = entry.getBundle();
-          int level = entry.getLevel();
-          Throwable throwable = entry.getException();
-    
-          String loggerName = bundle.getSymbolicName();
-          Logger log = Logger.getLogger(loggerName);
-          
-          if (level == LogService.LOG_DEBUG)
-             log.debug(entry.getMessage(), throwable);
-          
-          else if (level == LogService.LOG_INFO)
-             log.info(entry.getMessage(), throwable);
-          
-          else if (level == LogService.LOG_WARNING)
-             log.warn(entry.getMessage(), throwable);
-    
-          else if (level == LogService.LOG_ERROR)
-             log.error(entry.getMessage(), throwable);
-       }
-    }
-    </programlisting>
-    
-    <para>You can therefore change the logging for specific Bundles by <ulink url="http://www.jboss.org/community/docs/DOC-12490">setting the respective logging level</ulink>.</para>.  
-  </sect1>
-  
-  <sect1 xml:id="SecMicrocontainerService">  
-    <title>Microcontainer Service</title>
-    
-    <note>
-      <title>TODO: Document the Microcontainer Service</title>
-    </note>
-  </sect1>
-  
 </chapter>

Added: projects/jboss-osgi/trunk/build/docbook/en/modules/providedservices.xml
===================================================================
--- projects/jboss-osgi/trunk/build/docbook/en/modules/providedservices.xml	                        (rev 0)
+++ projects/jboss-osgi/trunk/build/docbook/en/modules/providedservices.xml	2009-03-26 13:40:34 UTC (rev 86381)
@@ -0,0 +1,82 @@
+<!-- 
+  $Id$ 
+-->
+<chapter xml:id="ChapProvidedServices">
+
+  <title>Provided Services</title>
+  
+  <sect1 xml:id="SecLoggingService">  
+    <title>JBoss Logging Service</title>
+    
+    <para>The JBossOSGi <emphasis role="bold">jboss-osgi-service-logging.jar</emphasis> Bundle contains a simple Logging Bridge Service to
+    <ulink url="http://www.jboss.org/community/docs/DOC-11280">JBoss Logging</ulink>. It registers a trivial LogListener with the 
+    LogReaderService in case that service is registered with the Framework.</para>
+    
+    <itemizedlist>
+      <listitem><ulink url="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogListener.html">LogListener</ulink> - Subscribes to LogEntry objects from the LogReaderService</listitem>
+      <listitem><ulink url="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogReaderService.html">LogReaderService</ulink> - Provides methods to retrieve LogEntry objects from the log</listitem>
+    </itemizedlist>
+    
+    <para>The LogReaderService is part of the standard <ulink url="http://www.osgi.org/Download/File?url=/download/r4v41/r4.cmpn.pdf">OSGi 
+    Compendium Services</ulink>. JBossOSGi currently uses the (not yet released) LogService from <ulink url="http://felix.apache.org">Apache Felix</ulink>, 
+    which gets deployed as Bundle <emphasis role="bold">org.apache.felix.log.jar</emphasis></para>
+    
+    <para>The LogListener itself logs messages under the Bundle's symbolic name.</para>
+    
+    <programlisting role="JAVA">
+    public class JBossLoggingLogListener implements LogListener
+    {
+       public void logged(LogEntry entry)
+       {
+          Bundle bundle = entry.getBundle();
+          int level = entry.getLevel();
+          Throwable throwable = entry.getException();
+    
+          String loggerName = bundle.getSymbolicName();
+          Logger log = Logger.getLogger(loggerName);
+          
+          if (level == LogService.LOG_DEBUG)
+             log.debug(entry.getMessage(), throwable);
+          
+          else if (level == LogService.LOG_INFO)
+             log.info(entry.getMessage(), throwable);
+          
+          else if (level == LogService.LOG_WARNING)
+             log.warn(entry.getMessage(), throwable);
+    
+          else if (level == LogService.LOG_ERROR)
+             log.error(entry.getMessage(), throwable);
+       }
+    }
+    </programlisting>
+    
+    <para>You can therefore change the logging for specific Bundles by 
+    <ulink url="http://www.jboss.org/community/docs/DOC-12490">setting the respective logging level</ulink>.</para>  
+  </sect1>
+  
+  <sect1 xml:id="SecMicrocontainerService">  
+    <title>Microcontainer Service</title>
+    
+    <para>JBossOSGi SPI comes with a service that give access to the <ulink url="http://www.jboss.org/jbossmc">JBoss Microcontainer</ulink> Kernel
+    and the JMX <ulink url="http://java.sun.com/j2se/1.5.0/docs/api/javax/management/MBeanServer.html">MBeanServer</ulink>. The service is 
+    registered with the Framework under the name</para>
+    
+    <itemizedlist>
+      <listitem><emphasis role="bold">org.jboss.osgi.service.MicrocontainerService</emphasis></listitem>
+    </itemizedlist>
+    
+    <para>Here is an example of how an OSGi component can register an arbitrary MBean with the 
+    <ulink url="http://java.sun.com/j2se/1.5.0/docs/api/javax/management/MBeanServer.html">MBeanServer</ulink>.</para>
+    
+    <programlisting role="JAVA">
+    ServiceReference sref = context.getServiceReference(MicrocontainerService.class.getName());
+    if (sref == null)
+      throw new IllegalStateException("MicrocontainerService not registered");
+    
+    MicrocontainerService mcService = (MicrocontainerService)context.getService(sref);
+  	MBeanServer mbeanServer = mcService.getMbeanServer();
+    mbeanServer.registerMBean(new Foo(), OBJECT_NAME);
+    </programlisting>
+  </sect1>
+  
+</chapter>


Property changes on: projects/jboss-osgi/trunk/build/docbook/en/modules/providedservices.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

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 12:50:09 UTC (rev 86380)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/resources/osgi-deployers-jboss-beans.xml	2009-03-26 13:40:34 UTC (rev 86381)
@@ -46,7 +46,7 @@
 
   <!-- A Service that gives access to the Microcontainer Kernel -->
   <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.service.MicrocontainerService">
-   <property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext"/></property>
+   <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext"/></property>
    <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
    <property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
   </bean>

Modified: projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/service/MicrocontainerService.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/service/MicrocontainerService.java	2009-03-26 12:50:09 UTC (rev 86380)
+++ projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/service/MicrocontainerService.java	2009-03-26 13:40:34 UTC (rev 86381)
@@ -30,14 +30,14 @@
 import org.osgi.framework.BundleContext;
 
 /**
- * An OSGi Service the gives access to the Microcontainer
+ * An OSGi Service the gives access to the Kernel and MBeanServer.
  * 
  * @author thomas.diesler at jboss.com
  * @since 23-Jan-2009
  */
 public class MicrocontainerService
 {
-  private BundleContext bundleContext;
+  private BundleContext systemContext;
   private MBeanServer mbeanServer;
   private Kernel kernel;
 
@@ -46,12 +46,12 @@
    */
   public void create()
   {
-    bundleContext.registerService(MicrocontainerService.class.getName(), this, null);
+    systemContext.registerService(MicrocontainerService.class.getName(), this, null);
   }
   
-  public void setBundleContext(BundleContext bundleContext)
+  public void setSystemContext(BundleContext bundleContext)
   {
-    this.bundleContext = bundleContext;
+    this.systemContext = bundleContext;
   }
 
   public void setKernel(Kernel kernel)

Modified: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/MBeanTestService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/MBeanTestService.java	2009-03-26 12:50:09 UTC (rev 86380)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/MBeanTestService.java	2009-03-26 13:40:34 UTC (rev 86381)
@@ -83,7 +83,7 @@
   {
     ServiceReference sref = context.getServiceReference(MicrocontainerService.class.getName());
     if (sref == null)
-      throw new IllegalStateException("HttpService not registered");
+      throw new IllegalStateException("MicrocontainerService not registered");
     
     return (MicrocontainerService)context.getService(sref);
   }




More information about the jboss-cvs-commits mailing list