You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/12/17 22:34:13 UTC
svn commit: r1818518 [16/30] - in /axis/axis2/java/core/branches/AXIS2-4091:
./ apidocs/ databinding-tests/ etc/ legal/ modules/adb-codegen/
modules/adb-codegen/src/org/apache/axis2/schema/
modules/adb-codegen/src/org/apache/axis2/schema/template/ modu...
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java Sun Dec 17 22:34:08 2017
@@ -95,7 +95,7 @@ public class AxisConfigBuilder extends D
}
// processing Parameters
// Processing service level parameters
- Iterator itr = config_element.getChildrenWithName(new QName(TAG_PARAMETER));
+ Iterator<OMElement> itr = config_element.getChildrenWithName(new QName(TAG_PARAMETER));
processParameters(itr, axisConfig, axisConfig);
@@ -111,19 +111,19 @@ public class AxisConfigBuilder extends D
}
}
// Process Module refs
- Iterator moduleitr =
+ Iterator<OMElement> moduleitr =
config_element.getChildrenWithName(new QName(DeploymentConstants.TAG_MODULE));
processModuleRefs(moduleitr, axisConfig);
// Processing Transport Senders
- Iterator trs_senders =
+ Iterator<OMElement> trs_senders =
config_element.getChildrenWithName(new QName(TAG_TRANSPORT_SENDER));
processTransportSenders(trs_senders);
// Processing Transport Receivers
- Iterator trs_Reivers =
+ Iterator<OMElement> trs_Reivers =
config_element.getChildrenWithName(new QName(TAG_TRANSPORT_RECEIVER));
processTransportReceivers(trs_Reivers);
@@ -139,22 +139,22 @@ public class AxisConfigBuilder extends D
processThreadContextMigrators(axisConfig, threadContextMigrators);
// Process Observers
- Iterator obs_ittr = config_element.getChildrenWithName(new QName(TAG_LISTENER));
+ Iterator<OMElement> obs_ittr = config_element.getChildrenWithName(new QName(TAG_LISTENER));
processObservers(obs_ittr);
// Processing Phase orders
- Iterator phaseorders = config_element.getChildrenWithName(new QName(TAG_PHASE_ORDER));
+ Iterator<OMElement> phaseorders = config_element.getChildrenWithName(new QName(TAG_PHASE_ORDER));
processPhaseOrders(phaseorders);
- Iterator moduleConfigs =
+ Iterator<OMElement> moduleConfigs =
config_element.getChildrenWithName(new QName(TAG_MODULE_CONFIG));
processModuleConfig(moduleConfigs, axisConfig, axisConfig);
// processing <wsp:Policy> .. </..> elements
- Iterator policyElements = PolicyUtil.getPolicyChildren(config_element);
+ Iterator<OMElement> policyElements = PolicyUtil.getPolicyChildren(config_element);
if (policyElements != null && policyElements.hasNext()) {
processPolicyElements(policyElements,
@@ -162,7 +162,7 @@ public class AxisConfigBuilder extends D
}
// processing <wsp:PolicyReference> .. </..> elements
- Iterator policyRefElements = PolicyUtil.getPolicyRefChildren(config_element);
+ Iterator<OMElement> policyRefElements = PolicyUtil.getPolicyRefChildren(config_element);
if (policyRefElements != null && policyRefElements.hasNext()) {
processPolicyRefElements(policyElements,
@@ -187,7 +187,7 @@ public class AxisConfigBuilder extends D
OMElement transactionElement = config_element.getFirstChildWithName(new QName(TAG_TRANSACTION));
if (transactionElement != null) {
ParameterInclude transactionParameters = new ParameterIncludeImpl();
- Iterator parameters = transactionElement.getChildrenWithName(new QName(TAG_PARAMETER));
+ Iterator<OMElement> parameters = transactionElement.getChildrenWithName(new QName(TAG_PARAMETER));
processParameters(parameters, transactionParameters, null);
TransactionConfiguration txcfg = null;
@@ -270,7 +270,7 @@ public class AxisConfigBuilder extends D
}
}
//Processing deployers.
- Iterator deployerItr = config_element.getChildrenWithName(new QName(DEPLOYER));
+ Iterator<OMElement> deployerItr = config_element.getChildrenWithName(new QName(DEPLOYER));
if (deployerItr != null) {
processDeployers(deployerItr);
}
@@ -290,9 +290,9 @@ public class AxisConfigBuilder extends D
private void processTargetResolvers(AxisConfiguration axisConfig, OMElement targetResolvers) {
if (targetResolvers != null) {
- Iterator iterator = targetResolvers.getChildrenWithName(new QName(TAG_TARGET_RESOLVER));
+ Iterator<OMElement> iterator = targetResolvers.getChildrenWithName(new QName(TAG_TARGET_RESOLVER));
while (iterator.hasNext()) {
- OMElement targetResolver = (OMElement) iterator.next();
+ OMElement targetResolver = iterator.next();
OMAttribute classNameAttribute =
targetResolver.getAttribute(new QName(TAG_CLASS_NAME));
String className = classNameAttribute.getAttributeValue();
@@ -313,9 +313,9 @@ public class AxisConfigBuilder extends D
private void processThreadContextMigrators(AxisConfiguration axisConfig, OMElement targetResolvers) {
if (targetResolvers != null) {
- Iterator iterator = targetResolvers.getChildrenWithName(new QName(TAG_THREAD_CONTEXT_MIGRATOR));
+ Iterator<OMElement> iterator = targetResolvers.getChildrenWithName(new QName(TAG_THREAD_CONTEXT_MIGRATOR));
while (iterator.hasNext()) {
- OMElement threadContextMigrator = (OMElement) iterator.next();
+ OMElement threadContextMigrator = iterator.next();
OMAttribute listIdAttribute =
threadContextMigrator.getAttribute(new QName(TAG_LIST_ID));
String listId = listIdAttribute.getAttributeValue();
@@ -358,9 +358,9 @@ public class AxisConfigBuilder extends D
if (soaproleconfigElement != null) {
final boolean isUltimateReceiever = JavaUtils.isTrue(soaproleconfigElement.getAttributeValue(new QName(Constants.SOAP_ROLE_IS_ULTIMATE_RECEIVER_ATTRIBUTE)), true);
ArrayList roles = new ArrayList();
- Iterator iterator = soaproleconfigElement.getChildrenWithName(new QName(Constants.SOAP_ROLE_ELEMENT));
+ Iterator<OMElement> iterator = soaproleconfigElement.getChildrenWithName(new QName(Constants.SOAP_ROLE_ELEMENT));
while (iterator.hasNext()) {
- OMElement roleElement = (OMElement) iterator.next();
+ OMElement roleElement = iterator.next();
roles.add(roleElement.getText());
}
final List unmodifiableRoles = Collections.unmodifiableList(roles);
@@ -421,9 +421,9 @@ public class AxisConfigBuilder extends D
deployer.setDirectory(directory);
deployer.setExtension(extension);
- for (Iterator<?> itr = element.getChildrenWithName(new QName(
+ for (Iterator<OMElement> itr = element.getChildrenWithName(new QName(
TAG_SERVICE_BUILDER_EXTENSION)); itr.hasNext();) {
- OMElement serviceBuilderEle = (OMElement) itr.next();
+ OMElement serviceBuilderEle = itr.next();
String serviceBuilderClass = serviceBuilderEle.getAttributeValue(new QName(
TAG_CLASS_NAME));
String serviceBuilderName = serviceBuilderEle.getAttributeValue(new QName(
@@ -476,7 +476,7 @@ public class AxisConfigBuilder extends D
String module = moduleName_att.getAttributeValue();
ModuleConfiguration moduleConfiguration =
new ModuleConfiguration(module, parent);
- Iterator parameters = moduleConfig.getChildrenWithName(new QName(TAG_PARAMETER));
+ Iterator<OMElement> parameters = moduleConfig.getChildrenWithName(new QName(TAG_PARAMETER));
processParameters(parameters, moduleConfiguration, parent);
config.addModuleConfig(moduleConfiguration);
@@ -527,7 +527,7 @@ public class AxisConfigBuilder extends D
observer = (AxisObserver) observerclass.newInstance();
// processing Parameters
// Processing service level parameters
- Iterator itr = observerelement.getChildrenWithName(new QName(TAG_PARAMETER));
+ Iterator<OMElement> itr = observerelement.getChildrenWithName(new QName(TAG_PARAMETER));
processParameters(itr, observer, axisConfig);
// initialization
try {
@@ -546,10 +546,10 @@ public class AxisConfigBuilder extends D
private ArrayList processPhaseList(OMElement phaseOrders) throws DeploymentException {
ArrayList phaselist = new ArrayList();
- Iterator phases = phaseOrders.getChildrenWithName(new QName(TAG_PHASE));
+ Iterator<OMElement> phases = phaseOrders.getChildrenWithName(new QName(TAG_PHASE));
while (phases.hasNext()) {
- OMElement phaseelement = (OMElement) phases.next();
+ OMElement phaseelement = phases.next();
String phaseName =
phaseelement.getAttribute(new QName(ATTRIBUTE_NAME)).getAttributeValue();
String phaseClass = phaseelement.getAttributeValue(new QName(TAG_CLASS_NAME));
@@ -564,10 +564,10 @@ public class AxisConfigBuilder extends D
phase.setName(phaseName);
- Iterator handlers = phaseelement.getChildrenWithName(new QName(TAG_HANDLER));
+ Iterator<OMElement> handlers = phaseelement.getChildrenWithName(new QName(TAG_HANDLER));
while (handlers.hasNext()) {
- OMElement omElement = (OMElement) handlers.next();
+ OMElement omElement = handlers.next();
HandlerDescription handler = processHandler(omElement, axisConfig, phaseName);
handler.getRules().setPhaseName(phaseName);
@@ -616,9 +616,9 @@ public class AxisConfigBuilder extends D
private void processDefaultModuleVersions(OMElement defaultVersions)
throws DeploymentException {
- Iterator moduleVersions = defaultVersions.getChildrenWithName(new QName(TAG_MODULE));
+ Iterator<OMElement> moduleVersions = defaultVersions.getChildrenWithName(new QName(TAG_MODULE));
while (moduleVersions.hasNext()) {
- OMElement omElement = (OMElement) moduleVersions.next();
+ OMElement omElement = moduleVersions.next();
String name = omElement.getAttributeValue(new QName(ATTRIBUTE_NAME));
if (name == null) {
throw new DeploymentException(Messages.getMessage("modulenamecannotbenull"));
@@ -670,7 +670,7 @@ public class AxisConfigBuilder extends D
}
}
try {
- Iterator itr = transport.getChildrenWithName(new QName(TAG_PARAMETER));
+ Iterator<OMElement> itr = transport.getChildrenWithName(new QName(TAG_PARAMETER));
processParameters(itr, transportIN, axisConfig);
// adding to axis2 config
axisConfig.addTransportIn(transportIN);
@@ -717,7 +717,7 @@ public class AxisConfigBuilder extends D
// process Parameters
// processing Parameters
// Processing service level parameters
- Iterator itr = transport.getChildrenWithName(new QName(TAG_PARAMETER));
+ Iterator<OMElement> itr = transport.getChildrenWithName(new QName(TAG_PARAMETER));
processParameters(itr, transportout, axisConfig);
// adding to axis2 config
@@ -760,11 +760,11 @@ public class AxisConfigBuilder extends D
axisConfig.addDataLocatorClassNames(DRConstants.GLOBAL_LEVEL,
className);
}
- Iterator iterator = dataLocatorElement.getChildrenWithName(new QName(
+ Iterator<OMElement> iterator = dataLocatorElement.getChildrenWithName(new QName(
DRConstants.DIALECT_LOCATOR_ELEMENT));
while (iterator.hasNext()) {
- OMElement locatorElement = (OMElement) iterator.next();
+ OMElement locatorElement = iterator.next();
OMAttribute dialect = locatorElement.getAttribute(new QName(
DRConstants.DIALECT_ATTRIBUTE));
OMAttribute dialectclass = locatorElement.getAttribute(new QName(
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java Sun Dec 17 22:34:08 2017
@@ -130,9 +130,9 @@ public class ClusterBuilder extends Desc
return;
}
- for (Iterator iter = lbEle.getChildrenWithName(new QName("applicationDomain"));
+ for (Iterator<OMElement> iter = lbEle.getChildrenWithName(new QName("applicationDomain"));
iter.hasNext();) {
- OMElement omElement = (OMElement) iter.next();
+ OMElement omElement = iter.next();
String domainName = omElement.getAttributeValue(new QName("name")).trim();
String handlerClass = omElement.getAttributeValue(new QName("agent")).trim();
String descAttrib = omElement.getAttributeValue(new QName("description"));
@@ -265,9 +265,9 @@ public class ClusterBuilder extends Desc
replicationEle.getFirstChildWithName(new QName(TAG_DEFAULTS));
if (defaultsEle != null) {
List<String> defaults = new ArrayList<String>();
- for (Iterator iter = defaultsEle.getChildrenWithName(new QName(TAG_EXCLUDE));
+ for (Iterator<OMElement> iter = defaultsEle.getChildrenWithName(new QName(TAG_EXCLUDE));
iter.hasNext();) {
- OMElement excludeEle = (OMElement) iter.next();
+ OMElement excludeEle = iter.next();
OMAttribute nameAtt = excludeEle.getAttribute(new QName(ATTRIBUTE_NAME));
defaults.add(nameAtt.getAttributeValue());
}
@@ -275,15 +275,15 @@ public class ClusterBuilder extends Desc
}
// Process specifics
- for (Iterator iter = replicationEle.getChildrenWithName(new QName(TAG_CONTEXT));
+ for (Iterator<OMElement> iter = replicationEle.getChildrenWithName(new QName(TAG_CONTEXT));
iter.hasNext();) {
- OMElement contextEle = (OMElement) iter.next();
+ OMElement contextEle = iter.next();
String ctxClassName =
contextEle.getAttribute(new QName(ATTRIBUTE_CLASS)).getAttributeValue();
List<String> excludes = new ArrayList<String>();
- for (Iterator iter2 = contextEle.getChildrenWithName(new QName(TAG_EXCLUDE));
+ for (Iterator<OMElement> iter2 = contextEle.getChildrenWithName(new QName(TAG_EXCLUDE));
iter2.hasNext();) {
- OMElement excludeEle = (OMElement) iter2.next();
+ OMElement excludeEle = iter2.next();
OMAttribute nameAtt = excludeEle.getAttribute(new QName(ATTRIBUTE_NAME));
excludes.add(nameAtt.getAttributeValue());
}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DeploymentClassLoader.java Sun Dec 17 22:34:08 2017
@@ -21,241 +21,30 @@ package org.apache.axis2.deployment;
import org.apache.axis2.classloader.BeanInfoCache;
import org.apache.axis2.classloader.BeanInfoCachingClassLoader;
-import org.apache.commons.io.IOUtils;
-import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLClassLoader;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
public class DeploymentClassLoader extends URLClassLoader implements BeanInfoCachingClassLoader {
- // List of URL's
- private URL[] urls = null;
-
- // List of jar files inside the jars in the original url
- private List embedded_jars;
-
private boolean isChildFirstClassLoading;
private final BeanInfoCache beanInfoCache = new BeanInfoCache();
/**
- * DeploymentClassLoader is extended from URLClassLoader. The constructor
- * does not override the super constructor, but takes in an addition list of
- * jar files inside /lib directory.
+ * Constructor.
*
* @param urls <code>URL</code>s
* @param parent parent classloader <code>ClassLoader</code>
*/
public DeploymentClassLoader(URL[] urls,
- List embedded_jars,
ClassLoader parent,
boolean isChildFirstClassLoading) {
super(urls, parent);
- this.urls = urls;
- this.embedded_jars = embedded_jars;
this.isChildFirstClassLoading = isChildFirstClassLoading;
}
- /**
- * Finds and loads the class with the specified name from the URL search
- * path. Any URLs referring to JAR files are loaded and opened as needed
- * until the class is found.
- *
- * @param name the name of the class
- * @return the resulting class
- * @exception ClassNotFoundException if the class could not be found
- */
- protected Class findClass(String name) throws ClassNotFoundException {
- Class clazz;
- try {
- clazz = super.findClass(name);
- } catch (ClassNotFoundException e) {
- byte raw[] = null;
- try {
- String completeFileName = name;
- /**
- * Replacing org.apache. -> org/apache/...
- */
- completeFileName = completeFileName.replace('.', '/').concat(".class");
- raw = getBytes(completeFileName);
- } catch (Exception ex) {
- // Fall through
- }
- if (raw == null) {
- throw new ClassNotFoundException("Class Not found : " + name);
- }
- clazz = defineClass(name, raw, 0, raw.length);
- }
- return clazz;
- }
-
-
- /**
- * Finds the resource with the specified name on the URL search path.
- *
- * @param resource the name of the resource
- * @return a <code>URL</code> for the resource, or <code>null</code>
- * if the resource could not be found.
- */
- public URL findResource(String resource) {
- URL url = super.findResource(resource);
- if (url == null) {
- for (int i = 0; embedded_jars != null && i < embedded_jars.size(); i++) {
- String libjar_name = (String) embedded_jars.get(i);
- try {
- InputStream in = getJarAsStream(libjar_name);
- ZipInputStream zin = new ZipInputStream(in);
- ZipEntry entry;
- String entryName;
- while ((entry = zin.getNextEntry()) != null) {
- entryName = entry.getName();
- if (entryName != null &&
- entryName.endsWith(resource)) {
- byte[] raw = IOUtils.toByteArray(zin);
- return new URL("jar", "", -1, urls[0] + "!/" + libjar_name + "!/" + entryName,
- new ByteUrlStreamHandler(raw));
- }
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
- return url;
- }
-
- /**
- * Returns an Enumeration of URLs representing all of the resources
- * on the URL search path having the specified name.
- *
- * @param resource the resource name
- * @exception IOException if an I/O exception occurs
- * @return an <code>Enumeration</code> of <code>URL</code>s
- */
- public Enumeration findResources(String resource) throws IOException {
- ArrayList resources = new ArrayList();
- Enumeration e = super.findResources(resource);
- while (e.hasMoreElements()) {
- resources.add(e.nextElement());
- }
- for (int i = 0; embedded_jars != null && i < embedded_jars.size(); i++) {
- String libjar_name = (String) embedded_jars.get(i);
- try {
- InputStream in = getJarAsStream(libjar_name);
- ZipInputStream zin = new ZipInputStream(in);
- ZipEntry entry;
- String entryName;
- while ((entry = zin.getNextEntry()) != null) {
- entryName = entry.getName();
- if (entryName != null &&
- entryName.endsWith(resource)) {
- byte[] raw = IOUtils.toByteArray(zin);
- resources.add(new URL("jar", "", -1, urls[0] + "!/" + libjar_name + "!/" + entryName,
- new ByteUrlStreamHandler(raw)));
- }
- }
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
- }
- return Collections.enumeration(resources);
- }
-
- /**
- * Access the jars file (/lib) one by one , then for each one create a <code>ZipInputStream</code>
- * and check to see whether there is any entry eith given name. if it is found then
- * return the byte array for that
- *
- * @param resource <code>String</code> Name of the file to be found
- * @return byte[]
- * @throws java.io.IOException <code>Exception</code>
- */
- private byte[] getBytes(String resource) throws Exception {
- for (int i = 0; embedded_jars != null && i < embedded_jars.size(); i++) {
- String libjar_name = (String) embedded_jars.get(i);
- InputStream in = getJarAsStream(libjar_name);
- byte[] bytes = getBytes(in, resource);
- if(bytes != null) {
- return bytes;
- }
- }
- return null;
- }
-
- /**
- * Get a specific entry's content as a byte array
- *
- * @param in
- * @param resource
- * @return
- * @throws Exception
- */
- private byte[] getBytes(InputStream in, String resource) throws Exception {
- ZipInputStream zin = new ZipInputStream(in);
- ZipEntry entry;
- String entryName;
- while ((entry = zin.getNextEntry()) != null) {
- entryName = entry.getName();
- if (entryName != null &&
- entryName.endsWith(resource)) {
- byte[] raw = IOUtils.toByteArray(zin);
- zin.close();
- return raw;
- }
- }
- return null;
- }
-
- /**
- * Get the specified embedded jar from the main jar
- *
- * @param libjar_name
- * @return
- * @throws Exception
- */
- private InputStream getJarAsStream(String libjar_name) throws Exception {
- return new ByteArrayInputStream(getBytes(urls[0].openStream(), libjar_name));
- }
-
- public static class ByteUrlStreamHandler extends URLStreamHandler {
- private byte[] bytes;
-
- public ByteUrlStreamHandler(byte[] bytes) {
- this.bytes = bytes;
- }
-
- protected URLConnection openConnection(URL u) throws IOException {
- return new ByteURLConnection(u, bytes);
- }
- }
-
- public static class ByteURLConnection extends URLConnection {
- protected byte[] bytes;
-
- public ByteURLConnection(URL url, byte[] bytes) {
- super(url);
- this.bytes = bytes;
- }
-
- public void connect() {
- }
-
- public InputStream getInputStream() {
- return new ByteArrayInputStream(bytes);
- }
- }
-
public InputStream getResourceAsStream(String name) {
URL url = findResource(name);
if(url == null) {
@@ -272,7 +61,7 @@ public class DeploymentClassLoader exten
}
protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
- Class c = null;
+ Class<?> c = null;
if (!isChildFirstClassLoading) {
c = super.loadClass(name, resolve);
} else {
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java Sun Dec 17 22:34:08 2017
@@ -95,7 +95,9 @@ public interface DeploymentConstants {
String TAG_EXTRACT_SERVICE_ARCHIVE = "extractServiceArchive";
String TAG_DISPATCH_ORDER = "dispatchOrder";
String TAG_DISPATCHER = "dispatcher";
- String TAG_DESCRIPTION = "Description";
+ String TAG_DESCRIPTION = "description";
+ // Alternate description tag; see AXIS2-5884
+ String TAG_DESCRIPTION_ALT = "Description";
String TAG_CLASS_NAME = "class";
String TAG_LIST_ID = "listId";
String TAG_EXCLUDE_PROPERTIES= "excludeProperties";
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java Sun Dec 17 22:34:08 2017
@@ -22,7 +22,6 @@ package org.apache.axis2.deployment;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
-import org.apache.axis2.classloader.JarFileClassLoader;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.deployment.repository.util.ArchiveReader;
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
@@ -800,11 +799,13 @@ public abstract class DeploymentEngine i
* @throws DeploymentException if there's a problem
*/
protected void setClassLoaders(String axis2repoURI) throws DeploymentException {
- ClassLoader sysClassLoader =
- Utils.getClassLoader(Thread.currentThread().getContextClassLoader(), axis2repoURI,
- axisConfig.isChildFirstClassLoading());
-
- axisConfig.setSystemClassLoader(sysClassLoader);
+ if (axisConfig.getSystemClassLoader() == null) {
+ ClassLoader sysClassLoader =
+ Utils.getClassLoader(Thread.currentThread().getContextClassLoader(), axis2repoURI,
+ axisConfig.isChildFirstClassLoading());
+
+ axisConfig.setSystemClassLoader(sysClassLoader);
+ }
if (servicesDir.exists()) {
axisConfig.setServiceClassLoader(
Utils.getClassLoader(axisConfig.getSystemClassLoader(), servicesDir,
@@ -1154,19 +1155,23 @@ public abstract class DeploymentEngine i
return (extensionMap != null) ? extensionMap.get(extension) : null;
}
+ private static void destroyClassLoader(ClassLoader classLoader) {
+ if (classLoader instanceof DeploymentClassLoader) {
+ try {
+ ((DeploymentClassLoader)classLoader).close();
+ } catch (IOException ex) {
+ log.warn("Failed to destroy class loader " + classLoader, ex);
+ }
+ }
+ }
+
/**
* Clean up the mess
*/
public void cleanup() {
- if (axisConfig.getModuleClassLoader() instanceof JarFileClassLoader) {
- ((JarFileClassLoader) axisConfig.getModuleClassLoader()).destroy();
- }
- if (axisConfig.getServiceClassLoader() instanceof JarFileClassLoader) {
- ((JarFileClassLoader) axisConfig.getServiceClassLoader()).destroy();
- }
- if (axisConfig.getSystemClassLoader() instanceof JarFileClassLoader) {
- ((JarFileClassLoader) axisConfig.getSystemClassLoader()).destroy();
- }
+ destroyClassLoader(axisConfig.getModuleClassLoader());
+ destroyClassLoader(axisConfig.getServiceClassLoader());
+ destroyClassLoader(axisConfig.getSystemClassLoader());
if (scheduler != null) {
scheduler.cleanup(schedulerTask);
}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java Sun Dec 17 22:34:08 2017
@@ -131,10 +131,10 @@ public class DescriptionBuilder implemen
protected HashMap<String,MessageReceiver> processMessageReceivers(OMElement messageReceivers)
throws DeploymentException {
HashMap<String,MessageReceiver> mr_mep = new HashMap<String,MessageReceiver>();
- Iterator msgReceivers = messageReceivers.getChildrenWithName(new QName(
+ Iterator<OMElement> msgReceivers = messageReceivers.getChildrenWithName(new QName(
TAG_MESSAGE_RECEIVER));
while (msgReceivers.hasNext()) {
- OMElement msgReceiver = (OMElement) msgReceivers.next();
+ OMElement msgReceiver = msgReceivers.next();
final OMElement tempMsgReceiver = msgReceiver;
MessageReceiver receiver = null;
try {
@@ -164,10 +164,10 @@ public class DescriptionBuilder implemen
protected HashMap<String,MessageReceiver> processMessageReceivers(ClassLoader loader,
OMElement element) throws DeploymentException {
HashMap<String,MessageReceiver> meps = new HashMap<String,MessageReceiver>();
- Iterator iterator = element.getChildrenWithName(new QName(
+ Iterator<OMElement> iterator = element.getChildrenWithName(new QName(
TAG_MESSAGE_RECEIVER));
while (iterator.hasNext()) {
- OMElement receiverElement = (OMElement) iterator.next();
+ OMElement receiverElement = iterator.next();
MessageReceiver receiver = loadMessageReceiver(loader,
receiverElement);
OMAttribute mepAtt = receiverElement
@@ -216,10 +216,10 @@ public class DescriptionBuilder implemen
protected HashMap processMessageBuilders(OMElement messageBuildersElement)
throws DeploymentException {
HashMap builderSelector = new HashMap();
- Iterator msgBuilders = messageBuildersElement
+ Iterator<OMElement> msgBuilders = messageBuildersElement
.getChildrenWithName(new QName(TAG_MESSAGE_BUILDER));
while (msgBuilders.hasNext()) {
- OMElement msgBuilderElement = (OMElement) msgBuilders.next();
+ OMElement msgBuilderElement = msgBuilders.next();
OMAttribute builderName = msgBuilderElement.getAttribute(new QName(TAG_CLASS_NAME));
String className = builderName.getAttributeValue();
Class builderClass = null;
@@ -254,10 +254,10 @@ public class DescriptionBuilder implemen
protected HashMap processMessageFormatters(OMElement messageFormattersElement)
throws DeploymentException {
HashMap messageFormatters = new HashMap();
- Iterator msgFormatters = messageFormattersElement
+ Iterator<OMElement> msgFormatters = messageFormattersElement
.getChildrenWithName(new QName(TAG_MESSAGE_FORMATTER));
while (msgFormatters.hasNext()) {
- OMElement msgFormatterElement = (OMElement) msgFormatters.next();
+ OMElement msgFormatterElement = msgFormatters.next();
OMElement tempMsgFormatter = msgFormatterElement;
OMAttribute formatterName = tempMsgFormatter.getAttribute(new QName(TAG_CLASS_NAME));
String className = formatterName.getAttributeValue();
@@ -327,11 +327,11 @@ public class DescriptionBuilder implemen
return flow;
}
- Iterator handlers = flowelement.getChildrenWithName(new QName(
+ Iterator<OMElement> handlers = flowelement.getChildrenWithName(new QName(
TAG_HANDLER));
while (handlers.hasNext()) {
- OMElement handlerElement = (OMElement) handlers.next();
+ OMElement handlerElement = handlers.next();
flow.addHandler(processHandler(handlerElement, parent));
}
@@ -459,7 +459,7 @@ public class DescriptionBuilder implemen
}
}
- Iterator parameters = handler_element
+ Iterator<OMElement> parameters = handler_element
.getChildrenWithName(new QName(TAG_PARAMETER));
try {
@@ -586,11 +586,11 @@ public class DescriptionBuilder implemen
*/
protected void processActionMappings(OMElement operation,
AxisOperation op_descrip) {
- Iterator mappingIterator = operation.getChildrenWithName(new QName(
+ Iterator<OMElement> mappingIterator = operation.getChildrenWithName(new QName(
Constants.ACTION_MAPPING));
ArrayList mappingList = new ArrayList();
while (mappingIterator.hasNext()) {
- OMElement mappingElement = (OMElement) mappingIterator.next();
+ OMElement mappingElement = mappingIterator.next();
String inputActionString = mappingElement.getText().trim();
if (log.isTraceEnabled()) {
log.trace("Input Action Mapping found: " + inputActionString);
@@ -614,10 +614,10 @@ public class DescriptionBuilder implemen
}
op_descrip.setOutputAction(outputActionString);
}
- Iterator faultActionsIterator = operation
+ Iterator<OMElement> faultActionsIterator = operation
.getChildrenWithName(new QName(Constants.FAULT_ACTION_MAPPING));
while (faultActionsIterator.hasNext()) {
- OMElement faultMappingElement = (OMElement) faultActionsIterator
+ OMElement faultMappingElement = faultActionsIterator
.next();
String faultActionString = faultMappingElement.getText().trim();
String faultActionName = faultMappingElement
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java Sun Dec 17 22:34:08 2017
@@ -105,7 +105,7 @@ public class ModuleBuilder extends Descr
OMAttribute moduleClassAtt = moduleElement.getAttribute(new QName(TAG_CLASS_NAME));
// processing Parameters
// Processing service level parameters
- Iterator<?> itr = moduleElement.getChildrenWithName(new QName(TAG_PARAMETER));
+ Iterator<OMElement> itr = moduleElement.getChildrenWithName(new QName(TAG_PARAMETER));
processParameters(itr, module, module.getParent());
@@ -148,7 +148,9 @@ public class ModuleBuilder extends Descr
// Process service description
OMElement descriptionElement =
moduleElement.getFirstChildWithName(new QName(TAG_DESCRIPTION));
-
+ if (descriptionElement == null) {
+ descriptionElement = moduleElement.getFirstChildWithName(new QName(TAG_DESCRIPTION_ALT));
+ }
if (descriptionElement != null) {
OMElement descriptionValue = descriptionElement.getFirstElement();
@@ -222,7 +224,7 @@ public class ModuleBuilder extends Descr
}
// processing Operations
- Iterator<?> op_itr = moduleElement.getChildrenWithName(new QName(TAG_OPERATION));
+ Iterator<OMElement> op_itr = moduleElement.getChildrenWithName(new QName(TAG_OPERATION));
List<AxisOperation> operations = processOperations(op_itr);
for (AxisOperation op : operations) {
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java Sun Dec 17 22:34:08 2017
@@ -197,21 +197,14 @@ public class ModuleDeployer extends Abst
}
try {
- ClassLoader deploymentClassLoader = Utils.createClassLoader(new URL[] { fileUrl },
- axisConfig.getModuleClassLoader(), true,
+ ClassLoader deploymentClassLoader = Utils.createClassLoader(fileUrl, null,
+ axisConfig.getModuleClassLoader(),
(File) axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR),
axisConfig.isChildFirstClassLoading());
AxisModule module = new AxisModule();
module.setModuleClassLoader(deploymentClassLoader);
module.setParent(axisConfig);
- int index = fileUrl.getPath().lastIndexOf(File.separator);
- String moduleFile;
- if(index > 0){
- moduleFile = fileUrl.getPath().substring(index);
- } else {
- moduleFile = fileUrl.getPath();
- }
- module.setArchiveName(moduleFile);
+ module.setArchiveName(DescriptionBuilder.getShortFileName(deploymentFileData.getName()));
populateModule(module, fileUrl);
module.setFileName(fileUrl);
DeploymentEngine.addNewModule(module, axisConfig);
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java Sun Dec 17 22:34:08 2017
@@ -105,17 +105,16 @@ public class POJODeployer extends Abstra
List<String> classList = Utils.getListOfClasses(deploymentFileData);
ArrayList<AxisService> axisServiceList = new ArrayList<AxisService>();
for (String className : classList) {
- ArrayList<URL> urls = new ArrayList<URL>();
- urls.add(deploymentFileData.getFile().toURI().toURL());
- urls.add(configCtx.getAxisConfiguration().getRepository());
+ List<URL> extraUrls = new ArrayList<>();
+ extraUrls.add(configCtx.getAxisConfiguration().getRepository());
String webLocation = DeploymentEngine.getWebLocationString();
if (webLocation != null) {
- urls.add(new File(webLocation).toURI().toURL());
+ extraUrls.add(new File(webLocation).toURI().toURL());
}
ClassLoader classLoader = Utils.createClassLoader(
- urls,
+ deploymentFileData.getFile().toURI().toURL(),
+ extraUrls.toArray(new URL[extraUrls.size()]),
configCtx.getAxisConfiguration().getSystemClassLoader(),
- true,
(File)configCtx.getAxisConfiguration().
getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR),
configCtx.getAxisConfiguration().isChildFirstClassLoading());
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java Sun Dec 17 22:34:08 2017
@@ -167,7 +167,13 @@ public class RepositoryListener implemen
classPath = ".";
}
File root = new File(classPath);
- File[] files = root.listFiles();
+ File[] files;
+ try {
+ files = root.listFiles();
+ } catch (SecurityException ex) {
+ // Ignore
+ files = null;
+ }
if (files != null) {
for (int i = 0; i < files.length; i++) {
File file = files[i];