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 de...@apache.org on 2005/05/20 11:44:25 UTC
svn commit: r171090 - in
/webservices/axis/trunk/java/modules/core/src/org/apache/axis:
deployment/DeploymentEngine.java deployment/DeploymentParser.java
description/OperationDescription.java engine/Phase.java
phaseresolver/PhaseResolver.java
Author: deepal
Date: Fri May 20 02:44:24 2005
New Revision: 171090
URL: http://svn.apache.org/viewcvs?rev=171090&view=rev
Log:
added test cases
Modified:
webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/OperationDescription.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/Phase.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java?rev=171090&r1=171089&r2=171090&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java Fri May 20 02:44:24 2005
@@ -40,9 +40,7 @@
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import java.io.*;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
public class DeploymentEngine implements DeploymentConstants {
@@ -363,9 +361,31 @@
ArrayList list = currentArchiveFile.getModules();
for(int i = 0;i<list.size();i++){
ModuleDescription module = axisConfig.getModule((QName)list.get(i));
- serviceMetaData.engageModule(module);
+ if (module != null) {
+ serviceMetaData.engageModule(module);
+ } else {
+ throw new DeploymentException("Service " + serviceMetaData.getName().getLocalPart() +
+ " Refer to invalide module " + ((QName)list.get(i)).getLocalPart());
+ }
}
-
+
+ HashMap opeartions = serviceMetaData.getOperations();
+ Collection opCol = opeartions.values();
+ for (Iterator iterator = opCol.iterator(); iterator.hasNext();) {
+ OperationDescription opDesc = (OperationDescription) iterator.next();
+ ArrayList modules = opDesc.getModuleRefs();
+ for (int i = 0; i < modules.size(); i++) {
+ QName moduleName = (QName) modules.get(i);
+ ModuleDescription module = axisConfig.getModule(moduleName);
+ if(module != null) {
+ opDesc.engageModule(module);
+ } else {
+ throw new DeploymentException("Operation " + opDesc.getName().getLocalPart() +
+ " Refer to invalide module " + moduleName.getLocalPart());
+ }
+ }
+
+ }
///factory.createChains(serviceMetaData, axisConfig, );
System.out.println("adding new service : " + serviceMetaData.getName().getLocalPart());
} catch (PhaseException e) {
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java?rev=171090&r1=171089&r2=171090&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java Fri May 20 02:44:24 2005
@@ -646,9 +646,7 @@
if (dpengine.getModule(new QName(attvalue)) == null) {
throw new DeploymentException(ST + " module is invalid or dose not have bean deployed");
} else {
- throw new UnsupportedOperationException("not yet Implememt : Deepal");
- //operation.addModule(new QName(attvalue));
- //TODO Fix me Deepal
+ operation.addModule(new QName(attvalue));
}
}
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/OperationDescription.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/OperationDescription.java?rev=171090&r1=171089&r2=171090&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/OperationDescription.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/OperationDescription.java Fri May 20 02:44:24 2005
@@ -1,15 +1,12 @@
package org.apache.axis.description;
-import org.apache.axis.context.ConfigurationContext;
-import org.apache.axis.context.MessageContext;
-import org.apache.axis.context.OperationContext;
-import org.apache.axis.context.OperationContextFactory;
-import org.apache.axis.context.ServiceContext;
+import org.apache.axis.context.*;
import org.apache.axis.engine.AxisError;
import org.apache.axis.engine.AxisFault;
import org.apache.axis.engine.MessageReceiver;
import org.apache.axis.engine.Phase;
import org.apache.axis.phaseresolver.PhaseMetadata;
+import org.apache.axis.phaseresolver.PhaseResolver;
import org.apache.wsdl.WSDLConstants;
import org.apache.wsdl.WSDLOperation;
import org.apache.wsdl.impl.WSDLOperationImpl;
@@ -20,214 +17,211 @@
/**
* @author chathura@opensource.lk
- *
*/
public class OperationDescription extends WSDLOperationImpl implements
- ParameterInclude, WSDLOperation, DescriptionConstants,
- WSDLConstants {
+ ParameterInclude, WSDLOperation, DescriptionConstants,
+ WSDLConstants {
- private MessageReceiver messageReceiver;
+ private MessageReceiver messageReceiver;
private ArrayList remainingPhasesInFlow;
private ArrayList phasesOutFlow;
private ArrayList phasesInFaultFlow;
private ArrayList phasesOutFaultFlow;
-
- private int mep = MEP_CONSTANT_INVALID;
- public OperationDescription() {
- this.setMessageExchangePattern(MEP_URI_IN_OUT);
- this.setComponentProperty(PARAMETER_KEY, new ParameterIncludeImpl());
- this.setComponentProperty(MODULEREF_KEY, new ArrayList());
+ private int mep = MEP_CONSTANT_INVALID;
+
+ //To store deploytime module refs
+ private ArrayList modulerefs;
+
+ public OperationDescription() {
+ this.setMessageExchangePattern(MEP_URI_IN_OUT);
+ this.setComponentProperty(PARAMETER_KEY, new ParameterIncludeImpl());
+ this.setComponentProperty(MODULEREF_KEY, new ArrayList());
remainingPhasesInFlow = new ArrayList();
remainingPhasesInFlow.add(new Phase(PhaseMetadata.PHASE_POLICY_DETERMINATION));
-
+
phasesOutFlow = new ArrayList();
phasesOutFlow.add(new Phase(PhaseMetadata.PHASE_POLICY_DETERMINATION));
phasesOutFlow.add(new Phase(PhaseMetadata.PHASE_MESSAGE_OUT));
-
+
phasesInFaultFlow = new ArrayList();
phasesOutFaultFlow = new ArrayList();
- }
+ modulerefs = new ArrayList();
+ }
- public OperationDescription(QName name) {
- this();
- this.setName(name);
- }
+ public OperationDescription(QName name) {
+ this();
+ this.setName(name);
+ }
- /** To ebgage a module it is reuired to use this method
+ /**
+ * To ebgage a module it is reuired to use this method
+ *
* @param moduleref
* @throws AxisFault
*/
- public void engageModule(ModuleDescription moduleref) throws AxisFault {
- //TODO Fix me Deepal
- if (moduleref == null) {
+ public void engageModule(ModuleDescription moduleref) throws AxisFault {
+ if (moduleref == null) {
return;
}
Collection collectionModule = (Collection) this.getComponentProperty(MODULEREF_KEY);
collectionModule.add(moduleref);
- throw new UnsupportedOperationException("This is not implemanted yet : Deepal");
+ new PhaseResolver().engageModuleToOperation(this, moduleref);
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.axis.description.ServiceDescription#getEngadgedModules()
- */
-
- /**
- * Method getEngadgedModules
- *
- * @return
- */
- public Collection getModules() {
- return (Collection) this.getComponentProperty(MODULEREF_KEY);
- }
-
- /**
- * Method addParameter
- *
- * @param param
- * Parameter that will be added
- */
- public void addParameter(Parameter param) {
- if (param == null) {
- return;
- }
- ParameterIncludeImpl paramInclude = (ParameterIncludeImpl) this
- .getComponentProperty(PARAMETER_KEY);
- paramInclude.addParameter(param);
- }
-
- /**
- * Method getParameter
- *
- * @param name
- * Name of the parameter
- * @return
- */
- public Parameter getParameter(String name) {
- ParameterIncludeImpl paramInclude = (ParameterIncludeImpl) this
- .getComponentProperty(PARAMETER_KEY);
- return (Parameter) paramInclude.getParameter(name);
- }
-
- /**
- * This method is responsible for finding a MEPContext for an incomming
- * messages. An incomming message can be of two states.
- *
- * 1)This is a new incomming message of a given MEP. 2)This message is a
- * part of an MEP which has already begun.
- *
- * The method is special cased for the two MEPs
- *
- * #IN_ONLY #IN_OUT
- *
- * for two reasons. First reason is the wide usage and the second being that
- * the need for the MEPContext to be saved for further incomming messages.
- *
- * In the event that MEP of this operation is different from the two MEPs
- * deafulted above the decession of creating a new or this message relates
- * to a MEP which already in business is decided by looking at the WSA
- * Relates TO of the incomming message.
- *
- * @param msgContext
- * @return
- */
- public OperationContext findOperationContext(MessageContext msgContext,
- ServiceContext serviceContext, boolean serverside) throws AxisFault {
- OperationContext operationContext = null;
-
- if (null == msgContext.getRelatesTo()) {
- //Its a new incomming message so get the factory to create a new
- // one
- operationContext = OperationContextFactory.createMEPContext(
- getAxisSpecifMEPConstant(), serverside, this,
- serviceContext);
-
- } else {
- // So this message is part of an ongoing MEP
- // operationContext =
- ConfigurationContext configContext = msgContext.getSystemContext();
- operationContext = configContext.getOperationContext(
- msgContext.getRelatesTo().getValue());
-
- if (null == operationContext) {
- throw new AxisFault(
- "Cannot relate the message in the operation :"
- + this.getName()
- + " :Unrelated RelatesTO value "
- + msgContext.getRelatesTo().getValue());
- }
-
- }
-
- msgContext.getSystemContext().registerOperationContext(
- msgContext.getMessageID(), operationContext);
- operationContext.addMessageContext(msgContext);
- msgContext.setOperationContext(operationContext);
- if (operationContext.isComplete()) {
- operationContext.cleanup();
- }
-
- return operationContext;
-
- }
-
- public MessageReceiver getMessageReciever() {
- return messageReceiver;
- }
-
- public void setMessageReciever(MessageReceiver messageReceiver) {
- this.messageReceiver = messageReceiver;
- }
-
-
- /**
- * This method will simply map the String URI of the Message exchange
- * pattern to a integer. Further in the first lookup it will cash the looked
- * up value so that the subsequent method calls will be extremely efficient.
- *
- * @return
- */
- public int getAxisSpecifMEPConstant() {
- if (this.mep != MEP_CONSTANT_INVALID) {
- return this.mep;
- }
-
- int temp = MEP_CONSTANT_INVALID;
-
- if (MEP_URI_IN_OUT.equals(getMessageExchangePattern())) {
- temp = MEP_CONSTANT_IN_OUT;
- } else if (MEP_URI_IN_ONLY.equals(getMessageExchangePattern())) {
- temp = MEP_CONSTANT_IN_ONLY;
- } else if (MEP_URI_IN_OPTIONAL_OUT.equals(getMessageExchangePattern())) {
- temp = MEP_CONSTANT_IN_OPTIONAL_OUT;
- } else if (MEP_URI_OUT_IN.equals(getMessageExchangePattern())) {
- temp = MEP_CONSTANT_OUT_IN;
- } else if (MEP_URI_OUT_ONLY.equals(getMessageExchangePattern())) {
- temp = MEP_CONSTANT_OUT_ONLY;
- } else if (MEP_URI_OUT_OPTIONAL_IN.equals(getMessageExchangePattern())) {
- temp = MEP_CONSTANT_OUT_OPTIONAL_IN;
- } else if (MEP_URI_ROBUST_IN_ONLY.equals(getMessageExchangePattern())) {
- temp = MEP_CONSTANT_ROBUST_IN_ONLY;
- } else if (MEP_URI_ROBUST_OUT_ONLY.equals(getMessageExchangePattern())) {
- temp = MEP_CONSTANT_ROBUST_OUT_ONLY;
- }
-
- if(temp == MEP_CONSTANT_INVALID){
- throw new AxisError("Could not Map the MEP URI to a axis MEP constant value");
- }
- this.mep = temp;
- return this.mep;
-
- }
-
-
-
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.axis.description.ServiceDescription#getEngadgedModules()
+ */
+
+ /**
+ * Method getEngadgedModules
+ *
+ * @return
+ */
+ public Collection getModules() {
+ return (Collection) this.getComponentProperty(MODULEREF_KEY);
+ }
+
+ /**
+ * Method addParameter
+ *
+ * @param param Parameter that will be added
+ */
+ public void addParameter(Parameter param) {
+ if (param == null) {
+ return;
+ }
+ ParameterIncludeImpl paramInclude = (ParameterIncludeImpl) this
+ .getComponentProperty(PARAMETER_KEY);
+ paramInclude.addParameter(param);
+ }
+
+ /**
+ * Method getParameter
+ *
+ * @param name Name of the parameter
+ * @return
+ */
+ public Parameter getParameter(String name) {
+ ParameterIncludeImpl paramInclude = (ParameterIncludeImpl) this
+ .getComponentProperty(PARAMETER_KEY);
+ return (Parameter) paramInclude.getParameter(name);
+ }
+
+ /**
+ * This method is responsible for finding a MEPContext for an incomming
+ * messages. An incomming message can be of two states.
+ * <p/>
+ * 1)This is a new incomming message of a given MEP. 2)This message is a
+ * part of an MEP which has already begun.
+ * <p/>
+ * The method is special cased for the two MEPs
+ * <p/>
+ * #IN_ONLY #IN_OUT
+ * <p/>
+ * for two reasons. First reason is the wide usage and the second being that
+ * the need for the MEPContext to be saved for further incomming messages.
+ * <p/>
+ * In the event that MEP of this operation is different from the two MEPs
+ * deafulted above the decession of creating a new or this message relates
+ * to a MEP which already in business is decided by looking at the WSA
+ * Relates TO of the incomming message.
+ *
+ * @param msgContext
+ * @return
+ */
+ public OperationContext findOperationContext(MessageContext msgContext,
+ ServiceContext serviceContext, boolean serverside) throws AxisFault {
+ OperationContext operationContext = null;
+
+ if (null == msgContext.getRelatesTo()) {
+ //Its a new incomming message so get the factory to create a new
+ // one
+ operationContext = OperationContextFactory.createMEPContext(getAxisSpecifMEPConstant(), serverside, this,
+ serviceContext);
+
+ } else {
+ // So this message is part of an ongoing MEP
+ // operationContext =
+ ConfigurationContext configContext = msgContext.getSystemContext();
+ operationContext = configContext.getOperationContext(msgContext.getRelatesTo().getValue());
+
+ if (null == operationContext) {
+ throw new AxisFault("Cannot relate the message in the operation :"
+ + this.getName()
+ + " :Unrelated RelatesTO value "
+ + msgContext.getRelatesTo().getValue());
+ }
+
+ }
+
+ msgContext.getSystemContext().registerOperationContext(msgContext.getMessageID(), operationContext);
+ operationContext.addMessageContext(msgContext);
+ msgContext.setOperationContext(operationContext);
+ if (operationContext.isComplete()) {
+ operationContext.cleanup();
+ }
+
+ return operationContext;
+
+ }
+
+ public MessageReceiver getMessageReciever() {
+ return messageReceiver;
+ }
+
+ public void setMessageReciever(MessageReceiver messageReceiver) {
+ this.messageReceiver = messageReceiver;
+ }
+
+
+ /**
+ * This method will simply map the String URI of the Message exchange
+ * pattern to a integer. Further in the first lookup it will cash the looked
+ * up value so that the subsequent method calls will be extremely efficient.
+ *
+ * @return
+ */
+ public int getAxisSpecifMEPConstant() {
+ if (this.mep != MEP_CONSTANT_INVALID) {
+ return this.mep;
+ }
+
+ int temp = MEP_CONSTANT_INVALID;
+
+ if (MEP_URI_IN_OUT.equals(getMessageExchangePattern())) {
+ temp = MEP_CONSTANT_IN_OUT;
+ } else if (MEP_URI_IN_ONLY.equals(getMessageExchangePattern())) {
+ temp = MEP_CONSTANT_IN_ONLY;
+ } else if (MEP_URI_IN_OPTIONAL_OUT.equals(getMessageExchangePattern())) {
+ temp = MEP_CONSTANT_IN_OPTIONAL_OUT;
+ } else if (MEP_URI_OUT_IN.equals(getMessageExchangePattern())) {
+ temp = MEP_CONSTANT_OUT_IN;
+ } else if (MEP_URI_OUT_ONLY.equals(getMessageExchangePattern())) {
+ temp = MEP_CONSTANT_OUT_ONLY;
+ } else if (MEP_URI_OUT_OPTIONAL_IN.equals(getMessageExchangePattern())) {
+ temp = MEP_CONSTANT_OUT_OPTIONAL_IN;
+ } else if (MEP_URI_ROBUST_IN_ONLY.equals(getMessageExchangePattern())) {
+ temp = MEP_CONSTANT_ROBUST_IN_ONLY;
+ } else if (MEP_URI_ROBUST_OUT_ONLY.equals(getMessageExchangePattern())) {
+ temp = MEP_CONSTANT_ROBUST_OUT_ONLY;
+ }
+
+ if (temp == MEP_CONSTANT_INVALID) {
+ throw new AxisError("Could not Map the MEP URI to a axis MEP constant value");
+ }
+ this.mep = temp;
+ return this.mep;
+
+ }
+
+
/**
* @return
*/
@@ -283,6 +277,15 @@
public void setRemainingPhasesInFlow(ArrayList list) {
remainingPhasesInFlow = list;
}
+
+ public void addModule(QName moduleName) {
+ modulerefs.add(moduleName);
+ }
+
+ public ArrayList getModuleRefs() {
+ return modulerefs;
+ }
+
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/Phase.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/Phase.java?rev=171090&r1=171089&r2=171090&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/Phase.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/Phase.java Fri May 20 02:44:24 2005
@@ -279,13 +279,17 @@
} else {
handlers.add(handler.getHandler());
isonehanlder = true;
+ return;
}
} else if (handler.getRules().isPhaseFirst()) {
setPhaseFirst(handler.getHandler());
+ return;
} else if (handler.getRules().isPhaseLast()) {
setPhaseLast(handler.getHandler());
+ return;
} else {
insertHandler(handler);
+ return;
}
}
@@ -364,8 +368,8 @@
*/
private void insertAfter(Handler handler) {
String afterName = handler.getHandlerDesc().getRules().getAfter();
- if (phaseLast != null) {
- if (phaseLast.getHandlerDesc().getName().getLocalPart().equals(afterName)) {
+ if (phaseFirst != null) {
+ if (phaseFirst.getHandlerDesc().getName().getLocalPart().equals(afterName)) {
handlers.add(0, handler);
return;
}
@@ -406,33 +410,27 @@
* just add the entery to vector
*/
if ((phaseFirst != null) && (phaseLast != null)) {
- if ((phaseFirst.getHandlerDesc().getName().getLocalPart().equals(
- handler.getHandlerDesc().getRules().getAfter()))
- && (phaseLast.getHandlerDesc().getName().getLocalPart().equals(
- handler.getHandlerDesc().getRules().getBefore()))) {
+ if ((phaseFirst.getHandlerDesc().getName().getLocalPart().equals(handler.getHandlerDesc().getRules().getAfter()))
+ && (phaseLast.getHandlerDesc().getName().getLocalPart().equals(handler.getHandlerDesc().getRules().getBefore()))) {
handlers.add(handler);
return;
}
}
if (phaseFirst != null &&
- (phaseFirst.getHandlerDesc().getName().getLocalPart().equals(
- handler.getHandlerDesc().getRules().getAfter()))) {
+ (phaseFirst.getHandlerDesc().getName().getLocalPart().equals(handler.getHandlerDesc().getRules().getAfter()))) {
after = 0;
}
if (phaseLast != null &&
- (phaseLast.getHandlerDesc().getName().getLocalPart().equals(
- handler.getHandlerDesc().getRules().getBefore()))) {
+ (phaseLast.getHandlerDesc().getName().getLocalPart().equals(handler.getHandlerDesc().getRules().getBefore()))) {
before = handlers.size();
}
for (int i = 0; i < handlers.size(); i++) {
Handler temphandler = (Handler) handlers.get(i);
- if (handler.getHandlerDesc().getRules().getAfter().equals(
- temphandler.getHandlerDesc().getName().getLocalPart())) {
+ if (handler.getHandlerDesc().getRules().getAfter().equals(temphandler.getHandlerDesc().getName().getLocalPart())) {
after = i;
- } else if (handler.getHandlerDesc().getRules().getBefore().equals(
- temphandler.getHandlerDesc().getName().getLocalPart())) {
+ } else if (handler.getHandlerDesc().getRules().getBefore().equals(temphandler.getHandlerDesc().getName().getLocalPart())) {
before = i;
}
if ((after >= 0) && (before >= 0)) {
@@ -454,24 +452,53 @@
}
handlers.add(handler);
}
+
private void insertHandler(HandlerDescription handler) throws PhaseException {
- int type = getBeforeAfter(handler.getHandler());
- validateafter(handler.getHandler());
- validatebefore(handler.getHandler());
- switch(type){
- case BOTH_BEFORE_AFTER : {
- insertBeforeandAfter(handler.getHandler());
- }
- case BEFORE : {
- insertBefore(handler.getHandler());
- }
- case AFTER : {
- insertAfter(handler.getHandler());
- }
- case ANYWHERE : {
- handlers.add(handler.getHandler());
- }
+ Handler han = handler.getHandler();
+ int type = getBeforeAfter(han);
+ validateafter(han);
+ validatebefore(han);
+ switch (type) {
+ case BOTH_BEFORE_AFTER:
+ {
+ insertBeforeandAfter(han);
+ break;
+ }
+ case BEFORE:
+ {
+ insertBefore(han);
+ break;
+ }
+ case AFTER:
+ {
+ insertAfter(han);
+ break;
+ }
+ case ANYWHERE:
+ {
+ handlers.add(han);
+ break;
+ }
+ }
+ }
+
+ /**
+ * To get the all the handlers in the phase
+ * @return
+ */
+ public ArrayList getHandlers() {
+ ArrayList phaseHandlers = new ArrayList();
+ if (phaseFirst != null) {
+ phaseHandlers.add(phaseFirst);
+ }
+ for (int i = 0; i < handlers.size(); i++) {
+ Handler handler = (Handler) handlers.get(i);
+ phaseHandlers.add(handler);
+ }
+ if (phaseLast != null) {
+ phaseHandlers.add(phaseLast);
}
+ return phaseHandlers;
}
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java?rev=171090&r1=171089&r2=171090&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java Fri May 20 02:44:24 2005
@@ -89,44 +89,6 @@
}
}
- private void buildModuleHandlers(ArrayList allHandlers, ModuleDescription module, int flowtype) throws PhaseException {
- Flow flow = null;
- switch (flowtype) {
- case PhaseMetadata.IN_FLOW:
- {
- flow = module.getInFlow();
- break;
- }
- case PhaseMetadata.OUT_FLOW:
- {
- flow = module.getOutFlow();
- break;
- }
- case PhaseMetadata.FAULT_IN_FLOW:
- {
- flow = module.getFaultInFlow();
- break;
- }
- case PhaseMetadata.FAULT_OUT_FLOW:
- {
- flow = module.getFaultOutFlow();
- break;
- }
- }
- if (flow != null) {
- for (int j = 0; j < flow.getHandlerCount(); j++) {
- HandlerDescription metadata = flow.getHandler(j);
-
- if (!PhaseValidator.isSystemPhases(metadata.getRules().getPhaseName())) {
- allHandlers.add(metadata);
- } else {
- throw new PhaseException("Service specifi module can not refer system pre defined phases : "
- + metadata.getRules().getPhaseName());
- }
- }
- }
- }
-
/**
* this opeartion is used to build all the three cahins ,
* so type varible is used to difrenciate them
@@ -231,18 +193,6 @@
allHandlers.add(metadata);
}
}
- /* ///////////////////////////////////////////////////////////////////////////////////////
- ///////////////////// OPERATION MODULES ////////////////////////////////////////////////
- Collection opmodule = operation.getModules();
- Iterator opitr = opmodule.iterator();
- while (opitr.hasNext()) {
- QName moduleref = (QName) opitr.next();
- module = axisConfig.getModule(moduleref);
- if (module != null) {
- buildModuleHandlers(allHandlers, module, flowtype);
- }
- }*/
-
switch (flowtype) {
case PhaseMetadata.IN_FLOW:
{
@@ -356,7 +306,7 @@
break;
}
}
- if (flow != null) {
+ if (flow != null) {
ArrayList handlers = new ArrayList();
for (int j = 0; j < flow.getHandlerCount(); j++) {
HandlerDescription metadata = flow.getHandler(j);
@@ -532,64 +482,68 @@
Collection opCol = opeartions.values();
for (Iterator iterator = opCol.iterator(); iterator.hasNext();) {
OperationDescription opDesc = (OperationDescription) iterator.next();
- Flow flow = null;
- for (int type = 1; type < 5; type++) {
- switch (type) {
- case PhaseMetadata.IN_FLOW:
- {
- phaseHolder = new PhaseHolder(opDesc.getRemainingPhasesInFlow());
- break;
- }
- case PhaseMetadata.OUT_FLOW:
- {
- phaseHolder = new PhaseHolder(opDesc.getPhasesOutFlow());
- break;
- }
- case PhaseMetadata.FAULT_IN_FLOW:
- {
- phaseHolder = new PhaseHolder(opDesc.getPhasesInFaultFlow());
- break;
- }
- case PhaseMetadata.FAULT_OUT_FLOW:
- {
- phaseHolder = new PhaseHolder(opDesc.getPhasesOutFaultFlow());
- break;
- }
- }
- ////////////////////////////////////////////////////////////////////////////////////
- /////////////////// Modules refered by server.xml //////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////////
- switch (type) {
- case PhaseMetadata.IN_FLOW:
- {
- flow = module.getInFlow();
- break;
- }
- case PhaseMetadata.OUT_FLOW:
- {
- flow = module.getOutFlow();
- break;
- }
- case PhaseMetadata.FAULT_IN_FLOW:
- {
- flow = module.getFaultInFlow();
- break;
- }
- case PhaseMetadata.FAULT_OUT_FLOW:
- {
- flow = module.getFaultOutFlow();
- break;
- }
- }
- if (flow != null) {
- for (int j = 0; j < flow.getHandlerCount(); j++) {
- HandlerDescription metadata = flow.getHandler(j);
- if (!PhaseValidator.isSystemPhases(metadata.getRules().getPhaseName())) {
- phaseHolder.addHandler(metadata);
- } else {
- throw new PhaseException("Service specific module can not refer system pre defined phases : "
- + metadata.getRules().getPhaseName());
- }
+ engageModuleToOperation(opDesc,module);
+ }
+ }
+
+
+ public void engageModuleToOperation(OperationDescription operation, ModuleDescription module) throws PhaseException {
+ OperationDescription opDesc = operation;
+ Flow flow = null;
+ for (int type = 1; type < 5; type++) {
+ switch (type) {
+ case PhaseMetadata.IN_FLOW:
+ {
+ phaseHolder = new PhaseHolder(opDesc.getRemainingPhasesInFlow());
+ break;
+ }
+ case PhaseMetadata.OUT_FLOW:
+ {
+ phaseHolder = new PhaseHolder(opDesc.getPhasesOutFlow());
+ break;
+ }
+ case PhaseMetadata.FAULT_IN_FLOW:
+ {
+ phaseHolder = new PhaseHolder(opDesc.getPhasesInFaultFlow());
+ break;
+ }
+ case PhaseMetadata.FAULT_OUT_FLOW:
+ {
+ phaseHolder = new PhaseHolder(opDesc.getPhasesOutFaultFlow());
+ break;
+ }
+ }
+
+ switch (type) {
+ case PhaseMetadata.IN_FLOW:
+ {
+ flow = module.getInFlow();
+ break;
+ }
+ case PhaseMetadata.OUT_FLOW:
+ {
+ flow = module.getOutFlow();
+ break;
+ }
+ case PhaseMetadata.FAULT_IN_FLOW:
+ {
+ flow = module.getFaultInFlow();
+ break;
+ }
+ case PhaseMetadata.FAULT_OUT_FLOW:
+ {
+ flow = module.getFaultOutFlow();
+ break;
+ }
+ }
+ if (flow != null) {
+ for (int j = 0; j < flow.getHandlerCount(); j++) {
+ HandlerDescription metadata = flow.getHandler(j);
+ if (!PhaseValidator.isSystemPhases(metadata.getRules().getPhaseName())) {
+ phaseHolder.addHandler(metadata);
+ } else {
+ throw new PhaseException("Service specific module can not refer system pre defined phases : "
+ + metadata.getRules().getPhaseName());
}
}
}