Class ServiceCollectionImp

    • Field Detail

      • log

        protected transient org.slf4j.Logger log
      • eventHandler

        protected transient EventHandler eventHandler
    • Constructor Detail

      • ServiceCollectionImp

        public ServiceCollectionImp()
      • ServiceCollectionImp

        public ServiceCollectionImp​(java.util.Collection<Service> list)
    • Method Detail

      • createName

        public java.lang.String createName()
        Description copied from interface: MessageEventGenerator
        Create a name for any MleMarker that is generated.

        The default implementation is to return the classname of the component in question.

        * @return the name for any MleMarker that is generated.
        Specified by:
        createName in interface MessageEventGenerator
      • createQualifier

        public java.lang.String createQualifier()
        Description copied from interface: MessageEventGenerator
        Create a qualifier for any MleMarker that is generated.

        The default implementation is to return the unique-id of the component in question, or the empty string if not configured

        Specified by:
        createQualifier in interface MessageEventGenerator
        Returns:
        the qualifier for any MleMarker that is generated.
      • getUniqueId

        public java.lang.String getUniqueId()
        Description copied from interface: AdaptrisComponent
        Get the unique-id that is associated with this component.
        Specified by:
        getUniqueId in interface AdaptrisComponent
        Returns:
        the unique-id
      • setUniqueId

        public void setUniqueId​(java.lang.String s)
        Description copied from interface: Service

        Sets the unique identifier for this Service. These unique identifiers are optional but maybe required by some implementations of ServiceCollection.

        Specified by:
        setUniqueId in interface Service
        Parameters:
        s - this Service's unique identifier
      • isBranching

        public boolean isBranching()
        Description copied from interface: Service

        Returns true if the implementation supports branching.

        Specified by:
        isBranching in interface Service
        Returns:
        true if the implementation supports branching
        See Also:
        BranchingServiceCollection
      • continueOnFailure

        public boolean continueOnFailure()
        Description copied from interface: Service

        If true containers should continue and apply the next configured Service even if this Service throws an Exception.

        Specified by:
        continueOnFailure in interface Service
        Returns:
        continueOnFail
      • getContinueOnFail

        public java.lang.Boolean getContinueOnFail()
        Returns:
        whether or not this service is configured to continue on failure.
        See Also:
        Service.continueOnFailure()
      • getIsTrackingEndpoint

        public java.lang.Boolean getIsTrackingEndpoint()
      • setIsTrackingEndpoint

        public void setIsTrackingEndpoint​(java.lang.Boolean b)
      • addService

        public void addService​(Service service)

        Adds a Service to the end of the configured List.

        Specified by:
        addService in interface ServiceCollection
        Parameters:
        service - the Service to add to the end of the configured List may not be null
      • getServices

        public java.util.List<Service> getServices()

        Returns the configured List of Services. May be empty but not null.

        Specified by:
        getServices in interface ServiceCollection
        Returns:
        the configured List of Services
      • setServices

        public void setServices​(java.util.List<Service> serviceList)
        Override the underlying service list.
        Parameters:
        serviceList - the service list.
      • applyServices

        protected abstract void applyServices​(AdaptrisMessage msg)
                                       throws ServiceException
        Apply the required services to the message.
        Parameters:
        msg - the message
        Throws:
        ServiceException - wrapping any underlying exception.
      • init

        public final void init()
                        throws CoreException
        Description copied from interface: ComponentLifecycle
        Initialises the component.

        Component initialisation includes config verification, creation of connections etc.

        Specified by:
        init in interface ComponentLifecycle
        Throws:
        CoreException - wrapping any underlying Exceptions
      • doInit

        protected abstract void doInit()
                                throws CoreException
        Start any additional components.
        Throws:
        CoreException - wrapping any underlying exception
      • doStart

        protected abstract void doStart()
                                 throws CoreException
        Start any additional components.
        Throws:
        CoreException - wrapping any underlying exception
      • stop

        public final void stop()
        Description copied from interface: ComponentLifecycle
        Stop the component

        A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer, calling stop will pause message delivery. Throwing a RuntimeException may cause unintended consequences

        Specified by:
        stop in interface ComponentLifecycle
      • doStop

        protected abstract void doStop()
        Stop any additional components.
      • close

        public final void close()
        Description copied from interface: ComponentLifecycle
        Closes the component.

        A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException may cause unintended consequences

        Specified by:
        close in interface ComponentLifecycle
      • doClose

        protected abstract void doClose()
        Close any additional components.
      • getRestartAffectedServiceOnException

        public java.lang.Boolean getRestartAffectedServiceOnException()
      • setRestartAffectedServiceOnException

        public void setRestartAffectedServiceOnException​(java.lang.Boolean b)
        Whether to restart the service that threw the ServiceException during processing.
        Parameters:
        b - true to restart affected services, default false
      • add

        public boolean add​(Service service)
        Specified by:
        add in interface java.util.Collection<Service>
        Specified by:
        add in interface java.util.List<Service>
        Overrides:
        add in class java.util.AbstractCollection<Service>
      • iterator

        public java.util.Iterator<Service> iterator()
        Specified by:
        iterator in interface java.util.Collection<Service>
        Specified by:
        iterator in interface java.lang.Iterable<Service>
        Specified by:
        iterator in interface java.util.List<Service>
        Specified by:
        iterator in class java.util.AbstractCollection<Service>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<Service>
        Specified by:
        size in interface java.util.List<Service>
        Specified by:
        size in class java.util.AbstractCollection<Service>
      • add

        public void add​(int index,
                        Service element)
        Specified by:
        add in interface java.util.List<Service>
      • addAll

        public boolean addAll​(java.util.Collection<? extends Service> c)
        Specified by:
        addAll in interface java.util.Collection<Service>
        Specified by:
        addAll in interface java.util.List<Service>
        Overrides:
        addAll in class java.util.AbstractCollection<Service>
      • addAll

        public boolean addAll​(int index,
                              java.util.Collection<? extends Service> c)
        Specified by:
        addAll in interface java.util.List<Service>
      • get

        public Service get​(int index)
        Specified by:
        get in interface java.util.List<Service>
      • indexOf

        public int indexOf​(java.lang.Object o)
        Specified by:
        indexOf in interface java.util.List<Service>
      • lastIndexOf

        public int lastIndexOf​(java.lang.Object o)
        Specified by:
        lastIndexOf in interface java.util.List<Service>
      • listIterator

        public java.util.ListIterator<Service> listIterator()
        Specified by:
        listIterator in interface java.util.List<Service>
      • listIterator

        public java.util.ListIterator<Service> listIterator​(int index)
        Specified by:
        listIterator in interface java.util.List<Service>
      • remove

        public Service remove​(int index)
        Specified by:
        remove in interface java.util.List<Service>
      • set

        public Service set​(int index,
                           Service element)
        Specified by:
        set in interface java.util.List<Service>
      • subList

        public java.util.List<Service> subList​(int fromIndex,
                                               int toIndex)
        Specified by:
        subList in interface java.util.List<Service>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<Service>
        Specified by:
        clear in interface java.util.List<Service>
        Overrides:
        clear in class java.util.AbstractCollection<Service>
      • enforceRequirements

        protected Service enforceRequirements​(Service service)
        Enforce any requirements of the list.
        Parameters:
        service - the service due to be added.
        Returns:
        the service
        Throws:
        java.lang.IllegalArgumentException - if the requirements are not met
      • enforceRequirements

        protected java.util.Collection<? extends Service> enforceRequirements​(java.util.Collection<? extends Service> collection)
        Enforce any requirements of the list.
        Parameters:
        collection - the services due to be added.
        Returns:
        the collection
        Throws:
        java.lang.IllegalArgumentException - if the requirements are not met
      • setOutOfStateHandler

        public void setOutOfStateHandler​(OutOfStateHandler handler)
        Set the behaviour when internal services are not in the correct state.
        Parameters:
        handler - if not specified defaults to RaiseExceptionOutOfStateHandler.