[jboss-cvs] JBossAS SVN: r97021 - in projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk: scripts and 9 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Nov 26 07:40:12 EST 2009


Author: thomas.diesler at jboss.com
Date: 2009-11-26 07:40:11 -0500 (Thu, 26 Nov 2009)
New Revision: 97021

Added:
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/scripts/
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/UnmarshallerService.java
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/UnmarshallerServiceImpl.java
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/BasicXMLBindingTestCase.java
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/apitest/
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/apitest/UnmarshallerTestCase.java
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/CompanyType.java
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/ContactType.java
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/CourseBooking.java
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/StudentType.java
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/simple/
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/simple/booking.xml
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/simple/booking.xsd
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/simple/simple-unmarshaller.bnd
Removed:
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/XMLBindingService.java
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/husky/
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/context/
Modified:
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/.classpath
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/scripts/antrun-test-jars.xml
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/scripts/assembly-bundles.xml
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/XMLBindingCapability.java
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingActivator.java
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/jboss-osgi-framework.properties
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/log4j.xml
Log:
Add integration tests

Modified: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/.classpath	2009-11-26 11:45:54 UTC (rev 97020)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/.classpath	2009-11-26 12:40:11 UTC (rev 97021)
@@ -1,7 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
-	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**" kind="src" path="src/main/resources"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
 	<classpathentry kind="output" path="target/classes"/>

Modified: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml	2009-11-26 11:45:54 UTC (rev 97020)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml	2009-11-26 12:40:11 UTC (rev 97021)
@@ -10,18 +10,18 @@
   <!-- ====================================================================== -->
 
   <!-- $Id$ -->
-  
+
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
 
   <name>JBossOSGi Bundles - JBossXB</name>
   <description>A JBossOSGi provided JBossXB bundle</description>
-  
+
   <groupId>org.jboss.osgi.bundles</groupId>
   <artifactId>jboss-osgi-xml-binding</artifactId>
   <packaging>bundle</packaging>
 
-  <version>2.0.1-SNAPSHOT</version>
+  <version>2.0.2-SNAPSHOT</version>
 
   <!-- Parent -->
   <parent>
@@ -30,39 +30,80 @@
     <version>1.0.4</version>
   </parent>
 
+  <!-- Subversion -->
+  <scm>
+    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk</connection>
+    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk</developerConnection>
+    <url>http://fisheye.jboss.com/qsearch/JBossOSGi</url>
+  </scm>
+
   <!-- Properties -->
   <properties>
-    <version.jboss.xb>2.0.1.GA</version.jboss.xb>
+    <version.jboss.osgi.runtime.felix>2.0.0</version.jboss.osgi.runtime.felix>
+    <version.jboss.xb>2.0.2.Beta3</version.jboss.xb>
     <version.javassist>3.9.0.GA</version.javassist>
-    <version.jboss.osgi.jaxb>2.1.10.SP2</version.jboss.osgi.jaxb>
+    <version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
+    <version.jboss.osgi.husky>1.0.2-SNAPSHOT</version.jboss.osgi.husky>
+    <version.jboss.osgi.jaxb>2.1.10-SNAPSHOT</version.jboss.osgi.jaxb>
+    <version.jboss.osgi.spi>1.0.3-SNAPSHOT</version.jboss.osgi.spi>
     <version.jboss.reflect>2.0.2.GA</version.jboss.reflect>
     <version.osgi>4.2.0</version.osgi>
   </properties>
 
+  <!-- Dependencies -->
   <dependencies>
     <dependency>
-      <groupId>org.jboss.osgi.bundles</groupId>
-      <artifactId>jboss-osgi-jaxb</artifactId>
-      <version>${version.jboss.osgi.jaxb}</version>
+      <groupId>biz.aQute</groupId>
+      <artifactId>bnd</artifactId>
     </dependency>
-    
     <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
+      <groupId>javassist</groupId>
+      <artifactId>javassist</artifactId>
+      <version>${version.javassist}</version>
     </dependency>
     <dependency>
+      <groupId>org.jboss.osgi</groupId>
+      <artifactId>jboss-osgi-spi</artifactId>
+      <version>${version.jboss.osgi.spi}</version>
+    </dependency>
+    <dependency>
       <groupId>org.jboss</groupId>
       <artifactId>jbossxb</artifactId>
       <version>${version.jboss.xb}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-common-core</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
-      <groupId>javassist</groupId>
-      <artifactId>javassist</artifactId>
-      <version>${version.javassist}</version>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
     </dependency>
-    
+
     <!-- Provided Dependencies -->
     <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-common-core</artifactId>
+      <version>${version.jboss.osgi.common.core}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-husky</artifactId>
+      <version>${version.jboss.osgi.husky}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-jaxb</artifactId>
+      <version>${version.jboss.osgi.jaxb}</version>
+      <scope>provided</scope>
+    </dependency>
+    
+    <!-- OSGi Dependencies -->
+    <dependency>
       <groupId>org.osgi</groupId>
       <artifactId>org.osgi.core</artifactId>
       <version>${version.osgi}</version>
@@ -74,6 +115,19 @@
       <version>${version.osgi}</version>
       <scope>provided</scope>
     </dependency>
+
+    <!-- Test Dependencies -->
+    <dependency>
+      <groupId>org.jboss.osgi.runtime</groupId>
+      <artifactId>jboss-osgi-runtime-felix</artifactId>
+      <version>${version.jboss.osgi.runtime.felix}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
@@ -88,28 +142,27 @@
             <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
             <Embed-Transitive>true</Embed-Transitive>
             <Export-Package>
-              org.jboss.osgi.jbossxb;version=2.0.1
+              org.jboss.osgi.jbossxb;version=2.0.2
             </Export-Package>
             <Import-Package>
               <!-- system -->
-              javax.activation, 
-              javax.xml.bind.*, 
-              javax.xml.namespace, 
+              javax.activation,
+              javax.xml.bind.*,
+              javax.xml.namespace,
               javax.xml.parsers,
               org.slf4j,
-              org.w3c.dom*, 
+              org.w3c.dom*,
               org.xml.sax*,
                
               <!-- import -->
-              com.wutka.dtd, 
-              org.apache.xerces.*, 
+              com.wutka.dtd,
+              org.apache.xerces.*,
               org.jboss.logging,
-              org.jboss.osgi.common.log;version=1.0,
               org.jboss.osgi.jaxb;version=2.0,
               org.jboss.osgi.spi.capability;version=1.0,
-              org.jboss.osgi.spi.service;version=1.0,
-              org.jboss.util*, 
-              org.osgi.framework, 
+              org.jboss.osgi.spi.util;version=1.0,
+              org.jboss.util*,
+              org.osgi.framework,
               org.osgi.service.log,
               org.osgi.util.tracker,
               
@@ -122,25 +175,112 @@
               jboss-reflect;inline=false,
             </Embed-Dependency>
             <_exportcontents>
-              org.jboss.beans.info.*;version=2.0.2,
-              org.jboss.config.*;version=2.0.2,
-              org.jboss.classadapter.*;version=2.0.2,
-              org.jboss.joinpoint.*;version=2.0.2,
-              org.jboss.reflect*;version=2.0.2,
-              org.jboss.xb.*;version=2.0.1,
-              javassist*;version=3.9.0,
+              org.jboss.xb.annotations;version=2.0.2,
             </_exportcontents>
           </instructions>
         </configuration>
       </plugin>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>bundles</id>
+            <phase>test-compile</phase>
+            <goals>
+              <goal>directory-single</goal>
+            </goals>
+            <configuration>
+              <finalName>test-libs</finalName>
+              <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+              <appendAssemblyId>false</appendAssemblyId>
+              <descriptors>
+                <descriptor>scripts/assembly-bundles.xml</descriptor>
+              </descriptors>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>build-test-jars</id>
+            <phase>integration-test</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <tasks>
+                <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+                <property name="artifactId" value="${artifactId}" />
+                <property name="tests.output.dir" value="${project.build.directory}" />
+                <property name="build.artifact" value="${project.build.finalName}" />
+                <ant antfile="scripts/antrun-test-jars.xml" />
+              </tasks>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+        <executions>
+          <execution>
+            <id>surefire-integration-tests</id>
+            <phase>integration-test</phase>
+            <goals>
+              <goal>test</goal>
+            </goals>
+            <configuration>
+              <skip>false</skip>
+              <argLine>${surefire.jpda.args}</argLine>
+              <systemProperties>
+                <property>
+                  <name>java.protocol.handler.pkgs</name>
+                  <value>org.jboss.net.protocol|org.jboss.virtual.protocol</value>
+                </property>
+                <property>
+                  <name>log4j.output.dir</name>
+                  <value>${project.build.directory}</value>
+                </property>
+                <property>
+                  <name>org.jboss.osgi.husky.Invoker</name>
+                  <value>org.jboss.osgi.husky.internal.OSGiInvoker</value>
+                </property>
+                <property>
+                  <name>test.archive.directory</name>
+                  <value>${project.build.directory}/test-libs</value>
+                </property>
+              </systemProperties>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 
-  <!-- Subversion -->
-  <scm>
-    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/xml-binding/trunk</connection>
-    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/xml-binding/trunk</developerConnection>
-    <url>http://fisheye.jboss.com/qsearch/JBossOSGi/projects/bundles/xml-binding/trunk</url>
-  </scm>
-  
+
+  <!-- Profiles -->
+  <profiles>
+
+    <!--
+      Name: jpda
+      Descr: Enable JPDA remote debuging
+    -->
+    <profile>
+      <id>jpda</id>
+      <activation>
+        <property>
+          <name>jpda</name>
+        </property>
+      </activation>
+      <properties>
+        <surefire.jpda.args>-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</surefire.jpda.args>
+      </properties>
+    </profile>
+
+  </profiles>
+
 </project>

Copied: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/scripts (from rev 97013, projects/jboss-osgi/projects/bundles/husky/trunk/scripts)

Modified: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/scripts/antrun-test-jars.xml	2009-11-26 07:32:06 UTC (rev 97013)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/scripts/antrun-test-jars.xml	2009-11-26 12:40:11 UTC (rev 97021)
@@ -45,9 +45,9 @@
 
     <!-- Please add alphabetically -->
 
-    <!-- context -->
-    <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/context-basic.jar" files="${tests.resources.dir}/context/context-basic.bnd" />
-
+    <!-- simple-unmarshaller -->
+    <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/simple-unmarshaller.jar" files="${tests.resources.dir}/simple/simple-unmarshaller.bnd" />
+  	
     <!-- Please add alphabetically -->
 
   </target>

Modified: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/scripts/assembly-bundles.xml	2009-11-26 07:32:06 UTC (rev 97013)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/scripts/assembly-bundles.xml	2009-11-26 12:40:11 UTC (rev 97021)
@@ -15,6 +15,10 @@
       <outputDirectory>bundles</outputDirectory>
       <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
       <includes>
+        <include>*:jboss-osgi-apache-xerces:jar</include>
+        <include>*:jboss-osgi-common-core:jar</include>
+        <include>*:jboss-osgi-husky:jar</include>
+        <include>*:jboss-osgi-jaxb:jar</include>
         <include>*:org.osgi.compendium:jar</include>
       </includes>
       <useStrictFiltering>true</useStrictFiltering>

Added: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/UnmarshallerService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/UnmarshallerService.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/UnmarshallerService.java	2009-11-26 12:40:11 UTC (rev 97021)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossxb;
+
+//$Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+
+/**
+ * An unmarshaller service
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 26-Nov-2009
+ */
+public interface UnmarshallerService
+{
+   void setValidation(boolean validation);
+
+   void setNamespaceAware(boolean namespaces);
+
+   void setSchemaValidation(boolean validation);
+   
+   void setErrorHandler(ErrorHandler errorHandler);
+   
+   /**
+    * Register the mapping from the public id/system id to the dtd/xsd file
+    * name. This overwrites any existing mapping.
+    *
+    * @param id  the DOCTYPE public id or system id such as "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN"
+    * @param dtdOrSchema the simple dtd/xsd file name, "ejb-jar.dtd"
+    */
+   void registerSchemaLocation(String id, String dtdOrSchema);
+
+   void addClassBinding(String nsUri, Class<?> clazz);
+
+   Object unmarshal(Reader xmlReader) throws IOException;
+
+   Object unmarshal(InputStream xmlStream) throws IOException;
+
+   Object unmarshal(InputSource source) throws IOException;
+
+   Object unmarshal(String xml) throws IOException;
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/UnmarshallerService.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/XMLBindingCapability.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/XMLBindingCapability.java	2009-11-26 11:45:54 UTC (rev 97020)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/XMLBindingCapability.java	2009-11-26 12:40:11 UTC (rev 97021)
@@ -25,13 +25,11 @@
 
 import org.jboss.osgi.jaxb.JAXBCapability;
 import org.jboss.osgi.spi.capability.Capability;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
 
 /**
- * Adds the JBossXB capability to the {@link OSGiRuntime}
- * under test. 
+ * Adds the JBossXB capability.
  * 
- * It is ignored if the {@link XMLBindingService} is already registered.
+ * It is ignored if the {@link UnmarshallerService} is already registered.
  * 
  * Dependent capabilities: {@link JAXBCapability}.
  * 
@@ -44,7 +42,7 @@
 {
    public XMLBindingCapability()
    {
-      super (XMLBindingService.class.getName());
+      super (UnmarshallerService.class.getName());
       
       addDependency(new JAXBCapability());
       

Deleted: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/XMLBindingService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/XMLBindingService.java	2009-11-26 11:45:54 UTC (rev 97020)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/XMLBindingService.java	2009-11-26 12:40:11 UTC (rev 97021)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossxb;
-
-//$Id$
-
-/**
- * A marker service that is registered by jboss-osgi-xml-binding
- * 
- * @author thomas.diesler at jboss.com
- * @since 29-May-2009
- */
-public interface XMLBindingService
-{
-}
\ No newline at end of file

Added: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/UnmarshallerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/UnmarshallerServiceImpl.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/UnmarshallerServiceImpl.java	2009-11-26 12:40:11 UTC (rev 97021)
@@ -0,0 +1,192 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossxb.internal;
+
+//$Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+import org.jboss.osgi.jbossxb.UnmarshallerService;
+import org.jboss.osgi.spi.util.BundleClassLoader;
+import org.jboss.util.xml.JBossEntityResolver;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+
+/**
+ * A {@link BundleActivator} that initializes the JBossXB bundle 
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class UnmarshallerServiceImpl implements UnmarshallerService
+{
+   // Provide logging
+   private static Logger log = LoggerFactory.getLogger(UnmarshallerServiceImpl.class);
+
+   private BundleContext context;
+   private Unmarshaller unmarshaller;
+   private JBossEntityResolver entityResolver;
+   private DefaultSchemaResolver schemaBindingResolver;
+
+   public UnmarshallerServiceImpl(BundleContext context)
+   {
+      this.context = context;
+      unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+      schemaBindingResolver = new DefaultSchemaResolver();
+   }
+
+   public void setNamespaceAware(boolean namespaces)
+   {
+      try
+      {
+         unmarshaller.setNamespaceAware(namespaces);
+      }
+      catch (JBossXBException ex)
+      {
+         throw new IllegalStateException(ex);
+      }
+   }
+
+   public void setSchemaValidation(boolean validation)
+   {
+      try
+      {
+         unmarshaller.setSchemaValidation(validation);
+      }
+      catch (JBossXBException ex)
+      {
+         throw new IllegalStateException(ex);
+      }
+   }
+
+   public void setValidation(boolean validation)
+   {
+      try
+      {
+         unmarshaller.setValidation(validation);
+      }
+      catch (JBossXBException ex)
+      {
+         throw new IllegalStateException(ex);
+      }
+   }
+   
+   public void setErrorHandler(ErrorHandler errorHandler)
+   {
+      unmarshaller.setErrorHandler(errorHandler);
+   }
+
+   public void registerSchemaLocation(String id, String dtdOrSchema)
+   {
+      if (entityResolver == null)
+      {
+         try
+         {
+            entityResolver = new JBossEntityResolver();
+            unmarshaller.setEntityResolver(entityResolver);
+         }
+         catch (JBossXBException ex)
+         {
+            throw new IllegalStateException(ex);
+         }
+      }
+      entityResolver.registerLocalEntity(id, dtdOrSchema);
+   }
+
+   public void addClassBinding(String nsUri, Class<?> clazz)
+   {
+      schemaBindingResolver.addClassBinding(nsUri, clazz);
+   }
+
+   public Object unmarshal(Reader xmlReader) throws IOException
+   {
+      try
+      {
+         return unmarshaller.unmarshal(xmlReader, schemaBindingResolver);
+      }
+      catch (JBossXBException ex)
+      {
+         IOException ioex = new IOException("Cannot unmarshall xmlReader");
+         ioex.initCause(ex);
+         throw ioex;
+      }
+   }
+
+   public Object unmarshal(InputStream xmlStream) throws IOException
+   {
+      try
+      {
+         return unmarshaller.unmarshal(xmlStream, schemaBindingResolver);
+      }
+      catch (JBossXBException ex)
+      {
+         IOException ioex = new IOException("Cannot unmarshall xmlStream");
+         ioex.initCause(ex);
+         throw ioex;
+      }
+   }
+
+   public Object unmarshal(InputSource source) throws IOException
+   {
+      try
+      {
+         return unmarshaller.unmarshal(source, schemaBindingResolver);
+      }
+      catch (JBossXBException ex)
+      {
+         IOException ioex = new IOException("Cannot unmarshall input source");
+         ioex.initCause(ex);
+         throw ioex;
+      }
+   }
+
+   public Object unmarshal(String xml) throws IOException
+   {
+      ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+      try
+      {
+         BundleClassLoader bundleLoader = BundleClassLoader.createClassLoader(context.getBundle());
+         Thread.currentThread().setContextClassLoader(bundleLoader);
+         return unmarshaller.unmarshal(xml, schemaBindingResolver);
+      }
+      catch (JBossXBException ex)
+      {
+         IOException ioex = new IOException("Cannot unmarshall: " + xml);
+         ioex.initCause(ex);
+         throw ioex;
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(ctxLoader);
+      }
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/UnmarshallerServiceImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingActivator.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingActivator.java	2009-11-26 11:45:54 UTC (rev 97020)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingActivator.java	2009-11-26 12:40:11 UTC (rev 97021)
@@ -23,16 +23,12 @@
 
 //$Id$
 
-import javax.xml.parsers.SAXParserFactory;
-
-import org.jboss.osgi.jbossxb.XMLBindingService;
-import org.jboss.osgi.xml.XMLParserCapability;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.parser.sax.SaxJBossXBParser;
+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;
-import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -49,48 +45,18 @@
 
    public void start(BundleContext context) throws Exception
    {
-      ServiceTracker saxTracker = new ServiceTracker(context, SAXParserFactory.class.getName(), null)
+      ServiceFactory unmarshallerFactory = new ServiceFactory()
       {
-         @Override
-         public Object addingService(ServiceReference reference)
+         public Object getService(Bundle bundle, ServiceRegistration registration)
          {
-            String provider = (String)reference.getProperty(XMLParserCapability.PARSER_PROVIDER);
-            boolean hasJBossSAXParser = XMLParserCapability.PROVIDER_JBOSS_OSGI.equals(provider);
-            boolean hasXMLBindingService = context.getServiceReference(XMLBindingService.class.getName()) != null;
-            
-            SAXParserFactory saxFactory = (SAXParserFactory)super.addingService(reference);
-            if (hasXMLBindingService == false && hasJBossSAXParser == true)
-            {
-               log.debug("JBossXB SAXParserFactory: " + saxFactory);
+            return new UnmarshallerServiceImpl(bundle.getBundleContext());
+         }
 
-               ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
-               try
-               {
-                  Thread.currentThread().setContextClassLoader(saxFactory.getClass().getClassLoader());
-                  try
-                  {
-                     // SaxJBossXBParser initializes the SAXParserFactory in a static block
-                     // using SAXParserFactory.newInstance(), which internally uses the TCCL
-                     new SaxJBossXBParser();
-                  }
-                  catch (JBossXBException ex)
-                  {
-                     throw new IllegalStateException("Cannot initialize SaxJBossXBParser", ex);
-                  }
-
-                  // Register the XMLBindingService
-                  XMLBindingService service = new XMLBindingService(){};
-                  context.registerService(XMLBindingService.class.getName(), service, null);
-               }
-               finally
-               {
-                  Thread.currentThread().setContextClassLoader(ctxLoader);
-               }
-            }
-            return saxFactory;
+         public void ungetService(Bundle bundle, ServiceRegistration registration, Object service)
+         {
          }
       };
-      saxTracker.open();
+      context.registerService(UnmarshallerService.class.getName(), unmarshallerFactory, null);
    }
 
    public void stop(BundleContext context) throws Exception

Copied: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test (from rev 97013, projects/jboss-osgi/projects/bundles/husky/trunk/src/test)

Copied: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/BasicXMLBindingTestCase.java (from rev 97013, projects/jboss-osgi/projects/bundles/husky/trunk/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/BasicXMLBindingTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/BasicXMLBindingTestCase.java	2009-11-26 12:40:11 UTC (rev 97021)
@@ -0,0 +1,111 @@
+/*
+ * 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.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.jboss.test.osgi.jbossxb.simple.CourseBooking;
+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 BasicXMLBindingTestCase 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("simple-unmarshaller.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(CourseBooking.NAMESPACE_XML_SIMPLE, 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

Added: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/apitest/UnmarshallerTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/apitest/UnmarshallerTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/apitest/UnmarshallerTestCase.java	2009-11-26 12:40:11 UTC (rev 97021)
@@ -0,0 +1,70 @@
+/*
+ * 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.jbossxb.apitest;
+
+//$Id$
+
+import static org.junit.Assert.assertNotNull;
+
+import java.net.URL;
+
+import org.jboss.osgi.testing.OSGiTest;
+import org.jboss.test.osgi.jbossxb.simple.CourseBooking;
+import org.jboss.util.xml.JBossEntityResolver;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.junit.Test;
+
+/**
+ * Test JBossXB unmarshaller API
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 26-Nov-2009
+ */
+public class UnmarshallerTestCase extends OSGiTest
+{
+   @Test
+   public void testUnmarshaller() throws Exception
+   {
+      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+      unmarshaller.setSchemaValidation(true);
+      unmarshaller.setNamespaceAware(true);
+      unmarshaller.setValidation(true);
+      
+      URL xsdurl = getResourceURL("simple/booking.xsd");
+      assertNotNull("booking.xsd available", xsdurl);
+      
+      URL xmlurl = getResourceURL("simple/booking.xml");
+      assertNotNull("booking.xml available", xmlurl);
+      
+      JBossEntityResolver entityResolver = new JBossEntityResolver();
+      entityResolver.registerLocalEntity(CourseBooking.NAMESPACE_XML_SIMPLE, xsdurl.toExternalForm());
+      unmarshaller.setEntityResolver(entityResolver);
+      
+      DefaultSchemaResolver schemaBindingResolver = new DefaultSchemaResolver();
+      schemaBindingResolver.addClassBinding(CourseBooking.NAMESPACE_XML_SIMPLE, CourseBooking.class);
+      
+      CourseBooking booking = (CourseBooking)unmarshaller.unmarshal(xmlurl.toExternalForm(), schemaBindingResolver);
+      assertNotNull("booking not null", booking);
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/apitest/UnmarshallerTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/CompanyType.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/CompanyType.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/CompanyType.java	2009-11-26 12:40:11 UTC (rev 97021)
@@ -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.jbossxb.simple;
+
+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>
+ * &lt;complexType name="companyType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="address" type="{http://www.w3.org/2001/XMLSchema}anyType"/>
+ *         &lt;element ref="{}contact"/>
+ *       &lt;/sequence>
+ *       &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/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/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/CompanyType.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/ContactType.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/ContactType.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/ContactType.java	2009-11-26 12:40:11 UTC (rev 97021)
@@ -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.jbossxb.simple;
+
+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>
+ * &lt;complexType name="contactType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="telephone" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="email" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/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/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/ContactType.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/CourseBooking.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/CourseBooking.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/CourseBooking.java	2009-11-26 12:40:11 UTC (rev 97021)
@@ -0,0 +1,231 @@
+//
+// 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.jbossxb.simple;
+
+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.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>
+ * &lt;complexType name="courseBooking">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element ref="{}company"/>
+ *         &lt;element ref="{}student" maxOccurs="unbounded"/>
+ *       &lt;/sequence>
+ *       &lt;attribute name="courseReference" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="courseDate" use="required" type="{http://www.w3.org/2001/XMLSchema}date" />
+ *       &lt;attribute name="invoiceReference" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="totalPrice" use="required" type="{http://www.w3.org/2001/XMLSchema}decimal" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+ at JBossXmlSchema(namespace = CourseBooking.NAMESPACE_XML_SIMPLE, elementFormDefault = XmlNsForm.QUALIFIED)
+ 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/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/CourseBooking.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/StudentType.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/StudentType.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/StudentType.java	2009-11-26 12:40:11 UTC (rev 97021)
@@ -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.jbossxb.simple;
+
+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>
+ * &lt;complexType name="studentType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;attribute name="firstName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="surname" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/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/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/simple/StudentType.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/test/resources/jboss-osgi-framework.properties	2009-11-26 07:32:06 UTC (rev 97013)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/jboss-osgi-framework.properties	2009-11-26 12:40:11 UTC (rev 97021)
@@ -8,22 +8,21 @@
 org.osgi.framework.storage=${test.archive.directory}/../osgi-store
 org.osgi.framework.storage.clean=onFirstInit
 
-# Husky socket connector properties
-org.jboss.osgi.husky.runtime.connector.host=localhost
-org.jboss.osgi.husky.runtime.connector.port=5401
-
 # Framework bootdelegation
-# org.osgi.framework.bootdelegation=org.osgi.service.log
+# org.osgi.framework.bootdelegation=
 
 # Extra System Packages
 org.osgi.framework.system.packages.extra=\
+    org.apache.log4j;version=1.2, \
+	org.jboss.logging, \
     org.jboss.osgi.deployment.interceptor;version=1.0, \
   	org.jboss.osgi.spi;version=1.0, \
   	org.jboss.osgi.spi.capability;version=1.0, \
   	org.jboss.osgi.spi.management;version=1.0, \
   	org.jboss.osgi.spi.service;version=1.0, \
   	org.jboss.osgi.spi.util;version=1.0, \
-  	org.osgi.framework;version=1.5, \
+  	org.jboss.virtual;version=2.1, \
+	org.osgi.framework;version=1.5, \
   	org.slf4j;version=1.5
 
 # Bundles that need to be installed with the Framework automatically 

Modified: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/log4j.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/test/resources/log4j.xml	2009-11-26 07:32:06 UTC (rev 97013)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/log4j.xml	2009-11-26 12:40:11 UTC (rev 97021)
@@ -38,11 +38,10 @@
   </category>
   -->
 
-  <!-- Show jboss deployer traces 
+  <!-- Show jboss deployer traces --> 
   <category name="org.jboss.xb">
     <priority value="TRACE" />
   </category>
-  --> 
 
   <!-- ======================= -->
   <!-- Setup the Root category -->

Added: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/simple/booking.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/simple/booking.xml	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/simple/booking.xml	2009-11-26 12:40:11 UTC (rev 97021)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<course-booking xmlns="http://org.jboss.test.osgi.jbossxb.simple" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <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" />
+</course-booking>  


Property changes on: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/simple/booking.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/simple/booking.xsd
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/simple/booking.xsd	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/simple/booking.xsd	2009-11-26 12:40:11 UTC (rev 97021)
@@ -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="course-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/projects/bundles/jboss-xml-binding/trunk/src/test/resources/simple/booking.xsd
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/simple/simple-unmarshaller.bnd
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/simple/simple-unmarshaller.bnd	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/simple/simple-unmarshaller.bnd	2009-11-26 12:40:11 UTC (rev 97021)
@@ -0,0 +1,21 @@
+# bnd build -classpath target/test-classes -output target/test-libs/simple-unmarshaller.jar src/test/resources/simple/simple-unmarshaller.bnd
+
+Bundle-SymbolicName: simple-unmarshaller
+Export-Package: org.jboss.test.osgi.jbossxb
+Private-Package: org.jboss.test.osgi.jbossxb.simple
+
+Import-Package: \
+    javax.xml.bind.annotation, \
+    javax.xml.datatype, \
+    org.jboss.osgi.jbossxb, \
+	org.jboss.osgi.spi.capability, \
+	org.jboss.osgi.husky, \
+	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.jbossxb




More information about the jboss-cvs-commits mailing list