public abstract class AbstractEndpoint extends FaultHandler implements Endpoint, PropertyInclude
Modifier and Type | Field and Description |
---|---|
protected boolean |
anonymous |
protected String |
errorHandler
The Sequence name associated with the endpoint
|
protected String |
fileName
The name of the file where this endpoint is defined
|
protected boolean |
initialized
Has this endpoint been initialized ?
|
protected Boolean |
isClusteringEnabled
Is clustering enabled
|
protected org.apache.commons.logging.Log |
log |
protected static org.apache.commons.logging.Log |
trace |
Modifier | Constructor and Description |
---|---|
protected |
AbstractEndpoint() |
Modifier and Type | Method and Description |
---|---|
void |
addProperties(Collection<MediatorProperty> mediatorProperties)
Add all the properties to the endpoint
|
void |
addProperty(MediatorProperty property)
Add a property to the endpoint.
|
void |
destroy()
This method should implement the destroying of the
implemented parts of the configuration.
|
protected void |
evaluateProperties(MessageContext synCtx)
Evaluates the endpoint properties based on the current message context and set
the properties to the message context appropriately
|
List<Endpoint> |
getChildren()
Get the children of this endpoint
|
EndpointContext |
getContext()
Get the EndpointContext that has the run-time state of this endpoint
|
EndpointDefinition |
getDefinition() |
String |
getDescription()
Retrieves the description of the artifact
|
String |
getErrorHandler()
Get the MessageStore name associated with the Endpoint
|
String |
getFileName()
Get the filename from which this endpoint is loaded,
null if it is an anonymous endpoint |
EndpointView |
getMetricsMBean()
Get a reference to the metrics MBean for this endpoint
|
String |
getName()
Get the name of an abstraction
|
Endpoint |
getParentEndpoint() |
Collection<MediatorProperty> |
getProperties()
Return the
Collection of properties specified |
MediatorProperty |
getProperty(String name)
Get a property with the given name
|
protected void |
handleException(String msg)
Helper methods to handle errors.
|
protected void |
handleException(String msg,
Exception e)
Helper methods to handle errors.
|
protected void |
informFailure(MessageContext synCtx,
int errorCode,
String errorMsg) |
void |
init(SynapseEnvironment synapseEnvironment)
This method should implement the initialization of the
implemented parts of the configuration.
|
boolean |
isAnonymous() |
boolean |
isInitialized()
Has this Endpoint initialized?
|
boolean |
isLeafEndpoint()
Is this a leaf level endpoint? or parent endpoint that has children?
|
protected boolean |
isRetryDisabled(MessageContext synCtx) |
protected boolean |
isSuspendFault(MessageContext synCtx)
Is this a fault that should put the endpoint on SUSPEND? or is this a fault to ignore?
|
protected boolean |
isTimeout(MessageContext synCtx)
Is this [fault] message a timeout?
|
protected boolean |
isTraceOn(MessageContext msgCtx)
Should this mediator perform tracing? True if its explicitly asked to
trace, or its parent has been asked to trace and it does not reject it
|
protected boolean |
isTraceOrDebugOn(boolean isTraceOn)
Is tracing or debug logging on?
|
protected void |
logOnChildEndpointFail(Endpoint endpoint,
MessageContext synMessageContext) |
void |
onChildEndpointFail(Endpoint endpoint,
MessageContext synMessageContext)
Endpoints that contain other endpoints should implement this method.
|
void |
onFault(MessageContext synCtx)
On a fault, propagate to parent if any, or call into the fault handler
|
void |
onSuccess()
The SynapseCallback Receiver notifies an endpoint, if a message was successfully processed
to give it a chance to clear up or reset its state to active
|
protected void |
prepareForEndpointStatistics(MessageContext synCtx)
Process statistics for this message
|
boolean |
readyToSend()
Returns true to indicate that the endpoint is ready to service requests
|
MediatorProperty |
removeProperty(String name)
Remove a property with the given name
|
void |
send(MessageContext synCtx)
Sends the message context according to an endpoint specific behavior.
|
void |
setAnonymous(boolean anonymous) |
void |
setChildren(List<Endpoint> children) |
void |
setDefinition(EndpointDefinition definition) |
void |
setDescription(String description)
Set the description of the artifact
|
void |
setEnableMBeanStats(boolean flag)
set whether this endpoint needs to be registered for JMX MBeans.
|
void |
setErrorHandler(String errorHandler)
Set the Message Store name associated with the Endpoint
|
protected void |
setErrorOnMessage(MessageContext synCtx,
String errorCode,
String errorMsg) |
void |
setFileName(String fileName)
Set the filename from which the endpoint is loaded
|
void |
setName(String endpointName)
Set the name of an abstraction
|
void |
setParentEndpoint(Endpoint parentEndpoint)
Sets the parent endpoint for the current endpoint.
|
String |
toString() |
protected void |
traceOrDebug(boolean traceOn,
String msg)
Perform Trace and Debug logging of a message @INFO (trace) and DEBUG (log)
|
getStackTrace, handleFault, handleFault
protected org.apache.commons.logging.Log log
protected static final org.apache.commons.logging.Log trace
protected boolean initialized
protected Boolean isClusteringEnabled
protected String fileName
protected boolean anonymous
protected String errorHandler
public EndpointView getMetricsMBean()
Endpoint
getMetricsMBean
in interface Endpoint
public EndpointContext getContext()
Endpoint
getContext
in interface Endpoint
public String getName()
Nameable
public boolean isInitialized()
Endpoint
isInitialized
in interface Endpoint
public EndpointDefinition getDefinition()
public void setDefinition(EndpointDefinition definition)
public Endpoint getParentEndpoint()
public void setParentEndpoint(Endpoint parentEndpoint)
Endpoint
setParentEndpoint
in interface Endpoint
parentEndpoint
- parent endpoint containing this endpoint. It should handle the onChildEndpointFail(...)
callback.public List<Endpoint> getChildren()
Endpoint
getChildren
in interface Endpoint
public String getFileName()
Endpoint
null
if it is an anonymous endpointgetFileName
in interface Endpoint
public void setFileName(String fileName)
Endpoint
setFileName
in interface Endpoint
fileName
- from which the endpoint is loadedpublic boolean isAnonymous()
public void setAnonymous(boolean anonymous)
public void setDescription(String description)
SynapseArtifact
setDescription
in interface SynapseArtifact
description
- tobe set to the artifactpublic String getDescription()
SynapseArtifact
getDescription
in interface SynapseArtifact
public void setName(String endpointName)
Nameable
public void setEnableMBeanStats(boolean flag)
flag
- set true/falsepublic void init(SynapseEnvironment synapseEnvironment)
ManagedLifecycle
init
in interface ManagedLifecycle
synapseEnvironment
- SynapseEnvironment to be used for initializationpublic boolean readyToSend()
Endpoint
readyToSend
in interface Endpoint
public void send(MessageContext synCtx)
Endpoint
public boolean isLeafEndpoint()
public void onChildEndpointFail(Endpoint endpoint, MessageContext synMessageContext)
Endpoint
onChildEndpointFail
in interface Endpoint
endpoint
- The child endpoint which caused the exception.synMessageContext
- MessageContext that was used in the failed attempt.protected boolean isTimeout(MessageContext synCtx)
synCtx
- the current fault messageprotected boolean isRetryDisabled(MessageContext synCtx)
protected boolean isSuspendFault(MessageContext synCtx)
synCtx
- the current fault messagepublic void onFault(MessageContext synCtx)
onFault
in class FaultHandler
synCtx
- the message at handpublic void onSuccess()
protected boolean isTraceOn(MessageContext msgCtx)
msgCtx
- the current messageprotected boolean isTraceOrDebugOn(boolean isTraceOn)
isTraceOn
- is tracing known to be on?protected void traceOrDebug(boolean traceOn, String msg)
traceOn
- is runtime trace on for this message?msg
- the message to log/traceprotected void prepareForEndpointStatistics(MessageContext synCtx)
synCtx
- the current messageprotected void handleException(String msg)
msg
- The error messageprotected void handleException(String msg, Exception e)
msg
- The error messagee
- The exceptionprotected void logOnChildEndpointFail(Endpoint endpoint, MessageContext synMessageContext)
protected void informFailure(MessageContext synCtx, int errorCode, String errorMsg)
protected void setErrorOnMessage(MessageContext synCtx, String errorCode, String errorMsg)
public void destroy()
ManagedLifecycle
destroy
in interface ManagedLifecycle
public void addProperty(MediatorProperty property)
addProperty
in interface PropertyInclude
property
- property to be addedpublic MediatorProperty getProperty(String name)
getProperty
in interface PropertyInclude
name
- name of the propertypublic Collection<MediatorProperty> getProperties()
Collection
of properties specifiedgetProperties
in interface PropertyInclude
Collection
of propertiespublic MediatorProperty removeProperty(String name)
removeProperty
in interface PropertyInclude
name
- name of the property to be removednull
if a property doesn't existspublic void addProperties(Collection<MediatorProperty> mediatorProperties)
addProperties
in interface PropertyInclude
mediatorProperties
- Collection
of properties to be addedpublic String getErrorHandler()
Endpoint
getErrorHandler
in interface Endpoint
public void setErrorHandler(String errorHandler)
Endpoint
setErrorHandler
in interface Endpoint
protected void evaluateProperties(MessageContext synCtx)
synCtx
- the current message contextCopyright © 2005-2017 Apache Software Foundation. All Rights Reserved.