Merged latest changes from trunk.
diff --git a/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-bean.xsl b/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-bean.xsl
index 9f9d564..1dd0412 100644
--- a/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-bean.xsl
+++ b/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-bean.xsl
@@ -1458,7 +1458,7 @@
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
- xmlWriter.writeStartElement(namespace, localPart);
+ xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
} else {
if (namespace.length() == 0) {
prefix = "";
@@ -1477,11 +1477,14 @@
*/
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
- if (xmlWriter.getPrefix(namespace) == null) {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+ if (writerPrefix != null) {
+ xmlWriter.writeAttribute(writerPrefix, namespace,attName,attValue);
+ } else {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
+ xmlWriter.writeAttribute(prefix, namespace,attName,attValue);
}
- xmlWriter.writeAttribute(namespace,attName,attValue);
}
/**
@@ -1492,8 +1495,7 @@
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
} else {
- registerPrefix(xmlWriter, namespace);
- xmlWriter.writeAttribute(namespace,attName,attValue);
+ xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace), namespace,attName,attValue);
}
}
@@ -1520,7 +1522,7 @@
xmlWriter.writeAttribute(attName, attributeValue);
} else {
registerPrefix(xmlWriter, namespace);
- xmlWriter.writeAttribute(namespace, attName, attributeValue);
+ xmlWriter.writeAttribute(attributePrefix, namespace, attName, attributeValue);
}
}
/**
diff --git a/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl b/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl
index 22961a1..cf31d7e 100644
--- a/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl
+++ b/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl
@@ -1051,7 +1051,7 @@
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
- xmlWriter.writeStartElement(namespace, localPart);
+ xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
} else {
if (namespace.length() == 0) {
prefix = "";
@@ -1070,11 +1070,14 @@
*/
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
- if (xmlWriter.getPrefix(namespace) == null) {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+ if (writerPrefix != null) {
+ xmlWriter.writeAttribute(writerPrefix, namespace,attName,attValue);
+ } else {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
+ xmlWriter.writeAttribute(prefix, namespace,attName,attValue);
}
- xmlWriter.writeAttribute(namespace,attName,attValue);
}
/**
@@ -1085,8 +1088,7 @@
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
} else {
- registerPrefix(xmlWriter, namespace);
- xmlWriter.writeAttribute(namespace,attName,attValue);
+ xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace), namespace,attName,attValue);
}
}
diff --git a/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOutAsyncMessageReceiver.java b/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOutAsyncMessageReceiver.java
index d6616f8..c453724 100644
--- a/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOutAsyncMessageReceiver.java
+++ b/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOutAsyncMessageReceiver.java
@@ -31,7 +31,7 @@
import org.apache.axis2.description.Parameter;
import org.apache.axis2.description.WSDL2Constants;
import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
-import org.apache.axis2.receivers.AbstractInOutAsyncMessageReceiver;
+import org.apache.axis2.receivers.AbstractInMessageReceiver;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -39,7 +39,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-public class RPCInOutAsyncMessageReceiver extends AbstractInOutAsyncMessageReceiver {
+public class RPCInOutAsyncMessageReceiver extends AbstractInMessageReceiver {
private static Log log = LogFactory.getLog(RPCInOnlyMessageReceiver.class);
@@ -67,7 +67,7 @@
// get the implementation class for the Web Service
Object obj = getTheImplementationObject(inMessage);
- Class ImplClass = obj.getClass();
+ Class<?> ImplClass = obj.getClass();
AxisOperation op = inMessage.getOperationContext().getAxisOperation();
AxisService service = inMessage.getAxisService();
@@ -137,7 +137,7 @@
if (cause != null) {
msg = cause.getMessage();
}
- if (msg == null) {
+ if (msg == null && method != null) {
msg = "Exception occurred while trying to invoke service method " +
method.getName();
}
@@ -147,10 +147,20 @@
}
throw new AxisFault(msg);
} catch (Exception e) {
- String msg = "Exception occurred while trying to invoke service method " +
- method.getName();
- log.error(msg, e);
- throw new AxisFault(msg, e);
+ if(method != null){
+ String msg = "Exception occurred while trying to invoke service method " +
+ method.getName();
+ log.error(msg, e);
+ throw new AxisFault(msg, e);
+ }
+
}
}
+
+ @Override
+ protected void invokeBusinessLogic(MessageContext messageCtx) throws AxisFault {
+ messageCtx.setProperty(DO_ASYNC, Boolean.TRUE);
+ super.receive(messageCtx);
+
+ }
}
diff --git a/modules/corba/src/org/apache/axis2/corba/receivers/CorbaInOutAsyncMessageReceiver.java b/modules/corba/src/org/apache/axis2/corba/receivers/CorbaInOutAsyncMessageReceiver.java
deleted file mode 100644
index 968e3b8..0000000
--- a/modules/corba/src/org/apache/axis2/corba/receivers/CorbaInOutAsyncMessageReceiver.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.corba.receivers;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.corba.deployer.CorbaConstants;
-import org.apache.axis2.corba.deployer.SchemaToIDLMapping;
-import org.apache.axis2.corba.exceptions.CorbaInvocationException;
-import org.apache.axis2.corba.idl.types.IDL;
-import org.apache.axis2.corba.idl.types.Member;
-import org.apache.axis2.description.AxisMessage;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.receivers.AbstractInOutAsyncMessageReceiver;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.omg.CORBA_2_3.ORB;
-
-import javax.xml.namespace.QName;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * This is takes care of the IN-OUT sync MEP in the server side
- *
- * @deprecated no longer needed, going away after 1.3
- */
-public class CorbaInOutAsyncMessageReceiver extends AbstractInOutAsyncMessageReceiver implements CorbaConstants {
-
- private static Log log = LogFactory.getLog(CorbaInOutAsyncMessageReceiver.class);
- private ORB orb = null;
- private Map invokerCache = new HashMap();
-
- public void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage) throws AxisFault {
- try{
- invoke(inMessage, outMessage);
- } catch (org.omg.CORBA.TRANSIENT e) {
- log.info("org.omg.CORBA.TRANSIENT exception thrown.");
- /*
- * If cannot connect to the corba server
- * try again after clearing the cache
- * (eg. if the Corba server is restarted)
- */
- invokerCache.clear();
- invoke(inMessage, outMessage);
- }
- }
-
- private void invoke(MessageContext inMessage, MessageContext outMessage) throws AxisFault {
- String methodName = null;
- try {
- AxisOperation op = inMessage.getOperationContext().getAxisOperation();
- AxisService service = inMessage.getAxisService();
- OMElement methodElement = inMessage.getEnvelope().getBody().getFirstElement();
-
- AxisMessage inAxisMessage = op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- String messageNameSpace = null;
- QName elementQName;
- methodName = op.getName().getLocalPart();
-
- Invoker invoker = (Invoker) invokerCache.get(methodName);
- if (invoker==null) {
- if (orb==null) {
- Parameter orbParam = service.getParameter(ORB_LITERAL);
- orb = orbParam != null ? (ORB) orbParam.getValue() : CorbaUtil.getORB(service);
- }
- org.omg.CORBA.Object obj = CorbaUtil.resolveObject(service, orb);
- Parameter idlParameter = service.getParameter(IDL_LITERAL);
- if (idlParameter==null)
- throw new CorbaInvocationException("IDL not found");
- IDL idl = (IDL) idlParameter.getValue();
- invoker = CorbaUtil.getInvoker(service, obj, idl, methodName);
- invokerCache.put(methodName, invoker);
- }
-
- Object resObject = null;
- Member[] params = null;
- Object[] outParamValues = null;
- if (inAxisMessage != null) {
- if (inAxisMessage.getElementQName()!=null) {
- elementQName = inAxisMessage.getElementQName();
- messageNameSpace = elementQName.getNamespaceURI();
- OMNamespace namespace = methodElement.getNamespace();
- if (messageNameSpace != null) {
- if (namespace == null || !messageNameSpace.equals(namespace.getNamespaceURI())) {
- throw new AxisFault("namespace mismatch require " +
- messageNameSpace +
- " found " + methodElement.getNamespace().getNamespaceURI());
- }
- } else if (namespace != null) {
- throw new AxisFault("namespace mismatch. Axis Oepration expects non-namespace " +
- "qualified element. But received a namespace qualified element");
- }
-
- SchemaToIDLMapping mapping = (SchemaToIDLMapping) service.getParameterValue(SCHEMA_TO_IDL_MAPPING_LITERAL);
- Object[] objectArray = CorbaUtil.extractParameters(methodElement, invoker.getParameterMembers(), mapping);
- invoker.setParameters(objectArray);
- params = invoker.getParameterMembers();
- outParamValues = invoker.getOutParameterValuess();
- }
- resObject = invoker.invoke();
- }
- SOAPFactory fac = getSOAPFactory(inMessage);
-
- AxisMessage outaxisMessage = op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
- if (messageNameSpace == null) {
- QName qname = outaxisMessage.getElementQName();
- if (qname != null) {
- messageNameSpace = qname.getNamespaceURI();
- }
- }
- // Handling the response
- CorbaUtil.processResponse(resObject, params, outParamValues, invoker.getReturnType(), service, methodName, fac,
- messageNameSpace, outMessage);
- } catch (CorbaInvocationException e) {
- String msg;
- Throwable cause = e.getCause();
- if (cause != null) {
- msg = cause.getMessage();
- if (msg == null) {
- msg = "Exception occurred while trying to invoke service method " + methodName;
- }
- //log.error(msg, e);
- if (cause instanceof AxisFault) {
- throw (AxisFault) cause;
- }
- } else {
- msg = e.getMessage();
- }
- throw new AxisFault(msg);
- }
- }
-}
diff --git a/modules/integration/test/org/apache/axis2/async/AsyncMessageReceiver.java b/modules/integration/test/org/apache/axis2/async/AsyncMessageReceiver.java
index 3748d90..ea551c6 100644
--- a/modules/integration/test/org/apache/axis2/async/AsyncMessageReceiver.java
+++ b/modules/integration/test/org/apache/axis2/async/AsyncMessageReceiver.java
@@ -27,11 +27,11 @@
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.receivers.AbstractInOutAsyncMessageReceiver;
+import org.apache.axis2.receivers.AbstractInOutMessageReceiver;
import java.lang.reflect.Method;
-public class AsyncMessageReceiver extends AbstractInOutAsyncMessageReceiver {
+public class AsyncMessageReceiver extends AbstractInOutMessageReceiver {
public void invokeBusinessLogic(MessageContext msgContext,
MessageContext newmsgContext) throws AxisFault {
@@ -40,13 +40,13 @@
Object obj = getTheImplementationObject(msgContext);
// find the WebService method
- Class ImplClass = obj.getClass();
+ Class<?> ImplClass = obj.getClass();
AxisOperation opDesc = msgContext.getOperationContext().getAxisOperation();
Method method = findOperation(opDesc, ImplClass);
if (method != null) {
- Class[] parameters = method.getParameterTypes();
+ Class<?>[] parameters = method.getParameterTypes();
Object[] args;
if ((parameters == null) || (parameters.length == 0)) {
@@ -84,7 +84,7 @@
}
}
- public Method findOperation(AxisOperation op, Class ImplClass) {
+ public Method findOperation(AxisOperation op, Class<?> ImplClass) {
Method method = null;
String methodName = op.getName().getLocalPart();
Method[] methods = ImplClass.getMethods();
diff --git a/modules/integration/test/org/apache/axis2/engine/EngineWithoutPhaseResolvingTest.java b/modules/integration/test/org/apache/axis2/engine/EngineWithoutPhaseResolvingTest.java
index c21092e..4bed0ae 100644
--- a/modules/integration/test/org/apache/axis2/engine/EngineWithoutPhaseResolvingTest.java
+++ b/modules/integration/test/org/apache/axis2/engine/EngineWithoutPhaseResolvingTest.java
@@ -22,7 +22,7 @@
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
+import org.apache.axis2.receivers.AbstractInOutMessageReceiver;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
@@ -104,7 +104,7 @@
AxisEngine.receive(mc);
}
- public class NullMessageReceiver extends AbstractInOutSyncMessageReceiver {
+ public class NullMessageReceiver extends AbstractInOutMessageReceiver {
public void invokeBusinessLogic(MessageContext inMessage,
MessageContext outMessage)
diff --git a/modules/integration/test/org/apache/axis2/engine/MessageWithServerTest.java b/modules/integration/test/org/apache/axis2/engine/MessageWithServerTest.java
index 6456e5f..9ddc657 100644
--- a/modules/integration/test/org/apache/axis2/engine/MessageWithServerTest.java
+++ b/modules/integration/test/org/apache/axis2/engine/MessageWithServerTest.java
@@ -23,6 +23,9 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.AxisModule;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
@@ -32,6 +35,7 @@
import org.apache.axis2.dispatchers.RequestURIBasedDispatcher;
import org.apache.axis2.dispatchers.SOAPActionBasedDispatcher;
import org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher;
+import org.apache.axis2.handlers.AbstractHandler;
import org.apache.axis2.integration.UtilServer;
import org.apache.axis2.integration.UtilServerBasedTestCase;
import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
@@ -156,4 +160,12 @@
rReader.close();
socket.close();
}
+
+ class InstanceDispatcher extends AbstractHandler {
+
+ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+ return InvocationResponse.CONTINUE;
+ }
+ }
+
}
diff --git a/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java b/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
index c16c04e..fe6eaec 100644
--- a/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
+++ b/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
@@ -20,7 +20,6 @@
package org.apache.axis2.deployment;
-import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.classloader.JarFileClassLoader;
@@ -28,8 +27,6 @@
import org.apache.axis2.deployment.repository.util.ArchiveReader;
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
import org.apache.axis2.deployment.repository.util.WSInfo;
-import org.apache.axis2.deployment.resolver.AARBasedWSDLLocator;
-import org.apache.axis2.deployment.resolver.AARFileBasedURIResolver;
import org.apache.axis2.deployment.scheduler.DeploymentIterator;
import org.apache.axis2.deployment.scheduler.Scheduler;
import org.apache.axis2.deployment.scheduler.SchedulerTask;
@@ -40,10 +37,7 @@
import org.apache.axis2.description.AxisServiceGroup;
import org.apache.axis2.description.Flow;
import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
-import org.apache.axis2.description.WSDL2Constants;
import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.MessageReceiver;
import org.apache.axis2.i18n.Messages;
import org.apache.axis2.util.FaultyServiceData;
import org.apache.axis2.util.JavaUtils;
@@ -105,12 +99,12 @@
/**
* Stores all the web Services to deploy.
*/
- protected List wsToDeploy = new ArrayList();
+ protected List<DeploymentFileData> wsToDeploy = new ArrayList<DeploymentFileData>();
/**
* Stores all the web Services to undeploy.
*/
- protected List wsToUnDeploy = new ArrayList();
+ protected List<WSInfo> wsToUnDeploy = new ArrayList<WSInfo>();
/**
* to keep a ref to engine register
@@ -205,7 +199,7 @@
URL servicesDir = new URL(repoURL, directory);
URL filelisturl = new URL(servicesDir, listName);
- ArrayList files = getFileList(filelisturl);
+ List<String> files = getFileList(filelisturl);
for (Object file : files) {
String fileName = (String) file;
String extension = getExtension(fileName);
@@ -216,7 +210,7 @@
URL servicesURL = new URL(servicesDir, fileName);
// We are calling reflection code here , to avoid changes to the interface
- Class classToLoad = deployer.getClass();
+ Class<?> classToLoad = deployer.getClass();
// We can not call classToLoad.getDeclaredMethed() , since there
// can be insatnce where mutiple services extends using one class
// just for init and other reflection methods
@@ -264,38 +258,27 @@
}
URL servicesDir = new URL(repoURL, path);
URL filelisturl = new URL(servicesDir, "services.list");
- ArrayList files = getFileList(filelisturl);
-
+ ArrayList<String> files = getFileList(filelisturl);
+ repoListener = new RepositoryListener(this, false);
for (Object file : files) {
String fileUrl = (String) file;
if (fileUrl.endsWith(".aar")) {
- AxisServiceGroup serviceGroup = new AxisServiceGroup();
URL servicesURL = new URL(servicesDir, fileUrl);
- ArrayList servicelist =
- populateService(serviceGroup,
- servicesURL,
- fileUrl.substring(0, fileUrl.indexOf(".aar")));
- addServiceGroup(serviceGroup, servicelist, servicesURL, null, axisConfig);
- // let the system have hidden services
- if (!JavaUtils.isTrueExplicitly(serviceGroup.getParameterValue(
- Constants.HIDDEN_SERVICE_PARAM_NAME))) {
- log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS,
- serviceGroup.getServiceGroupName(),
- servicesURL.toString()));
- }
+ repoListener.addURLToDeploy(servicesURL, getServiceDeployer(),
+ WSInfo.TYPE_SERVICE);
}
}
+ repoListener.update();
//Loading other type of services such as custom deployers
loadCustomServices(repoURL);
} catch (MalformedURLException e) {
log.error(e.getMessage(), e);
- } catch (IOException e) {
- log.error(e.getMessage(), e);
- }
+ }
}
public void loadRepositoryFromURL(URL repoURL) throws DeploymentException {
try {
+ setDeploymentFeatures();
String path = modulesPath == null ? DeploymentConstants.MODULE_PATH : modulesPath;
if (!path.endsWith("/")) {
path = path + "/";
@@ -307,34 +290,19 @@
}
URL moduleDir = new URL(repoURL, path);
URL filelisturl = new URL(moduleDir, "modules.list");
- ArrayList files = getFileList(filelisturl);
- Iterator fileIterator = files.iterator();
+ Iterator<String> fileIterator = getFileList(filelisturl).iterator();
+ axisConfig.setRepository(repoURL);
+ repoListener = new RepositoryListener(this, false);
while (fileIterator.hasNext()) {
String fileUrl = (String) fileIterator.next();
if (fileUrl.endsWith(".mar")) {
URL moduleurl = new URL(moduleDir, fileUrl);
- ClassLoader deploymentClassLoader =
- Utils.createClassLoader(
- new URL[]{moduleurl},
- axisConfig.getModuleClassLoader(),
- true,
- (File) axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR),
- axisConfig.isChildFirstClassLoading());
- AxisModule module = new AxisModule();
- module.setModuleClassLoader(deploymentClassLoader);
- module.setParent(axisConfig);
- String moduleFile = fileUrl.substring(0, fileUrl.indexOf(".mar"));
- module.setArchiveName(moduleFile);
- populateModule(module, moduleurl);
- module.setFileName(moduleurl);
- addNewModule(module, axisConfig);
- log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_MODULE,
- module.getArchiveName(),
- moduleurl.toString()));
+ repoListener.addURLToDeploy(moduleurl, getModuleDeployer(), WSInfo.TYPE_MODULE);
}
}
- org.apache.axis2.util.Utils.
- calculateDefaultModuleVersion(axisConfig.getModules(), axisConfig);
+ repoListener.update();
+ org.apache.axis2.util.Utils.calculateDefaultModuleVersion(axisConfig.getModules(),
+ axisConfig);
axisConfig.validateSystemPredefinedPhases();
} catch (MalformedURLException e) {
throw new DeploymentException(e);
@@ -343,202 +311,6 @@
}
}
- private void populateModule(AxisModule module, URL moduleUrl) throws DeploymentException {
- try {
- ClassLoader classLoader = module.getModuleClassLoader();
- InputStream moduleStream = classLoader.getResourceAsStream("META-INF/module.xml");
- if (moduleStream == null) {
- moduleStream = classLoader.getResourceAsStream("meta-inf/module.xml");
- }
- if (moduleStream == null) {
- throw new DeploymentException(
- Messages.getMessage(
- DeploymentErrorMsgs.MODULE_XML_MISSING, moduleUrl.toString()));
- }
- ModuleBuilder moduleBuilder = new ModuleBuilder(moduleStream, module, axisConfig);
- moduleBuilder.populateModule();
- } catch (IOException e) {
- throw new DeploymentException(e);
- }
- }
-
- protected ArrayList populateService(AxisServiceGroup serviceGroup,
- URL servicesURL,
- String serviceName) throws DeploymentException {
- try {
- serviceGroup.setServiceGroupName(serviceName);
- ClassLoader serviceClassLoader = Utils.createClassLoader(
- new URL[]{servicesURL},
- axisConfig.getServiceClassLoader(),
- true,
- (File) axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR),
- axisConfig.isChildFirstClassLoading());
- String metainf = "meta-inf";
- serviceGroup.setServiceGroupClassLoader(serviceClassLoader);
- //processing wsdl.list
- InputStream wsdlfilesStream =
- serviceClassLoader.getResourceAsStream("meta-inf/wsdl.list");
- if (wsdlfilesStream == null) {
- wsdlfilesStream = serviceClassLoader.getResourceAsStream("META-INF/wsdl.list");
- if (wsdlfilesStream != null) {
- metainf = "META-INF";
- }
- }
- HashMap servicesMap = new HashMap();
- if (wsdlfilesStream != null) {
- ArchiveReader reader = new ArchiveReader();
- BufferedReader input = new BufferedReader(new InputStreamReader(wsdlfilesStream));
- String line;
- while ((line = input.readLine()) != null) {
- line = line.trim();
- if (line.length() > 0 && line.charAt(0) != '#') {
- line = metainf + "/" + line;
- try {
- List services = reader.getAxisServiceFromWsdl(
- serviceClassLoader.getResourceAsStream(line),
- serviceClassLoader, line);
- if (services != null) {
- for (Object service : services) {
- AxisService axisService = (AxisService) service;
- servicesMap.put(axisService.getName(), axisService);
- }
- }
-
- } catch (Exception e) {
- throw new DeploymentException(e);
- }
- }
- }
- }
- InputStream servicexmlStream =
- serviceClassLoader.getResourceAsStream("META-INF/services.xml");
- if (servicexmlStream == null) {
- servicexmlStream = serviceClassLoader.getResourceAsStream("meta-inf/services.xml");
- } else {
- metainf = "META-INF";
- }
- if (servicexmlStream == null) {
- throw new DeploymentException(
- Messages.getMessage(DeploymentErrorMsgs.SERVICE_XML_NOT_FOUND,
- servicesURL.toString()));
- }
- DescriptionBuilder builder = new DescriptionBuilder(servicexmlStream, configContext);
- OMElement rootElement = builder.buildOM();
- String elementName = rootElement.getLocalName();
-
- if (TAG_SERVICE.equals(elementName)) {
- AxisService axisService = null;
- String wsdlLocation = "META-INF/service.wsdl";
- InputStream wsdlStream =
- serviceClassLoader.getResourceAsStream(wsdlLocation);
- URL wsdlURL = serviceClassLoader.getResource(metainf + "/service.wsdl");
- if (wsdlStream == null) {
- wsdlLocation = "META-INF/" + serviceName + ".wsdl";
- wsdlStream = serviceClassLoader
- .getResourceAsStream(wsdlLocation);
- wsdlURL = serviceClassLoader.getResource(wsdlLocation);
- }
- if (wsdlStream != null) {
- WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder =
- new WSDL11ToAxisServiceBuilder(wsdlStream, null, null);
- File file = Utils.toFile(servicesURL);
- if (file != null && file.exists()) {
- wsdl2AxisServiceBuilder.setCustomWSDLResolver(
- new AARBasedWSDLLocator(wsdlLocation, file, wsdlStream));
- wsdl2AxisServiceBuilder.setCustomResolver(
- new AARFileBasedURIResolver(file));
- }
- if (wsdlURL != null) {
- wsdl2AxisServiceBuilder.setDocumentBaseUri(wsdlURL.toString());
- }
- axisService = wsdl2AxisServiceBuilder.populateService();
- axisService.setWsdlFound(true);
- axisService.setCustomWsdl(true);
- axisService.setName(serviceName);
- }
- if (axisService == null) {
- axisService = new AxisService(serviceName);
- }
-
- axisService.setParent(serviceGroup);
- axisService.setClassLoader(serviceClassLoader);
-
- ServiceBuilder serviceBuilder = new ServiceBuilder(configContext, axisService);
- AxisService service = serviceBuilder.populateService(rootElement);
-
- ArrayList serviceList = new ArrayList();
- serviceList.add(service);
- return serviceList;
- } else if (TAG_SERVICE_GROUP.equals(elementName)) {
- ServiceGroupBuilder groupBuilder = new ServiceGroupBuilder(rootElement, servicesMap,
- configContext);
- ArrayList servicList = groupBuilder.populateServiceGroup(serviceGroup);
- Iterator serviceIterator = servicList.iterator();
- while (serviceIterator.hasNext()) {
- AxisService axisService = (AxisService) serviceIterator.next();
- String wsdlLocation = "META-INF/service.wsdl";
- InputStream wsdlStream =
- serviceClassLoader.getResourceAsStream(wsdlLocation);
- URL wsdlURL = serviceClassLoader.getResource(wsdlLocation);
- if (wsdlStream == null) {
- wsdlLocation = "META-INF/" + serviceName + ".wsdl";
- wsdlStream = serviceClassLoader
- .getResourceAsStream(wsdlLocation);
- wsdlURL =
- serviceClassLoader.getResource(wsdlLocation);
- }
- if (wsdlStream != null) {
- WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder =
- new WSDL11ToAxisServiceBuilder(wsdlStream, axisService);
- File file = Utils.toFile(servicesURL);
- if (file != null && file.exists()) {
- wsdl2AxisServiceBuilder.setCustomWSDLResolver(
- new AARBasedWSDLLocator(wsdlLocation, file, wsdlStream));
- wsdl2AxisServiceBuilder.setCustomResolver(
- new AARFileBasedURIResolver(file));
- }
- if (wsdlURL != null) {
- wsdl2AxisServiceBuilder.setDocumentBaseUri(wsdlURL.toString());
- }
- axisService = wsdl2AxisServiceBuilder.populateService();
- axisService.setWsdlFound(true);
- axisService.setCustomWsdl(true);
- // Set the default message receiver for the operations that were
- // not listed in the services.xml
- Iterator operations = axisService.getOperations();
- while (operations.hasNext()) {
- AxisOperation operation = (AxisOperation) operations.next();
- if (operation.getMessageReceiver() == null) {
- operation.setMessageReceiver(loadDefaultMessageReceiver(
- operation.getMessageExchangePattern(), axisService));
- }
- }
- }
- }
- return servicList;
- }
- } catch (IOException e) {
- throw new DeploymentException(e);
- } catch (XMLStreamException e) {
- throw new DeploymentException(e);
- }
- return null;
- }
-
- protected MessageReceiver loadDefaultMessageReceiver(String mepURL, AxisService service) {
- MessageReceiver messageReceiver;
- if (mepURL == null) {
- mepURL = WSDL2Constants.MEP_URI_IN_OUT;
- }
- if (service != null) {
- messageReceiver = service.getMessageReceiver(mepURL);
- if (messageReceiver != null) {
- return messageReceiver;
- }
- }
- return axisConfig.getMessageReceiver(mepURL);
- }
-
public static void addNewModule(AxisModule modulemetadata,
AxisConfiguration axisConfiguration) throws AxisFault {
@@ -597,7 +369,7 @@
}
public static void addServiceGroup(AxisServiceGroup serviceGroup,
- ArrayList serviceList,
+ ArrayList<AxisService> serviceList,
URL serviceLocation,
DeploymentFileData currentDeploymentFile,
AxisConfiguration axisConfiguration) throws AxisFault {
@@ -642,14 +414,14 @@
* @throws AxisFault
*/
protected static boolean isServiceGroupReadyToDeploy(AxisServiceGroup serviceGroup,
- ArrayList serviceList,
+ ArrayList<AxisService> serviceList,
URL serviceLocation,
DeploymentFileData currentDeploymentFile,
AxisConfiguration axisConfig)
throws AxisFault {
synchronized (axisConfig.getFaultyServicesDuetoModules()) {
String moduleName;
- ArrayList groupModules = serviceGroup.getModuleRefs();
+ ArrayList<String> groupModules = serviceGroup.getModuleRefs();
for (Object groupModule : groupModules) {
moduleName = (String) groupModule;
AxisModule module = axisConfig.getModule(moduleName);
@@ -672,7 +444,7 @@
AxisService axisService = (AxisService) aServiceList;
// modules from <service>
- ArrayList list = axisService.getModules();
+ ArrayList<String> list = axisService.getModules();
for (Object aList : list) {
moduleName = (String) aList;
@@ -692,9 +464,9 @@
}
}
- for (Iterator iterator = axisService.getOperations(); iterator.hasNext();) {
+ for (Iterator<AxisOperation> iterator = axisService.getOperations(); iterator.hasNext();) {
AxisOperation opDesc = (AxisOperation) iterator.next();
- ArrayList modules = opDesc.getModuleRefs();
+ ArrayList<String> modules = opDesc.getModuleRefs();
for (Object module1 : modules) {
moduleName = (String) module1;
@@ -721,12 +493,12 @@
}
protected static void fillServiceGroup(AxisServiceGroup serviceGroup,
- ArrayList serviceList,
+ ArrayList<AxisService> serviceList,
URL serviceLocation,
AxisConfiguration axisConfig) throws AxisFault {
// serviceGroup.setParent(axisConfig);
// module from services.xml at serviceGroup level
- ArrayList groupModules = serviceGroup.getModuleRefs();
+ ArrayList<String> groupModules = serviceGroup.getModuleRefs();
serviceGroup.setParent(axisConfig);
for (Object groupModule : groupModules) {
String moduleName = (String) groupModule;
@@ -742,7 +514,7 @@
}
}
- Iterator services = serviceList.iterator();
+ Iterator<AxisService> services = serviceList.iterator();
while (services.hasNext()) {
AxisService axisService = (AxisService) services.next();
@@ -752,7 +524,7 @@
serviceGroup.addService(axisService);
// modules from <service>
- ArrayList list = axisService.getModules();
+ ArrayList<String> list = axisService.getModules();
for (Object aList : list) {
AxisModule module = axisConfig.getModule((String) aList);
@@ -768,9 +540,9 @@
axisService.engageModule(module);
}
- for (Iterator iterator = axisService.getOperations(); iterator.hasNext();) {
+ for (Iterator<AxisOperation> iterator = axisService.getOperations(); iterator.hasNext();) {
AxisOperation opDesc = (AxisOperation) iterator.next();
- ArrayList modules = opDesc.getModuleRefs();
+ ArrayList<String> modules = opDesc.getModuleRefs();
for (Object module1 : modules) {
String moduleName = (String) module1;
@@ -1118,8 +890,8 @@
}
}
- protected ArrayList getFileList(URL fileListUrl) {
- ArrayList fileList = new ArrayList();
+ protected ArrayList<String> getFileList(URL fileListUrl) {
+ ArrayList<String> fileList = new ArrayList<String>();
InputStream in;
try {
in = fileListUrl.openStream();
@@ -1278,7 +1050,7 @@
String serviceGroupName,
ConfigurationContext configCtx,
ArchiveReader archiveReader,
- HashMap wsdlServices) throws AxisFault {
+ HashMap<String, AxisService> wsdlServices) throws AxisFault {
DeploymentFileData currentDeploymentFile = new DeploymentFileData(null, null);
currentDeploymentFile.setClassLoader(classLoader);
AxisServiceGroup serviceGroup = new AxisServiceGroup();
@@ -1286,7 +1058,7 @@
serviceGroup.setServiceGroupName(serviceGroupName);
AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
try {
- ArrayList serviceList = archiveReader.buildServiceGroup(servicesxml,
+ ArrayList<AxisService> serviceList = archiveReader.buildServiceGroup(servicesxml,
currentDeploymentFile,
serviceGroup,
wsdlServices, configCtx);
@@ -1315,9 +1087,9 @@
AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
ArchiveReader archiveReader = new ArchiveReader();
- HashMap wsdlServices = archiveReader.processWSDLs(currentDeploymentFile);
+ HashMap<String, AxisService> wsdlServices = archiveReader.processWSDLs(currentDeploymentFile);
InputStream serviceXml = classLoader.getResourceAsStream("META-INF/services.xml");
- ArrayList serviceList = archiveReader.buildServiceGroup(serviceXml,
+ ArrayList<AxisService> serviceList = archiveReader.buildServiceGroup(serviceXml,
currentDeploymentFile,
serviceGroup,
wsdlServices, configCtx);
diff --git a/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java b/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java
index 1d44f8b..075a3c0 100644
--- a/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java
+++ b/modules/kernel/src/org/apache/axis2/deployment/ModuleDeployer.java
@@ -24,6 +24,7 @@
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.deployment.repository.util.ArchiveReader;
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
+import org.apache.axis2.deployment.util.Utils;
import org.apache.axis2.description.AxisModule;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.i18n.Messages;
@@ -31,11 +32,56 @@
import org.apache.commons.logging.LogFactory;
import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.MalformedURLException;
import java.net.URL;
+/**
+ * Standard Axis2 Module Deployer which use module.xml file to deploy
+ * Modules. ModuleDeployer can be used with Axis2 Module archive (.mar) or exploded
+ * directory structure. Some of the example formats given below.
+ *
+ * Examples :
+ *
+ * repository/modules/LogModule.mar/meta-inf/module.xml
+ * repository/modules/LogModule/meta-inf/module.xml
+ * WEB-INF/modules/LogModule.mar/meta-inf/module.xml
+ * WEB-INF/modules/LogModule/meta-inf/module.xml
+ *
+ * Further ServiceDeployer can be used to deploy Modules from a remote
+ * repository or within a JAR file. In this case module files accessed through URLs.
+ * To deploy Modules from a remote repository or JAR file it is expected to
+ * present modules/modules.list file which contains names of Modules.
+ *
+ * Examples : jar:file:/home/resources/repo.jar!/repo/modules/modules.list may contains following
+ * list of service.
+ *
+ * LogModule.mar
+ * Addressing.mar
+ *
+ * There are several approaches available to set repository URL to Axis2 run
+ * time. As an example one can provide repository URL as a init-param of
+ * AxisServlet. Some of the examples given below.
+ *
+ * Example -1 :
+ * <init-param>
+ * <param-name>axis2.repository.url</param-name>
+ * <param-value>http://localhost/repo/</param-value>
+ * </init-param>
+ *
+ * Example -2 :
+ * <init-param>
+ * <param-name>axis2.repository.url</param-name>
+ * <param-value>jar:file:/home/resources/repo.jar!/repo/</param-value> </init-param>
+ *
+ * NOTE - It is discouraged to use above modules.list based deployment approach
+ * because it does not support some of the important deployment features of Axis2 runtime.
+ *
+ */
+
public class ModuleDeployer extends AbstractDeployer {
private static final Log log = LogFactory.getLog(ModuleDeployer.class);
@@ -57,6 +103,11 @@
public void deploy(DeploymentFileData deploymentFileData) {
File deploymentFile = deploymentFileData.getFile();
+ // deploymentFile == null indicate this can be a URL, try to deploy using a URL.
+ if(deploymentFile == null){
+ deoloyFromUrl(deploymentFileData);
+ return;
+ }
boolean isDirectory = deploymentFile.isDirectory();
if (isDirectory && deploymentFileData.getName().startsWith(".")) { // Ignore special meta directories starting with .
return;
@@ -124,6 +175,71 @@
}
}
}
+
+ public void deoloyFromUrl(DeploymentFileData deploymentFileData) {
+ URL fileUrl = deploymentFileData.getUrl();
+ StringWriter errorWriter = new StringWriter();
+ String moduleStatus = "";
+ if (fileUrl == null) {
+ return;
+ }
+
+ try {
+ ClassLoader deploymentClassLoader = Utils.createClassLoader(new URL[] { fileUrl },
+ axisConfig.getModuleClassLoader(), true,
+ (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);
+ populateModule(module, fileUrl);
+ module.setFileName(fileUrl);
+ DeploymentEngine.addNewModule(module, axisConfig);
+ log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_MODULE, module.getArchiveName(),
+ fileUrl.toString()));
+
+ } catch (DeploymentException e) {
+ log.error(
+ Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
+ deploymentFileData.getName(), e.getMessage()), e);
+ PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+ e.printStackTrace(error_ptintWriter);
+ moduleStatus = "Error:\n" + errorWriter.toString();
+ } catch (AxisFault axisFault) {
+ log.error(
+ Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
+ deploymentFileData.getName(), axisFault.getMessage()), axisFault);
+ PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+ axisFault.printStackTrace(error_ptintWriter);
+ moduleStatus = "Error:\n" + errorWriter.toString();
+ } catch (Throwable t) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ t.printStackTrace(pw);
+ log.error(
+ Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
+ deploymentFileData.getName(), t.getMessage()), t);
+ PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+ t.printStackTrace(error_ptintWriter);
+ moduleStatus = "Error:\n" + errorWriter.toString();
+ } finally {
+ if (moduleStatus.startsWith("Error:")) {
+ axisConfig.getFaultyModules().put(
+ DeploymentEngine.getAxisServiceName(deploymentFileData.getName()),
+ moduleStatus);
+ }
+ }
+
+
+ }
public void setDirectory(String directory) {
}
@@ -134,4 +250,23 @@
public void undeploy(String fileName) throws DeploymentException {
super.undeploy(fileName);
}
+
+ private void populateModule(AxisModule module, URL moduleUrl) throws DeploymentException {
+ try {
+ ClassLoader classLoader = module.getModuleClassLoader();
+ InputStream moduleStream = classLoader.getResourceAsStream("META-INF/module.xml");
+ if (moduleStream == null) {
+ moduleStream = classLoader.getResourceAsStream("meta-inf/module.xml");
+ }
+ if (moduleStream == null) {
+ throw new DeploymentException(
+ Messages.getMessage(
+ DeploymentErrorMsgs.MODULE_XML_MISSING, moduleUrl.toString()));
+ }
+ ModuleBuilder moduleBuilder = new ModuleBuilder(moduleStream, module, axisConfig);
+ moduleBuilder.populateModule();
+ } catch (IOException e) {
+ throw new DeploymentException(e);
+ }
+ }
}
diff --git a/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java b/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
index 1cd3209..800d99a 100644
--- a/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
+++ b/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
@@ -74,7 +74,10 @@
/** Finds a list of modules in the folder and adds to wsInfoList. */
public void checkModules() {
File root = deploymentEngine.getModulesDir();
- File[] files = root.listFiles();
+ File[] files = null;
+ if(root != null){
+ files = root.listFiles();
+ }
if (files != null) {
for (int i = 0; i < files.length; i++) {
@@ -385,4 +388,8 @@
public void addFileToDeploy(File file, Deployer deployer, int type) {
wsInfoList.addWSInfoItem(file, deployer, type);
}
+
+ public void addURLToDeploy(URL url, Deployer deployer, int type) {
+ wsInfoList.addWSInfoItem(url, deployer, type);
+ }
}
diff --git a/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java b/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java
index ca4615b..8119929 100644
--- a/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java
+++ b/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java
@@ -19,29 +19,87 @@
package org.apache.axis2.deployment;
+import org.apache.axiom.om.OMElement;
+
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.deployment.repository.util.ArchiveReader;
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
+import org.apache.axis2.deployment.resolver.AARBasedWSDLLocator;
+import org.apache.axis2.deployment.resolver.AARFileBasedURIResolver;
import org.apache.axis2.deployment.util.Utils;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
+import org.apache.axis2.description.WSDL2Constants;
import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.MessageReceiver;
import org.apache.axis2.engine.ServiceLifeCycle;
import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.util.JavaUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import java.io.BufferedReader;
import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
+import javax.xml.stream.XMLStreamException;
+
+/**
+ * Standard Axis2 service Deployer which use services.xml file to build
+ * services. ServiceDeployer can be used with Axis2 archive (.aar) or exploded
+ * directory structure. Some of the example formats given below.
+ *
+ * Examples :
+ *
+ * repository/services/SimpleService.aar/meta-inf/services.xml
+ * repository/services/SimpleService/meta-inf/services.xml
+ * WEB-INF/services/SimpleService.aar/meta-inf/services.xml
+ * WEB-INF/services/SimpleService/meta-inf/services.xml
+ *
+ * Further ServiceDeployer can be used to deploy services from a remote
+ * repository or within a JAR file. In this case service files accessed through URLs.
+ * To deploy services from a remote repository or JAR file it is expected to
+ * present service/services.list file which contains names of services.
+ *
+ * Examples : jar:file:/home/resources/repo.jar!/repo/services/services.list may contains following
+ * list of service.
+ *
+ * StudentService.aar
+ * SimpleService.aar
+ *
+ * There are several approaches available to set repository URL to Axis2 run
+ * time. As an example one can provide repository URL as a init-param of
+ * AxisServlet. Some of the examples given below.
+ *
+ * Example -1 :
+ * <init-param>
+ * <param-name>axis2.repository.url</param-name>
+ * <param-value>http://localhost/repo/</param-value>
+ * </init-param>
+ *
+ * Example -2 :
+ * <init-param>
+ * <param-name>axis2.repository.url</param-name>
+ * <param-value>jar:file:/home/resources/repo.jar!/repo/</param-value> </init-param>
+ *
+ * NOTE - It is discouraged to use above services.list based deployment approach
+ * because it does not support hot-deployment, hot-update and some of other
+ * important deployment features as well.
+ *
+ */
public class ServiceDeployer extends AbstractDeployer {
private static final Log log = LogFactory.getLog(ServiceDeployer.class);
private AxisConfiguration axisConfig;
@@ -57,7 +115,13 @@
//Will process the file and add that to axisConfig
public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException {
- boolean isDirectory = deploymentFileData.getFile().isDirectory();
+ File deploymentFile = deploymentFileData.getFile();
+ if(deploymentFile == null){
+ //This can be a URL
+ deployFromUrl(deploymentFileData);
+ return;
+ }
+ boolean isDirectory = deploymentFile.isDirectory();
ArchiveReader archiveReader;
StringWriter errorWriter = new StringWriter();
archiveReader = new ArchiveReader();
@@ -166,6 +230,231 @@
}
}
}
+
+ public void deployFromUrl(DeploymentFileData deploymentFileData) throws DeploymentException {
+ URL servicesURL = deploymentFileData.getUrl();
+ if (servicesURL == null) {
+ return;
+ }
+ AxisServiceGroup serviceGroup = new AxisServiceGroup();
+ StringWriter errorWriter = new StringWriter();
+ int index = servicesURL.getPath().lastIndexOf(File.separator);
+ String serviceFile;
+ if(index > 0){
+ serviceFile = servicesURL.getPath().substring(index);
+ } else {
+ serviceFile = servicesURL.getPath();
+ }
+ ArrayList<AxisService> servicelist =
+ populateService(serviceGroup,
+ servicesURL,
+ serviceFile.substring(0, serviceFile.indexOf(".aar")));
+ try {
+ DeploymentEngine.addServiceGroup(serviceGroup, servicelist, servicesURL, null,
+ axisConfig);
+ // let the system have hidden services
+ if (!JavaUtils.isTrueExplicitly(serviceGroup.getParameterValue(
+ Constants.HIDDEN_SERVICE_PARAM_NAME))) {
+ log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS,
+ serviceGroup.getServiceGroupName(),
+ servicesURL.toString()));
+ }
+ } catch (AxisFault axisFault) {
+ log.error(
+ Messages.getMessage(DeploymentErrorMsgs.INVALID_SERVICE,
+ deploymentFileData.getName(), axisFault.getMessage()), axisFault);
+ PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
+ axisFault.printStackTrace(error_ptintWriter);
+ throw new DeploymentException(axisFault);
+ }
+
+
+ }
+
+ /*
+ * TODO - This need to be implemented to support
+ * DeploymentEngine#loadCustomServices method.
+ */
+ public void deployFromUrl(Deployer deployer, URL servicesURL) throws DeploymentException {
+ throw new DeploymentException(
+ "Not support for this operation - deployFromUrl(Deployer deployer, URL servicesURL)");
+ }
+
+
+
+ /*
+ * TODO - This method is used by deployFromUrl() method and this should be
+ * refactored to reduce code complexity.
+ */
+ protected ArrayList<AxisService> populateService(AxisServiceGroup serviceGroup,
+ URL servicesURL, String serviceName) throws DeploymentException {
+ try {
+ serviceGroup.setServiceGroupName(serviceName);
+ ClassLoader serviceClassLoader = Utils
+ .createClassLoader(new URL[] { servicesURL }, axisConfig
+ .getServiceClassLoader(), true, (File) axisConfig
+ .getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR),
+ axisConfig.isChildFirstClassLoading());
+ String metainf = "meta-inf";
+ serviceGroup.setServiceGroupClassLoader(serviceClassLoader);
+ // processing wsdl.list
+ InputStream wsdlfilesStream = serviceClassLoader
+ .getResourceAsStream("meta-inf/wsdl.list");
+ if (wsdlfilesStream == null) {
+ wsdlfilesStream = serviceClassLoader.getResourceAsStream("META-INF/wsdl.list");
+ if (wsdlfilesStream != null) {
+ metainf = "META-INF";
+ }
+ }
+ HashMap<String, AxisService> servicesMap = new HashMap<String, AxisService>();
+ if (wsdlfilesStream != null) {
+ ArchiveReader reader = new ArchiveReader();
+ BufferedReader input = new BufferedReader(new InputStreamReader(wsdlfilesStream));
+ String line;
+ while ((line = input.readLine()) != null) {
+ line = line.trim();
+ if (line.length() > 0 && line.charAt(0) != '#') {
+ line = metainf + "/" + line;
+ try {
+ List<AxisService> services = reader.getAxisServiceFromWsdl(
+ serviceClassLoader.getResourceAsStream(line),
+ serviceClassLoader, line);
+ if (services != null) {
+ for (Object service : services) {
+ AxisService axisService = (AxisService) service;
+ servicesMap.put(axisService.getName(), axisService);
+ }
+ }
+
+ } catch (Exception e) {
+ throw new DeploymentException(e);
+ }
+ }
+ }
+ }
+ InputStream servicexmlStream = serviceClassLoader
+ .getResourceAsStream("META-INF/services.xml");
+ if (servicexmlStream == null) {
+ servicexmlStream = serviceClassLoader.getResourceAsStream("meta-inf/services.xml");
+ } else {
+ metainf = "META-INF";
+ }
+ if (servicexmlStream == null) {
+ throw new DeploymentException(Messages.getMessage(
+ DeploymentErrorMsgs.SERVICE_XML_NOT_FOUND, servicesURL.toString()));
+ }
+ DescriptionBuilder builder = new DescriptionBuilder(servicexmlStream, configCtx);
+ OMElement rootElement = builder.buildOM();
+ String elementName = rootElement.getLocalName();
+
+ if (DeploymentConstants.TAG_SERVICE.equals(elementName)) {
+ AxisService axisService = null;
+ String wsdlLocation = "META-INF/service.wsdl";
+ InputStream wsdlStream = serviceClassLoader.getResourceAsStream(wsdlLocation);
+ URL wsdlURL = serviceClassLoader.getResource(metainf + "/service.wsdl");
+ if (wsdlStream == null) {
+ wsdlLocation = "META-INF/" + serviceName + ".wsdl";
+ wsdlStream = serviceClassLoader.getResourceAsStream(wsdlLocation);
+ wsdlURL = serviceClassLoader.getResource(wsdlLocation);
+ }
+ if (wsdlStream != null) {
+ WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder = new WSDL11ToAxisServiceBuilder(
+ wsdlStream, null, null);
+ File file = Utils.toFile(servicesURL);
+ if (file != null && file.exists()) {
+ wsdl2AxisServiceBuilder.setCustomWSDLResolver(new AARBasedWSDLLocator(
+ wsdlLocation, file, wsdlStream));
+ wsdl2AxisServiceBuilder
+ .setCustomResolver(new AARFileBasedURIResolver(file));
+ }
+ if (wsdlURL != null) {
+ wsdl2AxisServiceBuilder.setDocumentBaseUri(wsdlURL.toString());
+ }
+ axisService = wsdl2AxisServiceBuilder.populateService();
+ axisService.setWsdlFound(true);
+ axisService.setCustomWsdl(true);
+ axisService.setName(serviceName);
+ }
+ if (axisService == null) {
+ axisService = new AxisService(serviceName);
+ }
+
+ axisService.setParent(serviceGroup);
+ axisService.setClassLoader(serviceClassLoader);
+
+ ServiceBuilder serviceBuilder = new ServiceBuilder(configCtx, axisService);
+ AxisService service = serviceBuilder.populateService(rootElement);
+
+ ArrayList<AxisService> serviceList = new ArrayList<AxisService>();
+ serviceList.add(service);
+ return serviceList;
+ } else if (DeploymentConstants.TAG_SERVICE_GROUP.equals(elementName)) {
+ ServiceGroupBuilder groupBuilder = new ServiceGroupBuilder(rootElement,
+ servicesMap, configCtx);
+ ArrayList<AxisService> servicList = groupBuilder.populateServiceGroup(serviceGroup);
+ Iterator<AxisService> serviceIterator = servicList.iterator();
+ while (serviceIterator.hasNext()) {
+ AxisService axisService = (AxisService) serviceIterator.next();
+ String wsdlLocation = "META-INF/service.wsdl";
+ InputStream wsdlStream = serviceClassLoader.getResourceAsStream(wsdlLocation);
+ URL wsdlURL = serviceClassLoader.getResource(wsdlLocation);
+ if (wsdlStream == null) {
+ wsdlLocation = "META-INF/" + serviceName + ".wsdl";
+ wsdlStream = serviceClassLoader.getResourceAsStream(wsdlLocation);
+ wsdlURL = serviceClassLoader.getResource(wsdlLocation);
+ }
+ if (wsdlStream != null) {
+ WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder = new WSDL11ToAxisServiceBuilder(
+ wsdlStream, axisService);
+ File file = Utils.toFile(servicesURL);
+ if (file != null && file.exists()) {
+ wsdl2AxisServiceBuilder.setCustomWSDLResolver(new AARBasedWSDLLocator(
+ wsdlLocation, file, wsdlStream));
+ wsdl2AxisServiceBuilder.setCustomResolver(new AARFileBasedURIResolver(
+ file));
+ }
+ if (wsdlURL != null) {
+ wsdl2AxisServiceBuilder.setDocumentBaseUri(wsdlURL.toString());
+ }
+ axisService = wsdl2AxisServiceBuilder.populateService();
+ axisService.setWsdlFound(true);
+ axisService.setCustomWsdl(true);
+ // Set the default message receiver for the operations
+ // that were
+ // not listed in the services.xml
+ Iterator<AxisOperation> operations = axisService.getOperations();
+ while (operations.hasNext()) {
+ AxisOperation operation = (AxisOperation) operations.next();
+ if (operation.getMessageReceiver() == null) {
+ operation.setMessageReceiver(loadDefaultMessageReceiver(
+ operation.getMessageExchangePattern(), axisService));
+ }
+ }
+ }
+ }
+ return servicList;
+ }
+ } catch (IOException e) {
+ throw new DeploymentException(e);
+ } catch (XMLStreamException e) {
+ throw new DeploymentException(e);
+ }
+ return null;
+ }
+
+ private MessageReceiver loadDefaultMessageReceiver(String mepURL, AxisService service) {
+ MessageReceiver messageReceiver;
+ if (mepURL == null) {
+ mepURL = WSDL2Constants.MEP_URI_IN_OUT;
+ }
+ if (service != null) {
+ messageReceiver = service.getMessageReceiver(mepURL);
+ if (messageReceiver != null) {
+ return messageReceiver;
+ }
+ }
+ return axisConfig.getMessageReceiver(mepURL);
+ }
public void setDirectory(String directory) {
this.directory = directory;
@@ -188,7 +477,7 @@
AxisServiceGroup serviceGroup = axisConfig.removeServiceGroup(fileName);
//Fixed - https://issues.apache.org/jira/browse/AXIS2-4610
if (serviceGroup != null) {
- for (Iterator services = serviceGroup.getServices(); services.hasNext();) {
+ for (Iterator<AxisService> services = serviceGroup.getServices(); services.hasNext();) {
AxisService axisService = (AxisService) services.next();
ServiceLifeCycle serviceLifeCycle = axisService.getServiceLifeCycle();
if (serviceLifeCycle != null) {
diff --git a/modules/kernel/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java b/modules/kernel/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java
index 4d55737..555e02a 100644
--- a/modules/kernel/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java
+++ b/modules/kernel/src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java
@@ -23,6 +23,7 @@
import org.apache.axis2.Constants;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.deployment.repository.util.ArchiveReader;
+import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.AxisServiceGroup;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.engine.AxisConfiguration;
@@ -311,7 +312,7 @@
InputStream servicexml = config.getServletContext().
getResourceAsStream("/WEB-INF/services.xml");
if (servicexml != null) {
- HashMap wsdlServices = new HashMap();
+ HashMap<String, AxisService> wsdlServices = new HashMap<String, AxisService>();
ArchiveReader archiveReader = new ArchiveReader();
String path = config.getServletContext().getRealPath("/WEB-INF");
if (path != null) {
diff --git a/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java b/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java
index fe5ebca..f92d364 100644
--- a/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java
+++ b/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java
@@ -38,6 +38,15 @@
private File file;
private ClassLoader classLoader;
private Deployer deployer;
+ private URL url;
+
+ public URL getUrl() {
+ return url;
+ }
+
+ public void setUrl(URL url) {
+ this.url = url;
+ }
public DeploymentFileData(File file) {
this.file = file;
@@ -45,7 +54,13 @@
public DeploymentFileData(File file, Deployer deployer) {
this(file);
+ this.deployer = deployer;
+ }
+
+ public DeploymentFileData(URL url, Deployer deployer, ClassLoader classLoader) {
this.deployer = deployer;
+ this.url = url;
+ this.classLoader = classLoader;
}
public String getAbsolutePath() {
diff --git a/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java b/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java
index 519e01f..e441ca1 100644
--- a/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java
+++ b/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java
@@ -25,6 +25,7 @@
import org.apache.axis2.deployment.DeploymentEngine;
import java.io.File;
+import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -83,6 +84,25 @@
jarList.add(info.getFileName());
}
+
+ public synchronized void addWSInfoItem(URL url, Deployer deployer, int type) {
+ // There is no way to set hot-update.
+ // Here file.getAbsolutePath() = info.getFileName()
+ WSInfo info = (WSInfo) currentJars.get(url.getPath());
+ if (info != null) {
+ if (deploymentEngine.isHotUpdate()) {
+ WSInfo wsInfo = new WSInfo(info.getFileName(), info.getLastModifiedDate(),
+ deployer, type);
+ deploymentEngine.addWSToUndeploy(wsInfo); // add entry to undeploy list
+ DeploymentFileData deploymentFileData = new DeploymentFileData(url, deployer, null);
+ deploymentEngine.addWSToDeploy(deploymentFileData); // add entry to deploylist
+ }
+ } else {
+ info = getFileItem(url, deployer, type);
+ }
+
+ jarList.add(info.getFileName());
+ }
/**
* Checks undeployed Services. Checks old jars files and current jars.
@@ -160,6 +180,21 @@
}
return info;
}
+
+ /**
+ * Gets the WSInfo object related to a file if it exists, null otherwise.
+ *
+ */
+ private WSInfo getFileItem(URL url, Deployer deployer, int type) {
+ WSInfo info = (WSInfo) currentJars.get(url.getPath());
+ if (info == null) {
+ info = new WSInfo(url.getPath(), 0, deployer, type);
+ currentJars.put(url.getPath(), info);
+ DeploymentFileData fileData = new DeploymentFileData(url, deployer, null);
+ deploymentEngine.addWSToDeploy(fileData);
+ }
+ return info;
+ }
/**
* Checks if a file has been modified by comparing the last update date of
diff --git a/modules/kernel/src/org/apache/axis2/engine/AddressingBasedDispatcher.java b/modules/kernel/src/org/apache/axis2/engine/AddressingBasedDispatcher.java
deleted file mode 100644
index c0aa16f..0000000
--- a/modules/kernel/src/org/apache/axis2/engine/AddressingBasedDispatcher.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.engine;
-
-/**
- * Dispatcher based on the WS-Addressing properties.
- * @deprecated use org.apache.axis2.dispatchers.AddressingBasedDispatcher
- */
-public class AddressingBasedDispatcher extends org.apache.axis2.dispatchers.AddressingBasedDispatcher {
-}
diff --git a/modules/kernel/src/org/apache/axis2/engine/HTTPLocationBasedDispatcher.java b/modules/kernel/src/org/apache/axis2/engine/HTTPLocationBasedDispatcher.java
deleted file mode 100644
index aac34fe..0000000
--- a/modules/kernel/src/org/apache/axis2/engine/HTTPLocationBasedDispatcher.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.axis2.engine;
-
-/**
- * Dispatches the operation based on the information from the target endpoint URL.
- *
- * @deprecated use org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher
- */
-public class HTTPLocationBasedDispatcher extends org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher {
-}
diff --git a/modules/kernel/src/org/apache/axis2/engine/InstanceDispatcher.java b/modules/kernel/src/org/apache/axis2/engine/InstanceDispatcher.java
deleted file mode 100644
index 4cf7a23..0000000
--- a/modules/kernel/src/org/apache/axis2/engine/InstanceDispatcher.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.axis2.engine;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.handlers.AbstractHandler;
-
-/**
- * By the time the control comes to this handler, the dispatching must have happened
- * so that the message context contains the AxisServiceGroup, AxisService and
- * AxisOperation.
- * This will then try to find the Contexts of ServiceGroup, Service and the Operation.
- * @deprecated The functionality of this class has moved into the DispatchPhase postconditions
- */
-public class InstanceDispatcher extends AbstractHandler {
-
- /**
- * This doesn't do anything, as the functionality is now in DispatchPhase.checkPostConditions()
- * The class remains for backwards compatibility of axis2.xml files, but it should go away after
- * 1.3.
- *
- * @param msgContext the <code>MessageContext</code> to process with this <code>Handler</code>.
- * @return An InvocationResponse that indicates what the next step in the message processing
- * should be.
- * @throws org.apache.axis2.AxisFault if the handler encounters an error
- */
- public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
- return InvocationResponse.CONTINUE;
- }
-}
diff --git a/modules/kernel/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java b/modules/kernel/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java
deleted file mode 100644
index 29a05a6..0000000
--- a/modules/kernel/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.engine;
-
-/**
- * Dispatches the service based on the information from the target endpoint URL.
- *
- * @deprecated use org.apache.axis2.dispatchers.RequestURIBasedDispatcher
- */
-public class RequestURIBasedDispatcher extends org.apache.axis2.dispatchers.RequestURIBasedDispatcher {
-}
diff --git a/modules/kernel/src/org/apache/axis2/engine/RequestURIOperationDispatcher.java b/modules/kernel/src/org/apache/axis2/engine/RequestURIOperationDispatcher.java
deleted file mode 100644
index 031dcf6..0000000
--- a/modules/kernel/src/org/apache/axis2/engine/RequestURIOperationDispatcher.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.engine;
-
-/**
- * Dispatches the operation based on the information from the target endpoint URL.
- *
- * @deprecated use org.apache.axis2.dispatchers.RequestURIOperationDispatcher
- */
-public class RequestURIOperationDispatcher extends org.apache.axis2.dispatchers.RequestURIOperationDispatcher {
-}
diff --git a/modules/kernel/src/org/apache/axis2/engine/SOAPActionBasedDispatcher.java b/modules/kernel/src/org/apache/axis2/engine/SOAPActionBasedDispatcher.java
deleted file mode 100644
index f446d94..0000000
--- a/modules/kernel/src/org/apache/axis2/engine/SOAPActionBasedDispatcher.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.engine;
-
-/**
- * Dispatches based on the SOAPAction.
- *
- * @deprecated use org.apache.axis2.dispatchers.SOAPActionBasedDispatcher
- */
-public class SOAPActionBasedDispatcher extends org.apache.axis2.dispatchers.SOAPActionBasedDispatcher {
-}
-
diff --git a/modules/kernel/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java b/modules/kernel/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java
deleted file mode 100644
index 9307c89..0000000
--- a/modules/kernel/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.axis2.engine;
-
-/**
- * Dispatches based on the namespace URI of the first child of
- * the body.
- *
- * @deprecated use org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher
- */
-public class SOAPMessageBodyBasedDispatcher extends org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher {
-}
diff --git a/modules/kernel/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java b/modules/kernel/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java
deleted file mode 100644
index 6fb94f2..0000000
--- a/modules/kernel/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.axis2.receivers;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.util.MessageContextBuilder;
-
-/**
- * This is the Absract IN-OUT MEP MessageReceiver. The
- * protected abstract methods are only for the sake of breaking down the logic
- *
- * @deprecated use AbstractInOutMessageReceiver
- */
-public abstract class AbstractInOutSyncMessageReceiver extends AbstractMessageReceiver {
- public abstract void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage)
- throws AxisFault;
-
- public final void invokeBusinessLogic(MessageContext msgContext) throws AxisFault {
- MessageContext outMsgContext = MessageContextBuilder.createOutMessageContext(msgContext);
- outMsgContext.getOperationContext().addMessageContext(outMsgContext);
-
- invokeBusinessLogic(msgContext, outMsgContext);
- replicateState(msgContext);
-
- AxisEngine.send(outMsgContext);
- }
-}
diff --git a/modules/kernel/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java b/modules/kernel/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java
deleted file mode 100644
index 897cd71..0000000
--- a/modules/kernel/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.axis2.receivers;
-
-/**
- * This is takes care of the IN-OUT sync MEP in the server side
- *
- * @deprecated not needed, since in-only MessageReceivers can throw faults
- */
-public abstract class AbstractRobustInMessageReceiver extends AbstractMessageReceiver{
-}
diff --git a/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutAsyncMessageReceiver.java b/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutAsyncMessageReceiver.java
deleted file mode 100644
index 6ff1768..0000000
--- a/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutAsyncMessageReceiver.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.receivers;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-
-/**
- * The RawXMLINOutAsyncMessageReceiver MessageReceiver hands over the raw request received to
- * the service implementation class as an OMElement. The implementation class is expected
- * to return back the OMElement to be returned to the caller. This is an asynchronous
- * MessageReceiver, and finds the service implementation class to invoke by referring to
- * the "ServiceClass" parameter value specified in the service.xml and looking at the
- * methods of the form OMElement <<methodName>>(OMElement request)
- *
- * @see RawXMLINOnlyMessageReceiver
- * @see RawXMLINOutMessageReceiver
- * @deprecated use RawXMLINOutMessageReceiver and the DO_ASYNC property instead....
- */
-public class RawXMLINOutAsyncMessageReceiver extends RawXMLINOutMessageReceiver {
- public void receive(final MessageContext messageCtx) throws AxisFault {
- messageCtx.setProperty(DO_ASYNC, Boolean.TRUE);
- super.receive(messageCtx);
- }
-}
diff --git a/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java b/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java
index cadef20..80c3739 100644
--- a/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java
+++ b/modules/kernel/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java
@@ -26,8 +26,10 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.engine.AxisEngine;
import org.apache.axis2.engine.MessageReceiver;
import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.util.MessageContextBuilder;
import java.lang.reflect.Method;
@@ -42,7 +44,7 @@
* @see RawXMLINOnlyMessageReceiver
* @see RawXMLINOutAsyncMessageReceiver
*/
-public class RawXMLINOutMessageReceiver extends AbstractInOutSyncMessageReceiver
+public class RawXMLINOutMessageReceiver extends AbstractMessageReceiver
implements MessageReceiver {
private Method findOperation(AxisOperation op, Class implClass) {
@@ -108,4 +110,14 @@
throw AxisFault.makeFault(e);
}
}
+
+ public final void invokeBusinessLogic(MessageContext msgContext) throws AxisFault {
+ MessageContext outMsgContext = MessageContextBuilder.createOutMessageContext(msgContext);
+ outMsgContext.getOperationContext().addMessageContext(outMsgContext);
+
+ invokeBusinessLogic(msgContext, outMsgContext);
+ replicateState(msgContext);
+
+ AxisEngine.send(outMsgContext);
+ }
}
diff --git a/modules/kernel/src/org/apache/axis2/util/Base64.java b/modules/kernel/src/org/apache/axis2/util/Base64.java
deleted file mode 100644
index 4d23002..0000000
--- a/modules/kernel/src/org/apache/axis2/util/Base64.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.util;
-
-/**
- * @deprecated
- */
-public class Base64 extends org.apache.axiom.om.util.Base64 {
-}
\ No newline at end of file
diff --git a/modules/kernel/src/org/apache/axis2/util/FaultyServiceData.java b/modules/kernel/src/org/apache/axis2/util/FaultyServiceData.java
index ae275be..8c03eb9 100644
--- a/modules/kernel/src/org/apache/axis2/util/FaultyServiceData.java
+++ b/modules/kernel/src/org/apache/axis2/util/FaultyServiceData.java
@@ -19,6 +19,7 @@
package org.apache.axis2.util;
+import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.AxisServiceGroup;
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
@@ -29,12 +30,12 @@
private String serviceGroupName;
private AxisServiceGroup serviceGroup;
- private ArrayList serviceList;
+ private ArrayList<AxisService> serviceList;
private DeploymentFileData currentDeploymentFile;
private URL serviceLocation;
public FaultyServiceData(AxisServiceGroup serviceGroup,
- ArrayList serviceList,
+ ArrayList<AxisService> serviceList,
URL serviceLocation,
DeploymentFileData currentDeploymentFile) {
serviceGroupName = serviceGroup.getServiceGroupName();
@@ -53,7 +54,7 @@
return currentDeploymentFile;
}
- public ArrayList getServiceList() {
+ public ArrayList<AxisService> getServiceList() {
return serviceList;
}
diff --git a/modules/kernel/test/org/apache/axis2/engine/AbstractEngineTest.java b/modules/kernel/test/org/apache/axis2/engine/AbstractEngineTest.java
index a954270..9333e58 100644
--- a/modules/kernel/test/org/apache/axis2/engine/AbstractEngineTest.java
+++ b/modules/kernel/test/org/apache/axis2/engine/AbstractEngineTest.java
@@ -22,7 +22,8 @@
import junit.framework.TestCase;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
+import org.apache.axis2.receivers.AbstractMessageReceiver;
+import org.apache.axis2.util.MessageContextBuilder;
public class AbstractEngineTest extends TestCase {
public AbstractEngineTest() {
@@ -32,12 +33,22 @@
super(arg0);
}
- public class NullMessageReceiver extends AbstractInOutSyncMessageReceiver {
+ public class NullMessageReceiver extends AbstractMessageReceiver {
public void invokeBusinessLogic(MessageContext inMessage,
MessageContext outMessage)
throws AxisFault {
}
+
+ public final void invokeBusinessLogic(MessageContext msgContext) throws AxisFault {
+ MessageContext outMsgContext = MessageContextBuilder.createOutMessageContext(msgContext);
+ outMsgContext.getOperationContext().addMessageContext(outMsgContext);
+
+ invokeBusinessLogic(msgContext, outMsgContext);
+ replicateState(msgContext);
+
+ AxisEngine.send(outMsgContext);
+ }
}
}
diff --git a/modules/ping/src/org/apache/axis2/ping/PingMessageReceiver.java b/modules/ping/src/org/apache/axis2/ping/PingMessageReceiver.java
index 33c00d2..b73f472 100644
--- a/modules/ping/src/org/apache/axis2/ping/PingMessageReceiver.java
+++ b/modules/ping/src/org/apache/axis2/ping/PingMessageReceiver.java
@@ -26,7 +26,7 @@
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.engine.MessageReceiver;
import org.apache.axis2.engine.Pingable;
-import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
+import org.apache.axis2.receivers.AbstractInOutMessageReceiver;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -34,7 +34,7 @@
import java.util.ArrayList;
import java.util.Iterator;
-public class PingMessageReceiver extends AbstractInOutSyncMessageReceiver implements PingConstants {
+public class PingMessageReceiver extends AbstractInOutMessageReceiver implements PingConstants {
private static Log log = LogFactory.getLog(PingMessageReceiver.class);
public void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage) throws AxisFault {
@@ -44,7 +44,7 @@
AxisOperation axisOperation;
PingResponse pingResponse = new PingResponse();
pingResponse.initPingResponse(inMessage);
- Iterator opListIterator = getAxisOperations(inMessage);
+ Iterator<AxisOperation> opListIterator = getAxisOperations(inMessage);
while (opListIterator.hasNext()) {
axisOperation = (AxisOperation) opListIterator.next();
@@ -75,9 +75,9 @@
* @return Iterator for the list of AxisOperations
* @throws AxisFault
*/
- private Iterator getAxisOperations(MessageContext inMessage) throws AxisFault {
+ private Iterator<AxisOperation> getAxisOperations(MessageContext inMessage) throws AxisFault {
boolean serviceLevel = false;
- Iterator operationsIterator;
+ Iterator<AxisOperation> operationsIterator;
OMElement element = null;
OMElement pingRequestElement = inMessage.getEnvelope().
@@ -95,8 +95,8 @@
if (!serviceLevel && element != null) {
//Operations to be pinged has been specified in the ping request
- Iterator elementIterator = pingRequestElement.getChildrenWithName(new QName(TAG_OPERATION));
- ArrayList operationList = new ArrayList();
+ Iterator<?> elementIterator = pingRequestElement.getChildrenWithName(new QName(TAG_OPERATION));
+ ArrayList<AxisOperation> operationList = new ArrayList<AxisOperation>();
AxisOperation axisOperation;
while (elementIterator.hasNext()) {
diff --git a/modules/scripting/src/org/apache/axis2/scripting/ScriptReceiver.java b/modules/scripting/src/org/apache/axis2/scripting/ScriptReceiver.java
index 36fbc08..f36d275 100644
--- a/modules/scripting/src/org/apache/axis2/scripting/ScriptReceiver.java
+++ b/modules/scripting/src/org/apache/axis2/scripting/ScriptReceiver.java
@@ -24,7 +24,7 @@
import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
-import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
+import org.apache.axis2.receivers.AbstractInOutMessageReceiver;
import org.apache.axis2.scripting.convertors.ConvertorFactory;
import org.apache.axis2.scripting.convertors.OMElementConvertor;
import org.apache.bsf.BSFEngine;
@@ -76,7 +76,7 @@
* The script language is determined by the file name suffix when using scripts
* in seperate files or the script parameter name suffix when using inline scripts.
*/
-public class ScriptReceiver extends AbstractInOutSyncMessageReceiver {
+public class ScriptReceiver extends AbstractInOutMessageReceiver {
public static final String SCRIPT_ATTR = "script";
public static final String FUNCTION_ATTR = "function";
@@ -161,7 +161,7 @@
}
} else {
// the script is defined inline within the services.xml
- ArrayList parameters = axisService.getParameters();
+ ArrayList<Parameter> parameters = axisService.getParameters();
for (int i=0; scriptFileParam == null && i<parameters.size(); i++) {
Parameter p = (Parameter) parameters.get(i);
if (p.getName().startsWith("script.")) {