Package org.apache.axis2.engine
Class Phase
java.lang.Object
org.apache.axis2.engine.Phase
- All Implemented Interfaces:
Handler
- Direct Known Subclasses:
DispatchPhase
A Phase is an ordered collection of Handlers.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.axis2.engine.Handler
Handler.InvocationResponse -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHandler(HandlerDescription handlerDesc) Add a HandlerDescription to the PhasevoidaddHandler(Handler handler) Add a handler to the Phase.voidaddHandler(Handler handler, int index) Add a Handler at a particular index within the Phase.voidcheckPostConditions(MessageContext msgContext) Confirm that all post-conditions of this Phase are met.voidcheckPreconditions(MessageContext msgContext) Check the preconditions for a Phase.voidflowComplete(MessageContext msgContext) This method will be called on each registered handler that had its invoke(...) method called during the processing of the message, once the message processing has completed.intGets the HandlerDescription of a handler.Gets all the handlers in the phase.getName()Return the name of this HandlergetParameter(String name) Get a Parameter from this Handlervoidinit(HandlerDescription handlerdesc) Initialize a Handler.invoke(MessageContext msgctx) Invoke all the handlers in this PhasevoidremoveHandler(HandlerDescription handlerDesc) Remove a given Handler from a phase using a HandlerDescriptionvoidvoidsetPhaseFirst(Handler handler) Add a Handler to the Phase in the very first position, and ensure no other Handler will come before it.voidsetPhaseLast(Handler handler) Add a Handler to the Phase in the very last position, and ensure no other Handler will come after it.toString()
-
Field Details
-
ALL_PHASES
- See Also:
-
-
Constructor Details
-
Phase
public Phase()Default constructor -
Phase
Create a named Phase- Parameters:
phaseName- the name for this Phase
-
-
Method Details
-
addHandler
Add a handler to the Phase.- Parameters:
handler- the Handler to add
-
addHandler
Add a HandlerDescription to the Phase- Parameters:
handlerDesc- the HandlerDescription to add- Throws:
PhaseException- if there is a problem
-
addHandler
Add a Handler at a particular index within the Phase. If we have a Phase with (H1, H2), calling addHandler(H3, 1) will result in (H1, H3, H2)- Parameters:
handler- the Handler to addindex- the position in the Phase at which to place the Handler
-
checkPostConditions
Confirm that all post-conditions of this Phase are met. After all Handlers in a Phase are invoke()d, this method will be called. Subclasses should override it in order to confirm that the purpose of the given Phase has been acheived.- Parameters:
msgContext- the active MessageContext- Throws:
AxisFault- if a post-condition has not been met, or other problems occur
-
checkPreconditions
Check the preconditions for a Phase. This method will be called when the Phase is invoked, BEFORE any Handlers are invoked. Subclasses should override it in order to confirm that necessary preconditions are met before the Phase does its work. They should throw an appropriate AxisFault if not.- Parameters:
msgContext- the active MessageContext- Throws:
AxisFault- if a precondition is not met, or in case of other problem
-
init
Description copied from interface:HandlerInitialize a Handler. -
invoke
Invoke all the handlers in this Phase -
flowComplete
Description copied from interface:HandlerThis method will be called on each registered handler that had its invoke(...) method called during the processing of the message, once the message processing has completed. During execution of the flowComplete's, handlers are invoked in the opposite order that they were invoked originally. Note that implementations SHOULD check msgContext.getFailureReason() to see if this is an error or a normal completion.- Specified by:
flowCompletein interfaceHandler- Parameters:
msgContext- theMessageContextto process with thisHandler.
-
toString
-
getHandlerCount
public int getHandlerCount() -
getHandlerDesc
Description copied from interface:HandlerGets the HandlerDescription of a handler.- Specified by:
getHandlerDescin interfaceHandler- Returns:
- Returns HandlerDescription.
-
getHandlers
Gets all the handlers in the phase.- Returns:
- Returns an ArrayList of Handlers
-
getName
Description copied from interface:HandlerReturn the name of this Handler -
getParameter
Description copied from interface:HandlerGet a Parameter from this Handler- Specified by:
getParameterin interfaceHandler- Parameters:
name- the name of the desired value- Returns:
- the Parameter, or null.
-
getPhaseName
- Returns:
- Returns the name.
-
setName
-
setPhaseFirst
Add a Handler to the Phase in the very first position, and ensure no other Handler will come before it.- Parameters:
handler- the Handler to add- Throws:
PhaseException- if another Handler is already set as phaseFirst
-
setPhaseLast
Add a Handler to the Phase in the very last position, and ensure no other Handler will come after it.- Parameters:
handler- the Handler to add- Throws:
PhaseException- if another Handler is already set as phaseLast
-
removeHandler
Remove a given Handler from a phase using a HandlerDescription- Parameters:
handlerDesc- the HandlerDescription to remove
-