Class SharedComponentList

  • All Implemented Interfaces:
    ComponentLifecycle, ComponentLifecycleExtension

    @ComponentProfile(summary="A Collection of Shared Components",
                      tag="base")
    public class SharedComponentList
    extends java.lang.Object
    implements ComponentLifecycle, ComponentLifecycleExtension
    A common store for components.

    In the adapter configuration file this class is aliased as shared-components which is the preferred alternative to the fully qualified classname when building your configuration.

    • Constructor Detail

      • SharedComponentList

        public SharedComponentList()
    • Method Detail

      • setConnections

        public void setConnections​(java.util.List<AdaptrisConnection> l)
        Set the connections.

        Note that this simply calls Collection.clear() and addConnections(Collection) rather than setting the underlying object directly.

        Parameters:
        l - the list to set.
        Throws:
        java.lang.IllegalArgumentException - if one or more connections had no unique-id, or if one or more connections would be rejected because of duplication.
      • getServices

        public java.util.List<Service> getServices()
        Returns a clone of the shared-services

        This method is purely to allow the underlying XML marshaller to do it's thing, you are strongly encouraged to use the corresponding methods addService(Service), addServices(Collection), removeService(String) instead to manipulate the contents of the list.

        Returns:
        the list of connections.
      • setServices

        public void setServices​(java.util.List<Service> serviceLists)
      • stop

        public 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
      • close

        public 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
      • bindJNDI

        public void bindJNDI​(java.lang.String componentId)
                      throws CoreException
        Bind a previously added Connection to JNDI.

        When runtime additions of a connection occurs (generally via AdapterManagerMBean.addSharedConnection(String)), they are not automatically bound to the internal JNDI. Use this method after adding a connection to bind the connection to JNDI.

        Parameters:
        componentId - the connection ID of connection to bind.
        Throws:
        CoreException - wrapping other exceptions.
      • getConnectionIds

        public java.util.Collection<java.lang.String> getConnectionIds()
        Return a list of connection-ids that are registered.
        Returns:
        a set of connection-ids
      • getServiceIds

        public java.util.Collection<java.lang.String> getServiceIds()
        Return a list of service-ids that are registered.
        Returns:
        a set of service-ids
      • addService

        public boolean addService​(Service c)
        Convenience method to add a connection performing verification.
        Parameters:
        c - the connection to add
        Returns:
        true if the object was successfully added, false if there was already a connection with that unique-id
        Throws:
        java.lang.IllegalArgumentException - if the connection has no unique-id.
      • addServices

        public java.util.Collection<Service> addServices​(java.util.Collection<Service> coll)
        Convenience method to add service collections performing verification.
        Parameters:
        coll - the service collections to add
        Returns:
        a collection of things that were rejected.
        Throws:
        java.lang.IllegalArgumentException - if one or more service collections has no unique-id.
      • addConnection

        public boolean addConnection​(AdaptrisConnection c)
        Convenience method to add a service collection performing verification.
        Parameters:
        c - the service collection to add
        Returns:
        true if the object was successfully added, false if there was already a service collection with that unique-id
        Throws:
        java.lang.IllegalArgumentException - if the service collection has no unique-id.
      • addConnections

        public java.util.Collection<AdaptrisConnection> addConnections​(java.util.Collection<AdaptrisConnection> coll)
        Convenience method to add connections performing verification.
        Parameters:
        coll - the connections to add
        Returns:
        a collection of things that were rejected.
        Throws:
        java.lang.IllegalArgumentException - if one or more connections has no unique-id.
      • removeConnection

        public java.util.Collection<AdaptrisConnection> removeConnection​(java.lang.String id)
        Remove a connection by it's ID.
        Parameters:
        id - the unique-id of the connection to remove.
        Returns:
        a collection of the removed items
      • removeService

        public java.util.Collection<Service> removeService​(java.lang.String id)
        Remove a service collection by it's ID.
        Parameters:
        id - the unique-id of the service collection to remove.
        Returns:
        a collection of the removed items
      • containsConnection

        public boolean containsConnection​(java.lang.String id)
        Does the underlying connection list contain this id.
        Parameters:
        id - the ID to check for.
        Returns:
        true if the ID exists.
      • containsService

        public boolean containsService​(java.lang.String id)
        Does the underlying service collection list contain this id.
        Parameters:
        id - the ID to check for.
        Returns:
        true if the ID exists.
      • getDebug

        public java.lang.Boolean getDebug()
      • setDebug

        public void setDebug​(java.lang.Boolean debug)