Class AbstractEndpoint

    • Field Detail

      • log

        protected org.apache.commons.logging.Log log
      • trace

        protected static final org.apache.commons.logging.Log trace
      • initialized

        protected volatile boolean initialized
        Has this endpoint been initialized ?
      • isClusteringEnabled

        protected Boolean isClusteringEnabled
        Is clustering enabled
      • fileName

        protected String fileName
        The name of the file where this endpoint is defined
      • anonymous

        protected boolean anonymous
      • errorHandler

        protected String errorHandler
        The Sequence name associated with the endpoint
      • artifactContainerName

        protected String artifactContainerName
    • Constructor Detail

      • AbstractEndpoint

        protected AbstractEndpoint()
    • Method Detail

      • getMetricsMBean

        public EndpointView getMetricsMBean()
        Description copied from interface: Endpoint
        Get a reference to the metrics MBean for this endpoint
        Specified by:
        getMetricsMBean in interface Endpoint
        Returns:
        EndpointView instance
      • getContext

        public EndpointContext getContext()
        Description copied from interface: Endpoint
        Get the EndpointContext that has the run-time state of this endpoint
        Specified by:
        getContext in interface Endpoint
        Returns:
        the runtime context
      • getName

        public String getName()
        Description copied from interface: Nameable
        Get the name of an abstraction
        Specified by:
        getName in interface Nameable
        Returns:
        String Representation of name
      • isInitialized

        public boolean isInitialized()
        Description copied from interface: Endpoint
        Has this Endpoint initialized?
        Specified by:
        isInitialized in interface Endpoint
        Returns:
        true if the endpoint is initialized
      • getParentEndpoint

        public Endpoint getParentEndpoint()
      • setParentEndpoint

        public void setParentEndpoint​(Endpoint parentEndpoint)
        Description copied from interface: Endpoint
        Sets the parent endpoint for the current endpoint.
        Specified by:
        setParentEndpoint in interface Endpoint
        Parameters:
        parentEndpoint - parent endpoint containing this endpoint. It should handle the onChildEndpointFail(...) callback.
      • getChildren

        public List<Endpoint> getChildren()
        Description copied from interface: Endpoint
        Get the children of this endpoint
        Specified by:
        getChildren in interface Endpoint
        Returns:
        the child endpoints
      • setChildren

        public void setChildren​(List<Endpoint> children)
      • getFileName

        public String getFileName()
        Description copied from interface: Endpoint
        Get the filename from which this endpoint is loaded, null if it is an anonymous endpoint
        Specified by:
        getFileName in interface Endpoint
        Returns:
        String file name
      • setFileName

        public void setFileName​(String fileName)
        Description copied from interface: Endpoint
        Set the filename from which the endpoint is loaded
        Specified by:
        setFileName in interface Endpoint
        Parameters:
        fileName - from which the endpoint is loaded
      • isAnonymous

        public boolean isAnonymous()
      • setAnonymous

        public void setAnonymous​(boolean anonymous)
      • setDescription

        public void setDescription​(String description)
        Description copied from interface: SynapseArtifact
        Set the description of the artifact
        Specified by:
        setDescription in interface SynapseArtifact
        Parameters:
        description - tobe set to the artifact
      • setName

        public void setName​(String endpointName)
        Description copied from interface: Nameable
        Set the name of an abstraction
        Specified by:
        setName in interface Nameable
        Parameters:
        endpointName - String Representation of name
      • setArtifactContainerName

        public void setArtifactContainerName​(String name)
        Set the car File name which this endpoint deployed from
        Specified by:
        setArtifactContainerName in interface Endpoint
        Parameters:
        name -
      • getArtifactContainerName

        public String getArtifactContainerName()
        Get the car File name which this endpoint deployed from
        Specified by:
        getArtifactContainerName in interface Endpoint
        Returns:
        artifactContainerName
      • getIsEdited

        public boolean getIsEdited()
        Get the edit state of the endpoint
        Specified by:
        getIsEdited in interface Endpoint
        Returns:
      • setIsEdited

        public void setIsEdited​(boolean isEdited)
        Set the edit state of the endpoint
        Specified by:
        setIsEdited in interface Endpoint
        Parameters:
        isEdited -
      • setEnableMBeanStats

        public void setEnableMBeanStats​(boolean flag)
        set whether this endpoint needs to be registered for JMX MBeans. some endpoints may not need to register under MBean and setting false will cut the additional overhead.
        Parameters:
        flag - set true/false
      • init

        public void init​(SynapseEnvironment synapseEnvironment)
        Description copied from interface: ManagedLifecycle
        This method should implement the initialization of the implemented parts of the configuration.
        Specified by:
        init in interface ManagedLifecycle
        Parameters:
        synapseEnvironment - SynapseEnvironment to be used for initialization
      • getCommentsList

        public List<String> getCommentsList()
      • setCommentsList

        public void setCommentsList​(List<String> commentsList)
      • readyToSend

        public boolean readyToSend()
        Description copied from interface: Endpoint
        Returns true to indicate that the endpoint is ready to service requests
        Specified by:
        readyToSend in interface Endpoint
        Returns:
        true if endpoint is ready to service requests
      • send

        public void send​(MessageContext synCtx)
        Description copied from interface: Endpoint
        Sends the message context according to an endpoint specific behavior.
        Specified by:
        send in interface Endpoint
        Parameters:
        synCtx - MessageContext to be sent.
      • isLeafEndpoint

        public boolean isLeafEndpoint()
        Is this a leaf level endpoint? or parent endpoint that has children?
        Returns:
        true if there is no children - a leaf endpoint
      • onChildEndpointFail

        public void onChildEndpointFail​(Endpoint endpoint,
                                        MessageContext synMessageContext)
        Description copied from interface: Endpoint
        Endpoints that contain other endpoints should implement this method. It will be called if a child endpoint causes an exception. Action to be taken on such failure is up to the implementation. But it is good practice to first try addressing the issue. If it can't be addressed propagate the exception to parent endpoint by calling parent endpoint's onChildEndpointFail(...) method.
        Specified by:
        onChildEndpointFail in interface Endpoint
        Parameters:
        endpoint - The child endpoint which caused the exception.
        synMessageContext - MessageContext that was used in the failed attempt.
      • executeEpTypeSpecificFunctions

        public void executeEpTypeSpecificFunctions​(MessageContext synCtx)
      • isTimeout

        protected boolean isTimeout​(MessageContext synCtx)
        Is this [fault] message a timeout?
        Parameters:
        synCtx - the current fault message
        Returns:
        true if this is defined as a timeout
      • isSuspendFault

        protected boolean isSuspendFault​(MessageContext synCtx)
        Is this a fault that should put the endpoint on SUSPEND? or is this a fault to ignore?
        Parameters:
        synCtx - the current fault message
        Returns:
        true if this fault should suspend the endpoint
      • onFault

        public void onFault​(MessageContext synCtx)
        On a fault, propagate to parent if any, or call into the fault handler
        Specified by:
        onFault in class FaultHandler
        Parameters:
        synCtx - the message at hand
      • onSuccess

        public 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
        Specified by:
        onSuccess in interface Endpoint
      • isTraceOn

        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
        Parameters:
        msgCtx - the current message
        Returns:
        true if tracing should be performed
      • isTraceOrDebugOn

        protected boolean isTraceOrDebugOn​(boolean isTraceOn)
        Is tracing or debug logging on?
        Parameters:
        isTraceOn - is tracing known to be on?
        Returns:
        true, if either tracing or debug logging is on
      • traceOrDebug

        protected void traceOrDebug​(boolean traceOn,
                                    String msg)
        Perform Trace and Debug logging of a message @INFO (trace) and DEBUG (log)
        Parameters:
        traceOn - is runtime trace on for this message?
        msg - the message to log/trace
      • prepareForEndpointStatistics

        protected void prepareForEndpointStatistics​(MessageContext synCtx)
        Process statistics for this message
        Parameters:
        synCtx - the current message
      • handleException

        protected void handleException​(String msg)
        Helper methods to handle errors.
        Parameters:
        msg - The error message
      • handleException

        protected void handleException​(String msg,
                                       Exception e)
        Helper methods to handle errors.
        Parameters:
        msg - The error message
        e - The exception
      • handleException

        protected void handleException​(String msg,
                                       Exception e,
                                       MessageContext msgCtx)
        Helper methods to handle errors.
        Parameters:
        msg - The error message
        e - The exception
        msgCtx - The message context
      • logOnChildEndpointFail

        protected void logOnChildEndpointFail​(Endpoint endpoint,
                                              MessageContext synMessageContext)
      • informFailure

        protected void informFailure​(MessageContext synCtx,
                                     int errorCode,
                                     String errorMsg)
      • destroy

        public void destroy()
        Description copied from interface: ManagedLifecycle
        This method should implement the destroying of the implemented parts of the configuration.
        Specified by:
        destroy in interface ManagedLifecycle
      • getProperty

        public MediatorProperty getProperty​(String name)
        Get a property with the given name
        Specified by:
        getProperty in interface PropertyInclude
        Parameters:
        name - name of the property
        Returns:
        a property with the given name
      • removeProperty

        public MediatorProperty removeProperty​(String name)
        Remove a property with the given name
        Specified by:
        removeProperty in interface PropertyInclude
        Parameters:
        name - name of the property to be removed
        Returns:
        the remove property or null if a property doesn't exists
      • getErrorHandler

        public String getErrorHandler()
        Description copied from interface: Endpoint
        Get the MessageStore name associated with the Endpoint
        Specified by:
        getErrorHandler in interface Endpoint
        Returns:
        String message store name
      • setErrorHandler

        public void setErrorHandler​(String errorHandler)
        Description copied from interface: Endpoint
        Set the Message Store name associated with the Endpoint
        Specified by:
        setErrorHandler in interface Endpoint
        Parameters:
        errorHandler - , name of the message store
      • setContentAware

        public void setContentAware​(boolean contentAware)
      • setForceBuildMC

        public void setForceBuildMC​(boolean forceBuildMC)
      • evaluateProperties

        protected void evaluateProperties​(MessageContext synCtx)
        Evaluates the endpoint properties based on the current message context and set the properties to the message context appropriately
        Parameters:
        synCtx - the current message context
      • logSetter

        public void logSetter()
      • getReportingName

        public String getReportingName()
      • setAdvancedProperties

        protected void setAdvancedProperties()
        Set advanced properties of the endpoint to json object.
      • getEndpointChildrenAsJson

        protected org.json.JSONArray getEndpointChildrenAsJson​(List<Endpoint> children)
      • getJsonRepresentation

        public org.json.JSONObject getJsonRepresentation()
        Description copied from interface: Endpoint
        Get the json representation of the endpoint.
        Specified by:
        getJsonRepresentation in interface Endpoint
        Returns:
        JSONObject
      • createJsonRepresentation

        protected abstract void createJsonRepresentation()