Author: thomas.diesler(a)jboss.com
Date: 2009-11-30 11:09:19 -0500 (Mon, 30 Nov 2009)
New Revision: 97174
Added:
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingDocumentBuilderFactory.java
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingSAXParserFactory.java
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/refresh/UnmarshallerServiceRefreshTestCase.java
Removed:
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/DocumentBuilderFactoryOSGi.java
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/SAXParserFactoryOSGi.java
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/refresh/RefreshServiceTestCase.java
Modified:
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml
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/XMLBindingActivator.java
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/resources/META-INF/services/javax.xml.parsers.DocumentBuilderFactory
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/resources/META-INF/services/javax.xml.parsers.SAXParserFactory
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/jboss-osgi-framework.properties
Log:
Delegate to SAXParserFactory and DocumentBuilderFactory services
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-30
16:06:48 UTC (rev 97173)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml 2009-11-30
16:09:19 UTC (rev 97174)
@@ -161,7 +161,6 @@
org.w3c.dom*,
org.xml.sax*,
- <!-- import -->
com.wutka.dtd,
org.apache.xerces.*,
org.jboss.logging,
Deleted:
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/DocumentBuilderFactoryOSGi.java
===================================================================
---
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/DocumentBuilderFactoryOSGi.java 2009-11-30
16:06:48 UTC (rev 97173)
+++
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/DocumentBuilderFactoryOSGi.java 2009-11-30
16:09:19 UTC (rev 97174)
@@ -1,38 +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.internal;
-
-//$Id$
-
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.apache.xerces.jaxp.DocumentBuilderFactoryImpl;
-
-/**
- * A {@link DocumentBuilderFactory}
- *
- * @author thomas.diesler(a)jboss.com
- * @since 13-May-2009
- */
-public class DocumentBuilderFactoryOSGi extends DocumentBuilderFactoryImpl
-{
-}
\ No newline at end of file
Deleted:
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/SAXParserFactoryOSGi.java
===================================================================
---
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/SAXParserFactoryOSGi.java 2009-11-30
16:06:48 UTC (rev 97173)
+++
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/SAXParserFactoryOSGi.java 2009-11-30
16:09:19 UTC (rev 97174)
@@ -1,38 +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.internal;
-
-//$Id$
-
-import javax.xml.parsers.SAXParserFactory;
-
-import org.apache.xerces.jaxp.SAXParserFactoryImpl;
-
-/**
- * A {@link SAXParserFactory}
- *
- * @author thomas.diesler(a)jboss.com
- * @since 13-May-2009
- */
-public class SAXParserFactoryOSGi extends SAXParserFactoryImpl
-{
-}
\ No newline at end of file
Modified:
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 2009-11-30
16:06:48 UTC (rev 97173)
+++
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/UnmarshallerServiceImpl.java 2009-11-30
16:09:19 UTC (rev 97174)
@@ -64,11 +64,35 @@
schemaBindingResolver = new DefaultSchemaResolver();
bundleLoader = BundleClassLoader.createClassLoader(context.getBundle());
log.debug("UnmarshallerService using: " + bundleLoader);
+
+ // Initialize the JBossXB unmarshaller in the context of this bundle
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ unmarshaller = factory.newUnmarshaller();
+ }
+ catch (Throwable th)
+ {
+ log.error("Cannot initialze unmarshaller", th);
+ if (th instanceof RuntimeException)
+ throw (RuntimeException)th;
+ if (th instanceof Error)
+ throw (Error)th;
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
}
public void setFeature(String featureName, boolean flag)
{
factory.setFeature(featureName, flag);
+
+ // A feature change dicards a previously used unmarshaller
+ // The factory constructs a new one with the canged feature set.
+ unmarshaller = null;
}
public void setNamespaceAware(boolean namespaces)
@@ -137,11 +161,13 @@
{
Thread.currentThread().setContextClassLoader(bundleLoader);
schemaBindingResolver.addClassBinding(nsUri, className);
- log.debug("Add mapping of '" + nsUri + "' to " +
className);
+ if (log.isTraceEnabled())
+ log.trace("Add mapping of '" + nsUri + "' to " +
className);
}
catch (ClassNotFoundException ex)
{
- log.debug("Ignore mapping of '" + nsUri + "' to " +
className);
+ if (log.isTraceEnabled())
+ log.trace("Ignore mapping of '" + nsUri + "' to "
+ className);
}
finally
{
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-30
16:06:48 UTC (rev 97173)
+++
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingActivator.java 2009-11-30
16:09:19 UTC (rev 97174)
@@ -29,8 +29,6 @@
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceRegistration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* A {@link BundleActivator} that initializes the JBossXB bundle
@@ -40,23 +38,26 @@
*/
public class XMLBindingActivator implements BundleActivator
{
- // Provide logging
- private static Logger log = LoggerFactory.getLogger(XMLBindingActivator.class);
-
public void start(BundleContext context) throws Exception
{
- ServiceFactory unmarshallerFactory = new ServiceFactory()
+ // Register a service factory that creates an JBossXB unmarshaller
+ // in the context of the client bundle
+ ServiceFactory serviceFactory = new ServiceFactory()
{
public Object getService(Bundle bundle, ServiceRegistration registration)
{
+ XMLBindingSAXParserFactory.setBundleContext(bundle.getBundleContext());
+
XMLBindingDocumentBuilderFactory.setBundleContext(bundle.getBundleContext());
return new UnmarshallerServiceImpl(bundle.getBundleContext());
}
public void ungetService(Bundle bundle, ServiceRegistration registration, Object
service)
{
+ XMLBindingSAXParserFactory.setBundleContext(null);
+ XMLBindingDocumentBuilderFactory.setBundleContext(null);
}
};
- context.registerService(UnmarshallerService.class.getName(), unmarshallerFactory,
null);
+ context.registerService(UnmarshallerService.class.getName(), serviceFactory,
null);
}
public void stop(BundleContext context) throws Exception
Copied:
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingDocumentBuilderFactory.java
(from rev 97156,
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/DocumentBuilderFactoryOSGi.java)
===================================================================
---
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingDocumentBuilderFactory.java
(rev 0)
+++
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingDocumentBuilderFactory.java 2009-11-30
16:09:19 UTC (rev 97174)
@@ -0,0 +1,158 @@
+/*
+ * 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.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.xerces.jaxp.DocumentBuilderFactoryImpl;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.xml.XMLParserActivator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A {@link DocumentBuilderFactory}
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 13-May-2009
+ */
+public class XMLBindingDocumentBuilderFactory extends DocumentBuilderFactory
+{
+ // Provide logging
+ private static Logger log;
+
+ private static BundleContext context;
+ private Map<String, Boolean> features = new HashMap<String, Boolean>();
+ private Map<String, Object> attributes = new HashMap<String, Object>();
+
+ public static void setBundleContext(BundleContext context)
+ {
+ // The log4j initialization routine may use this DocumentBuilderFactory
+ // Only create the logger, when we are running in an OSGi context
+ log = LoggerFactory.getLogger(XMLBindingDocumentBuilderFactory.class);
+
+ XMLBindingDocumentBuilderFactory.context = context;
+ }
+
+ @Override
+ public boolean getFeature(String name)
+ {
+ Boolean value = features.get(name);
+ return value != null ? value.booleanValue() : false;
+ }
+
+ @Override
+ public void setFeature(String name, boolean value)
+ {
+ features.put(name, new Boolean(value));
+ }
+
+ @Override
+ public Object getAttribute(String name)
+ {
+ return attributes.get(name);
+ }
+
+ @Override
+ public void setAttribute(String name, Object value)
+ {
+ attributes.put(name, value);
+ }
+
+ /**
+ * Creates a new instance of a {@link javax.xml.parsers.DocumentBuilder} using the
currently configured parameters.
+ *
+ * If the bundle context is available, which would be the case if this bundle was
started
+ * try using the registered DocumentBuilderFactory service.
+ *
+ * If there is no DocumentBuilderFactory service for the given parameters, use the
Apache Xerces DocumentBuilderFactoryImpl.
+ */
+ @Override
+ public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException
+ {
+ String validating = "(" + XMLParserActivator.PARSER_VALIDATING +
"=" + isValidating() + ")";
+ String namespaceAware = "(" + XMLParserActivator.PARSER_NAMESPACEAWARE +
"=" + isNamespaceAware() + ")";
+ String filter = "(&" + validating + namespaceAware + ")";
+
+ DocumentBuilderFactory factory = null;
+
+ // First try to obtain the DocumentBuilderFactory service
+ if (context != null)
+ {
+ try
+ {
+ ServiceReference[] srefs =
context.getServiceReferences(DocumentBuilderFactory.class.getName(), filter);
+ if (srefs != null)
+ {
+ if (srefs.length > 1)
+ logDebug("Multiple DocumentBuilderFactory services: " +
Arrays.asList(srefs));
+
+ logDebug("Using DocumentBuilderFactory service: " + srefs[0]);
+ factory = (DocumentBuilderFactory)context.getService(srefs[0]);
+ }
+ }
+ catch (InvalidSyntaxException ex)
+ {
+ // ignore
+ }
+ }
+
+ // Fall back to Apache Xerces DocumentBuilderFactoryImpl
+ if (factory == null)
+ {
+ logDebug("Cannot obtain DocumentBuilderFactory service " + filter +
". Now use " + DocumentBuilderFactoryImpl.class.getName());
+ factory = new DocumentBuilderFactoryImpl();
+ }
+
+ // Set the features on the factory
+ for (Map.Entry<String, Boolean> entry : features.entrySet())
+ {
+ logDebug("Set feature [" + entry.getKey() + "=" +
entry.getValue() + "]");
+ factory.setFeature(entry.getKey(), entry.getValue());
+ }
+
+ // Set the attributes on the factory
+ for (Map.Entry<String, Object> entry : attributes.entrySet())
+ {
+ logDebug("Set attribute [" + entry.getKey() + "=" +
entry.getValue() + "]");
+ factory.setAttribute(entry.getKey(), entry.getValue());
+ }
+
+ return factory.newDocumentBuilder();
+ }
+
+ private void logDebug(String message)
+ {
+ if (log != null)
+ log.debug(message);
+ }
+}
\ No newline at end of file
Copied:
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingSAXParserFactory.java
(from rev 97156,
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/SAXParserFactoryOSGi.java)
===================================================================
---
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingSAXParserFactory.java
(rev 0)
+++
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingSAXParserFactory.java 2009-11-30
16:09:19 UTC (rev 97174)
@@ -0,0 +1,139 @@
+/*
+ * 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.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.apache.xerces.jaxp.SAXParserFactoryImpl;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.xml.XMLParserActivator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.SAXException;
+
+/**
+ * A {@link SAXParserFactory}
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 13-May-2009
+ */
+public class XMLBindingSAXParserFactory extends SAXParserFactory
+{
+ // Provide logging
+ private static Logger log;
+
+ private static BundleContext context;
+ private Map<String, Boolean> features = new HashMap<String, Boolean>();
+
+ public static void setBundleContext(BundleContext context)
+ {
+ // The log4j initialization routine may use this DocumentBuilderFactory
+ // Only create the logger, when we are running in an OSGi context
+ log = LoggerFactory.getLogger(XMLBindingSAXParserFactory.class);
+
+ XMLBindingSAXParserFactory.context = context;
+ }
+
+ @Override
+ public boolean getFeature(String name)
+ {
+ Boolean value = features.get(name);
+ return value != null ? value.booleanValue() : false;
+ }
+
+ @Override
+ public void setFeature(String name, boolean value)
+ {
+ features.put(name, new Boolean(value));
+ }
+
+ /**
+ * Creates a new instance of a {@link javax.xml.parsers.SAXParserFactory} using the
currently configured parameters.
+ *
+ * If the bundle context is available, which would be the case if this bundle was
started
+ * try using the registered SAXParserFactory service.
+ *
+ * If there is no SAXParserFactory service for the given parameters, use the Apache
Xerces SAXParserFactoryImpl.
+ */
+ @Override
+ public SAXParser newSAXParser() throws ParserConfigurationException, SAXException
+ {
+ String validating = "(" + XMLParserActivator.PARSER_VALIDATING +
"=" + isValidating() + ")";
+ String namespaceAware = "(" + XMLParserActivator.PARSER_NAMESPACEAWARE +
"=" + isNamespaceAware() + ")";
+ String filter = "(&" + validating + namespaceAware + ")";
+
+ SAXParserFactory factory = null;
+
+ // First try to obtain the SAXParserFactory service
+ if (context != null)
+ {
+ try
+ {
+ ServiceReference[] srefs =
context.getServiceReferences(SAXParserFactory.class.getName(), filter);
+ if (srefs != null)
+ {
+ if (srefs.length > 1)
+ logDebug("Multiple SAXParserFactory services: " +
Arrays.asList(srefs));
+
+ logDebug("Using SAXParserFactory service: " + srefs[0]);
+ factory = (SAXParserFactory)context.getService(srefs[0]);
+ }
+ }
+ catch (InvalidSyntaxException ex)
+ {
+ // ignore
+ }
+ }
+
+ // Fall back to Apache Xerces SAXParserFactoryImpl
+ if (factory == null)
+ {
+ logDebug("Cannot obtain SAXParserFactory service " + filter + ".
Now use " + SAXParserFactoryImpl.class.getName());
+ factory = new SAXParserFactoryImpl();
+ }
+
+ // Set the features on the factory
+ for (Map.Entry<String, Boolean> entry : features.entrySet())
+ {
+ logDebug("Set feature [" + entry.getKey() + "=" +
entry.getValue() + "]");
+ factory.setFeature(entry.getKey(), entry.getValue());
+ }
+
+ return factory.newSAXParser();
+ }
+
+ private void logDebug(String message)
+ {
+ if (log != null)
+ log.debug(message);
+ }
+}
\ No newline at end of file
Modified:
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/resources/META-INF/services/javax.xml.parsers.DocumentBuilderFactory
===================================================================
---
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/resources/META-INF/services/javax.xml.parsers.DocumentBuilderFactory 2009-11-30
16:06:48 UTC (rev 97173)
+++
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/resources/META-INF/services/javax.xml.parsers.DocumentBuilderFactory 2009-11-30
16:09:19 UTC (rev 97174)
@@ -1 +1 @@
-org.jboss.osgi.jbossxb.internal.DocumentBuilderFactoryOSGi
\ No newline at end of file
+org.jboss.osgi.jbossxb.internal.XMLBindingDocumentBuilderFactory
\ No newline at end of file
Modified:
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/resources/META-INF/services/javax.xml.parsers.SAXParserFactory
===================================================================
---
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/resources/META-INF/services/javax.xml.parsers.SAXParserFactory 2009-11-30
16:06:48 UTC (rev 97173)
+++
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/resources/META-INF/services/javax.xml.parsers.SAXParserFactory 2009-11-30
16:09:19 UTC (rev 97174)
@@ -1 +1 @@
-org.jboss.osgi.jbossxb.internal.SAXParserFactoryOSGi
\ No newline at end of file
+org.jboss.osgi.jbossxb.internal.XMLBindingSAXParserFactory
\ No newline at end of file
Deleted:
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/refresh/RefreshServiceTestCase.java
===================================================================
---
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/refresh/RefreshServiceTestCase.java 2009-11-30
16:06:48 UTC (rev 97173)
+++
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/refresh/RefreshServiceTestCase.java 2009-11-30
16:09:19 UTC (rev 97174)
@@ -1,86 +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.test.osgi.jbossxb.refresh;
-
-//$Id: BasicXMLBindingTestCase.java 97031 2009-11-26 14:54:08Z thomas.diesler(a)jboss.com
$
-
-import static org.junit.Assert.*;
-import static org.junit.Assume.assumeNotNull;
-
-import org.jboss.osgi.husky.BridgeFactory;
-import org.jboss.osgi.husky.HuskyCapability;
-import org.jboss.osgi.husky.RuntimeContext;
-import org.jboss.osgi.jbossxb.XMLBindingCapability;
-import org.jboss.osgi.testing.OSGiBundle;
-import org.jboss.osgi.testing.OSGiPackageAdmin;
-import org.jboss.osgi.testing.OSGiRuntime;
-import org.jboss.osgi.testing.OSGiTest;
-import org.jboss.test.osgi.jbossxb.simple.bundle.BookingActivator;
-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;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * Test XMLBindingService
- *
- * @author thomas.diesler(a)jboss.com
- * @since 26-Nov-2009
- */
-public class RefreshServiceTestCase extends OSGiTest
-{
- @Test
- public void testUnmarshaller() throws Exception
- {
- OSGiRuntime runtime = getDefaultRuntime();
- try
- {
- runtime.addCapability(new XMLBindingCapability());
-
- OSGiBundle serviceBundle = runtime.getBundle("jboss-osgi-xml-binding",
null);
- serviceBundle.start();
-
- OSGiBundle userBundle = runtime.installBundle("simple-booking.jar");
- userBundle.start();
- userBundle.uninstall();
-
- serviceBundle.uninstall();
-
- OSGiPackageAdmin packageAdmin = runtime.getPackageAdmin();
- packageAdmin.refreshPackages(null);
-
- serviceBundle =
runtime.installBundle("bundles/jboss-osgi-xml-binding.jar");
- serviceBundle.start();
-
- userBundle = runtime.installBundle("simple-booking.jar");
- userBundle.start();
- }
- finally
- {
- runtime.shutdown();
- }
- }
-}
\ No newline at end of file
Copied:
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/refresh/UnmarshallerServiceRefreshTestCase.java
(from rev 97156,
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/refresh/RefreshServiceTestCase.java)
===================================================================
---
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/refresh/UnmarshallerServiceRefreshTestCase.java
(rev 0)
+++
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/java/org/jboss/test/osgi/jbossxb/refresh/UnmarshallerServiceRefreshTestCase.java 2009-11-30
16:09:19 UTC (rev 97174)
@@ -0,0 +1,72 @@
+/*
+ * 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.refresh;
+
+//$Id: BasicXMLBindingTestCase.java 97031 2009-11-26 14:54:08Z thomas.diesler(a)jboss.com
$
+
+import org.jboss.osgi.jbossxb.XMLBindingCapability;
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiPackageAdmin;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.junit.Test;
+
+/**
+ * Test XMLBindingService
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 26-Nov-2009
+ */
+public class UnmarshallerServiceRefreshTestCase extends OSGiTest
+{
+ @Test
+ public void testUnmarshaller() throws Exception
+ {
+ OSGiRuntime runtime = getDefaultRuntime();
+ try
+ {
+ runtime.addCapability(new XMLBindingCapability());
+
+ OSGiBundle serviceBundle = runtime.getBundle("jboss-osgi-xml-binding",
null);
+ serviceBundle.start();
+
+ OSGiBundle userBundle = runtime.installBundle("simple-booking.jar");
+ userBundle.start();
+ userBundle.uninstall();
+
+ serviceBundle.uninstall();
+
+ OSGiPackageAdmin packageAdmin = runtime.getPackageAdmin();
+ packageAdmin.refreshPackages(null);
+
+ serviceBundle =
runtime.installBundle("bundles/jboss-osgi-xml-binding.jar");
+ serviceBundle.start();
+
+ userBundle = runtime.installBundle("simple-booking.jar");
+ userBundle.start();
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+}
\ No newline at end of file
Modified:
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/jboss-osgi-framework.properties 2009-11-30
16:06:48 UTC (rev 97173)
+++
projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/jboss-osgi-framework.properties 2009-11-30
16:09:19 UTC (rev 97174)
@@ -4,12 +4,15 @@
# $Id$
#
+# Felix config properties
+felix.bootdelegation.implicit=false
+
# Properties to configure the Framework
org.osgi.framework.storage=${test.archive.directory}/../osgi-store
org.osgi.framework.storage.clean=onFirstInit
# Framework bootdelegation
-# org.osgi.framework.bootdelegation=
+org.osgi.framework.bootdelegation=sun.reflect
# Extra System Packages
org.osgi.framework.system.packages.extra=\