You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/12/16 18:18:08 UTC
svn commit: r357187 [12/25] - in
/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: ./
addressing/ client/ client/async/ context/ deployment/ deployment/listener/
deployment/repository/util/ deployment/scheduler/ deployment/util/
descript...
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=357187&r1=357186&r2=357187&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 Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
package org.apache.axis2.engine;
@@ -32,91 +33,70 @@
* A Phase is an ordered collection of Handlers.
*/
public class Phase implements Handler {
- /**
- * Field phaseName
- */
- private String phaseName;
/**
- * Field handlers
+ * Field BOTH_BEFORE_AFTER
*/
- private ArrayList handlers;
+ private static final int BOTH_BEFORE_AFTER = 0;
/**
- * Field log
+ * Field BEFORE
*/
- private Log log = LogFactory.getLog(getClass());
+ private static final int BEFORE = 1;
/**
- * Field phasefirstset
+ * Field ANYWHERE
*/
- private boolean phasefirstset;
+ private static final int ANYWHERE = 3;
/**
- * Field phaselastset
+ * Field AFTER
*/
- private boolean phaselastset;
+ private static final int AFTER = 2;
/**
- * Field BOTH_BEFORE_AFTER
+ * Field log
*/
- private static final int BOTH_BEFORE_AFTER = 0;
+ private Log log = LogFactory.getLog(getClass());
/**
- * Field BEFORE
+ * Field handlers
*/
- private static final int BEFORE = 1;
+ private ArrayList handlers;
/**
- * Field AFTER
+ * this is want if the phaseFirst and phaseLst same hanlder
+ * that is for this phase there is only one phase
*/
- private static final int AFTER = 2;
+ private boolean isOneHanlder;
/**
- * Field ANYWHERE
+ * Field phaseName
*/
- private static final int ANYWHERE = 3;
+ private String phaseName;
/**
- * this is want if the phaseFirst and phaseLst same hanlder
- * that is for this phase there is only one phase
+ * Field phasefirstset
*/
- private boolean isOneHanlder;
+ private boolean phasefirstset;
/**
- * Constructor Phase.
- *
- * @param phaseName
+ * Field phaselastset
*/
- public Phase(String phaseName) {
- handlers = new ArrayList();
- this.phaseName = phaseName;
- }
+ private boolean phaselastset;
public Phase() {
this(null);
}
- public void checkPreconditions(MessageContext msgContext) throws AxisFault {
- // Default version does nothing
- }
-
- public void checkPostConditions(MessageContext msgContext) throws AxisFault {
- // Default version does nothing
- }
-
/**
- * Method addHandler.
+ * Constructor Phase.
*
- * @param handler
- * @param index
+ * @param phaseName
*/
- public void addHandler(Handler handler, int index) {
- log.debug(
- "Handler " + handler.getName() + "Added to place " + index +
- " At the Phase " +
- phaseName);
- handlers.add(index, handler);
+ public Phase(String phaseName) {
+ handlers = new ArrayList();
+ this.phaseName = phaseName;
}
/**
@@ -126,144 +106,11 @@
*/
public void addHandler(Handler handler) {
log.debug("Handler " + handler.getName() + " added to Phase " + phaseName);
- if (phaselastset) {
- handlers.add(handlers.size() - 2, handler); // add before phaseLast
- } else {
- handlers.add(handler);
- }
- }
-
- /**
- * invokes all the handlers in this Phase
- *
- * @param msgctx
- * @throws org.apache.axis2.AxisFault
- */
- public final void invoke(MessageContext msgctx) throws AxisFault {
- if (log.isDebugEnabled()) {
- log.debug("Checking pre-condition for Phase \"" + phaseName + "\"");
- }
- int currentIndex = msgctx.getCurrentPhaseIndex();
- if (currentIndex == 0)
- checkPreconditions(msgctx);
-
- if (log.isDebugEnabled()) {
- log.debug("Invoking phase \"" + phaseName + "\"");
- }
-
- while (currentIndex < handlers.size()) {
- Handler handler = (Handler) handlers.get(currentIndex);
- log.info("Invoking Handler '"
- + handler.getName()
- + "' in Phase '"
- + phaseName + "'");
- handler.invoke(msgctx);
-
- if (msgctx.isPaused())
- return;
-
- currentIndex++;
- msgctx.setCurrentPhaseIndex(currentIndex);
- }
-
- if (log.isDebugEnabled()) {
- log.debug("Checking post-conditions for phase \"" + phaseName + "\"");
- }
- msgctx.setCurrentPhaseIndex(0);
- checkPostConditions(msgctx);
- }
-
- /**
- * @return Returns the name.
- */
- public String getPhaseName() {
- return phaseName;
- }
-
- public int getHandlerCount() {
- return handlers.size();
- }
- //////////////////////////////////////////////////////////////// FROM PhaseMetaData //////////
-
- /**
- * Method getBeforeAfter.
- *
- * @param handler
- * @return Returns AFTER or ANYWHERE or BOTH_BEFORE_AFTER
- * @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 {
- handlers.add(0, phaseFirst);
- phasefirstset = true;
-
- // TODO: move this error check to where we read the rules
- if (getBeforeAfter(phaseFirst) != ANYWHERE) {
- throw new PhaseException("Handler with PhaseFirst can not have " +
- "any before or after proprty error in "
- + phaseFirst.getName());
- }
- }
- }
-
- /**
- * 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());
- }
- if (handlers.size() == 0) {
- handlers.add(phaseLast);
+ handlers.add(handlers.size() - 2, handler); // add before phaseLast
} else {
- handlers.add(handlers.size() - 1, phaseLast);
- }
- phaselastset = true;
-
- // TODO: Move this check to where we read the rules
- if (getBeforeAfter(phaseLast) != ANYWHERE) {
- throw new PhaseException("Handler with PhaseLast property " +
- "can not have any before or after property error in "
- + phaseLast.getName());
+ handlers.add(handler);
}
}
@@ -275,33 +122,35 @@
*/
public void addHandler(HandlerDescription handler) throws PhaseException {
Iterator handlers_itr = getHandlers().iterator();
+
while (handlers_itr.hasNext()) {
Handler hand = (Handler) handlers_itr.next();
HandlerDescription handlerDesc = hand.getHandlerDesc();
+
if (handler.getName().getLocalPart().equals(handlerDesc.getName().getLocalPart())) {
-// if (handler.equals(handlerDesc)) {
- //tryting to add the same handler twice to the phase
+
+// if (handler.equals(handlerDesc)) {
+ // tryting to add the same handler twice to the phase
// this is can happen due to we are allowing service specifc module
- //to add hndlers into gloal chain
+ // to add hndlers into gloal chain
return;
}
}
+
if (isOneHanlder) {
+
// TODO : should we allow both phaseFirst and phaseLast to be true for one Handler??
- throw new PhaseException(
- this.getPhaseName()
- + "can only have one handler, since there is a "
- + "handler with both phaseFirst and PhaseLast true ");
+ throw new PhaseException(this.getPhaseName()
+ + "can only have one handler, since there is a "
+ + "handler with both phaseFirst and PhaseLast true ");
}
- if (handler.getRules().isPhaseFirst() &&
- handler.getRules().isPhaseLast()) {
+ 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");
+ 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;
@@ -316,30 +165,35 @@
}
/**
- * Method insertBefore.
+ * Method addHandler.
*
* @param handler
+ * @param index
*/
- private void insertBefore(Handler handler) throws PhaseException {
- String beforename = handler.getHandlerDesc().getRules().getBefore();
+ public void addHandler(Handler handler, int index) {
+ log.debug("Handler " + handler.getName() + "Added to place " + index + " At the Phase "
+ + phaseName);
+ handlers.add(index, handler);
+ }
- for (int i = 0; i < handlers.size(); i++) {
- Handler temphandler = (Handler) handlers.get(i);
- if (temphandler.getName().getLocalPart().equals(beforename)) {
- if (i == 0) {
- if (phasefirstset) {
- throw new PhaseException("Can't insert handler before handler '" +
- temphandler.getName() + "', which is marked phaseFirst");
- }
- handlers.add(0, handler);
- return;
- }
- handlers.add(i - 1, handler);
- }
- }
+ public void checkPostConditions(MessageContext msgContext) throws AxisFault {
- //added as last handler
- addHandler(handler);
+ // Default version does nothing
+ }
+
+ public void checkPreconditions(MessageContext msgContext) throws AxisFault {
+
+ // Default version does nothing
+ }
+
+ public void cleanup() throws AxisFault {
+
+ // To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void init(HandlerDescription handlerdesc) {
+
+ // To change body of implemented methods use File | Settings | File Templates.
}
/**
@@ -352,19 +206,57 @@
for (int i = 0; i < handlers.size(); i++) {
Handler temphandler = (Handler) handlers.get(i);
+
if (temphandler.getName().getLocalPart().equals(afterName)) {
if (phaselastset && (i == handlers.size() - 1)) {
- throw new PhaseException("Can't insert handler after handler '" +
- temphandler.getName() + "', which is marked phaseLast");
+ throw new PhaseException("Can't insert handler after handler '"
+ + temphandler.getName()
+ + "', which is marked phaseLast");
}
+
handlers.add(i + 1, handler);
+
return;
}
}
+
if (handlers.size() > 0) {
handlers.add(0, handler);
- } else
+ } else {
handlers.add(handler);
+ }
+ }
+
+ /**
+ * Method insertBefore.
+ *
+ * @param handler
+ */
+ private void insertBefore(Handler handler) throws PhaseException {
+ String beforename = handler.getHandlerDesc().getRules().getBefore();
+
+ for (int i = 0; i < handlers.size(); i++) {
+ Handler temphandler = (Handler) handlers.get(i);
+
+ if (temphandler.getName().getLocalPart().equals(beforename)) {
+ if (i == 0) {
+ if (phasefirstset) {
+ throw new PhaseException("Can't insert handler before handler '"
+ + temphandler.getName()
+ + "', which is marked phaseFirst");
+ }
+
+ handlers.add(0, handler);
+
+ return;
+ }
+
+ handlers.add(i - 1, handler);
+ }
+ }
+
+ // added as last handler
+ addHandler(handler);
}
/**
@@ -377,12 +269,12 @@
private void insertBeforeandAfter(Handler handler) throws PhaseException {
int before = -1;
int after = -1;
-
String beforeName = handler.getHandlerDesc().getRules().getBefore();
String afterName = handler.getHandlerDesc().getRules().getAfter();
for (int i = 0; i < handlers.size(); i++) {
Handler temphandler = (Handler) handlers.get(i);
+
if (afterName.equals(temphandler.getName().getLocalPart())) {
after = i;
} else {
@@ -390,6 +282,7 @@
before = i;
}
}
+
if ((after >= 0) && (before >= 0)) {
break;
}
@@ -397,26 +290,29 @@
// 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());
+
+ // TODO fix me Deepal , (have to check this)
+ throw new PhaseException("incorrect handler order for "
+ + handler.getHandlerDesc().getName());
}
- if (before == -1 && after == -1) {
+ if ((before == -1) && (after == -1)) {
addHandler(handler);
+
return;
}
if (before == -1) {
addHandler(handler);
+
return;
}
if (after == -1) {
- if (phasefirstset && before == 0) {
- throw new PhaseException("Can't insert handler before handler '" +
- ((Handler) handlers.get(0)).getName() + "', which is marked phaseFirst");
+ if (phasefirstset && (before == 0)) {
+ throw new PhaseException("Can't insert handler before handler '"
+ + ((Handler) handlers.get(0)).getName()
+ + "', which is marked phaseFirst");
}
}
@@ -426,27 +322,120 @@
private void insertHandler(HandlerDescription handlerDesc) throws PhaseException {
Handler handler = handlerDesc.getHandler();
int type = getBeforeAfter(handler);
+
switch (type) {
- case BOTH_BEFORE_AFTER: {
+ case BOTH_BEFORE_AFTER : {
insertBeforeandAfter(handler);
+
break;
}
- case BEFORE: {
+
+ case BEFORE : {
insertBefore(handler);
+
break;
}
- case AFTER: {
+
+ case AFTER : {
insertAfter(handler);
+
break;
}
- case ANYWHERE: {
+
+ case ANYWHERE : {
addHandler(handler);
+
break;
}
}
}
/**
+ * invokes all the handlers in this Phase
+ *
+ * @param msgctx
+ * @throws org.apache.axis2.AxisFault
+ */
+ public final void invoke(MessageContext msgctx) throws AxisFault {
+ if (log.isDebugEnabled()) {
+ log.debug("Checking pre-condition for Phase \"" + phaseName + "\"");
+ }
+
+ int currentIndex = msgctx.getCurrentPhaseIndex();
+
+ if (currentIndex == 0) {
+ checkPreconditions(msgctx);
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("Invoking phase \"" + phaseName + "\"");
+ }
+
+ while (currentIndex < handlers.size()) {
+ Handler handler = (Handler) handlers.get(currentIndex);
+
+ log.info("Invoking Handler '" + handler.getName() + "' in Phase '" + phaseName + "'");
+ handler.invoke(msgctx);
+
+ if (msgctx.isPaused()) {
+ return;
+ }
+
+ currentIndex++;
+ msgctx.setCurrentPhaseIndex(currentIndex);
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("Checking post-conditions for phase \"" + phaseName + "\"");
+ }
+
+ msgctx.setCurrentPhaseIndex(0);
+ checkPostConditions(msgctx);
+ }
+
+ public String toString() {
+ return this.getPhaseName();
+ }
+
+ // ////////////////////////////////////////////////////////////// FROM PhaseMetaData //////////
+
+ /**
+ * Method getBeforeAfter.
+ *
+ * @param handler
+ * @return Returns AFTER or ANYWHERE or BOTH_BEFORE_AFTER
+ * @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;
+ }
+ }
+
+ public int getHandlerCount() {
+ return handlers.size();
+ }
+
+ public HandlerDescription getHandlerDesc() {
+ return null; // To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ /**
* Gets all the handlers in the phase.
*
* @return Returns an ArrayList of Handlers
@@ -455,31 +444,74 @@
return handlers;
}
- public void init(HandlerDescription handlerdesc) {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
public QName getName() {
return new QName(phaseName);
}
public Parameter getParameter(String name) {
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return null; // To change body of implemented methods use File | Settings | File Templates.
}
- public void cleanup() throws AxisFault {
- //To change body of implemented methods use File | Settings | File Templates.
+ /**
+ * @return Returns the name.
+ */
+ public String getPhaseName() {
+ return phaseName;
}
- public HandlerDescription getHandlerDesc() {
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ public void setName(String phaseName) {
+ this.phaseName = phaseName;
}
- public String toString() {
- return this.getPhaseName();
+ /**
+ * 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 {
+ handlers.add(0, phaseFirst);
+ phasefirstset = true;
+
+ // TODO: move this error check to where we read the rules
+ if (getBeforeAfter(phaseFirst) != ANYWHERE) {
+ throw new PhaseException("Handler with PhaseFirst can not have "
+ + "any before or after proprty error in "
+ + phaseFirst.getName());
+ }
+ }
}
- public void setName(String phaseName) {
- this.phaseName = phaseName;
+ /**
+ * 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());
+ }
+
+ if (handlers.size() == 0) {
+ handlers.add(phaseLast);
+ } else {
+ handlers.add(handlers.size() - 1, phaseLast);
+ }
+
+ phaselastset = true;
+
+ // TODO: Move this check to where we read the rules
+ if (getBeforeAfter(phaseLast) != ANYWHERE) {
+ throw new PhaseException("Handler with PhaseLast property "
+ + "can not have any before or after property error in "
+ + phaseLast.getName());
+ }
}
}
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=357187&r1=357186&r2=357187&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 Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
package org.apache.axis2.engine;
@@ -32,57 +33,65 @@
* Dispatches the service based on the information from the target endpoint URL.
*/
public class RequestURIBasedDispatcher extends AbstractDispatcher {
- private Log log = LogFactory.getLog(getClass());
+
/**
* Field NAME
*/
- public static final QName NAME =
- new QName("http://axis.ws.apache.org",
- "RequestURIBasedDispatcher");
+ public static final QName NAME = new QName("http://axis.ws.apache.org",
+ "RequestURIBasedDispatcher");
+ private Log log = LogFactory.getLog(getClass());
String serviceName = null;
QName operationName = null;
-
- public AxisOperation findOperation(AxisService service,
- MessageContext messageContext)
+ public AxisOperation findOperation(AxisService service, MessageContext messageContext)
throws AxisFault {
log.debug("Checking for Operation using target endpoint uri fragment : " + operationName);
+
EndpointReference toEPR = messageContext.getTo();
- if (toEPR != null && operationName == null) {
+
+ if ((toEPR != null) && (operationName == null)) {
String filePart = toEPR.getAddress();
- String[] values = Utils.parseRequestURLForServiceAndOperation(
- filePart);
- if (values.length >= 2 && values[1] != null) {
+ String[] values = Utils.parseRequestURLForServiceAndOperation(filePart);
+
+ if ((values.length >= 2) && (values[1] != null)) {
operationName = new QName(values[1]);
}
}
+
if (operationName != null) {
return service.getOperation(operationName);
}
- return null;
+ return null;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
*/
public AxisService findService(MessageContext messageContext) throws AxisFault {
EndpointReference toEPR = messageContext.getTo();
+
if (toEPR != null) {
log.debug("Checking for Service using target endpoint address : " + toEPR.getAddress());
+
String filePart = toEPR.getAddress();
- String[] values = Utils.parseRequestURLForServiceAndOperation(
- filePart);
+ String[] values = Utils.parseRequestURLForServiceAndOperation(filePart);
+
if (values[1] != null) {
operationName = new QName(values[1]);
}
+
if (values[0] != null) {
serviceName = values[0];
+
AxisConfiguration registry =
messageContext.getConfigurationContext().getAxisConfiguration();
+
return registry.getService(serviceName);
}
}
+
return null;
}
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=357187&r1=357186&r2=357187&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 Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
package org.apache.axis2.engine;
@@ -30,50 +31,54 @@
* Dispatches based on the SOAPAction.
*/
public class SOAPActionBasedDispatcher extends AbstractDispatcher {
- private Log log = LogFactory.getLog(getClass());
/**
* Field NAME
*/
public static final QName NAME = new QName("http://axis.ws.apache.org",
"SOAPActionBasedDispatcher");
+ private Log log = LogFactory.getLog(getClass());
- public void initDispatcher() {
- init(new HandlerDescription(NAME));
- }
-
- public AxisOperation findOperation(AxisService service,
- MessageContext messageContext) throws AxisFault {
-
+ public AxisOperation findOperation(AxisService service, MessageContext messageContext)
+ throws AxisFault {
String action = messageContext.getSoapAction();
+
log.debug("Checking for Operation using SOAPAction : " + action);
+
if (action != null) {
AxisOperation op = service.getOperationBySOAPAction(action);
+
if (op == null) {
op = service.getOperationByAction(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())));
+ 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 AxisService findService(MessageContext messageContext)
- throws AxisFault {
+ public AxisService findService(MessageContext messageContext) throws AxisFault {
log.debug("Checking for Service using SOAPAction is a TODO item");
+
return null;
}
+ public void initDispatcher() {
+ init(new HandlerDescription(NAME));
+ }
}
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=357187&r1=357186&r2=357187&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 Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
package org.apache.axis2.engine;
@@ -34,36 +35,34 @@
* the body.
*/
public class SOAPMessageBodyBasedDispatcher extends AbstractDispatcher {
- private Log log = LogFactory.getLog(getClass());
+
/**
* Field NAME
*/
- public static final QName NAME =
- new QName("http://axis.ws.apache.org",
- "SOAPMessageBodyBasedDispatcher");
+ public static final QName NAME = new QName("http://axis.ws.apache.org",
+ "SOAPMessageBodyBasedDispatcher");
+ private Log log = LogFactory.getLog(getClass());
String serviceName = null;
QName operationName = null;
- public void initDispatcher() {
- init(new HandlerDescription(NAME));
- }
-
- public AxisOperation findOperation(AxisService service,
- MessageContext messageContext)
+ public AxisOperation findOperation(AxisService service, MessageContext messageContext)
throws AxisFault {
- OMElement bodyFirstChild = messageContext.getEnvelope().getBody()
- .getFirstElement();
+ OMElement bodyFirstChild = messageContext.getEnvelope().getBody().getFirstElement();
+
if (bodyFirstChild == null) {
return null;
} else {
- log.debug("Checking for Operation using SOAP message body's first child's local name : " + bodyFirstChild.getLocalName());
+ log.debug(
+ "Checking for Operation using SOAP message body's first child's local name : "
+ + bodyFirstChild.getLocalName());
operationName = new QName(bodyFirstChild.getLocalName());
}
return service.getOperation(operationName);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
*/
public AxisService findService(MessageContext messageContext) throws AxisFault {
@@ -71,23 +70,35 @@
if (bodyFirstChild != null) {
OMNamespace ns = bodyFirstChild.getNamespace();
+
if (ns != null) {
String filePart = ns.getName();
- log.debug("Checking for Service using SOAP message body's first child's namespace : " + filePart);
- String[] values = Utils.parseRequestURLForServiceAndOperation(
- filePart);
+ log.debug(
+ "Checking for Service using SOAP message body's first child's namespace : "
+ + filePart);
+
+ String[] values = Utils.parseRequestURLForServiceAndOperation(filePart);
+
if (values[1] != null) {
operationName = new QName(values[1]);
}
+
if (values[0] != null) {
serviceName = values[0];
+
AxisConfiguration registry =
messageContext.getConfigurationContext().getAxisConfiguration();
+
return registry.getService(serviceName);
}
}
}
+
return null;
+ }
+
+ public void initDispatcher() {
+ init(new HandlerDescription(NAME));
}
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/AbstractFaultCode.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/AbstractFaultCode.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/AbstractFaultCode.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/AbstractFaultCode.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,20 @@
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 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.fault;
import javax.xml.namespace.QName;
@@ -22,18 +24,26 @@
* subcodes must have qnames; faultcodes are simple strings.
* created 31-Oct-2005 14:20:40
*/
-
public abstract class AbstractFaultCode {
+
/**
* a subcode, may be null.
*/
private FaultSubcode subcode;
+ protected AbstractFaultCode() {
+ }
+
protected AbstractFaultCode(FaultSubcode subcode) {
this.subcode = subcode;
}
- protected AbstractFaultCode() {
+ public FaultSubcode getSubcode() {
+ return subcode;
+ }
+
+ public void setSubcode(FaultSubcode subcode) {
+ this.subcode = subcode;
}
/**
@@ -44,13 +54,4 @@
* @param value
*/
public abstract void setValue(QName value);
-
- public FaultSubcode getSubcode() {
- return subcode;
- }
-
- public void setSubcode(FaultSubcode subcode) {
- this.subcode = subcode;
- }
-
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultCode.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultCode.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultCode.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultCode.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,20 @@
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 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.fault;
import org.apache.axis2.soap.SOAPFaultCode;
@@ -24,9 +26,7 @@
/**
* created 31-Oct-2005 13:08:33
*/
-
public class FaultCode extends AbstractFaultCode {
-
String value;
/**
@@ -36,47 +36,50 @@
}
/**
- * Constructor to fill in subcodes
- *
- * @param value fault value (may be null)
- * @param subcode fault subcode (may be null)
- */
- public FaultCode(String value, FaultSubcode subcode) {
- super(subcode);
- setValueString(value);
- }
-
- /**
* Create a fault code (and all subcodes) from a SOAP Fault Code
*
* @param source SOAPFaultCode to parse
*/
public FaultCode(SOAPFaultCode source) {
-
SOAPFaultValue value = source.getValue();
- //what if it is a qname already?
+
+ // what if it is a qname already?
setValueString(value.getText());
+
SOAPFaultSubCode subCode = source.getSubCode();
+
if (subCode != null) {
setSubcode(new FaultSubcode(subCode));
}
}
/**
- * local names are stuck in as a string and turned into a local qname
+ * Constructor to fill in subcodes
*
- * @param value
+ * @param value fault value (may be null)
+ * @param subcode fault subcode (may be null)
*/
- public void setValueString(String value) {
- QName newName = new QName(value);
- this.value = newName.toString();
+ public FaultCode(String value, FaultSubcode subcode) {
+ super(subcode);
+ setValueString(value);
+ }
+
+ public String getValueString() {
+ return value;
}
public void setValue(QName value) {
setValueString(value.toString());
}
- public String getValueString() {
- return value;
+ /**
+ * local names are stuck in as a string and turned into a local qname
+ *
+ * @param value
+ */
+ public void setValueString(String value) {
+ QName newName = new QName(value);
+
+ this.value = newName.toString();
}
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultReason.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultReason.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultReason.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultReason.java Fri Dec 16 09:13:57 2005
@@ -1,67 +1,68 @@
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 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.fault;
/**
* Representation of a FaultReason; a language specific reason for a fault.
*/
-
public class FaultReason {
/**
- * env:reasontext
- */
- private String text;
-
- /**
* Language of the reason.
* xml:lang="en" "en-GB" or just ""
*/
private String language = "";
- public FaultReason(String text, String language) {
- this.text = text;
- this.language = language;
- }
+ /**
+ * env:reasontext
+ */
+ private String text;
public FaultReason() {
}
- public String getText() {
- return text;
+ public FaultReason(String text, String language) {
+ this.text = text;
+ this.language = language;
}
- public void setText(String text) {
- this.text = text;
+ /**
+ * Returns a string representation of the object.
+ *
+ * @return the text value
+ */
+ public String toString() {
+ return text;
}
public String getLanguage() {
return language;
}
+ public String getText() {
+ return text;
+ }
+
public void setLanguage(String language) {
this.language = language;
}
- /**
- * Returns a string representation of the object.
- *
- * @return the text value
- */
- public String toString() {
- return text;
+ public void setText(String text) {
+ this.text = text;
}
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultReasonList.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultReasonList.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultReasonList.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultReasonList.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,20 @@
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 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.fault;
import java.util.ArrayList;
@@ -22,19 +24,17 @@
/**
* A list of fault reasons
*/
-
public class FaultReasonList {
-
private List reasons;
- public FaultReasonList(int size) {
- reasons = new ArrayList(size);
- }
-
public FaultReasonList() {
this(1);
}
+ public FaultReasonList(int size) {
+ reasons = new ArrayList(size);
+ }
+
/**
* Add a new fault reason
*
@@ -85,5 +85,4 @@
public List getReasons() {
return reasons;
}
-
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultSubcode.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultSubcode.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultSubcode.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/FaultSubcode.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,20 @@
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 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.fault;
import org.apache.axis2.om.OMException;
@@ -25,10 +27,8 @@
* OM-neutral representation of a SOAP1.2 fault code for use in AxisFaults
* created 28-Oct-2005 16:52:29
*/
-
public class FaultSubcode extends AbstractFaultCode {
-
/**
* in a subcode this can be an arbitrary qname.
* In a s12:Fault/s12:Code/s12:Value form, a limited set of values
@@ -45,18 +45,6 @@
}
/**
- * Constructor to fill in subcodes
- *
- * @param value fault value (may be null)
- * @param subcode fault subcode (may be null)
- */
- public FaultSubcode(QName value, FaultSubcode subcode) {
- super(subcode);
- this.value = value;
- }
-
-
- /**
* Recursively construct from fault information
*
* @param source
@@ -65,19 +53,46 @@
SOAPFaultValue value = source.getValue();
String text = value.getText();
QName qname = source.resolveQName(text);
+
if (qname != null) {
setValue(qname);
} else {
- //what to do here?
+
+ // what to do here?
throw new OMException("No QName from " + text);
}
+
SOAPFaultSubCode subCode = source.getSubCode();
+
if (subCode != null) {
setSubcode(new FaultSubcode(subCode));
}
}
/**
+ * Constructor to fill in subcodes
+ *
+ * @param value fault value (may be null)
+ * @param subcode fault subcode (may be null)
+ */
+ public FaultSubcode(QName value, FaultSubcode subcode) {
+ super(subcode);
+ this.value = value;
+ }
+
+ /**
+ * Returns a string representation of the object.
+ * This only stringifies the base fault
+ *
+ * @return a string representation of the object.
+ */
+ public String toString() {
+ return (value != null)
+ ? value.toString()
+ : "[undefined fault]";
+ }
+
+ /**
* Get the current failt code value
*
* @return
@@ -93,16 +108,5 @@
*/
public void setValue(QName value) {
this.value = value;
- }
-
-
- /**
- * Returns a string representation of the object.
- * This only stringifies the base fault
- *
- * @return a string representation of the object.
- */
- public String toString() {
- return value != null ? value.toString() : "[undefined fault]";
}
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/SoapFaultSource.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/SoapFaultSource.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/SoapFaultSource.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/fault/SoapFaultSource.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 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.fault;
@@ -25,22 +26,20 @@
* their own SOAPFault directly.
* Axis2 can extract the body and any headers and use them in the response.
*/
-
-
public interface SoapFaultSource {
/**
- * The full SOAPFault to send back. This will become the body of a message.
- *
- * @return the SOAPFault to return as the body of a message.
- */
- SOAPFault getSOAPFault();
-
- /**
* Get any Headers to include in the message.
* Most
*
* @return an iterator over headers, or null for no headers of interest.
*/
Iterator getHeaders();
+
+ /**
+ * The full SOAPFault to send back. This will become the body of a message.
+ *
+ * @return the SOAPFault to return as the body of a message.
+ */
+ SOAPFault getSOAPFault();
}
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=357187&r1=357186&r2=357187&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 Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
package org.apache.axis2.handlers;
@@ -48,47 +49,40 @@
}
/**
- * Method getName
+ * Method cleanup
*
- * @return
+ * @throws AxisFault
*/
- public QName getName() {
- return handlerDesc.getName();
+ public void cleanup() throws AxisFault {
}
/**
- * Method revoke
+ * Method init
*
- * @param msgContext
+ * @param handlerdesc
*/
- public void revoke(MessageContext msgContext) {
+ public void init(HandlerDescription handlerdesc) {
+ this.handlerDesc = handlerdesc;
}
/**
- * Method cleanup
+ * Method revoke
*
- * @throws AxisFault
+ * @param msgContext
*/
- public void cleanup() throws AxisFault {
+ public void revoke(MessageContext msgContext) {
}
- /**
- * Method getParameter
- *
- * @param name
- * @return
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#toString()
*/
- public Parameter getParameter(String name) {
- return handlerDesc.getParameter(name);
- }
+ public String toString() {
+ QName name = this.getName();
- /**
- * Method init
- *
- * @param handlerdesc
- */
- public void init(HandlerDescription handlerdesc) {
- this.handlerDesc = handlerdesc;
+ return (name != null)
+ ? name.toString()
+ : null;
}
/**
@@ -101,12 +95,22 @@
return handlerDesc;
}
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
+ /**
+ * Method getName
+ *
+ * @return
*/
- public String toString() {
- QName name = this.getName();
- return (name != null) ? name.toString() : null;
+ public QName getName() {
+ return handlerDesc.getName();
}
+ /**
+ * Method getParameter
+ *
+ * @param name
+ * @return
+ */
+ public Parameter getParameter(String name) {
+ return handlerDesc.getParameter(name);
+ }
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/modules/Module.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/modules/Module.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/modules/Module.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/modules/Module.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
package org.apache.axis2.modules;
@@ -34,12 +35,12 @@
* allowing more dynamic scenarios.
*/
public interface Module {
+
// initialize the module
public void init(AxisConfiguration axisSystem) throws AxisFault;
// TODO figure out how to get the engage() concept done
// public void engage(ExecutionChain exeChain) throws AxisFault;
-
// shutdown the module
public void shutdown(AxisConfiguration axisSystem) throws AxisFault;
}
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=357187&r1=357186&r2=357187&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 Fri Dec 16 09:13:57 2005
@@ -1,21 +1,21 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
-package org.apache.axis2.phaseresolver;
+package org.apache.axis2.phaseresolver;
import org.apache.axis2.AxisFault;
@@ -23,10 +23,10 @@
* Class PhaseException
*/
public class PhaseException extends AxisFault {
+
/**
* Constructor PhaseException
*/
-
/**
* Constructor PhaseException
@@ -40,19 +40,19 @@
/**
* Constructor PhaseException
*
- * @param message
* @param cause
*/
- public PhaseException(String message, Throwable cause) {
- super(message, cause);
+ public PhaseException(Throwable cause) {
+ super(cause);
}
/**
* Constructor PhaseException
*
+ * @param message
* @param cause
*/
- public PhaseException(Throwable cause) {
- super(cause);
+ public PhaseException(String message, Throwable cause) {
+ super(message, cause);
}
}
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=357187&r1=357186&r2=357187&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 Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
package org.apache.axis2.phaseresolver;
@@ -24,36 +25,17 @@
import java.util.ArrayList;
-
/**
* This class hold all the phases found in the services.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;
+ public PhaseHolder(ArrayList phases) {
+ this.phaseList = phases;
}
/**
@@ -64,32 +46,16 @@
*/
public void addHandler(HandlerDescription handlerDesc) throws PhaseException {
String phaseName = handlerDesc.getRules().getPhaseName();
+
if (isPhaseExist(phaseName)) {
getPhase(phaseName).addHandler(handlerDesc);
} else {
- throw new PhaseException(Messages.getMessage(
- DeploymentErrorMsgs.INVALID_PHASE,
+ throw new PhaseException(Messages.getMessage(DeploymentErrorMsgs.INVALID_PHASE,
phaseName, handlerDesc.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
*
@@ -101,14 +67,13 @@
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();
+
+ handlerClass = Class.forName(description.getClassName(), true,
+ Thread.currentThread().getContextClassLoader());
+ handler = (Handler) handlerClass.newInstance();
handler.init(description);
description.setHandler(handler);
phase.addHandler(description.getHandler());
@@ -122,4 +87,39 @@
}
}
+ /**
+ * 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;
+ }
+
+ /**
+ * 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;
+ }
}
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=357187&r1=357186&r2=357187&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 Fri Dec 16 09:13:57 2005
@@ -1,49 +1,47 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
-package org.apache.axis2.phaseresolver;
+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;
+ public static final int FAULT_IN_FLOW = 3;
- //INFLOW
+ // 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
+ // OUTFLOW
public static final String PHASE_MESSAGE_OUT = "MessageOut";
+ public static final String PHASE_DISPATCH = "Dispatch";
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";
-
-
}