You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by de...@apache.org on 2006/03/03 16:55:55 UTC
svn commit: r382876 - in /webservices/axis2/trunk/java/modules:
common/src/org/apache/axis2/i18n/ core/src/org/apache/axis2/client/
core/src/org/apache/axis2/context/ core/src/org/apache/axis2/deployment/
core/src/org/apache/axis2/deployment/repository...
Author: deepal
Date: Fri Mar 3 07:55:53 2006
New Revision: 382876
URL: http://svn.apache.org/viewcvs?rev=382876&view=rev
Log:
-started i18n
- few refactoring
Added:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/RepositoryListener.java
- copied, changed from r382800, webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListener.java
Modified:
webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLBasedPolicyProcessor.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLBasedServiceConfigurationBuilder.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/AbstractContext.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceGroupContext.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisConfigBuilder.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisServiceBuilder.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/scheduler/SchedulerTask.java
Modified: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties?rev=382876&r1=382875&r2=382876&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties (original)
+++ webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties Fri Mar 3 07:55:53 2006
@@ -61,7 +61,23 @@
rawXmlProivdeIsLimited=Raw Xml provider supports only the methods bearing the signature public OMElement <method-name>(OMElement) where the method name can be anything
methodNotImplemented=Implementation class does not define a method called
blockInvocationExpectsRes=Blocking invocation always expects a response
-serviceGroupIDNotFound=SOAP session information can not be retrieved from the received correlation id.
+serviceGroupIDNotFound=SOAP session information can not be retrieved from the received correlation id.
+
+# Client
+operationnotfound=Operation {0} not found
+unsupportedyype=Unsupported type
+unknownsoapversion=Unknown SOAP version
+cannotfindamoduletoprocess=cannot find a module to process {0} type assertions
+noendpointfound=No Endpoint Found in Service, {0}
+endpointnotfound=Endpoint Not found
+unsupportdmep=Unsupported MEP
+noservicefound=No service found
+
+# context
+servicenotfound=Service not found
+threadpoolset=Thread pool already set.
+transportiniterror=Transport-OUT initialization error : {0}
+invalidserviceinagroup=Invalid service {0} not belong to service group {1}
# Deployment Errors
wsdlfilenotfound=WSDL file not found for the service : {0}
@@ -133,6 +149,17 @@
fileExistsNoOverwrite=File {0} will not be overwritten.
cannotConnectError=Unable to connect
failedJMSConnectorShutdown=failure in JMSConnectorShutdown
+errorinscheamgen=Error in schema generating {0}
+errorininputstreamclose=Error in closing input stream
+phaseclassnotfound=Couldn't find phase class : {0} : {1}
+modulenamecannotnull=Module name can not be null in side default module vresion element
+documentcreatingerror=Exception occured when creating the Document from WSDL {0}
+noserviceelemtfound=No javax.wsdl.Service element is found
+serviceporterror=atleast one port should be specified
+soapbindingerror=atleast one port with a soap binding should be specified
+axisoperationcreateerror=Exception when creating AxisOperation for the AxisService {0}
+wrapperelementcreaterror=Exception occured while creating wrapper element
+policyprocessingerror=Exception occured when processing policy elements
#outMessageNull=Out message is null
malformedURLException00=MalformedURLException:
exception00=Exception:
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java?rev=382876&r1=382875&r2=382876&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java Fri Mar 3 07:55:53 2006
@@ -5,18 +5,8 @@
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.async.AsyncResult;
import org.apache.axis2.client.async.Callback;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.ServiceGroupContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
-import org.apache.axis2.description.ClientUtils;
-import org.apache.axis2.description.OutInAxisOperation;
-import org.apache.axis2.description.OutOnlyAxisOperation;
-import org.apache.axis2.description.RobustOutOnlyAxisOperation;
+import org.apache.axis2.context.*;
+import org.apache.axis2.description.*;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.engine.ListenerManager;
import org.apache.axis2.i18n.Messages;
@@ -112,7 +102,8 @@
// Action and To address to be present. In anon case, we might not have the action.
// so switching addressing off now. But will be setting back on, if some one sets the action.
// @see Options.setAction()
- if (axisService == null) serviceContext.setProperty(Constants.Configuration.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE);
+ if (axisService == null) serviceContext.setProperty(
+ Constants.Configuration.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE);
}
/**
@@ -132,7 +123,8 @@
initializeTransports(configContext);
try {
this.axisConfig = this.configContext.getAxisConfiguration();
- WSDLBasedServiceConfigurationBuilder scb = new WSDLBasedServiceConfigurationBuilder(wsdldesc, configContext);
+ WSDLBasedServiceConfigurationBuilder scb =
+ new WSDLBasedServiceConfigurationBuilder(wsdldesc, configContext);
axisService = scb.buildAxisService(wsdlServiceName, portName, options);
// add the service to the config context if it isn't in there
// already
@@ -519,7 +511,8 @@
public OperationClient createClient(QName operation) throws AxisFault {
AxisOperation axisOp = axisService.getOperation(operation);
if (axisOp == null) {
- throw new AxisFault("Operation '" + operation + "' not found");
+ throw new AxisFault(Messages
+ .getMessage("operationnotfound", operation.getLocalPart()));
}
OperationClient oc = axisOp.createClient(serviceContext, options);
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java?rev=382876&r1=382875&r2=382876&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/Stub.java Fri Mar 3 07:55:53 2006
@@ -18,16 +18,12 @@
package org.apache.axis2.client;
import org.apache.axis2.description.AxisService;
+import org.apache.axis2.i18n.Messages;
import org.apache.ws.commons.om.OMAbstractFactory;
import org.apache.ws.commons.om.OMElement;
import org.apache.ws.commons.om.impl.llom.builder.StAXOMBuilder;
import org.apache.ws.commons.om.impl.llom.factory.OMXMLBuilderFactory;
-import org.apache.ws.commons.soap.SOAP11Constants;
-import org.apache.ws.commons.soap.SOAP12Constants;
-import org.apache.ws.commons.soap.SOAPBody;
-import org.apache.ws.commons.soap.SOAPEnvelope;
-import org.apache.ws.commons.soap.SOAPFactory;
-import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.*;
import org.apache.wsdl.WSDLService;
import javax.xml.stream.XMLStreamReader;
@@ -68,7 +64,8 @@
} else if (WSDLService.STYLE_DOC.equals(type)) {
return element;
} else {
- throw new UnsupportedOperationException("Unsupported type");
+ throw new UnsupportedOperationException(Messages
+ .getMessage("unsupportedType"));
}
}
@@ -80,16 +77,16 @@
}
protected SOAPFactory getFactory(String soapVersionURI) {
-
+
if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) {
return OMAbstractFactory.getSOAP11Factory();
} else if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) {
return OMAbstractFactory.getSOAP12Factory();
} else {
- throw new RuntimeException("Unknown SOAP version");
+ throw new RuntimeException(Messages
+ .getMessage("unknownsoapversion"));
}
}
-
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLBasedPolicyProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLBasedPolicyProcessor.java?rev=382876&r1=382875&r2=382876&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLBasedPolicyProcessor.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLBasedPolicyProcessor.java Fri Mar 3 07:55:53 2006
@@ -16,104 +16,104 @@
package org.apache.axis2.client;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisModule;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.i18n.Messages;
import org.apache.ws.policy.AndCompositeAssertion;
import org.apache.ws.policy.Policy;
import org.apache.ws.policy.PrimitiveAssertion;
import org.apache.ws.policy.XorCompositeAssertion;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
public class WSDLBasedPolicyProcessor {
- private HashMap ns2modules = new HashMap();
-
- public WSDLBasedPolicyProcessor(ConfigurationContext configctx){
- //create the Map for namespaces to modules this is 1:N mapping
- // so we got to use array lists
-
- AxisConfiguration axisConfiguration = configctx.getAxisConfiguration();
- for (Iterator iterator = axisConfiguration.getModules().values()
- .iterator(); iterator.hasNext();) {
- AxisModule axisModule = (AxisModule) iterator.next();
- String[] namespaces = axisModule.getSupportedPolicyNamespaces();
-
- if (namespaces == null) {
- continue;
- }
-
- for (int i = 0; i < namespaces.length; i++) {
- ArrayList moduleList = null;
- Object obj = ns2modules.get(namespaces[i]);
- if(obj == null){
- moduleList = new ArrayList(5);
- ns2modules.put(namespaces[i], moduleList);
- }else{
- moduleList = (ArrayList)obj;
- }
- moduleList.add(axisModule);
-
- }
- }
-
- }
-
- public void configureOperationPolices(AxisOperation op,Policy policy){
- if (!policy.isNormalized()) {
- policy = (Policy) policy.normalize();
- }
-
- HashMap map = new HashMap();
-
- XorCompositeAssertion XOR = (XorCompositeAssertion) policy.getTerms()
- .get(0);
- AndCompositeAssertion AND = (AndCompositeAssertion) XOR.getTerms().get(
- 0);
-
- for (Iterator iterator = AND.getTerms().iterator(); iterator.hasNext();) {
-
- AndCompositeAssertion nAND = new AndCompositeAssertion();
- PrimitiveAssertion pa = (PrimitiveAssertion) iterator.next();
-
- String namespace = pa.getName().getNamespaceURI();
- nAND.addTerm(pa);
-
- while (iterator.hasNext()) {
- pa = (PrimitiveAssertion) iterator.next();
-
- if (namespace.equals(pa.getName().getNamespaceURI())) {
- nAND.addTerm(pa);
- }
- }
-
- map.put(namespace, nAND);
- AND.getTerms().removeAll(nAND.getTerms());
-
- iterator = AND.getTerms().iterator();
- }
-
- for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();) {
- String namespace = (String) iterator.next();
-
- //for each module intersted in
- ArrayList moduleList = (ArrayList)ns2modules.get(namespace);
-
- if (moduleList == null) {
- System.err.println("cannot find a module to process "
- + namespace + "type assertions");
- continue;
- }else{
- for(int i = 0;i<moduleList.size();i++){
- AxisModule axisModule = (AxisModule) moduleList.get(i);
- //we should be notifying/consulting modules here
- throw new UnsupportedOperationException();
-
- }
- }
- }
- }
+ private HashMap ns2modules = new HashMap();
+
+ public WSDLBasedPolicyProcessor(ConfigurationContext configctx) {
+ //create the Map for namespaces to modules this is 1:N mapping
+ // so we got to use array lists
+
+ AxisConfiguration axisConfiguration = configctx.getAxisConfiguration();
+ for (Iterator iterator = axisConfiguration.getModules().values()
+ .iterator(); iterator.hasNext();) {
+ AxisModule axisModule = (AxisModule) iterator.next();
+ String[] namespaces = axisModule.getSupportedPolicyNamespaces();
+
+ if (namespaces == null) {
+ continue;
+ }
+
+ for (int i = 0; i < namespaces.length; i++) {
+ ArrayList moduleList;
+ Object obj = ns2modules.get(namespaces[i]);
+ if (obj == null) {
+ moduleList = new ArrayList(5);
+ ns2modules.put(namespaces[i], moduleList);
+ } else {
+ moduleList = (ArrayList) obj;
+ }
+ moduleList.add(axisModule);
+
+ }
+ }
+
+ }
+
+ public void configureOperationPolices(AxisOperation op, Policy policy) {
+ if (!policy.isNormalized()) {
+ policy = (Policy) policy.normalize();
+ }
+
+ HashMap map = new HashMap();
+
+ XorCompositeAssertion XOR = (XorCompositeAssertion) policy.getTerms()
+ .get(0);
+ AndCompositeAssertion AND = (AndCompositeAssertion) XOR.getTerms().get(
+ 0);
+
+ for (Iterator iterator = AND.getTerms().iterator(); iterator.hasNext();) {
+
+ AndCompositeAssertion nAND = new AndCompositeAssertion();
+ PrimitiveAssertion pa = (PrimitiveAssertion) iterator.next();
+
+ String namespace = pa.getName().getNamespaceURI();
+ nAND.addTerm(pa);
+
+ while (iterator.hasNext()) {
+ pa = (PrimitiveAssertion) iterator.next();
+
+ if (namespace.equals(pa.getName().getNamespaceURI())) {
+ nAND.addTerm(pa);
+ }
+ }
+
+ map.put(namespace, nAND);
+ AND.getTerms().removeAll(nAND.getTerms());
+
+ iterator = AND.getTerms().iterator();
+ }
+
+ for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();) {
+ String namespace = (String) iterator.next();
+
+ //for each module intersted in
+ ArrayList moduleList = (ArrayList) ns2modules.get(namespace);
+
+ if (moduleList == null) {
+ System.err.println(Messages
+ .getMessage("cannotfindamoduletoprocess", namespace));
+ } else {
+ for (int i = 0; i < moduleList.size(); i++) {
+ AxisModule axisModule = (AxisModule) moduleList.get(i);
+ //we should be notifying/consulting modules here
+ throw new UnsupportedOperationException();
+
+ }
+ }
+ }
+ }
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLBasedServiceConfigurationBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLBasedServiceConfigurationBuilder.java?rev=382876&r1=382875&r2=382876&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLBasedServiceConfigurationBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLBasedServiceConfigurationBuilder.java Fri Mar 3 07:55:53 2006
@@ -16,152 +16,146 @@
package org.apache.axis2.client;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisOperationFactory;
import org.apache.axis2.description.AxisService;
-import org.apache.wsdl.WSDLBinding;
-import org.apache.wsdl.WSDLBindingOperation;
-import org.apache.wsdl.WSDLConstants;
-import org.apache.wsdl.WSDLDescription;
-import org.apache.wsdl.WSDLEndpoint;
-import org.apache.wsdl.WSDLOperation;
-import org.apache.wsdl.WSDLService;
+import org.apache.axis2.i18n.Messages;
+import org.apache.wsdl.*;
import org.apache.wsdl.extensions.SOAPAddress;
import org.apache.wsdl.extensions.SOAPOperation;
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
public class WSDLBasedServiceConfigurationBuilder {
- private ConfigurationContext configurationContext;
- private WSDLDescription description;
+ private WSDLDescription description;
- public WSDLBasedServiceConfigurationBuilder(WSDLDescription wsdlDesc,
- ConfigurationContext configctx) {
- description = wsdlDesc;
- configurationContext = configctx;
- }
-
- public AxisService buildAxisService(QName servicename, String endpointname,Options clientOptions)throws AxisFault {
- WSDLService service = findService(servicename);
- AxisService serviceDesc = new AxisService();
-
- //TODO we just pick first end point
- WSDLEndpoint endpoint = findEndpoint(null, service);
-
- Iterator elements = endpoint.getExtensibilityElements().iterator();
-
- while (elements.hasNext()) {
- Object obj = elements.next();
- if (obj instanceof SOAPAddress) {
- SOAPAddress soapAddress = (SOAPAddress) obj;
- clientOptions.setTo(new EndpointReference(soapAddress.getLocationURI()));
- }
- }
-
- WSDLBinding binding = endpoint.getBinding();
-
- // let us configure the complete AxisService out of this, not the
- // current the Operation only
- Iterator bindings = binding.getBindingOperations().values().iterator();
-
- while (bindings.hasNext()) {
- WSDLBindingOperation wsdlbop = (WSDLBindingOperation) bindings
- .next();
- serviceDesc.addOperation(configureOperation(wsdlbop));
- }
-
- return serviceDesc;
- }
-
-
- private AxisOperation configureOperation(WSDLBindingOperation bindingOperation) throws AxisFault{
- WSDLOperation wsdlop = bindingOperation.getOperation();
- AxisOperation axisOp = AxisOperationFactory.getAxisOperation(findMEP(wsdlop));
-
- axisOp.setName(wsdlop.getName());
-
-
-
-
- Iterator elments = bindingOperation.getExtensibilityElements().iterator();
-
- while (elments.hasNext()) {
- Object obj = elments.next();
-
- if (obj instanceof SOAPOperation) {
- SOAPOperation soapOp = (SOAPOperation) obj;
- //TODO put soap action to right place
- //axisOp.setSoapAction(soapOp.getSoapAction());
- break;
- }
-
- //TODO set style
- }
- return axisOp;
- }
-
-
- private WSDLEndpoint findEndpoint(QName endpointname, WSDLService service)
- throws AxisFault {
- WSDLEndpoint endpoint;
-
- if (endpointname == null) {
- Iterator endpoints = service.getEndpoints().values().iterator();
-
- if (endpoints.hasNext()) {
- endpoint = (WSDLEndpoint) endpoints.next();
- } else {
- throw new AxisFault("No Endpoint Found in Service, "
- + service.getName());
- }
- } else {
- endpoint = service.getEndpoint(endpointname);
- }
-
- if (endpoint == null) {
- throw new AxisFault("Endpoint Not found");
- }
-
- return endpoint;
- }
-
- private int findMEP(WSDLOperation wsdlOp) throws AxisFault {
- if (wsdlOp.getInputMessage() == null) {
- throw new AxisFault("Unsupported MEP");
- }
-
- if (wsdlOp.getOutputMessage() == null) {
- return WSDLConstants.MEP_CONSTANT_IN_ONLY;
- } else {
- return WSDLConstants.MEP_CONSTANT_IN_OUT;
- }
- }
-
- private WSDLService findService(QName serviceName) throws AxisFault {
- WSDLService service;
-
- if (serviceName == null) {
- Iterator services = description.getServices().values().iterator();
-
- if (services.hasNext()) {
- service = (WSDLService) services.next();
- } else {
- throw new AxisFault("No service found");
- }
- } else {
- service = description.getService(serviceName);
- }
-
- if (service == null) {
- throw new AxisFault("No service found");
- }
+ public WSDLBasedServiceConfigurationBuilder(WSDLDescription wsdlDesc,
+ ConfigurationContext configctx) {
+ description = wsdlDesc;
+// ConfigurationContext configurationContext = configctx;
+ }
+
+ public AxisService buildAxisService(QName servicename, String endpointname, Options clientOptions) throws AxisFault {
+ WSDLService service = findService(servicename);
+ AxisService serviceDesc = new AxisService();
+
+ //TODO we just pick first end point
+ WSDLEndpoint endpoint = findEndpoint(null, service);
+
+ Iterator elements = endpoint.getExtensibilityElements().iterator();
+
+ while (elements.hasNext()) {
+ Object obj = elements.next();
+ if (obj instanceof SOAPAddress) {
+ SOAPAddress soapAddress = (SOAPAddress) obj;
+ clientOptions.setTo(new EndpointReference(soapAddress.getLocationURI()));
+ }
+ }
+
+ WSDLBinding binding = endpoint.getBinding();
+
+ // let us configure the complete AxisService out of this, not the
+ // current the Operation only
+ Iterator bindings = binding.getBindingOperations().values().iterator();
+
+ while (bindings.hasNext()) {
+ WSDLBindingOperation wsdlbop = (WSDLBindingOperation) bindings
+ .next();
+ serviceDesc.addOperation(configureOperation(wsdlbop));
+ }
+
+ return serviceDesc;
+ }
+
+
+ private AxisOperation configureOperation(WSDLBindingOperation bindingOperation) throws AxisFault {
+ WSDLOperation wsdlop = bindingOperation.getOperation();
+ AxisOperation axisOp = AxisOperationFactory.getAxisOperation(findMEP(wsdlop));
+
+ axisOp.setName(wsdlop.getName());
+
+
+ Iterator elments = bindingOperation.getExtensibilityElements().iterator();
+
+ while (elments.hasNext()) {
+ Object obj = elments.next();
+
+ if (obj instanceof SOAPOperation) {
+ SOAPOperation soapOp = (SOAPOperation) obj;
+ //TODO put soap action to right place
+ //axisOp.setSoapAction(soapOp.getSoapAction());
+ break;
+ }
+
+ //TODO set style
+ }
+ return axisOp;
+ }
+
+
+ private WSDLEndpoint findEndpoint(QName endpointname, WSDLService service)
+ throws AxisFault {
+ WSDLEndpoint endpoint;
+
+ if (endpointname == null) {
+ Iterator endpoints = service.getEndpoints().values().iterator();
+
+ if (endpoints.hasNext()) {
+ endpoint = (WSDLEndpoint) endpoints.next();
+ } else {
+ throw new AxisFault(Messages
+ .getMessage("noendpointfound", service.getName().getLocalPart()));
+ }
+ } else {
+ endpoint = service.getEndpoint(endpointname);
+ }
+
+ if (endpoint == null) {
+ throw new AxisFault(Messages
+ .getMessage("endpointnotfound"));
+ }
+
+ return endpoint;
+ }
+
+ private int findMEP(WSDLOperation wsdlOp) throws AxisFault {
+ if (wsdlOp.getInputMessage() == null) {
+ throw new AxisFault(Messages
+ .getMessage("unsupportdmep"));
+ }
+
+ if (wsdlOp.getOutputMessage() == null) {
+ return WSDLConstants.MEP_CONSTANT_IN_ONLY;
+ } else {
+ return WSDLConstants.MEP_CONSTANT_IN_OUT;
+ }
+ }
+
+ private WSDLService findService(QName serviceName) throws AxisFault {
+ WSDLService service;
+
+ if (serviceName == null) {
+ Iterator services = description.getServices().values().iterator();
+
+ if (services.hasNext()) {
+ service = (WSDLService) services.next();
+ } else {
+ throw new AxisFault(Messages
+ .getMessage("noservicefound"));
+ }
+ } else {
+ service = description.getService(serviceName);
+ }
+ if (service == null) {
+ throw new AxisFault(Messages
+ .getMessage("noservicefound"));
+ }
- return service;
- }
+ return service;
+ }
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/AbstractContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/AbstractContext.java?rev=382876&r1=382875&r2=382876&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/AbstractContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/AbstractContext.java Fri Mar 3 07:55:53 2006
@@ -57,7 +57,7 @@
* @return Returns the property.
*/
public Object getProperty(String key) {
- Object obj = null;
+ Object obj;
obj = properties.get(key);
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java?rev=382876&r1=382875&r2=382876&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java Fri Mar 3 07:55:53 2006
@@ -23,6 +23,7 @@
import org.apache.axis2.description.AxisServiceGroup;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.engine.ListenerManager;
+import org.apache.axis2.i18n.Messages;
import org.apache.axis2.util.SessionUtils;
import org.apache.axis2.util.UUIDGenerator;
import org.apache.axis2.util.threadpool.ThreadFactory;
@@ -126,7 +127,7 @@
// set the serviceGroupContextID
serviceGroupContext.setId(serviceGroupContextId);
} else {
- throw new AxisFault("AxisService Not found yet");
+ throw new AxisFault(Messages.getMessage("servicenotfound"));
}
}
@@ -230,12 +231,12 @@
}
}
if (serviceGroupContext == null
- && msgContext!=null
+ && msgContext != null
&& msgContext.getSessionContext() != null) {
serviceGroupContext = msgContext.getSessionContext().getServiceGroupContext(
serviceGroupContextId);
}
- if (serviceGroupContext == null) {
+ if (serviceGroupContext == null && msgContext != null) {
AxisService axisService = msgContext.getAxisService();
if (axisService != null) {
AxisServiceGroup asg = (AxisServiceGroup) axisService.getParent();
@@ -299,7 +300,7 @@
if (threadPool == null) {
threadPool = pool;
} else {
- throw new AxisFault("Thread pool already set.");
+ throw new AxisFault(Messages.getMessage("threadpoolset"));
}
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java?rev=382876&r1=382875&r2=382876&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java Fri Mar 3 07:55:53 2006
@@ -7,6 +7,7 @@
import org.apache.axis2.description.TransportOutDescription;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.engine.AxisConfigurator;
+import org.apache.axis2.i18n.Messages;
import org.apache.axis2.modules.Module;
import org.apache.axis2.phaseresolver.PhaseException;
import org.apache.axis2.phaseresolver.PhaseResolver;
@@ -115,8 +116,7 @@
sender.init(configContext, transportOut);
} catch (AxisFault axisFault) {
LogFactory.getLog(ConfigurationContextFactory.class)
- .info("Transport-OUT initialization error : "
- + transportOut.getName().getLocalPart());
+ .info(Messages.getMessage("transportiniterror", transportOut.getName().getLocalPart()));
}
}
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java?rev=382876&r1=382875&r2=382876&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java Fri Mar 3 07:55:53 2006
@@ -113,16 +113,6 @@
// Are we doing MTOM now?
private boolean doingMTOM;
- private QName transportInName;
-
- private QName transportOutname;
-
- private String serviceGroupId;
-
- private String axisServiceName;
-
- private QName axisOperationName;
-
private transient AxisOperation axisOperation;
private transient AxisService axisService;
@@ -399,8 +389,6 @@
* @return Parameter <code>Parameter</code>
*/
public Parameter getParameter(String key) {
- Parameter param = null;
-
if (getAxisOperation() != null) {
AxisOperation opDesc = getAxisOperation();
return opDesc.getParameter(key);
@@ -616,23 +604,15 @@
}
public void setAxisOperation(AxisOperation axisOperation) {
- if (axisOperation != null) {
- this.axisOperationName = axisOperation.getName();
- }
this.axisOperation = axisOperation;
}
public void setAxisService(AxisService axisService) {
this.axisService = axisService;
-
- if (axisService != null) {
- this.axisServiceName = axisService.getName();
- }
}
public void setAxisServiceGroup(AxisServiceGroup axisServiceGroup) {
if (axisServiceGroup != null) {
- this.serviceGroupId = axisServiceGroup.getServiceGroupName();
this.axisServiceGroup = axisServiceGroup;
}
}
@@ -845,10 +825,6 @@
*/
public void setTransportIn(TransportInDescription in) {
this.transportIn = in;
-
- if (in != null) {
- this.transportInName = in.getName();
- }
}
/**
@@ -856,10 +832,6 @@
*/
public void setTransportOut(TransportOutDescription out) {
transportOut = out;
-
- if (out != null) {
- this.transportOutname = out.getName();
- }
}
/**
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceGroupContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceGroupContext.java?rev=382876&r1=382875&r2=382876&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceGroupContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceGroupContext.java Fri Mar 3 07:55:53 2006
@@ -20,6 +20,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.i18n.Messages;
import java.util.HashMap;
import java.util.Iterator;
@@ -57,8 +58,8 @@
public ServiceContext getServiceContext(AxisService service) throws AxisFault {
AxisService axisService = axisServiceGroup.getService(service.getName());
if (axisService == null) {
- throw new AxisFault("Invalid service " + service.getName() + " not belong to " +
- "service group " + axisServiceGroup.getServiceGroupName());
+ throw new AxisFault(Messages.getMessage("invalidserviceinagroup",
+ service.getName(), axisServiceGroup.getServiceGroupName()));
}
ServiceContext serviceContext = (ServiceContext) serviceContextMap.get(service.getName());
if (serviceContext == null) {
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisConfigBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisConfigBuilder.java?rev=382876&r1=382875&r2=382876&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisConfigBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisConfigBuilder.java Fri Mar 3 07:55:53 2006
@@ -203,7 +203,7 @@
OMElement observerelement = (OMElement) oservers.next();
AxisObserver observer;
OMAttribute trsClas = observerelement.getAttribute(new QName(TAG_CLASS_NAME));
- String clasName ;
+ String clasName;
if (trsClas != null) {
clasName = trsClas.getAttributeValue();
} else {
@@ -241,7 +241,8 @@
try {
phase = getPhase(phaseClass);
} catch (Exception e) {
- throw new DeploymentException("Couldn't find phase class : " + phaseClass, e);
+ throw new DeploymentException(
+ Messages.getMessage("phaseclassnotfound", phaseClass, e.getMessage()));
}
phase.setName(phaseName);
@@ -298,13 +299,11 @@
OMElement omElement = (OMElement) moduleVersions.next();
String name = omElement.getAttributeValue(new QName(ATTRIBUTE_NAME));
if (name == null) {
- throw new DeploymentException("Module name can not be null in side" +
- " default module vresion element ");
+ throw new DeploymentException(Messages.getMessage("modulenamecannotnull"));
}
String defaultVeriosn = omElement.getAttributeValue(new QName(ATTRIBUTE_DEFAULT_VERSION));
if (defaultVeriosn == null) {
- throw new DeploymentException("Module vresion can not be null in side" +
- " default module vresion element ");
+ throw new DeploymentException(Messages.getMessage("modulenamecannotnull"));
}
axisConfig.addDefaultModuleVersion(name, defaultVeriosn);
}
@@ -314,18 +313,13 @@
while (trs_senders.hasNext()) {
TransportInDescription transportIN;
OMElement transport = (OMElement) trs_senders.next();
-
// getting transport Name
OMAttribute trsName = transport.getAttribute(new QName(ATTRIBUTE_NAME));
-
if (trsName != null) {
String name = trsName.getAttributeValue();
-
transportIN = new TransportInDescription(new QName(name));
-
// transport impl class
OMAttribute trsClas = transport.getAttribute(new QName(TAG_CLASS_NAME));
-
if (trsClas != null) {
try {
String clasName = trsClas.getAttributeValue();
@@ -333,7 +327,6 @@
Thread.currentThread().getContextClassLoader());
TransportListener receiver =
(TransportListener) receiverClass.newInstance();
-
transportIN.setReceiver(receiver);
} catch (NoClassDefFoundError e) {
log.info(Messages.getMessage("classnotfound", trsClas.getAttributeValue()));
@@ -345,38 +338,24 @@
throw new DeploymentException(e);
}
}
-
try {
-
- // process Parameters
- // processing Parameters
- // Processing service level parameters
Iterator itr = transport.getChildrenWithName(new QName(TAG_PARAMETER));
-
processParameters(itr, transportIN, axisConfig);
-
- // process INFLOW
OMElement inFlow = transport.getFirstChildWithName(new QName(TAG_FLOW_IN));
-
if (inFlow != null) {
throw new DeploymentException(
Messages.getMessage(
DeploymentErrorMsgs.INFLOW_NOT_ALLOWED_IN_TRS_OUT, name));
}
-
OMElement outFlow = transport.getFirstChildWithName(new QName(TAG_FLOW_OUT));
-
if (outFlow != null) {
transportIN.setInFlow(processFlow(outFlow, axisConfig));
}
-
OMElement inFaultFlow =
transport.getFirstChildWithName(new QName(TAG_FLOW_IN_FAULT));
-
if (inFaultFlow != null) {
transportIN.setFaultFlow(processFlow(inFaultFlow, axisConfig));
}
-
OMElement outFaultFlow =
transport.getFirstChildWithName(new QName(TAG_FLOW_OUT_FAULT));
@@ -385,7 +364,6 @@
Messages.getMessage(
DeploymentErrorMsgs.OUTFLOW_NOT_ALLOWED_IN_TRS_IN, name));
}
-
// adding to axis2 config
axisConfig.addTransportIn(transportIN);
} catch (AxisFault axisFault) {
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisServiceBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisServiceBuilder.java?rev=382876&r1=382875&r2=382876&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisServiceBuilder.java Fri Mar 3 07:55:53 2006
@@ -18,11 +18,8 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.description.AxisMessage;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisOperationFactory;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.PolicyInclude;
+import org.apache.axis2.description.*;
+import org.apache.axis2.i18n.Messages;
import org.apache.axis2.namespace.Constants;
import org.apache.axis2.util.XMLUtils;
import org.apache.commons.logging.Log;
@@ -39,20 +36,7 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import javax.wsdl.Binding;
-import javax.wsdl.BindingInput;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.BindingOutput;
-import javax.wsdl.Definition;
-import javax.wsdl.Input;
-import javax.wsdl.Message;
-import javax.wsdl.Operation;
-import javax.wsdl.Output;
-import javax.wsdl.Part;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.wsdl.Types;
+import javax.wsdl.*;
import javax.wsdl.extensions.ExtensibilityElement;
import javax.wsdl.extensions.UnknownExtensibilityElement;
import javax.wsdl.extensions.schema.Schema;
@@ -64,11 +48,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
/**
* AxisServiceBuilder builds an AxisService using a WSDL document which is input
@@ -126,10 +106,7 @@
} catch (Exception e) {
e.printStackTrace();
- logger
- .error(
- "Exception occured when creating the Document from WSDL",
- e);
+ logger.error(Messages.getMessage("documentcreatingerror", e.getMessage()));
throw new DeploymentException(e);
}
}
@@ -143,9 +120,8 @@
Map services = wsdlDefinition.getServices();
if (services.isEmpty()) {
- logger.error("No javax.wsdl.Service element found");
- throw new DeploymentException(
- "No javax.wsdl.Service element is found");
+ logger.error(Messages.getMessage("noserviceelemtfound"));
+ throw new DeploymentException(Messages.getMessage("noserviceelemtfound"));
}
Iterator serviceIterator = services.values().iterator();
@@ -201,17 +177,15 @@
Map ports = wsdl4jService.getPorts();
if (ports.isEmpty()) {
- logger.error("atleast one port should be specified");
- throw new WSDLProcessingException(
- "atleast one Port should be specified");
+ logger.error(Messages.getMessage("serviceporterror"));
+ throw new WSDLProcessingException(Messages.getMessage("serviceporterror"));
}
Port wsdl4jPort = getPortWithSoapBinding(ports);
if (wsdl4jPort == null) {
- logger
- .error("atleast one port with a soap binding should be specified");
- throw new WSDLProcessingException("no port with soap binding found");
+ logger.error(Messages.getMessage("soapbindingerror"));
+ throw new WSDLProcessingException(Messages.getMessage("soapbindingerror"));
}
Binding wsdl4jBinding = wsdl4jPort.getBinding();
@@ -377,7 +351,7 @@
outputPolicies = getPoliciesAsExtElements(wsdl4jBindingOutput
.getExtensibilityElements());
if (outputPolicies != null) {
- addPolicyElements(PolicyInclude.BINDING_OUTPUT_POLICY,
+ addPolicyElements(PolicyInclude.BINDING_OUTPUT_POLICY,
outputPolicies, outputPolicyInclude);
}
}
@@ -410,12 +384,9 @@
}
} catch (AxisFault axisFault) {
- logger
- .error(
- "Exception when creating AxisOperation for the AxisService",
- axisFault);
-
- throw new DeploymentException(axisFault.getMessage());
+ logger.error(Messages.getMessage("axisoperationcreateerror", axisFault.getMessage()));
+ throw new DeploymentException(
+ Messages.getMessage("axisoperationcreateerror", axisFault.getMessage()));
}
axisService.addOperation(axisOperation);
}
@@ -446,8 +417,7 @@
return fac.newDocumentBuilder().newDocument();
} catch (ParserConfigurationException ex) {
- logger.error("Exception occured when creating a Decument element",
- ex);
+ logger.error(Messages.getMessage("documentcreatingerror", ex.getMessage()));
throw new DeploymentException(ex.getMessage());
}
}
@@ -579,9 +549,8 @@
schemaTypeName = part.getElementName();
isTyped = false;
} else {
- logger
- .error("Exception occured while creating wrapper element");
- throw new RuntimeException(" Unqualified Message part!");
+ logger.error(Messages.getMessage("wrapperelementcreaterror"));
+ throw new RuntimeException(Messages.getMessage("wrapperelementcreaterror"));
}
child = document.createElementNS(XMLSCHEMA_NAMESPACE_URI,
@@ -857,9 +826,8 @@
policies.add(reader.readPolicyReference(element));
} catch (Exception ex) {
- logger
- .debug("Exception occured when processing policy elements");
- throw new DeploymentException(ex.getMessage());
+ logger.debug(Messages.getMessage("policyprocessingerror"));
+ throw new DeploymentException(Messages.getMessage("policyprocessingerror"));
}
}
}
@@ -910,7 +878,7 @@
if (wsaAction != null) {
return ((QName) wsaAction).getLocalPart();
}
-
+
wsaAction = extAttributes.get(new QName(AddressingConstants.Final.WSAW_NAMESPACE, AddressingConstants.WSA_ACTION));
if (wsaAction != null) {
return ((QName) wsaAction).getLocalPart();
@@ -963,7 +931,7 @@
if (name.getNamespaceURI().equals(Constants.URI_WSDL12_SOAP)
&& name.getLocalPart().equals("binding")) {
return port;
- }
+ }
}
}
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java?rev=382876&r1=382875&r2=382876&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java Fri Mar 3 07:55:53 2006
@@ -19,8 +19,6 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
-import org.apache.axis2.deployment.listener.RepositoryListener;
-import org.apache.axis2.deployment.listener.RepositoryListenerImpl;
import org.apache.axis2.deployment.repository.util.ArchiveFileData;
import org.apache.axis2.deployment.repository.util.ArchiveReader;
import org.apache.axis2.deployment.repository.util.WSInfo;
@@ -475,7 +473,7 @@
builder.populateConfig();
axisConfig.setPhasesinfo(phasesinfo);
//To load modules from the class path
- new RepositoryListenerImpl(this);
+ new RepositoryListener(this);
org.apache.axis2.util.Utils.calculateDefaultModuleVersion(axisConfig.getModules(), axisConfig);
return axisConfig;
} else if (axis2repository != null) {
@@ -498,7 +496,7 @@
// setting the CLs
setClassLoaders(axis2repository);
setDeploymentFeatures();
- RepositoryListener repoListener = new RepositoryListenerImpl(axis2repository, this);
+ RepositoryListener repoListener = new RepositoryListener(axis2repository, this);
org.apache.axis2.util.Utils.calculateDefaultModuleVersion(axisConfig.getModules(), axisConfig);
try {
axisConfig.setRepository(axis2repository);
@@ -531,7 +529,7 @@
axis2repository = (String) axis2repoPara.getValue();
setClassLoaders(axis2repository);
setDeploymentFeatures();
- RepositoryListener repoListener = new RepositoryListenerImpl(axis2repository, this);
+ RepositoryListener repoListener = new RepositoryListener(axis2repository, this);
org.apache.axis2.util.Utils.calculateDefaultModuleVersion(axisConfig.getModules(), axisConfig);
try {
axisConfig.setRepository(axis2repository);
@@ -549,7 +547,7 @@
return axisConfig;
} else {
log.info("no repository location found in axis2.xml");
- new RepositoryListenerImpl(this);
+ new RepositoryListener(this);
org.apache.axis2.util.Utils.calculateDefaultModuleVersion(axisConfig.getModules(), axisConfig);
validateSystemPredefinedPhases();
return axisConfig;
Copied: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/RepositoryListener.java (from r382800, webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListener.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/RepositoryListener.java?p2=webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/RepositoryListener.java&p1=webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListener.java&r1=382800&r2=382876&rev=382876&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListener.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/RepositoryListener.java Fri Mar 3 07:55:53 2006
@@ -1,46 +1,199 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.deployment.listener;
-
-/**
- * RepositoryListener listens to a specific directory for updates.
- * eg: addition, removal or modification of files.
- */
-public interface RepositoryListener {
-
- /**
- * Checks whether new module has been added.
- */
- void checkModules();
-
- /**
- * Checks whether new service has been added.
- */
- void checkServices();
-
- /**
- * Initializes the deployment. This is invoked during Axis engine start up
- * at which point it deploys all the services and modules, and initializes the WSInfolist.
- */
- void init();
-
- /**
- * Updates when new services or modules are added.
- */
- void update();
-}
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.deployment;
+
+import org.apache.axis2.deployment.DeploymentConstants;
+import org.apache.axis2.deployment.DeploymentEngine;
+import org.apache.axis2.deployment.repository.util.ArchiveFileData;
+import org.apache.axis2.deployment.repository.util.WSInfoList;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+
+public class RepositoryListener implements DeploymentConstants {
+ protected Log log = LogFactory.getLog(getClass());
+ private DeploymentEngine deploymentEngine;
+
+ /**
+ * The parent directory of the modules and services directories
+ */
+ private String folderName;
+
+ /**
+ * Reference to a WSInfoList
+ */
+ private WSInfoList wsInfoList;
+
+ /**
+ * This constructor takes two arguments, a folder name and a reference to Deployment Engine
+ * First, it initializes the system, by loading all the modules in the /modules directory
+ * and then creates a WSInfoList to store information about available modules and services.
+ *
+ * @param folderName path to parent directory that the listener should listen to
+ * @param deploymentEngine reference to engine registry for updates
+ */
+ public RepositoryListener(String folderName, DeploymentEngine deploymentEngine) {
+ this.folderName = folderName;
+ wsInfoList = new WSInfoList(deploymentEngine);
+ this.deploymentEngine = deploymentEngine;
+ init();
+ loadClassPathModules();
+ }
+
+ //The constructor , which loads moduls from class path
+ public RepositoryListener(DeploymentEngine deploymentEngine) {
+ this.deploymentEngine = deploymentEngine;
+ wsInfoList = new WSInfoList(deploymentEngine);
+ loadClassPathModules();
+ }
+
+ /**
+ * Finds a list of modules in the folder and adds to wsInfoList.
+ */
+ public void checkModules() {
+ String modulepath = folderName + MODULE_PATH;
+ File root = new File(modulepath);
+ File[] files = root.listFiles();
+
+ if (files != null) {
+ for (int i = 0; i < files.length; i++) {
+ File file = files[i];
+
+ if (!file.isDirectory()) {
+ if (ArchiveFileData.isModuleArchiveFile(file.getName())) {
+ wsInfoList.addWSInfoItem(file, TYPE_MODULE);
+ }
+ } else {
+ if (!"lib".equalsIgnoreCase(file.getName())) {
+ wsInfoList.addWSInfoItem(file, TYPE_MODULE);
+ }
+ }
+ }
+ }
+ }
+
+ private void loadClassPathModules() {
+ String classPath = getLocation();
+ int lstindex = classPath.lastIndexOf(File.separatorChar);
+ if (lstindex > 0) {
+ classPath = classPath.substring(0, lstindex);
+ } else {
+ classPath = ".";
+ }
+ File root = new File(classPath);
+ File[] files = root.listFiles();
+ if (files != null) {
+ for (int i = 0; i < files.length; i++) {
+ File file = files[i];
+ if (!file.isDirectory()) {
+ if (ArchiveFileData.isModuleArchiveFile(file.getName())) {
+ //adding moduls in the class path
+ wsInfoList.addWSInfoItem(file, TYPE_MODULE);
+ }
+ }
+ }
+ }
+ deploymentEngine.doDeploy();
+ }
+
+ /**
+ * To get the location of the Axis2.jar from that I can drive the location of class path
+ *
+ * @return String (location of the axis2 jar)
+ */
+ private String getLocation() {
+ try {
+ Class clazz = Class.forName("org.apache.axis2.engine.AxisEngine");
+ java.net.URL url = clazz.getProtectionDomain().getCodeSource().getLocation();
+ String location = url.toString();
+ if (location.startsWith("jar")) {
+ url = ((java.net.JarURLConnection) url.openConnection()).getJarFileURL();
+ location = url.toString();
+ }
+ if (location.startsWith("file")) {
+ java.io.File file = new java.io.File(url.getFile());
+ return file.getAbsolutePath();
+ } else {
+ return url.toString();
+ }
+ } catch (Throwable t) {
+ return "an unknown location";
+ }
+ }
+
+ /**
+ * Finds a list of services in the folder and adds to wsInfoList.
+ */
+ public void checkServices() {
+ String servicedir = folderName + SERVICE_PATH;
+
+ findServicesInDirectory(servicedir);
+ update();
+ }
+
+ /**
+ * First initializes the WSInfoList, then calls checkModule to load all the modules
+ * and calls update() to update the Deployment engine and engine registry.
+ */
+ public void init() {
+ wsInfoList.init();
+ checkModules();
+ deploymentEngine.doDeploy();
+ }
+
+ /**
+ * Searches a given folder for jar files and adds them to a list in the
+ * WSInfolist class.
+ */
+ private void findServicesInDirectory(String folderName) {
+ File root = new File(folderName);
+ File[] files = root.listFiles();
+
+ if (files != null) {
+ for (int i = 0; i < files.length; i++) {
+ File file = files[i];
+
+ if (!file.isDirectory()) {
+ if (ArchiveFileData.isServiceArchiveFile(file.getName())) {
+ wsInfoList.addWSInfoItem(file, TYPE_SERVICE);
+ }
+ } else {
+ if (!"lib".equalsIgnoreCase(file.getName())) {
+ wsInfoList.addWSInfoItem(file, TYPE_SERVICE);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Method invoked from the scheduler to start the listener.
+ */
+ public void startListener() {
+ checkServices();
+ update();
+ }
+
+ /**
+ * Updates WSInfoList object.
+ */
+ public void update() {
+ wsInfoList.update();
+ }
+}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java?rev=382876&r1=382875&r2=382876&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java Fri Mar 3 07:55:53 2006
@@ -80,7 +80,7 @@
try {
Utils.fillAxisService(service, axisConfig);
} catch (Exception e) {
- log.info("Error in schema generating :" + e.getMessage());
+ log.info(Messages.getMessage("errorinscheamgen", e.getMessage()));
}
}
serviceList.add(service);
@@ -219,7 +219,7 @@
try {
zin.close();
} catch (IOException e) {
- log.info("error in closing input stream");
+ log.info(Messages.getMessage("errorininputstreamclose"));
}
}
}
@@ -246,7 +246,7 @@
try {
in.close();
} catch (IOException e) {
- log.info("error in cloasing input stream");
+ log.info(Messages.getMessage("errorininputstreamclose"));
}
}
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/scheduler/SchedulerTask.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/scheduler/SchedulerTask.java?rev=382876&r1=382875&r2=382876&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/scheduler/SchedulerTask.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/scheduler/SchedulerTask.java Fri Mar 3 07:55:53 2006
@@ -17,8 +17,7 @@
package org.apache.axis2.deployment.scheduler;
-import org.apache.axis2.deployment.listener.RepositoryListener;
-import org.apache.axis2.deployment.listener.RepositoryListenerImpl;
+import org.apache.axis2.deployment.RepositoryListener;
import java.util.TimerTask;
@@ -59,7 +58,7 @@
}
private void checkRepositary() {
- ((RepositoryListenerImpl) wsListener).startListener();
+ wsListener.startListener();
}
/**