Author: gdaniels
Date: Wed May 30 08:09:49 2007
New Revision: 542835
URL: http://svn.apache.org/viewvc?view=rev&rev=542835
Log:
* Respect name attribute in module.xml
* Invert sense of if statement in Utils.getClassLoader to clean up code
* Little cleanups (remove redundant null initializers etc)
* Start of work on rationalizing modules on the classpath
Modified:
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/LocalTestCase.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
Modified:
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/LocalTestCase.java
URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/LocalTestCase.java?view=diff&rev=542835&r1=542834&r2=542835
==============================================================================
---
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/LocalTestCase.java
(original)
+++
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/LocalTestCase.java
Wed May 30 08:09:49 2007
@@ -54,7 +54,8 @@
protected void setUp() throws Exception {
// Configuration - server side
- serverConfig = new AxisConfiguration();
+ serverConfig = ConfigurationContextFactory.
+
createConfigurationContextFromFileSystem(null).getAxisConfiguration();
LocalTransportReceiver.CONFIG_CONTEXT = new
ConfigurationContext(serverConfig);
LocalTransportReceiver.CONFIG_CONTEXT.setServicePath("services");
LocalTransportReceiver.CONFIG_CONTEXT.setContextRoot("local:/");
@@ -62,14 +63,14 @@
tOut.setSender(new LocalTransportSender());
serverConfig.addTransportOut(tOut);
- addInPhases(serverConfig.getInFlowPhases());
- DispatchPhase dp =
(DispatchPhase)serverConfig.getInFlowPhases().get(1);
- dp.addHandler(new AddressingBasedDispatcher());
-
- addInPhases(serverConfig.getInFaultFlowPhases());
-
- addOutPhases(serverConfig.getOutFlowPhases());
- addOutPhases(serverConfig.getOutFaultFlowPhases());
+// addInPhases(serverConfig.getInFlowPhases());
+// DispatchPhase dp =
(DispatchPhase)serverConfig.getInFlowPhases().get(1);
+// dp.addHandler(new AddressingBasedDispatcher());
+//
+// addInPhases(serverConfig.getInFaultFlowPhases());
+//
+// addOutPhases(serverConfig.getOutFlowPhases());
+// addOutPhases(serverConfig.getOutFaultFlowPhases());
///////////////////////////////////////////////////////////////////////
// Set up raw message receivers for OMElement based tests
Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java
URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java?view=diff&rev=542835&r1=542834&r2=542835
==============================================================================
---
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java
(original)
+++
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java
Wed May 30 08:09:49 2007
@@ -83,6 +83,14 @@
public void populateModule() throws DeploymentException {
try {
OMElement moduleElement = buildOM();
+
+ OMAttribute nameAtt = moduleElement.getAttribute(new
QName("name"));
+ if (nameAtt != null) {
+ String moduleName = nameAtt.getAttributeValue();
+ if (moduleName != null && !"".equals(moduleName))
+ module.setName(moduleName);
+ }
+
// Setting Module Class , if it is there
OMAttribute moduleClassAtt = moduleElement.getAttribute(new
QName(TAG_CLASS_NAME));
Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java?view=diff&rev=542835&r1=542834&r2=542835
==============================================================================
---
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
(original)
+++
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
Wed May 30 08:09:49 2007
@@ -20,6 +20,8 @@
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
import org.apache.axis2.deployment.repository.util.WSInfoList;
import org.apache.axis2.util.Loader;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import java.io.File;
import java.io.OutputStreamWriter;
@@ -27,19 +29,19 @@
import java.net.URL;
import java.net.URLClassLoader;
import java.net.URLDecoder;
+import java.net.URI;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Enumeration;
public class RepositoryListener implements DeploymentConstants {
+ protected static final Log log =
LogFactory.getLog(RepositoryListener.class);
+
static String defaultEncoding = new
OutputStreamWriter(System.out).getEncoding();
protected DeploymentEngine deploymentEngine;
private HashMap directoryToExtensionMappingMap;
- /**
- * The parent directory of the modules and services directories
- */
-
/** Reference to a WSInfoList */
protected WSInfoList wsInfoList;
@@ -100,6 +102,32 @@
}
protected void loadClassPathModules() {
+ ModuleDeployer deployer = deploymentEngine.getModuleDeployer();
+
+ /* WORKING (Glen)
+ // Find Modules on the class path (i.e. if classpath includes
"addressing.mar" then
+ // addressing will be available for engaging)
+
+ // TODO: Confirm correct class loader
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try {
+ Enumeration moduleURLs =
loader.getResources("META-INF/module.xml");
+ while (moduleURLs.hasMoreElements()) {
+ URL url = (URL)moduleURLs.nextElement();
+ String fileName = url.toString();
+ fileName = fileName.substring(0,
fileName.lastIndexOf("/META-INF/module.xml"));
+ System.out.println(fileName);
+ File f = new File(new URI(fileName));
+ System.out.println(f.getAbsolutePath());
+ addFileToDeploy(f, deployer);
+ }
+ } catch (Exception e) {
+ // Oh well, log the problem
+ log.error(e);
+ }
+
+ */
+
String classPath = getLocation();
if (classPath == null) return;
@@ -118,7 +146,7 @@
if (!file.isDirectory()) {
if
(DeploymentFileData.isModuleArchiveFile(file.getName())) {
//adding modules in the class path
- addFileToDeploy(file,
deploymentEngine.getModuleDeployer());
+ addFileToDeploy(file, deployer);
}
}
}
@@ -143,7 +171,7 @@
if (file.isFile()) {
if
(DeploymentFileData.isModuleArchiveFile(file.getName())) {
//adding modules in the class path
- addFileToDeploy(file,
deploymentEngine.getModuleDeployer());
+ addFileToDeploy(file, deployer);
}
}
}
@@ -280,7 +308,6 @@
}
public void updateRemote() throws Exception {
-
findServicesInDirectory();
update();
}
Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java?view=diff&rev=542835&r1=542834&r2=542835
==============================================================================
---
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
(original)
+++
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
Wed May 30 08:09:49 2007
@@ -312,7 +312,7 @@
OMNamespace documentElementNS =
((OMElement) XMLUtils.toOM(in)).getNamespace();
if (documentElementNS != null) {
- WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder
= null;
+ WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder;
if (WSDL2Constants.WSDL_NAMESPACE
.equals(documentElementNS.getNamespaceURI())) {
// we have a WSDL 2.0 document here.
@@ -397,7 +397,7 @@
File file1 = files[i];
if (file1.getName().toLowerCase().endsWith(SUFFIX_WSDL)) {
InputStream in = new FileInputStream(file1);
- FileInputStream in2 = null;
+ FileInputStream in2;
// now the question is which version of WSDL file this archive
contains.
// lets check the namespace of the root element and decide.
But since we are
@@ -405,7 +405,7 @@
// whole thing.
OMNamespace documentElementNS = ((OMElement)
XMLUtils.toOM(in)).getNamespace();
if (documentElementNS != null) {
- WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder = null;
+ WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder;
if (WSDL2Constants.WSDL_NAMESPACE
.equals(documentElementNS.getNamespaceURI())) {
// we have a WSDL 2.0 document here.
@@ -423,9 +423,7 @@
AxisService service =
processWSDLFile(wsdlToAxisServiceBuilder, file1, false,
in2,
file1.toURI().toString());
try {
- if (in2 != null) {
- in2.close();
- }
+ in2.close();
in3.close();
} catch (IOException e) {
log.info(e);
Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?view=diff&rev=542835&r1=542834&r2=542835
==============================================================================
---
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
(original)
+++
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
Wed May 30 08:09:49 2007
@@ -190,16 +190,39 @@
return getClassLoader(parent, new File(path));
}
+ /**
+ * Get a ClassLoader which contains a classpath of a) the passed directory
and b) any jar
+ * files inside the "lib/" or "Lib/" subdirectory of the passed directory.
+ *
+ * @param parent parent ClassLoader which will be the parent of the result
of this method
+ * @param file a File which must be a directory for this to be useful
+ * @return a new ClassLoader pointing to both the passed dir and jar files
under lib/
+ * @throws DeploymentException if problems occur
+ */
public static ClassLoader getClassLoader(ClassLoader parent, File file)
throws DeploymentException {
URLClassLoader classLoader;
- if (file != null) {
- try {
- ArrayList urls = new ArrayList();
- urls.add(file.toURL());
- // lower case directory name
- File libfiles = new File(file, "lib");
+ if (file == null) return null; // Shouldn't this just return the
parent?
+
+ try {
+ ArrayList urls = new ArrayList();
+ urls.add(file.toURL());
+
+ // lower case directory name
+ File libfiles = new File(file, "lib");
+ if (libfiles.exists()) {
+ urls.add(libfiles.toURL());
+ File jarfiles[] = libfiles.listFiles();
+ for (int i = 0; i < jarfiles.length; i++) {
+ File jarfile = jarfiles[i];
+ if (jarfile.getName().endsWith(".jar")) {
+ urls.add(jarfile.toURL());
+ }
+ }
+ } else {
+ // upper case directory name
+ libfiles = new File(file, "Lib");
if (libfiles.exists()) {
urls.add(libfiles.toURL());
File jarfiles[] = libfiles.listFiles();
@@ -209,33 +232,18 @@
urls.add(jarfile.toURL());
}
}
- } else {
- // upper case directory name
- libfiles = new File(file, "Lib");
- if (libfiles.exists()) {
- urls.add(libfiles.toURL());
- File jarfiles[] = libfiles.listFiles();
- for (int i = 0; i < jarfiles.length; i++) {
- File jarfile = jarfiles[i];
- if (jarfile.getName().endsWith(".jar")) {
- urls.add(jarfile.toURL());
- }
- }
- }
}
+ }
- URL urllist[] = new URL[urls.size()];
- for (int i = 0; i < urls.size(); i++) {
- urllist[i] = (URL) urls.get(i);
- }
- classLoader = new URLClassLoader(urllist, parent);
- return classLoader;
- } catch (MalformedURLException e) {
- throw new DeploymentException(e);
+ URL urllist[] = new URL[urls.size()];
+ for (int i = 0; i < urls.size(); i++) {
+ urllist[i] = (URL) urls.get(i);
}
+ classLoader = new URLClassLoader(urllist, parent);
+ return classLoader;
+ } catch (MalformedURLException e) {
+ throw new DeploymentException(e);
}
-
- return null;
}
private static Class getHandlerClass(String className, ClassLoader
loader1) throws AxisFault {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]