Author: richard.opalka(a)jboss.com
Date: 2011-04-20 07:29:31 -0400 (Wed, 20 Apr 2011)
New Revision: 14170
Modified:
common-tools/trunk/src/main/java/org/jboss/ws/tools/cmd/SecurityActions.java
common-tools/trunk/src/main/java/org/jboss/ws/tools/cmd/WSConsume.java
common-tools/trunk/src/main/java/org/jboss/ws/tools/cmd/WSProvide.java
Log:
[JBWS-3273][JBWS-3222] final JBossWS tools cleanup - removing ugly AS7 modules hack
Modified: common-tools/trunk/src/main/java/org/jboss/ws/tools/cmd/SecurityActions.java
===================================================================
---
common-tools/trunk/src/main/java/org/jboss/ws/tools/cmd/SecurityActions.java 2011-04-20
11:28:28 UTC (rev 14169)
+++
common-tools/trunk/src/main/java/org/jboss/ws/tools/cmd/SecurityActions.java 2011-04-20
11:29:31 UTC (rev 14170)
@@ -82,41 +82,6 @@
}
}
- static ClassLoader getModulesClassLoader()
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm == null)
- {
- return getModulesClassLoaderInternal();
- }
- else
- {
- return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
{
- public ClassLoader run()
- {
- return getModulesClassLoaderInternal();
- }
- });
- }
- }
-
- private static ClassLoader getModulesClassLoaderInternal()
- {
- // TODO: use SPI class loader facade, not reflection!
- try {
- Class<?> moduleClass =
Class.forName("org.jboss.modules.Module");
- Class<?> moduleIdentifierClass =
Class.forName("org.jboss.modules.ModuleIdentifier");
- Class<?> moduleLoaderClass =
Class.forName("org.jboss.modules.ModuleLoader");
- Object moduleLoader =
moduleClass.getMethod("getBootModuleLoader").invoke(null);
- Object moduleIdentifier = moduleIdentifierClass.getMethod("create",
String.class).invoke(null, "org.jboss.as.webservices.server.integration");
- Object module = moduleLoaderClass.getMethod("loadModule",
moduleIdentifierClass).invoke(moduleLoader, moduleIdentifier);
- return
(ClassLoader)moduleClass.getMethod("getClassLoader").invoke(module);
- } catch (Exception e) {
- //ignore, JBoss Modules might not be available at all
- return null;
- }
- }
-
/**
* Load a class using the provided classloader
*
Modified: common-tools/trunk/src/main/java/org/jboss/ws/tools/cmd/WSConsume.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/ws/tools/cmd/WSConsume.java 2011-04-20
11:28:28 UTC (rev 14169)
+++ common-tools/trunk/src/main/java/org/jboss/ws/tools/cmd/WSConsume.java 2011-04-20
11:29:31 UTC (rev 14170)
@@ -66,7 +66,6 @@
*/
public class WSConsume
{
- private static final ClassLoader MODULES_LOADER =
SecurityActions.getModulesClassLoader();
private List<File> bindingFiles = new ArrayList<File>();
private File outputDir = new File("output");
private boolean generateSource;
@@ -86,23 +85,16 @@
public static void main(String[] args)
{
- if (MODULES_LOADER != null)
- {
- final ClassLoader origLoader = SecurityActions.getContextClassLoader();
- try
- {
- SecurityActions.setContextClassLoader(MODULES_LOADER);
- mainInternal(args);
- }
- finally
- {
- SecurityActions.setContextClassLoader(origLoader);
- }
- }
- else
- {
- mainInternal(args);
- }
+ final ClassLoader origLoader = SecurityActions.getContextClassLoader();
+ try
+ {
+ SecurityActions.setContextClassLoader(WSConsume.class.getClassLoader());
+ mainInternal(args);
+ }
+ finally
+ {
+ SecurityActions.setContextClassLoader(origLoader);
+ }
}
private static void mainInternal(final String[] args)
Modified: common-tools/trunk/src/main/java/org/jboss/ws/tools/cmd/WSProvide.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/ws/tools/cmd/WSProvide.java 2011-04-20
11:28:28 UTC (rev 14169)
+++ common-tools/trunk/src/main/java/org/jboss/ws/tools/cmd/WSProvide.java 2011-04-20
11:29:31 UTC (rev 14170)
@@ -59,11 +59,11 @@
* </pre>
*
* @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public class WSProvide
{
- private static final ClassLoader MODULES_LOADER =
SecurityActions.getModulesClassLoader();
- private ClassLoader loader = MODULES_LOADER != null ? MODULES_LOADER :
SecurityActions.getContextClassLoader();
+ private ClassLoader loader = WSProvide.class.getClassLoader();
private File outputDir = new File("output");
private boolean generateSource;
private boolean generateWsdl;
Show replies by date