[jboss-osgi-commits] JBoss-OSGI SVN: r97531 - in projects/jboss-osgi/trunk: testsuite/example/scripts and 4 other directories.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Tue Dec 8 05:16:15 EST 2009
Author: thomas.diesler at jboss.com
Date: 2009-12-08 05:16:14 -0500 (Tue, 08 Dec 2009)
New Revision: 97531
Added:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/CompanyType.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/ContactType.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/CourseBooking.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/StudentType.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/XMLBindingActivator.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/XMLBindingTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jbossxb/
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jbossxb/booking.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jbossxb/booking.xsd
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jbossxb/example-xml-binding.bnd
Modified:
projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch020-getting-started.xml
projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch030-runtime.xml
projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch050-developer-guide.xml
projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch070-provided-bundles.xml
projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml
Log:
Add XML Binding example
Modified: projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch020-getting-started.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch020-getting-started.xml 2009-12-08 09:33:12 UTC (rev 97530)
+++ projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch020-getting-started.xml 2009-12-08 10:16:14 UTC (rev 97531)
@@ -151,7 +151,7 @@
16:20:30,789 INFO [FrameworkEventsPluginImpl] Bundle STARTED: Bundle{jboss-osgi-jmx-1.0.2}
16:20:30,806 INFO [FrameworkEventsPluginImpl] Bundle STARTED: Bundle{jboss-osgi-common-core-2.2.13.GA}
...
- 16:20:30,824 INFO [DeploymentScannerImpl] <emphasis role="bold">JBossOSGi Runtime started in 1.64sec</emphasis>
+ <emphasis role="bold">16:20:30,824 INFO [DeploymentScannerImpl] JBossOSGi Runtime started in 1.64sec</emphasis>
</programlisting>
</sect1>
Modified: projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch030-runtime.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch030-runtime.xml 2009-12-08 09:33:12 UTC (rev 97530)
+++ projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch030-runtime.xml 2009-12-08 10:16:14 UTC (rev 97531)
@@ -80,6 +80,10 @@
Components can access the JNDI InitialContext as a service from the registry.
</listitem>
+ <listitem><emphasis role="bold">JTA Support</emphasis> -
+ Components can interact with the JTA TransactionManager and UserTransaction service.
+ </listitem>
+
<listitem><emphasis role="bold">SAX/DOM Parser Support</emphasis> -
The Runtime comes with an implementation of an <ulink url="http://www.osgi.org/javadoc/r4v41/org/osgi/util/xml/XMLParserActivator.html">XMLParserActivator</ulink>
which provides access to a SAXParserFactory and DocumentBuilderFactory.
@@ -97,6 +101,10 @@
ConfigAdmin support is provided by the <ulink url="http://felix.apache.org/site/apache-felix-configuration-admin-service.html">Apache Felix Configuration Admin Service</ulink>.
</listitem>
+ <listitem><emphasis role="bold">EventAdmin Support</emphasis> -
+ EventAdmin support is provided by the <ulink url="http://felix.apache.org/site/apache-felix-event-admin.html">Apache Felix Event Admin Service</ulink>.
+ </listitem>
+
<listitem><emphasis role="bold">Provisioning</emphasis> -
Bundle provisioning can be done through the JMX based Runtime Managment Interface.
</listitem>
@@ -151,7 +159,7 @@
12:10:50,042 INFO [jboss-osgi-hotdeploy] Start DeploymentScanner: [scandir=.../server/minimal/deploy,interval=2000ms]
12:10:50,047 INFO [FrameworkEventsPluginImpl] Bundle STARTED: Bundle{jboss-osgi-hotdeploy:1.0.2}
12:10:50,050 INFO [FrameworkEventsPluginImpl] Bundle STARTED: Bundle{system.bundle:0.0.0}
- 12:10:50,076 INFO [OSGiBootstrap] <emphasis role="bold">JBossOSGi Runtime booted in 1.357sec</emphasis>
+ <emphasis role="bold">12:10:50,076 INFO [OSGiBootstrap] JBossOSGi Runtime booted in 1.357sec</emphasis>
</programlisting>
<emphasis role="bold">Minimal Profile</emphasis>
@@ -174,6 +182,7 @@
<para>These additional bundles are installed:</para>
<itemizedlist>
+ <listitem><emphasis role="bold">org.apache.felix.eventadmin.jar</emphasis> - Apache Event Admin service</listitem>
<listitem><emphasis role="bold">jboss-osgi-common-core.jar</emphasis> - JBoss Common Core functionality</listitem>
<listitem><emphasis role="bold">jboss-osgi-jmx.jar</emphasis> - JBoss OSGi JMX service</listitem>
<listitem><emphasis role="bold">jboss-osgi-jndi.jar</emphasis> - JBoss OSGi JNDI service</listitem>
@@ -186,7 +195,7 @@
<para>These additional bundles are installed:</para>
<itemizedlist>
- <listitem><emphasis role="bold">org.apache.felix.configadmin.jar</emphasis> - Apache ConfigAdmin service</listitem>
+ <listitem><emphasis role="bold">org.apache.felix.configadmin.jar</emphasis> - Apache Config Admin service</listitem>
<listitem><emphasis role="bold">pax-web-jetty-bundle.jar</emphasis> - Pax Web HttpService</listitem>
<listitem><emphasis role="bold">pax-web-extender-war.jar</emphasis> - Pax Web WebApp Extender</listitem>
<listitem><emphasis role="bold">jboss-osgi-webconsole.jar</emphasis> - JBoss OSGi Web Console</listitem>
@@ -201,6 +210,7 @@
<itemizedlist>
<listitem><emphasis role="bold">jboss-osgi-apache-xerces.jar</emphasis> - Apache Xerces support</listitem>
<listitem><emphasis role="bold">jboss-osgi-jaxb.jar</emphasis> - JAXB support</listitem>
+ <listitem><emphasis role="bold">jboss-osgi-jta.jar</emphasis> - JTA support</listitem>
<listitem><emphasis role="bold">jboss-osgi-xml-binding.jar</emphasis> - XML Binding (JBossXB) support</listitem>
<listitem><emphasis role="bold">jboss-osgi-microcontainer.jar</emphasis> - Microcontainer support</listitem>
<listitem><emphasis role="bold">jboss-osgi-blueprint.jar</emphasis> - Blueprint Container support</listitem>
Modified: projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch050-developer-guide.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch050-developer-guide.xml 2009-12-08 09:33:12 UTC (rev 97530)
+++ projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch050-developer-guide.xml 2009-12-08 10:16:14 UTC (rev 97531)
@@ -19,7 +19,7 @@
<mediaobject>
<imageobject>
- <imagedata align="center" width="90%" fileref="images/jbossosgi-spi.png"/>
+ <imagedata fileref="images/jbossosgi-spi.png"/>
</imageobject>
</mediaobject>
@@ -145,7 +145,7 @@
<listitem>JBoss OSGi Runtime running in JBossAS</listitem>
</itemizedlist>
- <para>A test case that takes advantage of the SPI provided OSGi runtime abstration would transparently handle these scenarios.</para>
+ <para>A test case that takes advantage of the OSGi runtime abstration that transparently handles the various remote scenarios.</para>
<sect2 xml:id="SecWritingTestsSimpleTestCase">
@@ -157,27 +157,31 @@
</para>
<programlisting role="JAVA">
- public class SimpleTestCase
+ public class SimpleTestCase extends OSGiTest
{
@Test
public void testSimpleBundle() throws Exception
{
// Get the default runtime
- OSGiRuntime runtime = new OSGiTestHelper().getDefaultRuntime();
+ OSGiRuntime runtime = getDefaultRuntime();
- // Install the bundle
- OSGiBundle bundle = runtime.installBundle("example-simple.jar");
- assertEquals("Bundle installed", Bundle.INSTALLED, bundle.getState());
-
- // Start the bundle
- bundle.start();
- assertEquals("Bundle active", Bundle.ACTIVE, bundle.getState());
-
- // Uninstall the bundle
- bundle.uninstall();
-
- // Shutdown the runtime
- runtime.shutdown();
+ try
+ {
+ // Install the bundle
+ OSGiBundle bundle = runtime.installBundle("example-simple.jar");
+
+ // Start the bundle
+ bundle.start();
+ assertBundleState(Bundle.ACTIVE, bundle.getState());
+
+ // Uninstall the bundle
+ bundle.uninstall();
+ }
+ finally
+ {
+ // Shutdown the runtime
+ runtime.shutdown();
+ }
}
}
</programlisting>
@@ -223,8 +227,8 @@
<title>Simple Husky Test Case</title>
- <para>The test case does everthing identical to <link linkend="SecWritingTestsSimpleTestCase">SimpleTestCase</link>
- (setUp and tearDown not shown again), but only executes the code in the test method when Husky injected the BundleContext.
+ <para>The test case does everthing identical to <link linkend="SecWritingTestsSimpleTestCase">SimpleTestCase</link>,
+ but only executes the code in the test method when Husky injected the BundleContext.
</para>
<programlisting role="JAVA">
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-12-08 09:33:12 UTC (rev 97530)
+++ projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch070-provided-bundles.xml 2009-12-08 10:16:14 UTC (rev 97531)
@@ -217,4 +217,22 @@
</sect1>
+ <sect1 xml:id="SecBundleXMLBinding">
+ <title>XML Binding Services</title>
+
+ <para>The JBoss OSGi <emphasis role="bold">jboss-osgi-xml-binding.jar</emphasis> bundle provides services
+ from DOM and SAX parsing.</para>
+
+ <para>The services are registered with the Framework under the name</para>
+
+ <itemizedlist>
+ <listitem><emphasis role="bold"><ulink url="http://java.sun.com/javase/6/docs/api/javax/xml/parsers/SAXParserFactory.html">javax.xml.parsers.SAXParserFactory</ulink></emphasis></listitem>
+ <listitem><emphasis role="bold"><ulink url="http://java.sun.com/javase/6/docs/api/javax/xml/parsers/DocumentBuilderFactory.html">javax.xml.parsers.DocumentBuilderFactory</ulink></emphasis></listitem>
+ </itemizedlist>
+
+ <para>Please see <ulink url="http://www.osgi.org/javadoc/r4v41/org/osgi/util/xml/XMLParserActivator.html">XMLParserActivator</ulink>
+ for details.</para>
+
+ </sect1>
+
</chapter>
Modified: projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml 2009-12-08 09:33:12 UTC (rev 97530)
+++ projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml 2009-12-08 10:16:14 UTC (rev 97531)
@@ -92,6 +92,9 @@
<!-- xml/jaxb -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-xml-jaxb.jar" files="${tests.resources.dir}/xml/jaxb/example-xml-jaxb.bnd" />
+ <!-- xml/binding -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-xml-binding.jar" files="${tests.resources.dir}/xml/jbossxb/example-xml-binding.bnd" />
+
<!-- xml/parser -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-xml-parser.jar" files="${tests.resources.dir}/xml/parser/example-xml-parser.bnd" />
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/CompanyType.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/CompanyType.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/CompanyType.java 2009-12-08 10:16:14 UTC (rev 97531)
@@ -0,0 +1,126 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2009.07.21 at 10:48:55 AM CEST
+//
+
+
+package org.jboss.test.osgi.example.xml.jbossxb;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+
+/**
+ * <p>Java class for companyType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="companyType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="address" type="{http://www.w3.org/2001/XMLSchema}anyType"/>
+ * <element ref="{}contact"/>
+ * </sequence>
+ * <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "companyType", propOrder = {
+ "address",
+ "contact"
+})
+public class CompanyType {
+
+ @XmlElement(required = true)
+ protected Object address;
+ @XmlElement(required = true)
+ protected ContactType contact;
+ @XmlAttribute
+ protected String name;
+
+ /**
+ * Gets the value of the address property.
+ *
+ * @return
+ * possible object is
+ * {@link Object }
+ *
+ */
+ public Object getAddress() {
+ return address;
+ }
+
+ /**
+ * Sets the value of the address property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Object }
+ *
+ */
+ public void setAddress(Object value) {
+ this.address = value;
+ }
+
+ /**
+ * Gets the value of the contact property.
+ *
+ * @return
+ * possible object is
+ * {@link ContactType }
+ *
+ */
+ public ContactType getContact() {
+ return contact;
+ }
+
+ /**
+ * Sets the value of the contact property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ContactType }
+ *
+ */
+ public void setContact(ContactType value) {
+ this.contact = value;
+ }
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/CompanyType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/ContactType.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/ContactType.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/ContactType.java 2009-12-08 10:16:14 UTC (rev 97531)
@@ -0,0 +1,119 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2009.07.21 at 10:48:55 AM CEST
+//
+
+
+package org.jboss.test.osgi.example.xml.jbossxb;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for contactType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="contactType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="telephone" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="email" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "contactType", propOrder = {})
+public class ContactType {
+
+ @XmlAttribute(required = true)
+ protected String name;
+ @XmlAttribute(required = true)
+ protected String telephone;
+ @XmlAttribute(required = true)
+ protected String email;
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ /**
+ * Gets the value of the telephone property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTelephone() {
+ return telephone;
+ }
+
+ /**
+ * Sets the value of the telephone property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTelephone(String value) {
+ this.telephone = value;
+ }
+
+ /**
+ * Gets the value of the email property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getEmail() {
+ return email;
+ }
+
+ /**
+ * Sets the value of the email property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setEmail(String value) {
+ this.email = value;
+ }
+
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/ContactType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/CourseBooking.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/CourseBooking.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/CourseBooking.java 2009-12-08 10:16:14 UTC (rev 97531)
@@ -0,0 +1,233 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2009.07.21 at 10:48:55 AM CEST
+//
+
+package org.jboss.test.osgi.example.xml.jbossxb;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * <p>Java class for courseBooking complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="courseBooking">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element ref="{}company"/>
+ * <element ref="{}student" maxOccurs="unbounded"/>
+ * </sequence>
+ * <attribute name="courseReference" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="courseDate" use="required" type="{http://www.w3.org/2001/XMLSchema}date" />
+ * <attribute name="invoiceReference" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="totalPrice" use="required" type="{http://www.w3.org/2001/XMLSchema}decimal" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ at JBossXmlSchema(namespace = CourseBooking.NAMESPACE_XML_SIMPLE, elementFormDefault = XmlNsForm.QUALIFIED)
+ at XmlRootElement(name = "booking")
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "courseBooking", propOrder = { "company", "student" })
+public class CourseBooking
+{
+ public static final String NAMESPACE_XML_SIMPLE = "http://org.jboss.test.osgi.jbossxb.simple";
+
+ @XmlElement(required = true)
+ protected CompanyType company;
+ @XmlElement(required = true)
+ protected List<StudentType> student;
+ @XmlAttribute(required = true)
+ protected String courseReference;
+ @XmlAttribute(required = true)
+ @XmlSchemaType(name = "date")
+ protected XMLGregorianCalendar courseDate;
+ @XmlAttribute(required = true)
+ protected String invoiceReference;
+ @XmlAttribute(required = true)
+ protected BigDecimal totalPrice;
+
+ /**
+ * Gets the value of the company property.
+ *
+ * @return
+ * possible object is
+ * {@link CompanyType }
+ *
+ */
+ public CompanyType getCompany()
+ {
+ return company;
+ }
+
+ /**
+ * Sets the value of the company property.
+ *
+ * @param value
+ * allowed object is
+ * {@link CompanyType }
+ *
+ */
+ public void setCompany(CompanyType value)
+ {
+ this.company = value;
+ }
+
+ /**
+ * Gets the value of the student property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the student property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getStudent().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link StudentType }
+ *
+ *
+ */
+ public List<StudentType> getStudent()
+ {
+ if (student == null)
+ {
+ student = new ArrayList<StudentType>();
+ }
+ return this.student;
+ }
+
+ /**
+ * Gets the value of the courseReference property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCourseReference()
+ {
+ return courseReference;
+ }
+
+ /**
+ * Sets the value of the courseReference property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCourseReference(String value)
+ {
+ this.courseReference = value;
+ }
+
+ /**
+ * Gets the value of the courseDate property.
+ *
+ * @return
+ * possible object is
+ * {@link XMLGregorianCalendar }
+ *
+ */
+ public XMLGregorianCalendar getCourseDate()
+ {
+ return courseDate;
+ }
+
+ /**
+ * Sets the value of the courseDate property.
+ *
+ * @param value
+ * allowed object is
+ * {@link XMLGregorianCalendar }
+ *
+ */
+ public void setCourseDate(XMLGregorianCalendar value)
+ {
+ this.courseDate = value;
+ }
+
+ /**
+ * Gets the value of the invoiceReference property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getInvoiceReference()
+ {
+ return invoiceReference;
+ }
+
+ /**
+ * Sets the value of the invoiceReference property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setInvoiceReference(String value)
+ {
+ this.invoiceReference = value;
+ }
+
+ /**
+ * Gets the value of the totalPrice property.
+ *
+ * @return
+ * possible object is
+ * {@link BigDecimal }
+ *
+ */
+ public BigDecimal getTotalPrice()
+ {
+ return totalPrice;
+ }
+
+ /**
+ * Sets the value of the totalPrice property.
+ *
+ * @param value
+ * allowed object is
+ * {@link BigDecimal }
+ *
+ */
+ public void setTotalPrice(BigDecimal value)
+ {
+ this.totalPrice = value;
+ }
+
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/CourseBooking.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/StudentType.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/StudentType.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/StudentType.java 2009-12-08 10:16:14 UTC (rev 97531)
@@ -0,0 +1,92 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2009.07.21 at 10:48:55 AM CEST
+//
+
+
+package org.jboss.test.osgi.example.xml.jbossxb;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for studentType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="studentType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="firstName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="surname" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "studentType", propOrder = {})
+public class StudentType {
+
+ @XmlAttribute(required = true)
+ protected String firstName;
+ @XmlAttribute(required = true)
+ protected String surname;
+
+ /**
+ * Gets the value of the firstName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+
+ /**
+ * Sets the value of the firstName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setFirstName(String value) {
+ this.firstName = value;
+ }
+
+ /**
+ * Gets the value of the surname property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSurname() {
+ return surname;
+ }
+
+ /**
+ * Sets the value of the surname property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSurname(String value) {
+ this.surname = value;
+ }
+
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/StudentType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/XMLBindingActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/XMLBindingActivator.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/XMLBindingActivator.java 2009-12-08 10:16:14 UTC (rev 97531)
@@ -0,0 +1,63 @@
+/*
+ * 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.test.osgi.example.xml.jbossxb;
+
+//$Id$
+
+import java.net.URL;
+
+import org.jboss.osgi.jbossxb.UnmarshallerService;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * A bundle activator that uses the unmarshaller service
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 26-Nov-2009
+ */
+public class XMLBindingActivator implements BundleActivator
+{
+ public void start(BundleContext context) throws Exception
+ {
+ ServiceReference sref = context.getServiceReference(UnmarshallerService.class.getName());
+ UnmarshallerService unmarshaller = (UnmarshallerService)context.getService(sref);
+ unmarshaller.setSchemaValidation(true);
+ unmarshaller.setNamespaceAware(true);
+ unmarshaller.setValidation(true);
+
+ Bundle bundle = context.getBundle();
+ URL xsdurl = bundle.getEntry("booking.xsd");
+ URL xmlurl = bundle.getEntry("booking.xml");
+
+ unmarshaller.registerSchemaLocation("http://org.jboss.test.osgi.jbossxb.simple/booking.xsd", xsdurl.toExternalForm());
+ unmarshaller.addClassBinding(CourseBooking.NAMESPACE_XML_SIMPLE, CourseBooking.class);
+
+ unmarshaller.unmarshal(xmlurl.toExternalForm());
+ }
+
+ public void stop(BundleContext context) throws Exception
+ {
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/XMLBindingActivator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/XMLBindingTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/XMLBindingTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/XMLBindingTestCase.java 2009-12-08 10:16:14 UTC (rev 97531)
@@ -0,0 +1,110 @@
+/*
+ * 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.test.osgi.example.xml.jbossxb;
+
+//$Id$
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assume.assumeNotNull;
+
+import java.net.URL;
+
+import org.jboss.osgi.husky.BridgeFactory;
+import org.jboss.osgi.husky.HuskyCapability;
+import org.jboss.osgi.husky.RuntimeContext;
+import org.jboss.osgi.jbossxb.UnmarshallerService;
+import org.jboss.osgi.jbossxb.XMLBindingCapability;
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Test XMLBindingService
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 26-Nov-2009
+ */
+public class XMLBindingTestCase extends OSGiTest
+{
+ @RuntimeContext
+ public BundleContext context;
+
+ private OSGiRuntime runtime;
+
+ @Before
+ public void setUp() throws Exception
+ {
+ if (context == null)
+ {
+ runtime = getDefaultRuntime();
+ runtime.addCapability(new HuskyCapability());
+ runtime.addCapability(new XMLBindingCapability());
+
+ OSGiBundle bundle = runtime.installBundle("example-xml-binding.jar");
+ bundle.start();
+ }
+ }
+
+ @After
+ public void tearDown() throws BundleException
+ {
+ if (context == null)
+ runtime.shutdown();
+ }
+
+ @Test
+ public void testUnmarshaller() throws Exception
+ {
+ if (context == null)
+ BridgeFactory.getBridge().run();
+
+ assumeNotNull(context);
+
+ ServiceReference sref = context.getServiceReference(UnmarshallerService.class.getName());
+ assertNotNull("UnmarshallerService available", sref);
+
+ UnmarshallerService unmarshaller = (UnmarshallerService)context.getService(sref);
+ unmarshaller.setSchemaValidation(true);
+ unmarshaller.setNamespaceAware(true);
+ unmarshaller.setValidation(true);
+
+ Bundle bundle = context.getBundle();
+ URL xsdurl = bundle.getEntry("booking.xsd");
+ assertNotNull("booking.xsd available", xsdurl);
+
+ URL xmlurl = bundle.getEntry("booking.xml");
+ assertNotNull("booking.xml available", xmlurl);
+
+ unmarshaller.registerSchemaLocation("http://org.jboss.test.osgi.jbossxb.simple/booking.xsd", xsdurl.toExternalForm());
+ unmarshaller.addClassBinding(CourseBooking.NAMESPACE_XML_SIMPLE, CourseBooking.class);
+
+ CourseBooking booking = (CourseBooking)unmarshaller.unmarshal(xmlurl.toExternalForm());
+ assertNotNull("booking not null", booking);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jbossxb/XMLBindingTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jbossxb/booking.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jbossxb/booking.xml (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jbossxb/booking.xml 2009-12-08 10:16:14 UTC (rev 97531)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<booking xmlns="http://org.jboss.test.osgi.jbossxb.simple" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://org.jboss.test.osgi.jbossxb.simple http://org.jboss.test.osgi.jbossxb.simple/booking.xsd"
+ courseReference="Course100" courseDate="2009-11-26" invoiceReference="Ref100" totalPrice="100">
+ <company name="ACME Consulting">
+ <address>10 Coyote Avenue, Arizona, USA</address>
+ <contact name="Duke" email="duke at acme.com" telephone="1234567890" />
+ </company>
+ <student firstName="Jane" surname="Dow" />
+ <student firstName="John" surname="Doe" />
+</booking>
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jbossxb/booking.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jbossxb/booking.xsd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jbossxb/booking.xsd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jbossxb/booking.xsd 2009-12-08 10:16:14 UTC (rev 97531)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ This is taken from
+
+ "Java-XML mapping made easy with JAXB 2.0"
+ http://www.javaworld.com/javaworld/jw-06-2006/jw-0626-jaxb.html
+
+ $ xjc src/test/resources/xml/jaxb/booking.xsd -p org.jboss.test.osgi.example.xml.jaxb -d src/test/java
+
+-->
+<xsd:schema xmlns="http://org.jboss.test.osgi.jbossxb.simple"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://org.jboss.test.osgi.jbossxb.simple"
+ elementFormDefault="qualified" attributeFormDefault="unqualified"
+ version="1.0.0">
+
+ <xsd:element name="booking" type="courseBooking" />
+ <xsd:complexType name="courseBooking">
+ <xsd:sequence>
+ <xsd:element ref="company" />
+ <xsd:element ref="student" minOccurs="1" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="courseReference" type="xsd:string" use="required" />
+ <xsd:attribute name="courseDate" type="xsd:date" use="required" />
+ <xsd:attribute name="invoiceReference" type="xsd:string" use="required" />
+ <xsd:attribute name="totalPrice" type="xsd:decimal" use="required" />
+ </xsd:complexType>
+ <xsd:element name="student" type="studentType" />
+ <xsd:complexType name="studentType">
+ <xsd:attribute name="firstName" type="xsd:string" use="required" />
+ <xsd:attribute name="surname" type="xsd:string" use="required" />
+ </xsd:complexType>
+ <xsd:element name="company" type="companyType" />
+ <xsd:complexType name="companyType">
+ <xsd:sequence>
+ <xsd:element name="address" />
+ <xsd:element ref="contact" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ <xsd:element name="contact" type="contactType" />
+ <xsd:complexType name="contactType">
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ <xsd:attribute name="telephone" type="xsd:string" use="required" />
+ <xsd:attribute name="email" type="xsd:string" use="required" />
+ </xsd:complexType>
+</xsd:schema>
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jbossxb/booking.xsd
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jbossxb/example-xml-binding.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jbossxb/example-xml-binding.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jbossxb/example-xml-binding.bnd 2009-12-08 10:16:14 UTC (rev 97531)
@@ -0,0 +1,22 @@
+# bnd build -classpath target/test-classes -output target/test-libs/example-xml-binding.jar src/test/resources/simple/example-xml-binding.bnd
+
+Bundle-SymbolicName: example-xml-binding
+Bundle-Activator: org.jboss.test.osgi.example.xml.jbossxb.XMLBindingActivator
+
+Export-Package: org.jboss.test.osgi.example.xml.jbossxb
+
+Import-Package: \
+ javax.xml.bind.annotation, \
+ javax.xml.datatype, \
+ org.jboss.osgi.husky, \
+ org.jboss.osgi.jbossxb, \
+ org.jboss.osgi.spi.capability, \
+ org.jboss.osgi.testing, \
+ org.jboss.xb.annotations, \
+ org.junit, \
+ org.osgi.framework
+
+Include-Resource: booking.xml, booking.xsd
+
+# Tell Husky that there are test cases in this package
+Test-Package: org.jboss.test.osgi.example.xml.jbossxb
More information about the jboss-osgi-commits
mailing list