You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/12/16 18:18:08 UTC
svn commit: r357187 [4/25] - in
/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: ./
addressing/ client/ client/async/ context/ deployment/ deployment/listener/
deployment/repository/util/ deployment/scheduler/ deployment/util/
descripti...
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=357187&r1=357186&r2=357187&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 Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * 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.
- */
+* 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.context;
@@ -20,7 +21,15 @@
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.addressing.MessageInformationHeaders;
import org.apache.axis2.addressing.RelatesTo;
-import org.apache.axis2.description.*;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.description.ModuleConfiguration;
+import org.apache.axis2.description.ModuleDescription;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.TransportOutDescription;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.engine.Handler;
import org.apache.axis2.soap.SOAP11Constants;
@@ -34,8 +43,8 @@
* MessageContext holds service specific state information.
*/
public class MessageContext extends AbstractContext {
-
public static final String TRANSPORT_HEADERS = "TRANSPORT_HEADERS";
+
/**
* Field TRANSPORT_OUT
*/
@@ -49,8 +58,7 @@
/**
* Field CHARACTER_SET_ENCODING
*/
- public static final String CHARACTER_SET_ENCODING =
- "CHARACTER_SET_ENCODING";
+ public static final String CHARACTER_SET_ENCODING = "CHARACTER_SET_ENCODING";
/**
* Field UTF_8.
@@ -65,20 +73,27 @@
public static final String UTF_16 = "utf-16";
/**
+ * Field TRANSPORT_SUCCEED
+ */
+ public static final String TRANSPORT_SUCCEED = "TRANSPORT_SUCCEED";
+
+ /**
* Field DEFAULT_CHAR_SET_ENCODING.
* This is the default value for CHARACTER_SET_ENCODING property.
*/
public static final String DEFAULT_CHAR_SET_ENCODING = UTF_8;
/**
- * Field TRANSPORT_SUCCEED
+ * Field processingFault
*/
- public static final String TRANSPORT_SUCCEED = "TRANSPORT_SUCCEED";
+ private boolean processingFault = false;
+ private boolean paused = false;
+ public boolean outPutWritten = false;
/**
- * Field processingFault
+ * Field newThreadRequired
*/
- private boolean processingFault = false;
+ private boolean newThreadRequired = false;
/**
* Addressing Information for Axis 2
@@ -86,25 +101,38 @@
* the transport. Then later a addressing handler will make relevant changes to this, if addressing
* information is present in the SOAP header.
*/
-
private MessageInformationHeaders messageInformationHeaders = new MessageInformationHeaders();
+ private boolean isSOAP11 = true;
- private OperationContext operationContext;
- private ServiceContext serviceContext;
- private ServiceGroupContext serviceGroupContext;
+ /**
+ * The chain of Handlers/Phases for processing this message
+ */
+ private ArrayList executionChain = new ArrayList();
+ // Are we doing REST now?
+ private boolean doingREST = false;
+
+ // Are we doing MTOM now?
+ private boolean doingMTOM = false;
+ QName transportInName = null;
+ QName transportOutname = null;
+ String serviceGroupId = null;
+ String axisServiceName = null;
+ QName axisOperationName = null;
private transient AxisOperation axisOperation;
private transient AxisService axisService;
private transient AxisServiceGroup axisServiceGroup;
private ConfigurationContext configurationContext;
- private transient TransportInDescription transportIn;
- private transient TransportOutDescription transportOut;
+ /**
+ * Index into the execution chain of the currently executing handler
+ */
+ private int currentHandlerIndex;
/**
- * Field sessionContext
+ * Index into the current Phase of the currently executing handler (if any)
*/
- private final SessionContext sessionContext;
+ private int currentPhaseIndex;
/**
* Field service
@@ -116,69 +144,36 @@
private SOAPEnvelope envelope;
/**
- * Field responseWritten
- */
- private boolean responseWritten;
-
- /**
* Field inFaultFlow
*/
private boolean inFaultFlow;
+ private OperationContext operationContext;
/**
- * Field serverSide
+ * Field responseWritten
*/
- private boolean serverSide;
+ private boolean responseWritten;
/**
- * Field newThreadRequired
+ * Field serverSide
*/
- private boolean newThreadRequired = false;
-
- private boolean paused = false;
-
- public boolean outPutWritten = false;
-
+ private boolean serverSide;
+ private ServiceContext serviceContext;
private String serviceContextID;
+ private ServiceGroupContext serviceGroupContext;
/**
- * The chain of Handlers/Phases for processing this message
- */
- private ArrayList executionChain = new ArrayList();
-
- /**
- * Index into the execution chain of the currently executing handler
+ * This will hold a key to retrieve the correct ServiceGroupContext.
*/
- private int currentHandlerIndex;
+ private String serviceGroupContextId;
/**
- * Index into the current Phase of the currently executing handler (if any)
+ * Field sessionContext
*/
- private int currentPhaseIndex;
-
+ private final SessionContext sessionContext;
private String soapAction;
-
- //Are we doing MTOM now?
- private boolean doingMTOM = false;
- //Are we doing REST now?
- private boolean doingREST = false;
-
- private boolean isSOAP11 = true;
-
- /**
- * This will hold a key to retrieve the correct ServiceGroupContext.
- */
- private String serviceGroupContextId;
-
- QName transportInName = null;
-
- QName transportOutname = null;
-
- String serviceGroupId = null;
-
- String axisServiceName = null;
-
- QName axisOperationName = null;
+ private transient TransportInDescription transportIn;
+ private transient TransportOutDescription transportOut;
/**
* Convenience Constructor. Before calling engine.send() or engine.receive(), one must send
@@ -186,15 +181,12 @@
*
* @param engineContext
*/
-
public MessageContext(ConfigurationContext engineContext) {
this(engineContext, null, null, null);
}
- public MessageContext(
- ConfigurationContext engineContext,
- TransportInDescription transportIn,
- TransportOutDescription transportOut) {
+ public MessageContext(ConfigurationContext engineContext, TransportInDescription transportIn,
+ TransportOutDescription transportOut) {
this(engineContext, null, transportIn, transportOut);
this.transportInName = transportIn.getName();
this.transportOutname = transportOut.getName();
@@ -205,12 +197,9 @@
* @param transportIn
* @param transportOut
*/
-
- public MessageContext(
- ConfigurationContext engineContext,
- SessionContext sessionContext,
- TransportInDescription transportIn,
- TransportOutDescription transportOut) {
+ public MessageContext(ConfigurationContext engineContext, SessionContext sessionContext,
+ TransportInDescription transportIn,
+ TransportOutDescription transportOut) {
super(null);
if (sessionContext == null) {
@@ -218,274 +207,393 @@
} else {
this.sessionContext = sessionContext;
}
+
this.transportIn = transportIn;
this.transportOut = transportOut;
this.configurationContext = engineContext;
- if (transportIn != null)
+ if (transportIn != null) {
this.transportInName = transportIn.getName();
- if (transportOut != null)
+ }
+
+ if (transportOut != null) {
this.transportOutname = transportOut.getName();
+ }
}
public void invoke() throws AxisFault {
- if (currentHandlerIndex == -1) currentHandlerIndex = 0;
+ if (currentHandlerIndex == -1) {
+ currentHandlerIndex = 0;
+ }
+
while (currentHandlerIndex < executionChain.size()) {
Handler currentHandler = (Handler) executionChain.get(currentHandlerIndex);
+
currentHandler.invoke(this);
+
if (paused) {
break;
}
+
currentHandlerIndex++;
}
}
- public ArrayList getExecutionChain() {
- return executionChain;
- }
-
- /**
- * Set the execution chain of Handler in this MessageContext. Doing this causes
- * the current handler/phase indexes to reset to 0, since we have new Handlers to
- * execute (this usually only happens at initialization and when a fault occurs).
- *
- * @param executionChain
- */
- public void setExecutionChain(ArrayList executionChain) {
- this.executionChain = executionChain;
- currentHandlerIndex = -1;
- currentPhaseIndex = 0;
- }
-
/**
- * @return Returns EndpointReference.
+ * Pause the execution of the current handler chain
*/
- public EndpointReference getFaultTo() {
- return messageInformationHeaders.getFaultTo();
+ public void pause() {
+ paused = true;
}
- /**
- * @return Returns EndpointReference.
- */
- public EndpointReference getFrom() {
- return messageInformationHeaders.getFrom();
+ public void resume() throws AxisFault {
+ paused = false;
+ invoke();
}
- /**
- * @return Returns boolean.
- */
- public boolean isInFaultFlow() {
- return inFaultFlow;
+ public AxisOperation getAxisOperation() {
+ return axisOperation;
}
- /**
- * @return Returns SOAPEnvelope.
- */
- public SOAPEnvelope getEnvelope() {
- return envelope;
+ public AxisService getAxisService() {
+ return axisService;
}
- /**
- * @return Returns message id.
- */
- public String getMessageID() {
- return messageInformationHeaders.getMessageId();
+ public AxisServiceGroup getAxisServiceGroup() {
+ return axisServiceGroup;
}
- /**
- * @return Returns boolean.
- */
- public boolean isProcessingFault() {
- return processingFault;
+ public ConfigurationContext getConfigurationContext() {
+ return configurationContext;
}
- /**
- * @return Returns RelatesTo.
- */
- public RelatesTo getRelatesTo() {
- return messageInformationHeaders.getRelatesTo();
+ public int getCurrentHandlerIndex() {
+ return currentHandlerIndex;
}
- /**
- * @return Returns EndpointReference.
- */
- public EndpointReference getReplyTo() {
- return messageInformationHeaders.getReplyTo();
+ public int getCurrentPhaseIndex() {
+ return currentPhaseIndex;
}
/**
- * @return Returns boolean.
+ * @return Returns SOAPEnvelope.
*/
- public boolean isResponseWritten() {
- return responseWritten;
+ public SOAPEnvelope getEnvelope() {
+ return envelope;
}
- /**
- * @return Returns boolean.
- */
- public boolean isServerSide() {
- return serverSide;
+ public ArrayList getExecutionChain() {
+ return executionChain;
}
/**
- * @return Returns SessionContext.
+ * @return Returns EndpointReference.
*/
- public SessionContext getSessionContext() {
- return sessionContext;
+ public EndpointReference getFaultTo() {
+ return messageInformationHeaders.getFaultTo();
}
/**
* @return Returns EndpointReference.
*/
- public EndpointReference getTo() {
- return messageInformationHeaders.getTo();
+ public EndpointReference getFrom() {
+ return messageInformationHeaders.getFrom();
}
/**
- * @param reference
+ * @return Returns message id.
*/
- public void setFaultTo(EndpointReference reference) {
- messageInformationHeaders.setFaultTo(reference);
+ public String getMessageID() {
+ return messageInformationHeaders.getMessageId();
}
- /**
- * @param reference
- */
- public void setFrom(EndpointReference reference) {
- messageInformationHeaders.setFrom(reference);
+ public MessageInformationHeaders getMessageInformationHeaders() {
+ return messageInformationHeaders;
}
/**
- * @param b
+ * Retrieves both module specific configuration parameters as well as other parameters.
+ * The order of search is as follows:
+ * <ol>
+ * <li> Search in module configurations inside corresponding operation descripton if its there </li>
+ * <li> Search in corresponding operation if its there </li>
+ * <li> Search in module configurations inside corresponding service description if its there </li>
+ * <li> Next search in Corresponding Service description if its there </li>
+ * <li> Next search in module configurations inside axisConfiguration </li>
+ * <li> Search in AxisConfiguration for parameters </li>
+ * <li> Next get the corresponding module and search for the parameters </li>
+ * <li> Search in HandlerDescription for the parameter </li>
+ * </ol>
+ * <p/>
+ * and the way of specifing module configuration is as follows
+ * <moduleConfig name="addressing">
+ * <parameter name="addressingPara" locked="false">N/A</parameter>
+ * </moduleConfig>
+ *
+ * @param key : Parameter Name
+ * @param moduleName : Name of the module
+ * @param handler <code>HandlerDescription</code>
+ * @return Parameter <code>Parameter</code>
*/
- public void setInFaultFlow(boolean b) {
- inFaultFlow = b;
- }
+ public Parameter getModuleParameter(String key, String moduleName, HandlerDescription handler) {
+ Parameter param;
+ ModuleConfiguration moduleConfig;
- /**
- * @param envelope
- */
- public void setEnvelope(SOAPEnvelope envelope) throws AxisFault {
- this.envelope = envelope;
- String soapNamespaceURI = envelope.getNamespace().getName();
- if (SOAP12Constants
- .SOAP_ENVELOPE_NAMESPACE_URI
- .equals(soapNamespaceURI)) {
- isSOAP11 = false;
- } else if (
- SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
- soapNamespaceURI)) {
- isSOAP11 = true;
- } else {
- throw new AxisFault("Unknown SOAP Version. Current Axis handles only SOAP 1.1 and SOAP 1.2 messages");
+ if (getAxisOperation() != null) {
+ AxisOperation opDesc = getAxisOperation();
+
+ moduleConfig = opDesc.getModuleConfig(new QName(moduleName));
+
+ if (moduleConfig != null) {
+ param = moduleConfig.getParameter(key);
+
+ if (param != null) {
+ return param;
+ } else {
+ param = opDesc.getParameter(key);
+
+ if (param != null) {
+ return param;
+ }
+ }
+ }
}
- }
+ if (getAxisService() != null) {
+ AxisService axisService = getAxisService();
- /**
- * @param string
- */
- public void setMessageID(String string) {
- messageInformationHeaders.setMessageId(string);
- }
+ moduleConfig = axisService.getModuleConfig(new QName(moduleName));
- /**
- * @param b
- */
- public void setProcessingFault(boolean b) {
- processingFault = b;
- }
+ if (moduleConfig != null) {
+ param = moduleConfig.getParameter(key);
- /**
- * @param reference
- */
- public void setRelatesTo(RelatesTo reference) {
- messageInformationHeaders.setRelatesTo(reference);
+ if (param != null) {
+ return param;
+ } else {
+ param = axisService.getParameter(key);
+
+ if (param != null) {
+ return param;
+ }
+ }
+ }
+ }
+
+ if (getAxisServiceGroup() != null) {
+ AxisServiceGroup axisServiceDesc = getAxisServiceGroup();
+
+ moduleConfig = axisServiceDesc.getModuleConfig(new QName(moduleName));
+
+ if (moduleConfig != null) {
+ param = moduleConfig.getParameter(key);
+
+ if (param != null) {
+ return param;
+ } else {
+ param = axisServiceDesc.getParameter(key);
+
+ if (param != null) {
+ return param;
+ }
+ }
+ }
+ }
+
+ AxisConfiguration baseConfig = configurationContext.getAxisConfiguration();
+
+ moduleConfig = baseConfig.getModuleConfig(new QName(moduleName));
+
+ if (moduleConfig != null) {
+ param = moduleConfig.getParameter(key);
+
+ if (param != null) {
+ return param;
+ } else {
+ param = baseConfig.getParameter(key);
+
+ if (param != null) {
+ return param;
+ }
+ }
+ }
+
+ ModuleDescription module = baseConfig.getModule(new QName(moduleName));
+
+ if (module != null) {
+ param = module.getParameter(key);
+
+ if (param != null) {
+ return param;
+ }
+ }
+
+ param = handler.getParameter(key);
+
+ return param;
}
- /**
- * @param referance
- */
- public void setReplyTo(EndpointReference referance) {
- messageInformationHeaders.setReplyTo(referance);
+ public OperationContext getOperationContext() {
+ return operationContext;
}
/**
- * @param b
+ * Retrieves configuration descriptor parameters at any level. The order of search is
+ * as follows:
+ * <ol>
+ * <li> Search in operation description if it exists </li>
+ * <li> If parameter is not found or if operationContext is null, search in
+ * AxisService </li>
+ * <li> If parameter is not found or if axisService is null, search in
+ * AxisConfiguration </li>
+ * </ol>
+ *
+ * @param key
+ * @return Parameter <code>Parameter</code>
*/
- public void setResponseWritten(boolean b) {
- responseWritten = b;
+ public Parameter getParameter(String key) {
+ Parameter param = null;
+
+ if (getAxisOperation() != null) {
+ AxisOperation opDesc = getAxisOperation();
+
+ param = opDesc.getParameter(key);
+
+ if (param != null) {
+ return param;
+ }
+ }
+
+ if (getAxisService() != null) {
+ AxisService axisService = getAxisService();
+
+ param = axisService.getParameter(key);
+
+ if (param != null) {
+ return param;
+ }
+ }
+
+ if (getAxisServiceGroup() != null) {
+ AxisServiceGroup axisServiceDesc = getAxisServiceGroup();
+
+ param = axisServiceDesc.getParameter(key);
+
+ if (param != null) {
+ return param;
+ }
+ }
+
+ if (configurationContext != null) {
+ AxisConfiguration baseConfig = configurationContext.getAxisConfiguration();
+
+ param = baseConfig.getParameter(key);
+ }
+
+ return param;
}
/**
- * @param b
+ * Retrieves a property. The order of search is as follows:
+ * <p/>
+ * <ol>
+ * <li> Search in OperationContext, </li>
+ * <li> If OperationContext is null or if property is not found, search in ServiceContext,</li>
+ * <li> If ServiceContext is null or if property is not found, search in ServiceGroupContext,</li>
+ * <li> If ServiceGroupContext is null or if property is not found, search in ConfigurationContext.</li>
+ * </ol>
+ *
+ * @param key property Name
+ * @return Object
*/
- public void setServerSide(boolean b) {
- serverSide = b;
+ public Object getProperty(String key) {
+
+ // search in MC
+ Object obj = super.getProperty(key);
+
+ if (obj != null) {
+ return obj;
+ }
+
+ // The context hirachy might not have constructed fully, the check should
+ // look for the disconnected grandparents
+ // Search in Operation Context
+ if (operationContext != null) {
+ return operationContext.getProperty(key);
+ }
+
+ // Search in ServiceContext
+ if (serviceContext != null) {
+ return serviceContext.getProperty(key);
+ }
+
+ if (serviceGroupContext != null) {
+ return serviceGroupContext.getProperty(key);
+ }
+
+ if (configurationContext != null) {
+
+ // search in Configuration Context
+ return configurationContext.getProperty(key);
+ }
+
+ return obj;
}
/**
- * @param referance
+ * @return Returns RelatesTo.
*/
- public void setTo(EndpointReference referance) {
- messageInformationHeaders.setTo(referance);
+ public RelatesTo getRelatesTo() {
+ return messageInformationHeaders.getRelatesTo();
}
/**
- * @return Returns boolean.
+ * @return Returns EndpointReference.
*/
- public boolean isNewThreadRequired() {
- return newThreadRequired;
+ public EndpointReference getReplyTo() {
+ return messageInformationHeaders.getReplyTo();
}
/**
- * @param b
+ * @return Returns ServiceContext.
*/
- public void setNewThreadRequired(boolean b) {
- newThreadRequired = b;
+ public ServiceContext getServiceContext() {
+ return serviceContext;
}
/**
- * Method getExecutionChain
+ * @return Returns the serviceContextID.
*/
-
- public void setWSAAction(String actionURI) {
- messageInformationHeaders.setAction(actionURI);
- }
-
- public String getWSAAction() {
- return messageInformationHeaders.getAction();
- }
-
- public void setWSAMessageId(String messageID) {
- messageInformationHeaders.setMessageId(messageID);
+ public String getServiceContextID() {
+ return serviceContextID;
}
- public String getWSAMessageId() {
- return messageInformationHeaders.getMessageId();
+ public ServiceGroupContext getServiceGroupContext() {
+ return serviceGroupContext;
}
- public MessageInformationHeaders getMessageInformationHeaders() {
- return messageInformationHeaders;
+ public String getServiceGroupContextId() {
+ return serviceGroupContextId;
}
/**
- * @return Returns boolean.
+ * @return Returns SessionContext.
*/
- public boolean isPaused() {
- return paused;
+ public SessionContext getSessionContext() {
+ return sessionContext;
}
/**
- * Pause the execution of the current handler chain
+ * @return Returns soap action.
*/
- public void pause() {
- paused = true;
+ public String getSoapAction() {
+ return soapAction;
}
- public void resume() throws AxisFault {
- paused = false;
- invoke();
+ /**
+ * @return Returns EndpointReference.
+ */
+ public EndpointReference getTo() {
+ return messageInformationHeaders.getTo();
}
/**
@@ -502,392 +610,333 @@
return transportOut;
}
- /**
- * @param in
- */
- public void setTransportIn(TransportInDescription in) {
- transportIn = in;
- if (in != null)
- this.transportInName = in.getName();
- }
-
- /**
- * @param out
- */
- public void setTransportOut(TransportOutDescription out) {
- transportOut = out;
- if (out != null)
- this.transportOutname = out.getName();
+ public String getWSAAction() {
+ return messageInformationHeaders.getAction();
}
- public OperationContext getOperationContext() {
- return operationContext;
+ public String getWSAMessageId() {
+ return messageInformationHeaders.getMessageId();
}
/**
- * @param context
+ * @return Returns boolean.
*/
- public void setOperationContext(OperationContext context) {
- operationContext = context;
- if (serviceContext != null && operationContext.getParent() == null) {
- operationContext.setParent(serviceContext);
- }
- this.setParent(operationContext);
- if (operationContext != null) {
- this.setAxisOperation(operationContext.getAxisOperation());
- }
+ public boolean isDoingMTOM() {
+ return doingMTOM;
}
/**
* @return Returns boolean.
*/
- public boolean isOutPutWritten() {
- return outPutWritten;
+ public boolean isDoingREST() {
+ return doingREST;
}
/**
- * @param b
+ * @return Returns boolean.
*/
- public void setOutPutWritten(boolean b) {
- outPutWritten = b;
+ public boolean isInFaultFlow() {
+ return inFaultFlow;
}
/**
- * @return Returns the serviceContextID.
+ * @return Returns boolean.
*/
- public String getServiceContextID() {
- return serviceContextID;
+ public boolean isNewThreadRequired() {
+ return newThreadRequired;
}
/**
- * Sets the service context id.
- *
- * @param serviceContextID
+ * @return Returns boolean.
*/
- public void setServiceContextID(String serviceContextID) {
- this.serviceContextID = serviceContextID;
- }
-
- public ConfigurationContext getConfigurationContext() {
- return configurationContext;
+ public boolean isOutPutWritten() {
+ return outPutWritten;
}
/**
- * @return Returns ServiceContext.
+ * @return Returns boolean.
*/
- public ServiceContext getServiceContext() {
- return serviceContext;
+ public boolean isPaused() {
+ return paused;
}
/**
- * @param context
+ * @return Returns boolean.
*/
- public void setConfigurationContext(ConfigurationContext context) {
- configurationContext = context;
+ public boolean isProcessingFault() {
+ return processingFault;
}
/**
- * @param context
+ * @return Returns boolean.
*/
- public void setServiceContext(ServiceContext context) {
- serviceContext = context;
- if (operationContext != null && operationContext.getParent() != null) {
- operationContext.setParent(context);
- }
- this.setAxisService(context.getAxisService());
+ public boolean isResponseWritten() {
+ return responseWritten;
}
+ public boolean isSOAP11() {
+ return isSOAP11;
+ }
/**
- * Retrieves configuration descriptor parameters at any level. The order of search is
- * as follows:
- * <ol>
- * <li> Search in operation description if it exists </li>
- * <li> If parameter is not found or if operationContext is null, search in
- * AxisService </li>
- * <li> If parameter is not found or if axisService is null, search in
- * AxisConfiguration </li>
- * </ol>
- *
- * @param key
- * @return Parameter <code>Parameter</code>
+ * @return Returns boolean.
*/
- public Parameter getParameter(String key) {
- Parameter param = null;
- if (getAxisOperation() != null) {
- AxisOperation opDesc = getAxisOperation();
- param = opDesc.getParameter(key);
- if (param != null) {
- return param;
- }
- }
- if (getAxisService() != null) {
- AxisService axisService = getAxisService();
- param = axisService.getParameter(key);
- if (param != null) {
- return param;
- }
- }
- if (getAxisServiceGroup() != null) {
- AxisServiceGroup axisServiceDesc = getAxisServiceGroup();
- param = axisServiceDesc.getParameter(key);
- if (param != null) {
- return param;
- }
- }
- if (configurationContext != null) {
- AxisConfiguration baseConfig =
- configurationContext.getAxisConfiguration();
- param = baseConfig.getParameter(key);
- }
- return param;
+ public boolean isServerSide() {
+ return serverSide;
}
-
- /**
- * Retrieves both module specific configuration parameters as well as other parameters.
- * The order of search is as follows:
- * <ol>
- * <li> Search in module configurations inside corresponding operation descripton if its there </li>
- * <li> Search in corresponding operation if its there </li>
- * <li> Search in module configurations inside corresponding service description if its there </li>
- * <li> Next search in Corresponding Service description if its there </li>
- * <li> Next search in module configurations inside axisConfiguration </li>
- * <li> Search in AxisConfiguration for parameters </li>
- * <li> Next get the corresponding module and search for the parameters </li>
- * <li> Search in HandlerDescription for the parameter </li>
- * </ol>
- * <p/>
- * and the way of specifing module configuration is as follows
- * <moduleConfig name="addressing">
- * <parameter name="addressingPara" locked="false">N/A</parameter>
- * </moduleConfig>
- *
- * @param key : Parameter Name
- * @param moduleName : Name of the module
- * @param handler <code>HandlerDescription</code>
- * @return Parameter <code>Parameter</code>
- */
- public Parameter getModuleParameter(String key, String moduleName, HandlerDescription handler) {
- Parameter param;
- ModuleConfiguration moduleConfig;
- if (getAxisOperation() != null) {
- AxisOperation opDesc = getAxisOperation();
- moduleConfig = opDesc.getModuleConfig(new QName(moduleName));
- if (moduleConfig != null) {
- param = moduleConfig.getParameter(key);
- if (param != null) {
- return param;
- } else {
- param = opDesc.getParameter(key);
- if (param != null) {
- return param;
- }
- }
- }
- }
- if (getAxisService() != null) {
- AxisService axisService = getAxisService();
- moduleConfig = axisService.getModuleConfig(new QName(moduleName));
- if (moduleConfig != null) {
- param = moduleConfig.getParameter(key);
- if (param != null) {
- return param;
- } else {
- param = axisService.getParameter(key);
- if (param != null) {
- return param;
- }
- }
- }
- }
- if (getAxisServiceGroup() != null) {
- AxisServiceGroup axisServiceDesc = getAxisServiceGroup();
- moduleConfig = axisServiceDesc.getModuleConfig(new QName(moduleName));
- if (moduleConfig != null) {
- param = moduleConfig.getParameter(key);
- if (param != null) {
- return param;
- } else {
- param = axisServiceDesc.getParameter(key);
- if (param != null) {
- return param;
- }
- }
- }
- }
- AxisConfiguration baseConfig = configurationContext.getAxisConfiguration();
- moduleConfig = baseConfig.getModuleConfig(new QName(moduleName));
- if (moduleConfig != null) {
- param = moduleConfig.getParameter(key);
- if (param != null) {
- return param;
- } else {
- param = baseConfig.getParameter(key);
- if (param != null) {
- return param;
- }
- }
- }
- ModuleDescription module = baseConfig.getModule(new QName(moduleName));
- if (module != null) {
- param = module.getParameter(key);
- if (param != null) {
- return param;
- }
+ public void setAxisOperation(AxisOperation axisOperation) {
+ this.axisOperation = axisOperation;
+ this.axisOperationName = axisOperation.getName();
+
+ if (axisOperation != null) {
+ this.axisOperationName = axisOperation.getName();
}
- param = handler.getParameter(key);
- return param;
}
- /**
- * Retrieves a property. The order of search is as follows:
- * <p/>
- * <ol>
- * <li> Search in OperationContext, </li>
- * <li> If OperationContext is null or if property is not found, search in ServiceContext,</li>
- * <li> If ServiceContext is null or if property is not found, search in ServiceGroupContext,</li>
- * <li> If ServiceGroupContext is null or if property is not found, search in ConfigurationContext.</li>
- * </ol>
- *
- * @param key property Name
- * @return Object
- */
- public Object getProperty(String key) {
- // search in MC
- Object obj = super.getProperty(key);
- if (obj != null) {
- return obj;
- }
- //The context hirachy might not have constructed fully, the check should
- //look for the disconnected grandparents
- // Search in Operation Context
- if (operationContext != null) {
- return operationContext.getProperty(key);
- }
- //Search in ServiceContext
- if (serviceContext != null) {
- return serviceContext.getProperty(key);
- }
- if (serviceGroupContext != null) {
- return serviceGroupContext.getProperty(key);
+ public void setAxisService(AxisService axisService) {
+ this.axisService = axisService;
+
+ if (axisService != null) {
+ this.axisServiceName = axisService.getName();
}
- if (configurationContext != null) {
- // search in Configuration Context
- return configurationContext.getProperty(key);
+ }
+
+ public void setAxisServiceGroup(AxisServiceGroup axisServiceGroup) {
+ if (axisServiceGroup != null) {
+ this.serviceGroupId = axisServiceGroup.getServiceGroupName();
+ this.axisServiceGroup = axisServiceGroup;
}
- return obj;
}
- public int getCurrentHandlerIndex() {
- return currentHandlerIndex;
+ /**
+ * @param context
+ */
+ public void setConfigurationContext(ConfigurationContext context) {
+ configurationContext = context;
}
public void setCurrentHandlerIndex(int currentHandlerIndex) {
this.currentHandlerIndex = currentHandlerIndex;
}
- public int getCurrentPhaseIndex() {
- return currentPhaseIndex;
- }
-
public void setCurrentPhaseIndex(int currentPhaseIndex) {
this.currentPhaseIndex = currentPhaseIndex;
}
/**
- * @return Returns soap action.
+ * @param b
*/
- public String getSoapAction() {
- return soapAction;
+ public void setDoingMTOM(boolean b) {
+ doingMTOM = b;
}
/**
- * @param string
+ * @param b
*/
- public void setSoapAction(String string) {
- soapAction = string;
+ public void setDoingREST(boolean b) {
+ doingREST = b;
}
/**
- * @return Returns boolean.
+ * @param envelope
*/
- public boolean isDoingMTOM() {
- return doingMTOM;
+ public void setEnvelope(SOAPEnvelope envelope) throws AxisFault {
+ this.envelope = envelope;
+
+ String soapNamespaceURI = envelope.getNamespace().getName();
+
+ if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapNamespaceURI)) {
+ isSOAP11 = false;
+ } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapNamespaceURI)) {
+ isSOAP11 = true;
+ } else {
+ throw new AxisFault(
+ "Unknown SOAP Version. Current Axis handles only SOAP 1.1 and SOAP 1.2 messages");
+ }
}
/**
- * @param b
+ * Set the execution chain of Handler in this MessageContext. Doing this causes
+ * the current handler/phase indexes to reset to 0, since we have new Handlers to
+ * execute (this usually only happens at initialization and when a fault occurs).
+ *
+ * @param executionChain
*/
- public void setDoingMTOM(boolean b) {
- doingMTOM = b;
+ public void setExecutionChain(ArrayList executionChain) {
+ this.executionChain = executionChain;
+ currentHandlerIndex = -1;
+ currentPhaseIndex = 0;
}
/**
- * @return Returns boolean.
+ * @param reference
*/
- public boolean isDoingREST() {
- return doingREST;
+ public void setFaultTo(EndpointReference reference) {
+ messageInformationHeaders.setFaultTo(reference);
+ }
+
+ /**
+ * @param reference
+ */
+ public void setFrom(EndpointReference reference) {
+ messageInformationHeaders.setFrom(reference);
}
/**
* @param b
*/
- public void setDoingREST(boolean b) {
- doingREST = b;
+ public void setInFaultFlow(boolean b) {
+ inFaultFlow = b;
}
- public boolean isSOAP11() {
- return isSOAP11;
+ /**
+ * @param string
+ */
+ public void setMessageID(String string) {
+ messageInformationHeaders.setMessageId(string);
}
- public ServiceGroupContext getServiceGroupContext() {
- return serviceGroupContext;
+ /**
+ * @param b
+ */
+ public void setNewThreadRequired(boolean b) {
+ newThreadRequired = b;
}
- public void setServiceGroupContext(ServiceGroupContext serviceGroupContext) {
- this.serviceGroupContext = serviceGroupContext;
+ /**
+ * @param context
+ */
+ public void setOperationContext(OperationContext context) {
+ operationContext = context;
+
+ if ((serviceContext != null) && (operationContext.getParent() == null)) {
+ operationContext.setParent(serviceContext);
+ }
+
+ this.setParent(operationContext);
+
+ if (operationContext != null) {
+ this.setAxisOperation(operationContext.getAxisOperation());
+ }
}
- public AxisOperation getAxisOperation() {
- return axisOperation;
+ /**
+ * @param b
+ */
+ public void setOutPutWritten(boolean b) {
+ outPutWritten = b;
}
- public void setAxisOperation(AxisOperation axisOperation) {
- this.axisOperation = axisOperation;
- this.axisOperationName = axisOperation.getName();
- if (axisOperation != null)
- this.axisOperationName = axisOperation.getName();
+ /**
+ * @param b
+ */
+ public void setProcessingFault(boolean b) {
+ processingFault = b;
}
- public AxisService getAxisService() {
- return axisService;
+ /**
+ * @param reference
+ */
+ public void setRelatesTo(RelatesTo reference) {
+ messageInformationHeaders.setRelatesTo(reference);
}
- public void setAxisService(AxisService axisService) {
- this.axisService = axisService;
- if (axisService != null)
- this.axisServiceName = axisService.getName();
+ /**
+ * @param referance
+ */
+ public void setReplyTo(EndpointReference referance) {
+ messageInformationHeaders.setReplyTo(referance);
}
- public AxisServiceGroup getAxisServiceGroup() {
- return axisServiceGroup;
+ /**
+ * @param b
+ */
+ public void setResponseWritten(boolean b) {
+ responseWritten = b;
}
- public void setAxisServiceGroup(AxisServiceGroup axisServiceGroup) {
- if (axisServiceGroup != null) {
- this.serviceGroupId = axisServiceGroup.getServiceGroupName();
- this.axisServiceGroup = axisServiceGroup;
+ /**
+ * @param b
+ */
+ public void setServerSide(boolean b) {
+ serverSide = b;
+ }
+
+ /**
+ * @param context
+ */
+ public void setServiceContext(ServiceContext context) {
+ serviceContext = context;
+
+ if ((operationContext != null) && (operationContext.getParent() != null)) {
+ operationContext.setParent(context);
}
+
+ this.setAxisService(context.getAxisService());
}
- public String getServiceGroupContextId() {
- return serviceGroupContextId;
+ /**
+ * Sets the service context id.
+ *
+ * @param serviceContextID
+ */
+ public void setServiceContextID(String serviceContextID) {
+ this.serviceContextID = serviceContextID;
+ }
+
+ public void setServiceGroupContext(ServiceGroupContext serviceGroupContext) {
+ this.serviceGroupContext = serviceGroupContext;
}
public void setServiceGroupContextId(String serviceGroupContextId) {
this.serviceGroupContextId = serviceGroupContextId;
}
+ /**
+ * @param string
+ */
+ public void setSoapAction(String string) {
+ soapAction = string;
+ }
+
+ /**
+ * @param referance
+ */
+ public void setTo(EndpointReference referance) {
+ messageInformationHeaders.setTo(referance);
+ }
+
+ /**
+ * @param in
+ */
+ public void setTransportIn(TransportInDescription in) {
+ transportIn = in;
+
+ if (in != null) {
+ this.transportInName = in.getName();
+ }
+ }
+
+ /**
+ * @param out
+ */
+ public void setTransportOut(TransportOutDescription out) {
+ transportOut = out;
+
+ if (out != null) {
+ this.transportOutname = out.getName();
+ }
+ }
+
+ /**
+ * Method getExecutionChain
+ */
+ public void setWSAAction(String actionURI) {
+ messageInformationHeaders.setAction(actionURI);
+ }
+ public void setWSAMessageId(String messageID) {
+ messageInformationHeaders.setMessageId(messageID);
+ }
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContextConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContextConstants.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContextConstants.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContextConstants.java Fri Dec 16 09:13:57 2005
@@ -19,8 +19,7 @@
*/
public interface MessageContextConstants {
- // this will contain the keys of all the properties that will be in the message context
-
+ // this will contain the keys of all the properties that will be in the message context
public static final String TRANSPORT_URL = "TransportURL";
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/OperationContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/OperationContext.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/OperationContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/OperationContext.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * 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.
- */
+* 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.context;
@@ -38,26 +39,26 @@
* creation in the OperationContexFactory.
*/
public class OperationContext extends AbstractContext {
-
-
- private HashMap messageContexts;
+ private boolean isComplete = false;
// the in and out messages that may be present
-// private MessageContext inMessageContext;
-
-// private MessageContext outMessageContext;
-
+ // private MessageContext inMessageContext;
+ // private MessageContext outMessageContext;
// the AxisOperation of which this is a running instance. The MEP of this
// AxisOperation must be one of the 8 predefined ones in WSDL 2.0.
private transient AxisOperation axisOperation;
-
-
- private boolean isComplete = false;
+ private HashMap messageContexts;
// this is the global MessageID -> OperationContext map which is stored in
// the EngineContext. We're caching it here for faster acccess.
private Map operationContextMap;
+ public OperationContext(AxisOperation axisOperation) {
+ super(null);
+ this.messageContexts = new HashMap();
+ this.axisOperation = axisOperation;
+ }
+
/**
* Constructs a new OperationContext.
*
@@ -66,35 +67,55 @@
* @param serviceContext the parent ServiceContext representing any state related to
* the set of all operations of the service.
*/
- public OperationContext(AxisOperation axisOperation,
- ServiceContext serviceContext) {
+ public OperationContext(AxisOperation axisOperation, ServiceContext serviceContext) {
super(serviceContext);
this.messageContexts = new HashMap();
this.axisOperation = axisOperation;
- this.operationContextMap = getServiceContext().getConfigurationContext()
- .getOperationContextMap();
+ this.operationContextMap =
+ getServiceContext().getConfigurationContext().getOperationContextMap();
}
- public OperationContext(AxisOperation axisOperation) {
- super(null);
- this.messageContexts = new HashMap();
- this.axisOperation = axisOperation;
+ /**
+ * When a new message is added to the <code>MEPContext</code> the logic
+ * should be included remove the MEPContext from the table in the
+ * <code>EngineContext</code>. Example: IN_IN_OUT At the second IN
+ * message the MEPContext should be removed from the AxisOperation.
+ *
+ * @param msgContext
+ */
+ public synchronized void addMessageContext(MessageContext msgContext) throws AxisFault {
+ if (axisOperation != null) {
+ axisOperation.addMessageContext(msgContext, this);
+ }
}
/**
- * @return Returns the axisOperation.
+ * Removes the pointers to this <code>OperationContext</code> in the
+ * <code>EngineContext</code>'s OperationContextMap so that this
+ * <code>OperationContext</code> will eventually get garbage collected
+ * along with the <code>MessageContext</code>'s it contains. Note that if
+ * the caller wants to make sure its safe to clean up this OperationContext
+ * he should call isComplete() first. However, in cases like IN_OPTIONAL_OUT
+ * and OUT_OPTIONAL_IN, it is possibe this will get called without the MEP
+ * being complete due to the optional nature of the MEP.
*/
- public AxisOperation getAxisOperation() {
- return axisOperation;
+ public void cleanup() {
+ Iterator msgContexts = messageContexts.values().iterator();
+
+ while (msgContexts.hasNext()) {
+ MessageContext messageContext = (MessageContext) msgContexts.next();
+
+ if ((null != messageContext) && (operationContextMap != null)) {
+ operationContextMap.remove(messageContext.getMessageID());
+ }
+ }
}
/**
- * Returns the ServiceContext in which this OperationContext lives.
- *
- * @return parent ServiceContext
+ * @return Returns the axisOperation.
*/
- public ServiceContext getServiceContext() {
- return (ServiceContext) parent;
+ public AxisOperation getAxisOperation() {
+ return axisOperation;
}
/**
@@ -107,29 +128,27 @@
}
/**
- * When a new message is added to the <code>MEPContext</code> the logic
- * should be included remove the MEPContext from the table in the
- * <code>EngineContext</code>. Example: IN_IN_OUT At the second IN
- * message the MEPContext should be removed from the AxisOperation.
- *
- * @param msgContext
- */
- public synchronized void addMessageContext(MessageContext msgContext) throws AxisFault {
- if (axisOperation != null) {
- axisOperation.addMessageContext(msgContext, this);
- }
- }
-
- /**
* @param messageLabel
* @return
* @throws AxisFault
*/
-
public MessageContext getMessageContext(String messageLabel) throws AxisFault {
return (MessageContext) messageContexts.get(messageLabel);
}
+ public HashMap getMessageContexts() {
+ return messageContexts;
+ }
+
+ /**
+ * Returns the ServiceContext in which this OperationContext lives.
+ *
+ * @return parent ServiceContext
+ */
+ public ServiceContext getServiceContext() {
+ return (ServiceContext) parent;
+ }
+
/**
* Checks to see if the MEP is complete. i.e. whether all the messages that
* are associated with the MEP has arrived and MEP is complete.
@@ -142,35 +161,9 @@
isComplete = complete;
}
- /**
- * Removes the pointers to this <code>OperationContext</code> in the
- * <code>EngineContext</code>'s OperationContextMap so that this
- * <code>OperationContext</code> will eventually get garbage collected
- * along with the <code>MessageContext</code>'s it contains. Note that if
- * the caller wants to make sure its safe to clean up this OperationContext
- * he should call isComplete() first. However, in cases like IN_OPTIONAL_OUT
- * and OUT_OPTIONAL_IN, it is possibe this will get called without the MEP
- * being complete due to the optional nature of the MEP.
- */
- public void cleanup() {
- Iterator msgContexts = messageContexts.values().iterator();
- while (msgContexts.hasNext()) {
- MessageContext messageContext = (MessageContext) msgContexts.next();
- if (null != messageContext && operationContextMap != null) {
- operationContextMap.remove(messageContext.getMessageID());
- }
- }
-
- }
-
public void setParent(AbstractContext context) {
super.setParent(context);
- this.operationContextMap = getServiceContext().getConfigurationContext()
- .getOperationContextMap();
+ this.operationContextMap =
+ getServiceContext().getConfigurationContext().getOperationContextMap();
}
-
- public HashMap getMessageContexts() {
- return messageContexts;
- }
-
-}
\ No newline at end of file
+}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/OperationContextFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/OperationContextFactory.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/OperationContextFactory.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/OperationContextFactory.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * 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.
- */
+* 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.context;
@@ -24,53 +25,40 @@
/**
* This is the factory for OperationContext.
*/
-
public class OperationContextFactory implements WSDLConstants {
- public static OperationContext createOperationContext(
- int mepURI,
- AxisOperation axisOp,
- ServiceContext serviceContext)
- throws AxisFault {
- if (MEP_CONSTANT_IN_OUT == mepURI
- || MEP_CONSTANT_IN_ONLY == mepURI
- || MEP_CONSTANT_IN_OPTIONAL_OUT == mepURI
- || MEP_CONSTANT_ROBUST_IN_ONLY == mepURI
- || MEP_CONSTANT_OUT_ONLY == mepURI
- || MEP_CONSTANT_OUT_IN == mepURI
- || MEP_CONSTANT_OUT_OPTIONAL_IN == mepURI
- || MEP_CONSTANT_ROBUST_OUT_ONLY == mepURI) {
- return new OperationContext(axisOp, serviceContext);
-
- } else {
- throw new AxisFault(Messages.getMessage("unSupportedMEP","ID is "+ mepURI));
- }
- }
-
/**
* Creates the operation context. When you call this make sure you set the parent later.
+ *
* @param mepURI
* @param axisOp
* @return Returns OperationContext.
* @throws AxisFault
*/
- public static OperationContext createOperationContext(
- int mepURI,
- AxisOperation axisOp)
- throws AxisFault {
- if (MEP_CONSTANT_IN_OUT == mepURI
- || MEP_CONSTANT_IN_ONLY == mepURI
- || MEP_CONSTANT_IN_OPTIONAL_OUT == mepURI
- || MEP_CONSTANT_ROBUST_IN_ONLY == mepURI
- || MEP_CONSTANT_OUT_ONLY == mepURI
- || MEP_CONSTANT_OUT_IN == mepURI
- || MEP_CONSTANT_OUT_OPTIONAL_IN == mepURI
- || MEP_CONSTANT_ROBUST_OUT_ONLY == mepURI) {
+ public static OperationContext createOperationContext(int mepURI, AxisOperation axisOp)
+ throws AxisFault {
+ if ((MEP_CONSTANT_IN_OUT == mepURI) || (MEP_CONSTANT_IN_ONLY == mepURI)
+ || (MEP_CONSTANT_IN_OPTIONAL_OUT == mepURI)
+ || (MEP_CONSTANT_ROBUST_IN_ONLY == mepURI) || (MEP_CONSTANT_OUT_ONLY == mepURI)
+ || (MEP_CONSTANT_OUT_IN == mepURI) || (MEP_CONSTANT_OUT_OPTIONAL_IN == mepURI)
+ || (MEP_CONSTANT_ROBUST_OUT_ONLY == mepURI)) {
return new OperationContext(axisOp);
-
} else {
- throw new AxisFault(Messages.getMessage("unSupportedMEP","ID is "+ mepURI));
+ throw new AxisFault(Messages.getMessage("unSupportedMEP", "ID is " + mepURI));
}
}
+ public static OperationContext createOperationContext(int mepURI, AxisOperation axisOp,
+ ServiceContext serviceContext)
+ throws AxisFault {
+ if ((MEP_CONSTANT_IN_OUT == mepURI) || (MEP_CONSTANT_IN_ONLY == mepURI)
+ || (MEP_CONSTANT_IN_OPTIONAL_OUT == mepURI)
+ || (MEP_CONSTANT_ROBUST_IN_ONLY == mepURI) || (MEP_CONSTANT_OUT_ONLY == mepURI)
+ || (MEP_CONSTANT_OUT_IN == mepURI) || (MEP_CONSTANT_OUT_OPTIONAL_IN == mepURI)
+ || (MEP_CONSTANT_ROBUST_OUT_ONLY == mepURI)) {
+ return new OperationContext(axisOp, serviceContext);
+ } else {
+ throw new AxisFault(Messages.getMessage("unSupportedMEP", "ID is " + mepURI));
+ }
+ }
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * 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.
- */
+* 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.context;
@@ -26,22 +27,30 @@
* So do NOT use this as it might not live up to your expectation.
*/
public class ServiceContext extends AbstractContext {
-
private transient AxisService axisService;
-
private String serviceInstanceID;
-
- public ServiceContext(
- AxisService serviceConfig,
- ServiceGroupContext serviceGroupContext) {
+ public ServiceContext(AxisService serviceConfig, ServiceGroupContext serviceGroupContext) {
super(serviceGroupContext);
this.axisService = serviceConfig;
if (serviceConfig != null) {
serviceInstanceID = serviceConfig.getName();
}
+ }
+
+ public OperationContext createOperationContext(QName name) {
+ AxisOperation axisOp = axisService.getOperation(name);
+
+ return new OperationContext(axisOp, this);
+ }
+
+ public AxisService getAxisService() {
+ return axisService;
+ }
+ public ConfigurationContext getConfigurationContext() {
+ return (ConfigurationContext) parent.getParent();
}
/**
@@ -57,20 +66,8 @@
* @param serviceInstanceID
*/
public void setServiceInstanceID(String serviceInstanceID) {
- //todo we do not need this , this ID should equal to serviceName
- this.serviceInstanceID = serviceInstanceID;
- }
-
- public AxisService getAxisService() {
- return axisService;
- }
- public ConfigurationContext getConfigurationContext() {
- return (ConfigurationContext) parent.getParent();
- }
-
- public OperationContext createOperationContext(QName name) {
- AxisOperation axisOp = axisService.getOperation(name);
- return new OperationContext(axisOp, this);
+ // todo we do not need this , this ID should equal to serviceName
+ this.serviceInstanceID = serviceInstanceID;
}
}
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=357187&r1=357186&r2=357187&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 Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * 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.
- */
+* 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.context;
@@ -24,34 +25,21 @@
import java.util.Map;
public class ServiceGroupContext extends AbstractContext {
-
+ private String axisServiceGroupName = null;
+ private transient AxisServiceGroup axisServiceGroup;
private String id;
private Map serviceContextMap;
- private transient AxisServiceGroup axisServiceGroup;
- private String axisServiceGroupName = null;
-
public ServiceGroupContext(ConfigurationContext parent, AxisServiceGroup axisServiceGroup) {
super(parent);
this.axisServiceGroup = axisServiceGroup;
serviceContextMap = new HashMap();
- if (axisServiceGroup != null)
+ if (axisServiceGroup != null) {
this.axisServiceGroupName = axisServiceGroup.getServiceGroupName();
- fillServiceContexts();
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
+ }
- //if the service name is foo:bar , you should pass only bar
- public ServiceContext getServiceContext(String serviceName) {
- return (ServiceContext) serviceContextMap.get(serviceName);
+ fillServiceContexts();
}
/**
@@ -61,10 +49,12 @@
*/
private void fillServiceContexts() {
Iterator services = axisServiceGroup.getServices();
+
while (services.hasNext()) {
AxisService axisService = (AxisService) services.next();
ServiceContext serviceContext = new ServiceContext(axisService, this);
String serviceName = axisService.getName();
+
serviceContextMap.put(serviceName, serviceContext);
}
}
@@ -73,7 +63,20 @@
return axisServiceGroup;
}
+ public String getId() {
+ return id;
+ }
+
+ // if the service name is foo:bar , you should pass only bar
+ public ServiceContext getServiceContext(String serviceName) {
+ return (ServiceContext) serviceContextMap.get(serviceName);
+ }
+
public Iterator getServiceContexts() {
return serviceContextMap.values().iterator();
+ }
+
+ public void setId(String id) {
+ this.id = id;
}
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/SessionContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/SessionContext.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/SessionContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/SessionContext.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * 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.
- */
+* 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.context;
@@ -24,16 +25,14 @@
* Contexts, there are three context Global, Session and Message.
*/
public class SessionContext extends AbstractContext {
+
/**
* @param parent
*/
public SessionContext(AbstractContext parent) {
super(parent);
}
-
- public void init(AxisConfiguration axisConfiguration) throws AxisFault {
-
- }
-
+ public void init(AxisConfiguration axisConfiguration) throws AxisFault {
+ }
}