Package de.aristaflow.adept2.core.client
Class AddAttrSessionFactory
- java.lang.Object
-
- de.aristaflow.adept2.core.client.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 Summary
Constructors Constructor Description AddAttrSessionFactory(ClientSessionFactory csf, Map<String,String> additionalAttributes)
Creates a newClientSessionFactory
which adds the designated additional attributes to all created session tokens.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RichAgent
getAuthenticatedAgent()
Gets theRichAgent
which is authenticated for this client session factory.SessionToken
getSessionToken()
Creates a new (top-level) session token which is needed for calling the ADEPT2-API.SessionToken
getSessionToken(URI[] callingComponent)
Creates a new (top-level) session token which is needed for calling the ADEPT2-API.SessionToken
getSessionToken(URI[] callingComponent, Map<String,String> additionalAttributes)
Creates a new (top-level) session token which is needed for calling the ADEPT2-API.SessionToken
getSessionToken(Map<String,String> additionalAttributes)
Creates a new (top-level) session token which is needed for calling the ADEPT2-API.void
setClientURIs(URI[] clientURIs)
Sets the URIs to be used when creating a session token without explicit URIs.boolean
subEquals(Object obj)
An implementation ofObject.equals(Object)
for various purpose.int
subHashCode()
An implementation ofObject.hashCode()
for various purpose.
-
-
-
Constructor Detail
-
AddAttrSessionFactory
public AddAttrSessionFactory(ClientSessionFactory csf, Map<String,String> additionalAttributes)
Creates a newClientSessionFactory
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
-
getAuthenticatedAgent
public RichAgent getAuthenticatedAgent()
Description copied from interface:ClientSessionFactory
Gets theRichAgent
which is authenticated for this client session factory.- Specified by:
getAuthenticatedAgent
in interfaceClientSessionFactory
- Returns:
- The
RichAgent
authenticated for this client session factory.
-
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 callingClientSessionFactory.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 interfaceClientSessionFactory
- 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 interfaceClientSessionFactory
- 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 interfaceClientSessionFactory
- 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 anIllegalStateException
will be thrown.- Specified by:
getSessionToken
in interfaceClientSessionFactory
- 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 anIllegalStateException
will be thrown.- Specified by:
getSessionToken
in interfaceClientSessionFactory
- 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 ofObject.equals(Object)
for various purpose. Due to several reasons we do not want actually overrideObject.equals(Object)
.- Parameters:
obj
- The object with which to compare.- Returns:
- Whether this is the same object as the designated one.
-
subHashCode
public int subHashCode()
An implementation ofObject.hashCode()
for various purpose. Due to several reasons we do not want actually overrideObject.hashCode()
.
The implementation conforms to the implementation ofsubEquals(Object)
with respect toObject.equals(Object)
.- Returns:
- A hash code value for this object.
-
-