[jboss-cvs] JBossAS SVN: r91573 - in projects/jboss-osgi/trunk: distribution/installer/scripts and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jul 22 15:20:19 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-07-22 15:20:19 -0400 (Wed, 22 Jul 2009)
New Revision: 91573
Modified:
projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch040-framework-integration.xml
projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch070-provided-bundles.xml
projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch080-provided-examples.xml
projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch090-references.xml
projects/jboss-osgi/trunk/distribution/installer/scripts/assembly-src-distro.xml
projects/jboss-osgi/trunk/reactor/blueprint/pom.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/DOMParserTestCase.java
Log:
Update userguide
Modified: projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch040-framework-integration.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch040-framework-integration.xml 2009-07-22 19:18:27 UTC (rev 91572)
+++ projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch040-framework-integration.xml 2009-07-22 19:20:19 UTC (rev 91573)
@@ -20,7 +20,7 @@
<para>The Apache Felix integration can be configured through properties in the <link linkend="ChapRuntime">JBoss OSGi Runtime</link>.
</para>
- <programlisting role="XML"><![CDATA[
+ <programlisting>
cat conf/jboss-osgi-framework.properties
# The OSGiFramework implementation
@@ -44,7 +44,7 @@
file://${osgi.home}/server/minimal/bundles/org.apache.felix.log.jar \
file://${osgi.home}/server/minimal/bundles/jboss-osgi-common.jar \
file://${osgi.home}/server/minimal/bundles/jboss-osgi-hotdeploy.jar
- ]]></programlisting>
+ </programlisting>
<para>In the <ulink url="http://www.jboss.org/jbossas">JBossAS</ulink> integration we use
<ulink url="http://www.jboss.org/jbossmc">JBoss Microcontainer</ulink> beans configuration.</para>
Modified: projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch070-provided-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch070-provided-bundles.xml 2009-07-22 19:18:27 UTC (rev 91572)
+++ projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch070-provided-bundles.xml 2009-07-22 19:20:19 UTC (rev 91573)
@@ -220,7 +220,7 @@
<title>Blueprint Container Service</title>
<para>The JBoss OSGi <emphasis role="bold">jboss-osgi-blueprint.jar</emphasis> bundle provides
- a early access of a Blueprint extender service.</para>
+ an early access of a Blueprint extender service.</para>
<para>The <ulink url="http://jbossosgi.blogspot.com/2009/04/osgi-blueprint-service-rfc-124.html">Blueprint Container</ulink>
service allows bundles to contain standard blueprint descriptors, which can be used for component wiring
Modified: projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch080-provided-examples.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch080-provided-examples.xml 2009-07-22 19:18:27 UTC (rev 91572)
+++ projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch080-provided-examples.xml 2009-07-22 19:20:19 UTC (rev 91573)
@@ -24,6 +24,7 @@
[INFO] ------------------------------------------------------------------------
...
build-test-jars:
+ # example-blueprint (example-blueprint.jar) 6
# example-http (example-http.jar) 4
# example-jmx (example-jmx.jar) 4
# example-jndi (example-jndi.jar) 1
@@ -31,31 +32,49 @@
# example-mcservice-bundleA (example-mcservice-bundleA.jar) 2
# example-mcservice-bundleB (example-mcservice-bundleB.jar) 3
# example-simple (example-simple.jar) 2
- # example-simple-husky (example-simple-husky.jar) 4
+ # example-simple-husky (example-simple-husky.jar) 4
+ # example-xml-jaxb (example-xml-jaxb.jar) 8
+ # example-xml-parser (example-xml-parser.jar) 4
-------------------------------------------------------
T E S T S
-------------------------------------------------------
+ Running org.jboss.test.osgi.example.blueprint.BlueprintTestCase
+ Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.222 sec
+ Running org.jboss.test.osgi.example.xml.jaxb.JAXBTestCase
+ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.685 sec
Running org.jboss.test.osgi.example.microcontainer.MicrocontainerTestCase
- Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.006 sec
+ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.917 sec
+ Running org.jboss.test.osgi.example.xml.parser.SAXParserTestCase
+ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.01 sec
Running org.jboss.test.osgi.example.http.HttpServiceTestCase
- Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.735 sec
+ Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.45 sec
+ Running org.jboss.test.osgi.example.xml.parser.DOMParserTestCase
+ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.016 sec
Running org.jboss.test.osgi.example.log.LogServiceTestCase
- Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.385 sec
+ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.923 sec
Running org.jboss.test.osgi.example.jndi.JNDITestCase
- Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.535 sec
+ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.921 sec
Running org.jboss.test.osgi.example.jmx.JMXTestCase
- Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.643 sec
+ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.937 sec
Running org.jboss.test.osgi.example.simple.SimpleTestCase
- Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.166 sec
+ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.588 sec
Running org.jboss.test.osgi.example.simple.SimpleHuskyTestCase
- Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.384 sec
+ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.813 sec
+
+ Results :
+
+ Tests run: 19, Failures: 0, Errors: 0, Skipped: 0
</programlisting>
<para>To run the examples against a remote OSGi Runtime, you need to provide the
target container that the runtime should connect to. This can be done with the
<emphasis role="bold">target.container</emphasis> system property.</para>
+ <programlisting>
+ mvn -Dtarget.container=runtime test
+ </programlisting>
+
<para>Suported target container values are:</para>
<itemizedlist>
@@ -65,6 +84,7 @@
<listitem>jboss520</listitem>
<listitem>jboss600</listitem>
</itemizedlist>
+
</sect1>
<sect1 xml:id="SecSimpleExample">
@@ -72,6 +92,66 @@
<para>The simple example is covered in: <link linkend="SecWritingTests">Writing Test Cases</link></para>
</sect1>
+ <sect1 xml:id="SecXMLParserServiceExample">
+ <title>SAX/DOM Parser Service Example</title>
+
+ <para>The <emphasis role="bold">example-xml-parser.jar</emphasis> bundle gets a DocumentBuilderFactory/SAXParserFactory
+ respectivly and unmarshalls an XML document using that parser.
+ </para>
+
+ <programlisting role="JAVA">
+ ServiceReference sref = context.getServiceReference(DocumentBuilderFactory.class.getName());
+ if (sref == null)
+ throw new IllegalStateException("DocumentBuilderFactory not available");
+
+ DocumentBuilderFactory factory = (DocumentBuilderFactory)context.getService(sref);
+ factory.setValidating(false);
+
+ DocumentBuilder domBuilder = factory.newDocumentBuilder();
+ URL resURL = context.getBundle().getResource("example-xml-parser.xml");
+ Document dom = domBuilder.parse(resURL.openStream());
+ assertNotNull("Document not null", dom);
+ </programlisting>
+
+ <programlisting role="JAVA">
+ ServiceReference sref = context.getServiceReference(SAXParserFactory.class.getName());
+ if (sref == null)
+ throw new IllegalStateException("SAXParserFactory not available");
+
+ SAXParserFactory factory = (SAXParserFactory)context.getService(sref);
+ factory.setValidating(false);
+
+ SAXParser saxParser = factory.newSAXParser();
+ URL resURL = context.getBundle().getResource("example-xml-parser.xml");
+
+ SAXHandler saxHandler = new SAXHandler();
+ saxParser.parse(resURL.openStream(), saxHandler);
+ assertEquals("content", saxHandler.getContent());
+ </programlisting>
+ </sect1>
+
+ <sect1 xml:id="SecJAXBServiceExample">
+ <title>JAXB Service Example</title>
+
+ <para>The <emphasis role="bold">example-xml-jaxb.jar</emphasis> bundle gets the JAXBContext from the JAXBService
+ and unmarshalls an XML document using JAXB
+ </para>
+
+ <programlisting role="JAVA">
+ ServiceReference sref = context.getServiceReference(JAXBService.class.getName());
+ if (sref == null)
+ throw new IllegalStateException("JAXBService not available");
+
+ JAXBService service = (JAXBService)context.getService(sref);
+ JAXBContext jaxbContext = service.newJAXBContext(getClass().getPackage().getName());
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+
+ URL resURL = context.getBundle().getResource("booking.xml");
+ JAXBElement rootElement = unmarshaller.unmarshal(resURL.openStream());
+ assertNotNull("root element not null", rootElement);
+ </programlisting>
+ </sect1>
+
<sect1 xml:id="SecJMXServiceExample">
<title>JMX Service Example</title>
@@ -254,4 +334,69 @@
</programlisting>
</sect1>
+ <sect1 xml:id="SecBlueprintContainerExample">
+ <title>Blueprint Container Example</title>
+
+ <para>The <emphasis role="bold">example-blueprint.jar</emphasis> bundle contains a number of
+ components that are wired together and registerd as OSGi service through the Blueprint Container
+ Service.</para>
+
+ <para>The example uses this simple blueprint descriptor</para>
+
+ <programlisting role="XML"><![CDATA[
+ <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" ...>
+
+ <bean id="beanA" class="org.jboss.test.osgi.example.blueprint.bundle.BeanA">
+ <property name="mbeanServer" ref="mbeanService"/>
+ </bean>
+
+ <service id="serviceA" ref="beanA" interface="org.jboss.test.osgi.example.blueprint.bundle.ServiceA">
+ </service>
+
+ <service id="serviceB" interface="org.jboss.test.osgi.example.blueprint.bundle.ServiceB">
+ <bean class="org.jboss.test.osgi.example.blueprint.bundle.BeanB">
+ <property name="beanA" ref="beanA"/>
+ </bean>
+ </service>
+
+ <reference id="mbeanService" interface="javax.management.MBeanServer"/>
+
+ </blueprint>
+ ]]></programlisting>
+
+ <para>The Blueprint Container registers two services <emphasis role="bold">ServiceA</emphasis> and
+ <emphasis role="bold">ServiceB</emphasis>. ServiceA is backed up by <emphasis role="bold">BeanA</emphasis>,
+ ServiceB is backed up by the anonymous <emphasis role="bold">BeanB</emphasis>. BeanA is injected into
+ BeanB and the <emphasis role="bold">MBeanServer</emphasis> gets injected into BeanA. Both beans are plain POJOs.
+ There is <emphasis role="bold">no BundleActivator</emphasis> neccessary to register the services.</para>
+
+ <para>The example test verifies the correct wiring like this</para>
+
+ <programlisting role="JAVA">
+ @Test
+ public void testServiceA() throws Exception
+ {
+ ServiceReference sref = context.getServiceReference(ServiceA.class.getName());
+ assertNotNull("ServiceA not null", sref);
+
+ ServiceA service = (ServiceA)context.getService(sref);
+ MBeanServer mbeanServer = service.getMbeanServer();
+ assertNotNull("MBeanServer not null", mbeanServer);
+ }
+ </programlisting>
+
+ <programlisting role="JAVA">
+ @Test
+ public void testServiceB() throws Exception
+ {
+ ServiceReference sref = context.getServiceReference(ServiceB.class.getName());
+ assertNotNull("ServiceB not null", sref);
+
+ ServiceB service = (ServiceB)context.getService(sref);
+ BeanA beanA = service.getBeanA();
+ assertNotNull("BeanA not null", beanA);
+ }
+ </programlisting>
+ </sect1>
+
</chapter>
Modified: projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch090-references.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch090-references.xml 2009-07-22 19:18:27 UTC (rev 91572)
+++ projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch090-references.xml 2009-07-22 19:20:19 UTC (rev 91573)
@@ -9,7 +9,7 @@
<itemizedlist>
<listitem><ulink url="http://www.jboss.org/community/wiki/JBoss OSGi">JBoss OSGi Wiki</ulink></listitem>
- <listitem><ulink url="http://jbossosgi.blogspot.com">JBoss OSGi Diary (Blog)</ulink></listitem>
+ <listitem><ulink url="http://jbossosgi.blogspot.com">JBoss OSGi Diary</ulink></listitem>
<listitem><ulink url="https://jira.jboss.org/jira/browse/JBOSGI">Issue Tracking</ulink></listitem>
<listitem><ulink url="http://jbmuc.dyndns.org:8280/hudson">Hudson QA</ulink></listitem>
<listitem><ulink url="https://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi">Subversion</ulink></listitem>
Modified: projects/jboss-osgi/trunk/distribution/installer/scripts/assembly-src-distro.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/scripts/assembly-src-distro.xml 2009-07-22 19:18:27 UTC (rev 91572)
+++ projects/jboss-osgi/trunk/distribution/installer/scripts/assembly-src-distro.xml 2009-07-22 19:20:19 UTC (rev 91573)
@@ -9,7 +9,7 @@
<fileSets>
<fileSet>
- <directory>..</directory>
+ <directory>../..</directory>
<outputDirectory>/</outputDirectory>
<excludes>
<exclude>**/target/**</exclude>
Modified: projects/jboss-osgi/trunk/reactor/blueprint/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/pom.xml 2009-07-22 19:18:27 UTC (rev 91572)
+++ projects/jboss-osgi/trunk/reactor/blueprint/pom.xml 2009-07-22 19:20:19 UTC (rev 91573)
@@ -25,8 +25,8 @@
<!-- Parent -->
<parent>
<groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-reactor</artifactId>
- <version>1.0.0.Beta3</version>
+ <artifactId>jboss-osgi-parent</artifactId>
+ <version>1.0.1</version>
</parent>
<!-- Properties -->
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/DOMParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/DOMParserTestCase.java 2009-07-22 19:18:27 UTC (rev 91572)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/DOMParserTestCase.java 2009-07-22 19:20:19 UTC (rev 91573)
@@ -50,7 +50,7 @@
import org.w3c.dom.Node;
/**
- * A test that uses a SAX parser to read an XML document.
+ * A test that uses a DOM parser to read an XML document.
*
* @see http://www.osgi.org/javadoc/r4v41/org/osgi/util/xml/XMLParserActivator.html
*
@@ -96,9 +96,9 @@
// Stop here if the context is not injected
assumeNotNull(context);
- DocumentBuilder domParser = getDocumentBuilder();
+ DocumentBuilder domBuilder = getDocumentBuilder();
URL resURL = context.getBundle().getResource("example-xml-parser.xml");
- Document dom = domParser.parse(resURL.openStream());
+ Document dom = domBuilder.parse(resURL.openStream());
assertNotNull("Document not null", dom);
Element root = dom.getDocumentElement();
@@ -119,6 +119,7 @@
DocumentBuilderFactory factory = (DocumentBuilderFactory)context.getService(sref);
factory.setValidating(false);
- return factory.newDocumentBuilder();
+ DocumentBuilder domBuilder = factory.newDocumentBuilder();
+ return domBuilder;
}
}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list