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 di...@apache.org on 2005/09/15 21:07:03 UTC
svn commit: r289289 [20/134] - in /webservices/axis2/trunk/java: ./ etc/
modules/addressing/ modules/addressing/src/META-INF/
modules/addressing/src/org/apache/axis2/handlers/addressing/
modules/addressing/test-resources/ modules/addressing/test/org/ap...
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/Phase.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/Phase.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/Phase.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/Phase.java Thu Sep 15 11:52:11 2005
@@ -1,569 +1,569 @@
-/*
-* 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.engine;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.phaseresolver.PhaseException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.xml.namespace.QName;
-import java.util.ArrayList;
-
-/**
- * <p>This is Phase, a orderd collection of Handlers.
- * seems this is Handler Chain with order.</p>
- * Should this exttends Hanlders?
- */
-public class Phase {
- /**
- * Field phaseName
- */
- private String phaseName;
-
- /**
- * Field handlers
- */
- private ArrayList handlers;
-
- /**
- * Field log
- */
- private Log log = LogFactory.getLog(getClass());
-
- /**
- * to keet info about phase first handler
- */
- private Handler phaseFirst = null;
-
- /**
- * Field phasefirstset
- */
- private boolean phasefirstset;
-
- /**
- * to keet info about phase last handler
- */
- private Handler phaseLast = null;
-
- /**
- * Field phaselastset
- */
- private boolean phaselastset;
-
- /**
- * Field BOTH_BEFORE_AFTER
- */
- private static final int BOTH_BEFORE_AFTER = 0;
-
- /**
- * Field BEFORE
- */
- private static final int BEFORE = 1;
-
- /**
- * Field AFTER
- */
- private static final int AFTER = 2;
-
- /**
- * Field ANYWHERE
- */
- private static final int ANYWHERE = 3;
-
- /**
- * this is want if the phaseFirst and phaseLst same hanlder
- * that is for this phase there is only one phase
- */
- private boolean isonehanlder;
-
- /**
- * Constructor Phase
- *
- * @param phaseName
- */
- public Phase(String phaseName) {
- handlers = new ArrayList();
- this.phaseName = phaseName;
- }
-
- /**
- * Method addHandler
- *
- * @param handler
- * @param index
- */
- public void addHandler(Handler handler, int index) {
- log.info(
- "Handler " + handler.getName() + "Added to place " + 1 +
- " At the Phase " +
- phaseName);
- handlers.add(index, handler);
- }
-
- /**
- * add to next empty handler
- *
- * @param handler
- */
- public void addHandler(Handler handler) {
- log.info(
- "Handler " + handler.getName() + " Added to the Phase " +
- phaseName);
- handlers.add(handler);
- }
-
- /**
- * If need to see how this works look at the stack!
- *
- * @param msgctx
- * @throws org.apache.axis2.AxisFault
- */
- public void invoke(MessageContext msgctx) throws AxisFault {
- msgctx.setPausedPhaseName(this.getPhaseName());
- //If phase first Hnadler is there then it should run first
- if (phaseFirst != null) {
- if (msgctx.isPaused()) {
- return;
- } else {
- log.info("Invoke the Phase first handler "
- + phaseFirst.getName()
- + "with in the Phase "
- + phaseName);
- phaseFirst.invoke(msgctx);
- }
- }
- //Invoking the rest of handler except phaseFirst and phaseLast
- int indexOfHandlerToExecute = 0;
- while (indexOfHandlerToExecute < handlers.size()) {
- if (msgctx.isPaused()) {
- break;
- } else {
- Handler handler = (Handler) handlers.get(
- indexOfHandlerToExecute);
- if (handler != null) {
- log.info("Invoke the Handler "
- + handler.getName()
- + "with in the Phase "
- + phaseName);
- handler.invoke(msgctx);
- //This line should be after the invoke as if the invocation failed this handlers is takn care of and
- //no need to revoke agien
- indexOfHandlerToExecute++;
- }
- }
- }
- //If phase last handler is there will invoke that here
- if (phaseLast != null) {
- if (msgctx.isPaused()) {
- return;
- } else {
- log.info("Invoke the Phase first handler "
- + phaseLast.getName()
- + "with in the Phase "
- + phaseName);
- phaseLast.invoke(msgctx);
- }
- }
- }
-
- /**
- * @return Returns the name.
- */
- public String getPhaseName() {
- return phaseName;
- }
-
- public int getHandlerCount() {
- return handlers.size();
- }
-
- //////////////////////////////////////////////////////////////// FROM PhaseMetaData //////////
-
- /**
- * Method getBeforeAfter
- *
- * @param handler
- * @return
- * @throws org.apache.axis2.phaseresolver.PhaseException
- *
- */
- private int getBeforeAfter(Handler handler) throws PhaseException {
- if ((!handler.getHandlerDesc().getRules().getBefore().equals(""))
- &&
- (!handler.getHandlerDesc().getRules().getAfter().equals(""))) {
- if (handler
- .getHandlerDesc()
- .getRules()
- .getBefore()
- .equals(handler.getHandlerDesc().getRules().getAfter())) {
- throw new PhaseException("Both before and after cannot be the same for this handler"
- + handler.getName());
- }
- return BOTH_BEFORE_AFTER;
- } else if (!handler.getHandlerDesc().getRules().getBefore().equals("")) {
- return BEFORE;
- } else if (!handler.getHandlerDesc().getRules().getAfter().equals("")) {
- return AFTER;
- } else {
- return ANYWHERE;
- }
- }
-
- /**
- * Method setPhaseFirst
- *
- * @param phaseFirst
- * @throws PhaseException
- */
- public void setPhaseFirst(Handler phaseFirst) throws PhaseException {
- if (phasefirstset) {
- throw new PhaseException("PhaseFirst alredy has been set, cannot have two phaseFirst Handler for same phase "
- + this.getPhaseName());
- } else {
- if (getBeforeAfter(phaseFirst) != ANYWHERE) {
- throw new PhaseException("Handler with PhaseFirst can not have any before or after proprty error in "
- + phaseFirst.getName());
- } else {
- this.phaseFirst = phaseFirst;
- }
- phasefirstset = true;
- }
- }
-
- /**
- * Method setPhaseLast
- *
- * @param phaseLast
- * @throws PhaseException
- */
- public void setPhaseLast(Handler phaseLast) throws PhaseException {
- if (phaselastset) {
- throw new PhaseException("PhaseLast already has been set, cannot have two PhaseLast Handler for same phase "
- + this.getPhaseName());
- } else {
- if (getBeforeAfter(phaseLast) != ANYWHERE) {
- throw new PhaseException("Handler with PhaseLast property can not have any before or after property error in "
- + phaseLast.getName());
- } else {
- this.phaseLast = phaseLast;
- }
- phaselastset = true;
- }
- }
-
- /**
- * Method addHandler
- *
- * @param handler
- * @throws PhaseException
- */
- public void addHandler(HandlerDescription handler) throws PhaseException {
- if (isonehanlder) {
- throw new PhaseException(
- this.getPhaseName()
- + "can only have one handler, since there is a "
- + "handler with both phaseFirst and PhaseLast true ");
- } else {
- if (handler.getRules().isPhaseFirst() &&
- handler.getRules().isPhaseLast()) {
- if (handlers.size() > 0) {
- throw new PhaseException(
- this.getPhaseName()
- + " can not have more than one handler "
- + handler.getName()
- + " is invalid or incorrect phase rules");
- } 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;
- }
-
- }
- }
-
- /**
- * This method is to check whether user try to add a handler whose before property is
- * phaseFitsr handler , this cannot allowed , so this will throws an exception
- * otherewise it will retun
- *
- * @throws PhaseException
- */
- private void validatebefore(Handler handler) throws PhaseException {
- if (phaseFirst != null) {
- String phasFirstname = phaseFirst.getHandlerDesc().getName()
- .getLocalPart();
- if (handler.getHandlerDesc().getRules().getBefore().equals(
- phasFirstname)) {
- throw new PhaseException("Trying to insert a Handler "
- + handler.getName()
- + " before phaseFirst "
- + phasFirstname);
- }
- }
- }
-
- /**
- * This method is to check user try to add or plase a hander after the phaseLast
- * that operation dose not allowd so then this throw a exception
- *
- * @throws PhaseException
- */
- private void validateafter(Handler handler) throws PhaseException {
- if (phaseLast != null) {
- String phaseLastName = phaseLast.getHandlerDesc().getName()
- .getLocalPart();
- if (handler.getName().equals(phaseLastName)) {
- throw new PhaseException("Try to insert a Handler "
- + handler.getName()
- + " after phaseLast "
- + phaseLastName);
- }
- }
- }
-
- /**
- * Method insertBefore
- *
- * @param handler
- */
- private void insertBefore(Handler handler) {
- String beforename = handler.getHandlerDesc().getRules().getBefore();
- if (phaseLast != null) {
- if (phaseLast.getHandlerDesc().getName().getLocalPart().equals(
- beforename)) {
- handlers.add(handler);
- return;
- }
- }
- for (int i = 0; i < handlers.size(); i++) {
- Handler temphandler = (Handler) handlers.get(i);
- if (temphandler.getHandlerDesc().getName().getLocalPart().equals(
- beforename)) {
- if (i == 0) {
- handlers.add(0, handler);
- return;
- } else {
- handlers.add(i - 1, handler);
- return;
- }
- }
- }
- //added as last handler
- handlers.add(handler);
- }
-
- /**
- * Method insertAfter
- *
- * @param handler
- */
- private void insertAfter(Handler handler) {
- String afterName = handler.getHandlerDesc().getRules().getAfter();
- if (phaseFirst != null) {
- if (phaseFirst.getHandlerDesc().getName().getLocalPart().equals(
- afterName)) {
- handlers.add(0, handler);
- return;
- }
- }
- int count = handlers.size();
- for (int i = 0; i < count; i++) {
- Handler temphandler = (Handler) handlers.get(i);
- if (temphandler.getHandlerDesc().getName().getLocalPart().equals(
- afterName)) {
- if (i == count - 1) {
- handlers.add(handler);
- return;
- } else {
- handlers.add(i + 1, handler);
- return;
- }
- }
- }
- if (handlers.size() > 0) {
- handlers.add(0, handler);
- } else
- handlers.add(handler);
- }
-
- /**
- * This method assume that both the before and after cant be a same hander
- * that dose not check inside this , it should check befor calling this method
- *
- * @param handler
- * @throws PhaseException
- */
- private void insertBeforeandAfter(Handler handler) throws PhaseException {
- int before = -1;
- int after = -1;
-
- /**
- * if hander.after = PhaseFirts and hnder.before = phaselast then
- * 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()))) {
- handlers.add(handler);
- return;
- }
- }
-
- if (phaseFirst != null
- && (phaseFirst
- .getHandlerDesc()
- .getName()
- .getLocalPart()
- .equals(handler.getHandlerDesc().getRules().getAfter()))) {
- after = 0;
- }
- if (phaseLast != null
- && (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())) {
- after = i;
- } else if (
- handler.getHandlerDesc().getRules().getBefore().equals(
- temphandler.getHandlerDesc().getName()
- .getLocalPart())) {
- before = i;
- }
- if ((after >= 0) && (before >= 0)) {
- // no point of continue since both the before and after index has found
- if (after > before) {
- //TODO fix me Deepal , (have to check this)
- throw new PhaseException(
- "incorrect handler order for " +
- handler.getHandlerDesc().getName());
- } else {
- if (after + 1 <= handlers.size()) {
- handlers.add(after + 1, handler);
- return;
- } else {
- handlers.add(after, handler);
- return;
- }
- }
- }
- }
- handlers.add(handler);
- }
-
- private void insertHandler(HandlerDescription handler) throws PhaseException {
- 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;
- }
-
- public void invokeStartFromHandler(QName name, MessageContext msgctx) throws AxisFault {
- msgctx.setPausedPhaseName(this.getPhaseName());
- boolean foudMatch = false;
- ArrayList phaseHandlers = getHandlers();
- for (int i = 0; i < phaseHandlers.size(); i++) {
- Handler handler = (Handler) handlers.get(i);
- if (handler != null && handler.getName().equals(name)) {
- foudMatch = true;
- }
-
- if (handler != null && foudMatch) {
- handler.invoke(msgctx);
- }
- }
- }
-
- public String toString() {
- return this.getPhaseName();
- }
-
-}
+/*
+* 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.engine;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.phaseresolver.PhaseException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+
+/**
+ * <p>This is Phase, a orderd collection of Handlers.
+ * seems this is Handler Chain with order.</p>
+ * Should this exttends Hanlders?
+ */
+public class Phase {
+ /**
+ * Field phaseName
+ */
+ private String phaseName;
+
+ /**
+ * Field handlers
+ */
+ private ArrayList handlers;
+
+ /**
+ * Field log
+ */
+ private Log log = LogFactory.getLog(getClass());
+
+ /**
+ * to keet info about phase first handler
+ */
+ private Handler phaseFirst = null;
+
+ /**
+ * Field phasefirstset
+ */
+ private boolean phasefirstset;
+
+ /**
+ * to keet info about phase last handler
+ */
+ private Handler phaseLast = null;
+
+ /**
+ * Field phaselastset
+ */
+ private boolean phaselastset;
+
+ /**
+ * Field BOTH_BEFORE_AFTER
+ */
+ private static final int BOTH_BEFORE_AFTER = 0;
+
+ /**
+ * Field BEFORE
+ */
+ private static final int BEFORE = 1;
+
+ /**
+ * Field AFTER
+ */
+ private static final int AFTER = 2;
+
+ /**
+ * Field ANYWHERE
+ */
+ private static final int ANYWHERE = 3;
+
+ /**
+ * this is want if the phaseFirst and phaseLst same hanlder
+ * that is for this phase there is only one phase
+ */
+ private boolean isonehanlder;
+
+ /**
+ * Constructor Phase
+ *
+ * @param phaseName
+ */
+ public Phase(String phaseName) {
+ handlers = new ArrayList();
+ this.phaseName = phaseName;
+ }
+
+ /**
+ * Method addHandler
+ *
+ * @param handler
+ * @param index
+ */
+ public void addHandler(Handler handler, int index) {
+ log.info(
+ "Handler " + handler.getName() + "Added to place " + 1 +
+ " At the Phase " +
+ phaseName);
+ handlers.add(index, handler);
+ }
+
+ /**
+ * add to next empty handler
+ *
+ * @param handler
+ */
+ public void addHandler(Handler handler) {
+ log.info(
+ "Handler " + handler.getName() + " Added to the Phase " +
+ phaseName);
+ handlers.add(handler);
+ }
+
+ /**
+ * If need to see how this works look at the stack!
+ *
+ * @param msgctx
+ * @throws org.apache.axis2.AxisFault
+ */
+ public void invoke(MessageContext msgctx) throws AxisFault {
+ msgctx.setPausedPhaseName(this.getPhaseName());
+ //If phase first Hnadler is there then it should run first
+ if (phaseFirst != null) {
+ if (msgctx.isPaused()) {
+ return;
+ } else {
+ log.info("Invoke the Phase first handler "
+ + phaseFirst.getName()
+ + "with in the Phase "
+ + phaseName);
+ phaseFirst.invoke(msgctx);
+ }
+ }
+ //Invoking the rest of handler except phaseFirst and phaseLast
+ int indexOfHandlerToExecute = 0;
+ while (indexOfHandlerToExecute < handlers.size()) {
+ if (msgctx.isPaused()) {
+ break;
+ } else {
+ Handler handler = (Handler) handlers.get(
+ indexOfHandlerToExecute);
+ if (handler != null) {
+ log.info("Invoke the Handler "
+ + handler.getName()
+ + "with in the Phase "
+ + phaseName);
+ handler.invoke(msgctx);
+ //This line should be after the invoke as if the invocation failed this handlers is takn care of and
+ //no need to revoke agien
+ indexOfHandlerToExecute++;
+ }
+ }
+ }
+ //If phase last handler is there will invoke that here
+ if (phaseLast != null) {
+ if (msgctx.isPaused()) {
+ return;
+ } else {
+ log.info("Invoke the Phase first handler "
+ + phaseLast.getName()
+ + "with in the Phase "
+ + phaseName);
+ phaseLast.invoke(msgctx);
+ }
+ }
+ }
+
+ /**
+ * @return Returns the name.
+ */
+ public String getPhaseName() {
+ return phaseName;
+ }
+
+ public int getHandlerCount() {
+ return handlers.size();
+ }
+
+ //////////////////////////////////////////////////////////////// FROM PhaseMetaData //////////
+
+ /**
+ * Method getBeforeAfter
+ *
+ * @param handler
+ * @return
+ * @throws org.apache.axis2.phaseresolver.PhaseException
+ *
+ */
+ private int getBeforeAfter(Handler handler) throws PhaseException {
+ if ((!handler.getHandlerDesc().getRules().getBefore().equals(""))
+ &&
+ (!handler.getHandlerDesc().getRules().getAfter().equals(""))) {
+ if (handler
+ .getHandlerDesc()
+ .getRules()
+ .getBefore()
+ .equals(handler.getHandlerDesc().getRules().getAfter())) {
+ throw new PhaseException("Both before and after cannot be the same for this handler"
+ + handler.getName());
+ }
+ return BOTH_BEFORE_AFTER;
+ } else if (!handler.getHandlerDesc().getRules().getBefore().equals("")) {
+ return BEFORE;
+ } else if (!handler.getHandlerDesc().getRules().getAfter().equals("")) {
+ return AFTER;
+ } else {
+ return ANYWHERE;
+ }
+ }
+
+ /**
+ * Method setPhaseFirst
+ *
+ * @param phaseFirst
+ * @throws PhaseException
+ */
+ public void setPhaseFirst(Handler phaseFirst) throws PhaseException {
+ if (phasefirstset) {
+ throw new PhaseException("PhaseFirst alredy has been set, cannot have two phaseFirst Handler for same phase "
+ + this.getPhaseName());
+ } else {
+ if (getBeforeAfter(phaseFirst) != ANYWHERE) {
+ throw new PhaseException("Handler with PhaseFirst can not have any before or after proprty error in "
+ + phaseFirst.getName());
+ } else {
+ this.phaseFirst = phaseFirst;
+ }
+ phasefirstset = true;
+ }
+ }
+
+ /**
+ * Method setPhaseLast
+ *
+ * @param phaseLast
+ * @throws PhaseException
+ */
+ public void setPhaseLast(Handler phaseLast) throws PhaseException {
+ if (phaselastset) {
+ throw new PhaseException("PhaseLast already has been set, cannot have two PhaseLast Handler for same phase "
+ + this.getPhaseName());
+ } else {
+ if (getBeforeAfter(phaseLast) != ANYWHERE) {
+ throw new PhaseException("Handler with PhaseLast property can not have any before or after property error in "
+ + phaseLast.getName());
+ } else {
+ this.phaseLast = phaseLast;
+ }
+ phaselastset = true;
+ }
+ }
+
+ /**
+ * Method addHandler
+ *
+ * @param handler
+ * @throws PhaseException
+ */
+ public void addHandler(HandlerDescription handler) throws PhaseException {
+ if (isonehanlder) {
+ throw new PhaseException(
+ this.getPhaseName()
+ + "can only have one handler, since there is a "
+ + "handler with both phaseFirst and PhaseLast true ");
+ } else {
+ if (handler.getRules().isPhaseFirst() &&
+ handler.getRules().isPhaseLast()) {
+ if (handlers.size() > 0) {
+ throw new PhaseException(
+ this.getPhaseName()
+ + " can not have more than one handler "
+ + handler.getName()
+ + " is invalid or incorrect phase rules");
+ } 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;
+ }
+
+ }
+ }
+
+ /**
+ * This method is to check whether user try to add a handler whose before property is
+ * phaseFitsr handler , this cannot allowed , so this will throws an exception
+ * otherewise it will retun
+ *
+ * @throws PhaseException
+ */
+ private void validatebefore(Handler handler) throws PhaseException {
+ if (phaseFirst != null) {
+ String phasFirstname = phaseFirst.getHandlerDesc().getName()
+ .getLocalPart();
+ if (handler.getHandlerDesc().getRules().getBefore().equals(
+ phasFirstname)) {
+ throw new PhaseException("Trying to insert a Handler "
+ + handler.getName()
+ + " before phaseFirst "
+ + phasFirstname);
+ }
+ }
+ }
+
+ /**
+ * This method is to check user try to add or plase a hander after the phaseLast
+ * that operation dose not allowd so then this throw a exception
+ *
+ * @throws PhaseException
+ */
+ private void validateafter(Handler handler) throws PhaseException {
+ if (phaseLast != null) {
+ String phaseLastName = phaseLast.getHandlerDesc().getName()
+ .getLocalPart();
+ if (handler.getName().equals(phaseLastName)) {
+ throw new PhaseException("Try to insert a Handler "
+ + handler.getName()
+ + " after phaseLast "
+ + phaseLastName);
+ }
+ }
+ }
+
+ /**
+ * Method insertBefore
+ *
+ * @param handler
+ */
+ private void insertBefore(Handler handler) {
+ String beforename = handler.getHandlerDesc().getRules().getBefore();
+ if (phaseLast != null) {
+ if (phaseLast.getHandlerDesc().getName().getLocalPart().equals(
+ beforename)) {
+ handlers.add(handler);
+ return;
+ }
+ }
+ for (int i = 0; i < handlers.size(); i++) {
+ Handler temphandler = (Handler) handlers.get(i);
+ if (temphandler.getHandlerDesc().getName().getLocalPart().equals(
+ beforename)) {
+ if (i == 0) {
+ handlers.add(0, handler);
+ return;
+ } else {
+ handlers.add(i - 1, handler);
+ return;
+ }
+ }
+ }
+ //added as last handler
+ handlers.add(handler);
+ }
+
+ /**
+ * Method insertAfter
+ *
+ * @param handler
+ */
+ private void insertAfter(Handler handler) {
+ String afterName = handler.getHandlerDesc().getRules().getAfter();
+ if (phaseFirst != null) {
+ if (phaseFirst.getHandlerDesc().getName().getLocalPart().equals(
+ afterName)) {
+ handlers.add(0, handler);
+ return;
+ }
+ }
+ int count = handlers.size();
+ for (int i = 0; i < count; i++) {
+ Handler temphandler = (Handler) handlers.get(i);
+ if (temphandler.getHandlerDesc().getName().getLocalPart().equals(
+ afterName)) {
+ if (i == count - 1) {
+ handlers.add(handler);
+ return;
+ } else {
+ handlers.add(i + 1, handler);
+ return;
+ }
+ }
+ }
+ if (handlers.size() > 0) {
+ handlers.add(0, handler);
+ } else
+ handlers.add(handler);
+ }
+
+ /**
+ * This method assume that both the before and after cant be a same hander
+ * that dose not check inside this , it should check befor calling this method
+ *
+ * @param handler
+ * @throws PhaseException
+ */
+ private void insertBeforeandAfter(Handler handler) throws PhaseException {
+ int before = -1;
+ int after = -1;
+
+ /**
+ * if hander.after = PhaseFirts and hnder.before = phaselast then
+ * 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()))) {
+ handlers.add(handler);
+ return;
+ }
+ }
+
+ if (phaseFirst != null
+ && (phaseFirst
+ .getHandlerDesc()
+ .getName()
+ .getLocalPart()
+ .equals(handler.getHandlerDesc().getRules().getAfter()))) {
+ after = 0;
+ }
+ if (phaseLast != null
+ && (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())) {
+ after = i;
+ } else if (
+ handler.getHandlerDesc().getRules().getBefore().equals(
+ temphandler.getHandlerDesc().getName()
+ .getLocalPart())) {
+ before = i;
+ }
+ if ((after >= 0) && (before >= 0)) {
+ // no point of continue since both the before and after index has found
+ if (after > before) {
+ //TODO fix me Deepal , (have to check this)
+ throw new PhaseException(
+ "incorrect handler order for " +
+ handler.getHandlerDesc().getName());
+ } else {
+ if (after + 1 <= handlers.size()) {
+ handlers.add(after + 1, handler);
+ return;
+ } else {
+ handlers.add(after, handler);
+ return;
+ }
+ }
+ }
+ }
+ handlers.add(handler);
+ }
+
+ private void insertHandler(HandlerDescription handler) throws PhaseException {
+ 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;
+ }
+
+ public void invokeStartFromHandler(QName name, MessageContext msgctx) throws AxisFault {
+ msgctx.setPausedPhaseName(this.getPhaseName());
+ boolean foudMatch = false;
+ ArrayList phaseHandlers = getHandlers();
+ for (int i = 0; i < phaseHandlers.size(); i++) {
+ Handler handler = (Handler) handlers.get(i);
+ if (handler != null && handler.getName().equals(name)) {
+ foudMatch = true;
+ }
+
+ if (handler != null && foudMatch) {
+ handler.invoke(msgctx);
+ }
+ }
+ }
+
+ public String toString() {
+ return this.getPhaseName();
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/Phase.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java Thu Sep 15 11:52:11 2005
@@ -1,77 +1,77 @@
-/*
- * 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.engine;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.description.OperationDescription;
-import org.apache.axis2.description.ServiceDescription;
-import org.apache.axis2.util.Utils;
-
-import javax.xml.namespace.QName;
-
-/**
- * Dispatches the service based on the information from the traget endpoint URL
- */
-public class RequestURIBasedDispatcher extends AbstractDispatcher {
- /**
- * Field NAME
- */
- public static final QName NAME =
- new QName("http://axis.ws.apache.org",
- "RequestURIBasedDispatcher");
- String serviceName = null;
- QName operationName = null;
-
-
- public OperationDescription findOperation(ServiceDescription service,
- MessageContext messageContext)
- throws AxisFault {
- if (operationName != null) {
- return service.getOperation(operationName);
- }
- return null;
-
- }
-
- /* (non-Javadoc)
- * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
- */
- public ServiceDescription findService(MessageContext messageContext) throws AxisFault {
- EndpointReference toEPR = messageContext.getTo();
- if (toEPR != null) {
- String filePart = toEPR.getAddress();
- String[] values = Utils.parseRequestURLForServiceAndOperation(
- filePart);
- if (values[1] != null) {
- operationName = new QName(values[1]);
- }
- if (values[0] != null) {
- serviceName = values[0];
- AxisConfiguration registry =
- messageContext.getSystemContext().getAxisConfiguration();
- return registry.getService(serviceName);
- }
- }
- return null;
- }
-
- public void initDispatcher() {
- init(new HandlerDescription(NAME));
- }
-}
+/*
+ * 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.engine;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.description.OperationDescription;
+import org.apache.axis2.description.ServiceDescription;
+import org.apache.axis2.util.Utils;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Dispatches the service based on the information from the traget endpoint URL
+ */
+public class RequestURIBasedDispatcher extends AbstractDispatcher {
+ /**
+ * Field NAME
+ */
+ public static final QName NAME =
+ new QName("http://axis.ws.apache.org",
+ "RequestURIBasedDispatcher");
+ String serviceName = null;
+ QName operationName = null;
+
+
+ public OperationDescription findOperation(ServiceDescription service,
+ MessageContext messageContext)
+ throws AxisFault {
+ if (operationName != null) {
+ return service.getOperation(operationName);
+ }
+ return null;
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
+ */
+ public ServiceDescription findService(MessageContext messageContext) throws AxisFault {
+ EndpointReference toEPR = messageContext.getTo();
+ if (toEPR != null) {
+ String filePart = toEPR.getAddress();
+ String[] values = Utils.parseRequestURLForServiceAndOperation(
+ filePart);
+ if (values[1] != null) {
+ operationName = new QName(values[1]);
+ }
+ if (values[0] != null) {
+ serviceName = values[0];
+ AxisConfiguration registry =
+ messageContext.getSystemContext().getAxisConfiguration();
+ return registry.getService(serviceName);
+ }
+ }
+ return null;
+ }
+
+ public void initDispatcher() {
+ init(new HandlerDescription(NAME));
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPActionBasedDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPActionBasedDispatcher.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPActionBasedDispatcher.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPActionBasedDispatcher.java Thu Sep 15 11:52:11 2005
@@ -1,70 +1,70 @@
-/*
-* 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.engine;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.description.OperationDescription;
-import org.apache.axis2.description.ServiceDescription;
-
-import javax.xml.namespace.QName;
-
-/**
- * Dispatches based on the SOAPAction
- */
-public class SOAPActionBasedDispatcher extends AbstractDispatcher {
- /**
- * Field NAME
- */
- public static final QName NAME =
- new QName("http://axis.ws.apache.org",
- "SOAPActionBasedDispatcher");
-
-// public SOAPActionBasedDispatcher() {
-// init(new HandlerDescription(NAME));
-// }
-
- public void initDispatcher() {
- init(new HandlerDescription(NAME));
- }
- public OperationDescription findOperation(ServiceDescription service,
- MessageContext messageContext)
- throws AxisFault {
-
- String action = messageContext.getSoapAction();
- if (action != null) {
- OperationDescription op = service.getOperationBySOAPAction(action);
- if (op == null) {
- op = service.getOperation(new QName(action));
- }
- /* HACK: Please remove this when we add support for custom action uri */
- if (op == null && action.lastIndexOf('/')!=-1) {
- op = service.getOperation(new QName(action.substring(action.lastIndexOf('/'),action.length())));
- }
- return op;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
- */
- public ServiceDescription findService(MessageContext messageContext) throws AxisFault {
- return null;
- }
-
-}
+/*
+* 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.engine;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.description.OperationDescription;
+import org.apache.axis2.description.ServiceDescription;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Dispatches based on the SOAPAction
+ */
+public class SOAPActionBasedDispatcher extends AbstractDispatcher {
+ /**
+ * Field NAME
+ */
+ public static final QName NAME =
+ new QName("http://axis.ws.apache.org",
+ "SOAPActionBasedDispatcher");
+
+// public SOAPActionBasedDispatcher() {
+// init(new HandlerDescription(NAME));
+// }
+
+ public void initDispatcher() {
+ init(new HandlerDescription(NAME));
+ }
+ public OperationDescription findOperation(ServiceDescription service,
+ MessageContext messageContext)
+ throws AxisFault {
+
+ String action = messageContext.getSoapAction();
+ if (action != null) {
+ OperationDescription op = service.getOperationBySOAPAction(action);
+ if (op == null) {
+ op = service.getOperation(new QName(action));
+ }
+ /* HACK: Please remove this when we add support for custom action uri */
+ if (op == null && action.lastIndexOf('/')!=-1) {
+ op = service.getOperation(new QName(action.substring(action.lastIndexOf('/'),action.length())));
+ }
+ return op;
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
+ */
+ public ServiceDescription findService(MessageContext messageContext) throws AxisFault {
+ return null;
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPActionBasedDispatcher.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java Thu Sep 15 11:52:11 2005
@@ -1,90 +1,90 @@
-/*
- * 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.engine;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.description.OperationDescription;
-import org.apache.axis2.description.ServiceDescription;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.util.Utils;
-
-import javax.xml.namespace.QName;
-
-/**
- * Dispatches based on the namespace URI of the first child of
- * the Body.
- */
-public class SOAPMessageBodyBasedDispatcher extends AbstractDispatcher {
- /**
- * Field NAME
- */
- public static final QName NAME =
- new QName("http://axis.ws.apache.org",
- "SOAPMessageBodyBasedDispatcher");
- String serviceName = null;
- QName operationName = null;
-
- /**
- * Constructor Dispatcher
- */
-// public SOAPMessageBodyBasedDispatcher() {
-// init(new HandlerDescription(NAME));
-// }
-
- public void initDispatcher() {
- init(new HandlerDescription(NAME));
- }
-
- public OperationDescription findOperation(ServiceDescription service,
- MessageContext messageContext)
- throws AxisFault {
- OMElement bodyFirstChild = messageContext.getEnvelope().getBody()
- .getFirstElement();
- operationName = new QName(bodyFirstChild.getLocalName());
-
- return service.getOperation(operationName);
- }
-
- /* (non-Javadoc)
- * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
- */
- public ServiceDescription findService(MessageContext messageContext) throws AxisFault {
- OMElement bodyFirstChild = messageContext.getEnvelope().getBody().getFirstElement();
-
- if(bodyFirstChild != null){
- OMNamespace ns = bodyFirstChild.getNamespace();
- if (ns != null) {
- String filePart = ns.getName();
-
- String[] values = Utils.parseRequestURLForServiceAndOperation(
- filePart);
- if (values[1] != null) {
- operationName = new QName(values[1]);
- }
- if (values[0] != null) {
- serviceName = values[0];
- AxisConfiguration registry =
- messageContext.getSystemContext().getAxisConfiguration();
- return registry.getService(serviceName);
- }
- }
- }
- return null;
- }
-}
+/*
+ * 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.engine;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.description.OperationDescription;
+import org.apache.axis2.description.ServiceDescription;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.util.Utils;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Dispatches based on the namespace URI of the first child of
+ * the Body.
+ */
+public class SOAPMessageBodyBasedDispatcher extends AbstractDispatcher {
+ /**
+ * Field NAME
+ */
+ public static final QName NAME =
+ new QName("http://axis.ws.apache.org",
+ "SOAPMessageBodyBasedDispatcher");
+ String serviceName = null;
+ QName operationName = null;
+
+ /**
+ * Constructor Dispatcher
+ */
+// public SOAPMessageBodyBasedDispatcher() {
+// init(new HandlerDescription(NAME));
+// }
+
+ public void initDispatcher() {
+ init(new HandlerDescription(NAME));
+ }
+
+ public OperationDescription findOperation(ServiceDescription service,
+ MessageContext messageContext)
+ throws AxisFault {
+ OMElement bodyFirstChild = messageContext.getEnvelope().getBody()
+ .getFirstElement();
+ operationName = new QName(bodyFirstChild.getLocalName());
+
+ return service.getOperation(operationName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
+ */
+ public ServiceDescription findService(MessageContext messageContext) throws AxisFault {
+ OMElement bodyFirstChild = messageContext.getEnvelope().getBody().getFirstElement();
+
+ if(bodyFirstChild != null){
+ OMNamespace ns = bodyFirstChild.getNamespace();
+ if (ns != null) {
+ String filePart = ns.getName();
+
+ String[] values = Utils.parseRequestURLForServiceAndOperation(
+ filePart);
+ if (values[1] != null) {
+ operationName = new QName(values[1]);
+ }
+ if (values[0] != null) {
+ serviceName = values[0];
+ AxisConfiguration registry =
+ messageContext.getSystemContext().getAxisConfiguration();
+ return registry.getService(serviceName);
+ }
+ }
+ }
+ return null;
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPProcessingModelChecker.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/handlers/AbstractHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/handlers/AbstractHandler.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/handlers/AbstractHandler.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/handlers/AbstractHandler.java Thu Sep 15 11:52:11 2005
@@ -1,111 +1,111 @@
-/*
- * 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.handlers;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.engine.Handler;
-
-import javax.xml.namespace.QName;
-
-/**
- * Class AbstractHandler
- */
-public abstract class AbstractHandler implements Handler {
-
- /**
- * Field EMPTY_HANDLER_METADATA
- */
- private static HandlerDescription EMPTY_HANDLER_METADATA =
- new HandlerDescription(new QName("default Handler"));
-
- /**
- * Field handlerDesc
- */
- protected HandlerDescription handlerDesc;
-
- /**
- * Constructor AbstractHandler
- */
- public AbstractHandler() {
- handlerDesc = EMPTY_HANDLER_METADATA;
- }
-
- /**
- * Method getName
- *
- * @return
- */
- public QName getName() {
- return handlerDesc.getName();
- }
-
- /**
- * Method revoke
- *
- * @param msgContext
- */
- public void revoke(MessageContext msgContext) {
- }
-
- /**
- * Method cleanup
- *
- * @throws AxisFault
- */
- public void cleanup() throws AxisFault {
- }
-
- /**
- * Method getParameter
- *
- * @param name
- * @return
- */
- public Parameter getParameter(String name) {
- return handlerDesc.getParameter(name);
- }
-
- /**
- * Method init
- *
- * @param handlerdesc
- */
- public void init(HandlerDescription handlerdesc) {
- this.handlerDesc = handlerdesc;
- }
-
- /**
- * To get the phaseRule of a handler it is required to get the HnadlerDescription of the handler
- * so the argumnet pass when it call return as HnadlerDescription
- *
- * @return
- */
- public HandlerDescription getHandlerDesc() {
- return handlerDesc;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString() {
- QName name = this.getName();
- return (name != null) ? name.toString() : null;
- }
-
-}
+/*
+ * 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.handlers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.Handler;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Class AbstractHandler
+ */
+public abstract class AbstractHandler implements Handler {
+
+ /**
+ * Field EMPTY_HANDLER_METADATA
+ */
+ private static HandlerDescription EMPTY_HANDLER_METADATA =
+ new HandlerDescription(new QName("default Handler"));
+
+ /**
+ * Field handlerDesc
+ */
+ protected HandlerDescription handlerDesc;
+
+ /**
+ * Constructor AbstractHandler
+ */
+ public AbstractHandler() {
+ handlerDesc = EMPTY_HANDLER_METADATA;
+ }
+
+ /**
+ * Method getName
+ *
+ * @return
+ */
+ public QName getName() {
+ return handlerDesc.getName();
+ }
+
+ /**
+ * Method revoke
+ *
+ * @param msgContext
+ */
+ public void revoke(MessageContext msgContext) {
+ }
+
+ /**
+ * Method cleanup
+ *
+ * @throws AxisFault
+ */
+ public void cleanup() throws AxisFault {
+ }
+
+ /**
+ * Method getParameter
+ *
+ * @param name
+ * @return
+ */
+ public Parameter getParameter(String name) {
+ return handlerDesc.getParameter(name);
+ }
+
+ /**
+ * Method init
+ *
+ * @param handlerdesc
+ */
+ public void init(HandlerDescription handlerdesc) {
+ this.handlerDesc = handlerdesc;
+ }
+
+ /**
+ * To get the phaseRule of a handler it is required to get the HnadlerDescription of the handler
+ * so the argumnet pass when it call return as HnadlerDescription
+ *
+ * @return
+ */
+ public HandlerDescription getHandlerDesc() {
+ return handlerDesc;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ QName name = this.getName();
+ return (name != null) ? name.toString() : null;
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/handlers/AbstractHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/modules/Module.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseException.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseException.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseException.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseException.java Thu Sep 15 11:52:11 2005
@@ -1,57 +1,57 @@
-/*
- * 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.phaseresolver;
-
-
-import org.apache.axis2.AxisFault;
-
-/**
- * Class PhaseException
- */
-public class PhaseException extends AxisFault {
- /**
- * Constructor PhaseException
- */
-
-
- /**
- * Constructor PhaseException
- *
- * @param message
- */
- public PhaseException(String message) {
- super(message);
- }
-
- /**
- * Constructor PhaseException
- *
- * @param message
- * @param cause
- */
- public PhaseException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Constructor PhaseException
- *
- * @param cause
- */
- public PhaseException(Throwable cause) {
- super(cause);
- }
-}
+/*
+ * 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.phaseresolver;
+
+
+import org.apache.axis2.AxisFault;
+
+/**
+ * Class PhaseException
+ */
+public class PhaseException extends AxisFault {
+ /**
+ * Constructor PhaseException
+ */
+
+
+ /**
+ * Constructor PhaseException
+ *
+ * @param message
+ */
+ public PhaseException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructor PhaseException
+ *
+ * @param message
+ * @param cause
+ */
+ public PhaseException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructor PhaseException
+ *
+ * @param cause
+ */
+ public PhaseException(Throwable cause) {
+ super(cause);
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseHolder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseHolder.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseHolder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseHolder.java Thu Sep 15 11:52:11 2005
@@ -1,123 +1,123 @@
-/*
-* 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.phaseresolver;
-
-import org.apache.axis2.deployment.DeploymentErrorMsgs;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.engine.Handler;
-import org.apache.axis2.engine.Phase;
-import org.apache.axis2.i18n.Messages;
-
-import java.util.ArrayList;
-
-
-/**
- * This class hold all the phases found in the service.xml and server.xml
- */
-public class PhaseHolder {
-
-
- private ArrayList phaseList;
-
- public PhaseHolder(ArrayList phases) {
- this.phaseList = phases;
- }
-
- public PhaseHolder() {
- }
-
- /**
- * Method isPhaseExist
- *
- * @param phaseName
- * @return
- */
- private boolean isPhaseExist(String phaseName) {
- for (int i = 0; i < phaseList.size(); i++) {
- Phase phase = (Phase) phaseList.get(i);
- if (phase.getPhaseName().equals(phaseName)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Method addHandler
- *
- * @param handler
- * @throws PhaseException
- */
- public void addHandler(HandlerDescription handler) throws PhaseException {
- String phaseName = handler.getRules().getPhaseName();
- if (isPhaseExist(phaseName)) {
- getPhase(phaseName).addHandler(handler);
- } else {
- throw new PhaseException(Messages.getMessage(DeploymentErrorMsgs.IN_VALID_PHASE,
- phaseName, handler.getName().getLocalPart()));
- }
- }
-
- /**
- * this method is used to get the actual phase object given in the phase array list
- *
- * @param phaseName
- * @return
- */
- private Phase getPhase(String phaseName) {
- for (int i = 0; i < phaseList.size(); i++) {
- Phase phase = (Phase) phaseList.get(i);
- if (phase.getPhaseName().equals(phaseName)) {
- return phase;
- }
- }
- return null;
- }
-
- /**
- * This method is to build the transport phase , here load the corresponding handlers and added them
- * in to correct phase
- *
- * @param phase
- * @param handlers
- * @throws PhaseException
- */
- public void buildTransportHandlerChain(Phase phase, ArrayList handlers) throws PhaseException {
- try {
- Class handlerClass = null;
- Handler handler;
- for (int i = 0; i < handlers.size(); i++) {
- HandlerDescription description = (HandlerDescription) handlers.get(i);
- handlerClass =
- Class.forName(description.getClassName(),
- true,
- Thread.currentThread().getContextClassLoader());
- handler =
- (Handler) handlerClass.newInstance();
- handler.init(description);
- description.setHandler(handler);
- phase.addHandler(description.getHandler());
- }
- } catch (ClassNotFoundException e) {
- throw new PhaseException(e);
- } catch (InstantiationException e) {
- throw new PhaseException(e);
- } catch (IllegalAccessException e) {
- throw new PhaseException(e);
- }
- }
-
-}
+/*
+* 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.phaseresolver;
+
+import org.apache.axis2.deployment.DeploymentErrorMsgs;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.engine.Handler;
+import org.apache.axis2.engine.Phase;
+import org.apache.axis2.i18n.Messages;
+
+import java.util.ArrayList;
+
+
+/**
+ * This class hold all the phases found in the service.xml and server.xml
+ */
+public class PhaseHolder {
+
+
+ private ArrayList phaseList;
+
+ public PhaseHolder(ArrayList phases) {
+ this.phaseList = phases;
+ }
+
+ public PhaseHolder() {
+ }
+
+ /**
+ * Method isPhaseExist
+ *
+ * @param phaseName
+ * @return
+ */
+ private boolean isPhaseExist(String phaseName) {
+ for (int i = 0; i < phaseList.size(); i++) {
+ Phase phase = (Phase) phaseList.get(i);
+ if (phase.getPhaseName().equals(phaseName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Method addHandler
+ *
+ * @param handler
+ * @throws PhaseException
+ */
+ public void addHandler(HandlerDescription handler) throws PhaseException {
+ String phaseName = handler.getRules().getPhaseName();
+ if (isPhaseExist(phaseName)) {
+ getPhase(phaseName).addHandler(handler);
+ } else {
+ throw new PhaseException(Messages.getMessage(DeploymentErrorMsgs.IN_VALID_PHASE,
+ phaseName, handler.getName().getLocalPart()));
+ }
+ }
+
+ /**
+ * this method is used to get the actual phase object given in the phase array list
+ *
+ * @param phaseName
+ * @return
+ */
+ private Phase getPhase(String phaseName) {
+ for (int i = 0; i < phaseList.size(); i++) {
+ Phase phase = (Phase) phaseList.get(i);
+ if (phase.getPhaseName().equals(phaseName)) {
+ return phase;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * This method is to build the transport phase , here load the corresponding handlers and added them
+ * in to correct phase
+ *
+ * @param phase
+ * @param handlers
+ * @throws PhaseException
+ */
+ public void buildTransportHandlerChain(Phase phase, ArrayList handlers) throws PhaseException {
+ try {
+ Class handlerClass = null;
+ Handler handler;
+ for (int i = 0; i < handlers.size(); i++) {
+ HandlerDescription description = (HandlerDescription) handlers.get(i);
+ handlerClass =
+ Class.forName(description.getClassName(),
+ true,
+ Thread.currentThread().getContextClassLoader());
+ handler =
+ (Handler) handlerClass.newInstance();
+ handler.init(description);
+ description.setHandler(handler);
+ phase.addHandler(description.getHandler());
+ }
+ } catch (ClassNotFoundException e) {
+ throw new PhaseException(e);
+ } catch (InstantiationException e) {
+ throw new PhaseException(e);
+ } catch (IllegalAccessException e) {
+ throw new PhaseException(e);
+ }
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseHolder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseMetadata.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseMetadata.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseMetadata.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseMetadata.java Thu Sep 15 11:52:11 2005
@@ -1,48 +1,48 @@
-/*
-* 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.phaseresolver;
-
-
-/**
- * Class PhaseMetadata
- */
-public class PhaseMetadata {
-
- public static final int IN_FLOW = 1;
- public static final int OUT_FLOW = 2;
- public static final int FAULT_IN_FLOW = 3;
- public static final int FAULT_OUT_FLOW = 4;
-
- //INFLOW
- public static final String PHASE_TRANSPORTIN = "TransportIn";
- public static final String PHASE_PRE_DISPATCH = "PreDispatch";
- public static final String PHASE_DISPATCH = "Dispatch";
- public static final String PHASE_POST_DISPATCH = "PostDispatch";
- public static final String PHASE_POLICY_DETERMINATION = "PolicyDetermination";
- public static final String PHASE_MESSAGE_PROCESSING = "MessageProcessing";
-
- //OUTFLOW
- public static final String PHASE_MESSAGE_OUT = "MessageOut";
- public static final String PHASE_TRANSPORT_OUT = "MessageOut";
- /**
- * todo I think thi shas to be change
- * All the handlers inside transportsender and TranportRecievre in axis2.xml gose
- * to this phase
- */
- public static final String TRANSPORT_PHASE = "TRANSPORT";
-
-
-}
+/*
+* 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.phaseresolver;
+
+
+/**
+ * Class PhaseMetadata
+ */
+public class PhaseMetadata {
+
+ public static final int IN_FLOW = 1;
+ public static final int OUT_FLOW = 2;
+ public static final int FAULT_IN_FLOW = 3;
+ public static final int FAULT_OUT_FLOW = 4;
+
+ //INFLOW
+ public static final String PHASE_TRANSPORTIN = "TransportIn";
+ public static final String PHASE_PRE_DISPATCH = "PreDispatch";
+ public static final String PHASE_DISPATCH = "Dispatch";
+ public static final String PHASE_POST_DISPATCH = "PostDispatch";
+ public static final String PHASE_POLICY_DETERMINATION = "PolicyDetermination";
+ public static final String PHASE_MESSAGE_PROCESSING = "MessageProcessing";
+
+ //OUTFLOW
+ public static final String PHASE_MESSAGE_OUT = "MessageOut";
+ public static final String PHASE_TRANSPORT_OUT = "MessageOut";
+ /**
+ * todo I think thi shas to be change
+ * All the handlers inside transportsender and TranportRecievre in axis2.xml gose
+ * to this phase
+ */
+ public static final String TRANSPORT_PHASE = "TRANSPORT";
+
+
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseMetadata.java
------------------------------------------------------------------------------
svn:eol-style = native