[jboss-cvs] JBossAS SVN: r111761 - in projects/bootstrap/trunk: impl-mc/src/main/java/org/jboss/bootstrap/impl/mc/server and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jul 15 13:11:11 EDT 2011
Author: ALRubinger
Date: 2011-07-15 13:11:11 -0400 (Fri, 15 Jul 2011)
New Revision: 111761
Added:
projects/bootstrap/trunk/impl-mc/src/main/java/org/jboss/bootstrap/impl/mc/server/SecurityActions.java
Modified:
projects/bootstrap/trunk/build/pom.xml
projects/bootstrap/trunk/impl-mc/src/main/java/org/jboss/bootstrap/impl/mc/server/AbstractMCServerBase.java
projects/bootstrap/trunk/spi-test/pom.xml
Log:
[JBBOOT-136] Move registration of URLStreamHandlerFactory to bootstrap (from AS Main)
Modified: projects/bootstrap/trunk/build/pom.xml
===================================================================
--- projects/bootstrap/trunk/build/pom.xml 2011-07-14 15:30:14 UTC (rev 111760)
+++ projects/bootstrap/trunk/build/pom.xml 2011-07-15 17:11:11 UTC (rev 111761)
@@ -29,7 +29,7 @@
<!-- Versioning -->
<version.org.jboss.logging_jboss.logging.log4j>2.2.0.CR1</version.org.jboss.logging_jboss.logging.log4j>
<version.org.jboss.logging_jboss.logging.spi>2.2.0.CR1</version.org.jboss.logging_jboss.logging.spi>
- <version.org.jboss.kernel_jboss.kernel>2.2.0-SNAPSHOT</version.org.jboss.kernel_jboss.kernel>
+ <version.org.jboss.kernel_jboss.kernel>2.2.0.GA</version.org.jboss.kernel_jboss.kernel>
<version.org.jboss_jbossxb>2.0.2.Beta7</version.org.jboss_jbossxb>
<version.javassist_javassist>3.12.0.GA</version.javassist_javassist>
<version.org.jboss.classpool_jboss.classpool>1.0.0.Alpha6</version.org.jboss.classpool_jboss.classpool>
@@ -126,7 +126,7 @@
<configuration>
<rules>
<requireMavenVersion>
- <version>[2.0.9,2.1)</version> <!-- Must be Maven 2.0.9 >= x > 2.1 -->
+ <version>[2.0.9,3.1)</version> <!-- Must be Maven 2.0.9 >= x > 2.1 -->
</requireMavenVersion>
<requireJavaVersion>
<version>1.6.0</version> <!-- Must be JDK6 -->
Modified: projects/bootstrap/trunk/impl-mc/src/main/java/org/jboss/bootstrap/impl/mc/server/AbstractMCServerBase.java
===================================================================
--- projects/bootstrap/trunk/impl-mc/src/main/java/org/jboss/bootstrap/impl/mc/server/AbstractMCServerBase.java 2011-07-14 15:30:14 UTC (rev 111760)
+++ projects/bootstrap/trunk/impl-mc/src/main/java/org/jboss/bootstrap/impl/mc/server/AbstractMCServerBase.java 2011-07-15 17:11:11 UTC (rev 111761)
@@ -23,6 +23,7 @@
package org.jboss.bootstrap.impl.mc.server;
import java.io.InputStream;
+import java.net.URLStreamHandlerFactory;
import java.util.List;
import java.util.Map;
@@ -223,6 +224,10 @@
@Override
protected void doInitialize() throws IllegalStateException, InvalidConfigurationException, LifecycleEventException
{
+ // Set URL stream handler factory from JBoss Commons
+ ClassLoader cl = SecurityActions.getThreadContextClassLoader();
+ setupURLStreamHandlerFactory("org.jboss.net.protocol.URLStreamHandlerFactory", cl);
+
/*
* Make sure we have the correct classpools set up
*/
@@ -260,6 +265,26 @@
}
}
+ /**
+ * Setup URL stream handler factory.
+ *
+ * @param className the url stream handler factory classname
+ * @param cl the classloader to use to load the ushf class
+ */
+ protected void setupURLStreamHandlerFactory(String className, ClassLoader cl)
+ {
+ try
+ {
+ Class<?> clazz = cl.loadClass(className);
+ URLStreamHandlerFactory ushf = (URLStreamHandlerFactory) clazz.newInstance();
+ SecurityActions.setURLStreamHandlerFactory(ushf);
+ }
+ catch (Throwable t)
+ {
+ log.error("Cannot set URLStreamHandlerFactory: " + t);
+ }
+ }
+
/* (non-Javadoc)
* @see org.jboss.bootstrap.impl.base.server.AbstractServer#start()
*/
Added: projects/bootstrap/trunk/impl-mc/src/main/java/org/jboss/bootstrap/impl/mc/server/SecurityActions.java
===================================================================
--- projects/bootstrap/trunk/impl-mc/src/main/java/org/jboss/bootstrap/impl/mc/server/SecurityActions.java (rev 0)
+++ projects/bootstrap/trunk/impl-mc/src/main/java/org/jboss/bootstrap/impl/mc/server/SecurityActions.java 2011-07-15 17:11:11 UTC (rev 111761)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.bootstrap.impl.mc.server;
+
+import java.net.URL;
+import java.net.URLStreamHandlerFactory;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * SecurityActions
+ *
+ * Collection of tasks to be run under a security manager,
+ * package-private so we don't leak out.
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+class SecurityActions
+{
+ /**
+ * Obtains the Thread Context ClassLoader
+ */
+ static ClassLoader getThreadContextClassLoader()
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+
+ /**
+ * Set URL stream handler factory.
+ *
+ * @param ushf the url stream handler factory
+ */
+ static void setURLStreamHandlerFactory(final URLStreamHandlerFactory ushf)
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ URL.setURLStreamHandlerFactory(ushf);
+ return null;
+ }
+ });
+ }
+}
Modified: projects/bootstrap/trunk/spi-test/pom.xml
===================================================================
--- projects/bootstrap/trunk/spi-test/pom.xml 2011-07-14 15:30:14 UTC (rev 111760)
+++ projects/bootstrap/trunk/spi-test/pom.xml 2011-07-15 17:11:11 UTC (rev 111761)
@@ -10,6 +10,7 @@
<groupId>org.jboss.bootstrap</groupId>
<artifactId>jboss-bootstrap-build</artifactId>
<version>2.1.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
</parent>
<!-- Model Version -->
More information about the jboss-cvs-commits
mailing list