[jboss-cvs] JBossAS SVN: r89459 - in projects/jboss-osgi/trunk: 3rdparty/jbossxb and 8 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed May 27 05:46:37 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-05-27 05:46:37 -0400 (Wed, 27 May 2009)
New Revision: 89459
Added:
projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/java/org/jboss/osgi/jbossxb/internal/DocumentBuilderFactoryOSGi.java
projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/java/org/jboss/osgi/jbossxb/internal/SAXParserFactoryOSGi.java
projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/resources/
projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/resources/META-INF/
projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/resources/META-INF/services/
projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/resources/META-INF/services/javax.xml.parsers.DocumentBuilderFactory
projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/resources/META-INF/services/javax.xml.parsers.SAXParserFactory
Modified:
projects/jboss-osgi/trunk/3rdparty/jboss-common-core/pom.xml
projects/jboss-osgi/trunk/3rdparty/jbossxb/.classpath
projects/jboss-osgi/trunk/3rdparty/jbossxb/pom.xml
projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/java/org/jboss/osgi/jbossxb/internal/Activator.java
projects/jboss-osgi/trunk/bundles/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java
projects/jboss-osgi/trunk/bundles/jndi/src/main/java/org/jboss/osgi/jndi/internal/JNPServer.java
projects/jboss-osgi/trunk/distribution/runtime/bin/run.conf
Log:
Initialize SAXParserFactory in JBossXB
Modified: projects/jboss-osgi/trunk/3rdparty/jboss-common-core/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/3rdparty/jboss-common-core/pom.xml 2009-05-27 08:21:11 UTC (rev 89458)
+++ projects/jboss-osgi/trunk/3rdparty/jboss-common-core/pom.xml 2009-05-27 09:46:37 UTC (rev 89459)
@@ -56,7 +56,10 @@
<Embed-Dependency>
jboss-common-core;inline=false,
</Embed-Dependency>
- <_exportcontents>*</_exportcontents>
+ <_exportcontents>
+ org.jboss.net.*;version=${version.jboss.common.core},
+ org.jboss.util*;version=${version.jboss.common.core},
+ </_exportcontents>
</instructions>
</configuration>
</plugin>
Modified: projects/jboss-osgi/trunk/3rdparty/jbossxb/.classpath
===================================================================
--- projects/jboss-osgi/trunk/3rdparty/jbossxb/.classpath 2009-05-27 08:21:11 UTC (rev 89458)
+++ projects/jboss-osgi/trunk/3rdparty/jbossxb/.classpath 2009-05-27 09:46:37 UTC (rev 89459)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry 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/trunk/3rdparty/jbossxb/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/3rdparty/jbossxb/pom.xml 2009-05-27 08:21:11 UTC (rev 89458)
+++ projects/jboss-osgi/trunk/3rdparty/jbossxb/pom.xml 2009-05-27 09:46:37 UTC (rev 89459)
@@ -37,11 +37,6 @@
<!-- Provided Dependencies -->
<dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
@@ -76,7 +71,6 @@
com.wutka.dtd,
org.apache.xerces.*,
org.jboss.logging,
- org.jboss.osgi.common.log,
org.jboss.util*,
org.osgi.framework,
org.osgi.service.log,
Modified: projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/java/org/jboss/osgi/jbossxb/internal/Activator.java
===================================================================
--- projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/java/org/jboss/osgi/jbossxb/internal/Activator.java 2009-05-27 08:21:11 UTC (rev 89458)
+++ projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/java/org/jboss/osgi/jbossxb/internal/Activator.java 2009-05-27 09:46:37 UTC (rev 89459)
@@ -23,10 +23,13 @@
//$Id$
-import org.jboss.osgi.common.log.LogServiceTracker;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.jboss.logging.Logger;
+import org.jboss.xb.binding.parser.sax.SaxJBossXBParser;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
-import org.osgi.service.log.LogService;
/**
* A {@link BundleActivator} that initializes the JBossXB bundle
@@ -36,11 +39,27 @@
*/
public class Activator implements BundleActivator
{
- private LogService log;
+ // Provide logging
+ final Logger log = Logger.getLogger(Activator.class);
public void start(BundleContext context) throws Exception
{
- log = new LogServiceTracker(context);
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ String saxFactory = SAXParserFactory.newInstance().getClass().getName();
+ String domFactory = DocumentBuilderFactory.newInstance().getClass().getName();
+ log.info("JBossXB started: SAXParserFactory=" + saxFactory + ",DocumentBuilderFactory=" + domFactory);
+
+ // SaxJBossXBParser initializes the SAXParserFactory in a static block
+ // using SAXParserFactory.newInstance(), which internally uses the TCCL
+ new SaxJBossXBParser();
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
}
public void stop(BundleContext context) throws Exception
Added: projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/java/org/jboss/osgi/jbossxb/internal/DocumentBuilderFactoryOSGi.java
===================================================================
--- projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/java/org/jboss/osgi/jbossxb/internal/DocumentBuilderFactoryOSGi.java (rev 0)
+++ projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/java/org/jboss/osgi/jbossxb/internal/DocumentBuilderFactoryOSGi.java 2009-05-27 09:46:37 UTC (rev 89459)
@@ -0,0 +1,46 @@
+/*
+ * 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;
+import org.jboss.logging.Logger;
+
+/**
+ * A {@link DocumentBuilderFactory}
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class DocumentBuilderFactoryOSGi extends DocumentBuilderFactoryImpl
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(DocumentBuilderFactoryOSGi.class);
+
+ public DocumentBuilderFactoryOSGi()
+ {
+ log.debug("Using OSGi DocumentBuilderFactory");
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/java/org/jboss/osgi/jbossxb/internal/DocumentBuilderFactoryOSGi.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/java/org/jboss/osgi/jbossxb/internal/SAXParserFactoryOSGi.java
===================================================================
--- projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/java/org/jboss/osgi/jbossxb/internal/SAXParserFactoryOSGi.java (rev 0)
+++ projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/java/org/jboss/osgi/jbossxb/internal/SAXParserFactoryOSGi.java 2009-05-27 09:46:37 UTC (rev 89459)
@@ -0,0 +1,46 @@
+/*
+ * 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;
+import org.jboss.logging.Logger;
+
+/**
+ * A {@link SAXParserFactory}
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class SAXParserFactoryOSGi extends SAXParserFactoryImpl
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(SAXParserFactoryOSGi.class);
+
+ public SAXParserFactoryOSGi()
+ {
+ log.debug("Using OSGi SAXParserFactory");
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/java/org/jboss/osgi/jbossxb/internal/SAXParserFactoryOSGi.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/resources/META-INF/services/javax.xml.parsers.DocumentBuilderFactory
===================================================================
--- projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/resources/META-INF/services/javax.xml.parsers.DocumentBuilderFactory (rev 0)
+++ projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/resources/META-INF/services/javax.xml.parsers.DocumentBuilderFactory 2009-05-27 09:46:37 UTC (rev 89459)
@@ -0,0 +1 @@
+org.jboss.osgi.jbossxb.internal.DocumentBuilderFactoryOSGi
\ No newline at end of file
Added: projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/resources/META-INF/services/javax.xml.parsers.SAXParserFactory
===================================================================
--- projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/resources/META-INF/services/javax.xml.parsers.SAXParserFactory (rev 0)
+++ projects/jboss-osgi/trunk/3rdparty/jbossxb/src/main/resources/META-INF/services/javax.xml.parsers.SAXParserFactory 2009-05-27 09:46:37 UTC (rev 89459)
@@ -0,0 +1 @@
+org.jboss.osgi.jbossxb.internal.SAXParserFactoryOSGi
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundles/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java
===================================================================
--- projects/jboss-osgi/trunk/bundles/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java 2009-05-27 08:21:11 UTC (rev 89458)
+++ projects/jboss-osgi/trunk/bundles/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java 2009-05-27 09:46:37 UTC (rev 89459)
@@ -62,19 +62,17 @@
try
{
- InetAddress bindAddress = InetAddress.getByName(host);
-
// check to see if registry already created
rmiRegistry = LocateRegistry.getRegistry(host, rmiPort);
try
{
rmiRegistry.list();
- log.log(LogService.LOG_DEBUG, "RMI Registry running at host=" + host + ",port=" + rmiPort);
+ log.log(LogService.LOG_DEBUG, "RMI registry running at host=" + host + ",port=" + rmiPort);
}
catch (RemoteException e)
{
- log.log(LogService.LOG_DEBUG, "No RMI Registry running at host=" + host + ",port=" + rmiPort + ". Will create one.");
- rmiRegistry = LocateRegistry.createRegistry(rmiPort, null, new DefaultSocketFactory(bindAddress));
+ log.log(LogService.LOG_DEBUG, "No RMI registry running at host=" + host + ",port=" + rmiPort + ". Will create one.");
+ rmiRegistry = LocateRegistry.createRegistry(rmiPort, null, new DefaultSocketFactory(InetAddress.getByName(host)));
shutdownRegistry = true;
}
@@ -108,9 +106,9 @@
try
{
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-
+
jmxConnectorServer.start();
-
+
log.log(LogService.LOG_INFO, "JMXConnectorServer started: " + serviceURL);
}
catch (IOException ex)
@@ -129,13 +127,13 @@
try
{
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-
+
jmxConnectorServer.stop();
-
+
// Shutdown the registry if this service created it
if (shutdownRegistry == true)
{
- log.log(LogService.LOG_DEBUG, "Shutdown RMI Registry");
+ log.log(LogService.LOG_DEBUG, "Shutdown RMI registry");
UnicastRemoteObject.unexportObject(rmiRegistry, true);
}
Modified: projects/jboss-osgi/trunk/bundles/jndi/src/main/java/org/jboss/osgi/jndi/internal/JNPServer.java
===================================================================
--- projects/jboss-osgi/trunk/bundles/jndi/src/main/java/org/jboss/osgi/jndi/internal/JNPServer.java 2009-05-27 08:21:11 UTC (rev 89458)
+++ projects/jboss-osgi/trunk/bundles/jndi/src/main/java/org/jboss/osgi/jndi/internal/JNPServer.java 2009-05-27 09:46:37 UTC (rev 89459)
@@ -23,8 +23,16 @@
//$Id$
+import java.net.InetAddress;
+import java.rmi.NoSuchObjectException;
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.rmi.server.UnicastRemoteObject;
+
import javax.naming.NamingException;
+import org.jboss.net.sockets.DefaultSocketFactory;
import org.jboss.osgi.common.log.LogServiceTracker;
import org.jnp.interfaces.Naming;
import org.jnp.server.Main;
@@ -48,6 +56,9 @@
private Main namingMain;
private Naming namingServer;
+
+ private boolean shutdownRegistry;
+ private Registry rmiRegistry;
public JNPServer(BundleContext context, String host, int jndiPort, int rmiPort)
{
@@ -61,6 +72,20 @@
{
try
{
+ // check to see if registry already created
+ rmiRegistry = LocateRegistry.getRegistry(host, rmiPort);
+ try
+ {
+ rmiRegistry.list();
+ log.log(LogService.LOG_DEBUG, "RMI registry running at host=" + host + ",port=" + rmiPort);
+ }
+ catch (RemoteException e)
+ {
+ log.log(LogService.LOG_DEBUG, "No RMI registry running at host=" + host + ",port=" + rmiPort + ". Will create one.");
+ rmiRegistry = LocateRegistry.createRegistry(rmiPort, null, new DefaultSocketFactory(InetAddress.getByName(host)));
+ shutdownRegistry = true;
+ }
+
namingMain = new Main();
namingMain.setNamingInfo(getNamingBean());
@@ -71,7 +96,7 @@
namingMain.setRmiPort(rmiPort);
namingMain.start();
- log.log(LogService.LOG_DEBUG, "Naming server started");
+ log.log(LogService.LOG_INFO, "JNDI started: JNP=" + host + ":" + jndiPort + ", RMI=" + host + ":" + rmiPort);
}
catch (Exception ex)
{
@@ -88,6 +113,21 @@
namingServer = null;
log.log(LogService.LOG_DEBUG, "Naming server stopped");
}
+
+ // Shutdown the registry if this service created it
+ if (shutdownRegistry == true)
+ {
+ log.log(LogService.LOG_DEBUG, "Shutdown RMI registry");
+ try
+ {
+ UnicastRemoteObject.unexportObject(rmiRegistry, true);
+ }
+ catch (NoSuchObjectException ex)
+ {
+ log.log(LogService.LOG_WARNING, "Cannot shotdown RMI registry", ex);
+ }
+ }
+
}
private NamingBean getNamingBean()
Modified: projects/jboss-osgi/trunk/distribution/runtime/bin/run.conf
===================================================================
--- projects/jboss-osgi/trunk/distribution/runtime/bin/run.conf 2009-05-27 08:21:11 UTC (rev 89458)
+++ projects/jboss-osgi/trunk/distribution/runtime/bin/run.conf 2009-05-27 09:46:37 UTC (rev 89459)
@@ -29,7 +29,7 @@
fi
# Sample JPDA settings for remote socket debuging
-JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
+#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"
# Sample JPDA settings for shared memory debugging
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=jboss"
More information about the jboss-cvs-commits
mailing list