Class AddAttrSessionFactory

  • All Implemented Interfaces:
    ClientSessionFactory, Serializable

    public class AddAttrSessionFactory
    extends Object
    implements ClientSessionFactory
    This class wraps a normal client session factory and adds specific additional attributes to all created session tokens. Note that these attributes may be overridden by additional attributes provided to the corresponding methods.
    See Also:
    Serialized Form
    • Constructor Detail

      • AddAttrSessionFactory

        public AddAttrSessionFactory​(ClientSessionFactory csf,
                                     Map<String,​String> additionalAttributes)
        Creates a new ClientSessionFactory which adds the designated additional attributes to all created session tokens.
        Parameters:
        csf - The client session factory used to create session tokens.
        additionalAttributes - The additional attributes added to every created session token (complemented by provided additional attributes if appropriate).
    • Method Detail

      • setClientURIs

        public void setClientURIs​(URI[] clientURIs)
        Description copied from interface: ClientSessionFactory
        Sets the URIs to be used when creating a session token without explicit URIs. This method has to be called before calling ClientSessionFactory.getSessionToken() and it must not be called more than once! Further calls are ignored.
        The array should be a copy of the original one.
        Specified by:
        setClientURIs in interface ClientSessionFactory
        Parameters:
        clientURIs - The URIs of the client used if a component does not have its own URIs. This must not be null.
      • getSessionToken

        public SessionToken getSessionToken​(URI[] callingComponent)
        Description copied from interface: ClientSessionFactory
        Creates a new (top-level) session token which is needed for calling the ADEPT2-API. This method provides a session token containing the appropriate security token, the agent and organisational position ID. The calling component just has to submit a URI of itself.
        This method has to be used by components having a own external communication interface.
        Specified by:
        getSessionToken in interface ClientSessionFactory
        Parameters:
        callingComponent - The component initiating the requested session on the client side, identified by its communication protocol depended URIs.
        Returns:
        A session token (signed) for the logged on user, the corresponding organisational position, security token and the designated component initiating the session.
      • getSessionToken

        public SessionToken getSessionToken​(URI[] callingComponent,
                                            Map<String,​String> additionalAttributes)
        Description copied from interface: ClientSessionFactory
        Creates a new (top-level) session token which is needed for calling the ADEPT2-API. This method provides a session token containing the appropriate security token, the agent and organisational position ID as well as the additional attributes. The calling component just has to submit a URI of itself.
        This method has to be used by components having a own external communication interface.
        Specified by:
        getSessionToken in interface ClientSessionFactory
        Parameters:
        callingComponent - The component initiating the requested session on the client side, identified by its communication protocol depended URIs.
        additionalAttributes - Additional attributes which are provided by the created session token. This may be null.
        Returns:
        A session token for the logged on user, the corresponding organisational position, security token and the designated component initiating the session.
      • getSessionToken

        public SessionToken getSessionToken()
        Description copied from interface: ClientSessionFactory
        Creates a new (top-level) session token which is needed for calling the ADEPT2-API. This method provides a session token containing the appropriate security token, the agent and organisational position ID and the URIs of the client.

        Before calling this method, ClientSessionFactory.setClientURIs(URI[]) has to be called. Otherwise an IllegalStateException will be thrown.

        Specified by:
        getSessionToken in interface ClientSessionFactory
        Returns:
        A session token for the logged on user, the corresponding organisational position, security token and URIs of the corresponding client.
      • getSessionToken

        public SessionToken getSessionToken​(Map<String,​String> additionalAttributes)
        Description copied from interface: ClientSessionFactory
        Creates a new (top-level) session token which is needed for calling the ADEPT2-API. This method provides a session token containing the appropriate security token, the agent and organisational position ID and the URIs of the client as well as the additional attributes.

        Before calling this method, ClientSessionFactory.setClientURIs(URI[]) has to be called. Otherwise an IllegalStateException will be thrown.

        Specified by:
        getSessionToken in interface ClientSessionFactory
        Parameters:
        additionalAttributes - Additional attributes which are provided by the created session token. This may be null.
        Returns:
        A session token for the logged on user, the corresponding organisational position, security token and URIs of the corresponding client.
      • subEquals

        public boolean subEquals​(Object obj)
        An implementation of Object.equals(Object) for various purpose. Due to several reasons we do not want actually override Object.equals(Object).
        Parameters:
        obj - The object with which to compare.
        Returns:
        Whether this is the same object as the designated one.