org.silverpeas.token.persistent.service
Class DefaultTokenService

java.lang.Object
  extended by org.silverpeas.token.persistent.service.DefaultTokenService
All Implemented Interfaces:
PersistentResourceTokenService

@Service(value="persistentResourceTokenService")
public class DefaultTokenService
extends Object
implements PersistentResourceTokenService

The default implementation of the PersistentResourceTokenService interface.

Author:
Yohann Chastagnier

Constructor Summary
DefaultTokenService()
           
 
Method Summary
 PersistentResourceToken get(EntityReference resource)
          Gets the token of the resource referred by the specified EntityReference.
 PersistentResourceToken get(String token)
          Gets the token with the specified value from the data source.
 PersistentResourceToken initialize(EntityReference resource)
          Initializes the token of the resource referred by the specified EntityReference.
 void remove(EntityReference resource)
          Removes quietly the token of the resource referred by the specified entity reference.
 void remove(String token)
          Removes quietly the specified token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTokenService

public DefaultTokenService()
Method Detail

initialize

@Transactional(propagation=REQUIRED)
public PersistentResourceToken initialize(EntityReference resource)
                                   throws TokenException
Description copied from interface: PersistentResourceTokenService
Initializes the token of the resource referred by the specified EntityReference. If the resource has already a token, this token is then renewed.

Specified by:
initialize in interface PersistentResourceTokenService
Parameters:
resource - a reference to the resource for which a token will be initialized.
Returns:
a token persisted for the specified resource.
Throws:
TokenException - if an error occurs while initializing a token.
See Also:
PersistentResourceTokenService.initialize(org.silverpeas.EntityReference)

get

public PersistentResourceToken get(EntityReference resource)
Description copied from interface: PersistentResourceTokenService
Gets the token of the resource referred by the specified EntityReference. If no token exists for the resource, then PersistentResourceToken.NoneToken is returned.

Specified by:
get in interface PersistentResourceTokenService
Parameters:
resource - a reference to the resource for which a token will be initialized.
Returns:
either the token associated with the specified resource or NoneToken if no such token exists.
See Also:
PersistentResourceTokenService.get(org.silverpeas.EntityReference)

get

public PersistentResourceToken get(String token)
Description copied from interface: PersistentResourceTokenService
Gets the token with the specified value from the data source. If no token exists with a such value, then PersistentResourceToken.NoneToken is returned.

Specified by:
get in interface PersistentResourceTokenService
Parameters:
token - the value of the token to get.
Returns:
either the token with the specified value or NoneToken if no such token exists.
See Also:
PersistentResourceTokenService.get(java.lang.String)

remove

@Transactional(propagation=REQUIRED)
public void remove(EntityReference resource)
Description copied from interface: PersistentResourceTokenService
Removes quietly the token of the resource referred by the specified entity reference.

Specified by:
remove in interface PersistentResourceTokenService
Parameters:
resource - the resource for which the token has to be removed.
See Also:
PersistentResourceTokenService.remove(org.silverpeas.EntityReference)

remove

@Transactional(propagation=REQUIRED)
public void remove(String token)
Description copied from interface: PersistentResourceTokenService
Removes quietly the specified token.

Specified by:
remove in interface PersistentResourceTokenService
Parameters:
token - the String representation of the token to remove.
See Also:
PersistentResourceTokenService.remove(java.lang.String)


Copyright © 2016 Silverpeas. All Rights Reserved.