org.silverpeas.token.persistent.service
Interface PersistentResourceTokenService

All Known Implementing Classes:
DefaultTokenService, TokenServiceMockWrapper

public interface PersistentResourceTokenService

A service on the persistent token for Silverpeas entities. It wraps the mechanism to compute and to retrieve a token for a given resource handled in Silverpeas.

Author:
Yohann Chastagnier

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.
 

Method Detail

initialize

PersistentResourceToken initialize(EntityReference resource)
                                   throws TokenException
Initializes the token of the resource referred by the specified EntityReference. If the resource has already a token, this token is then renewed.

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 unexpected error occurs while initializing a token.

get

PersistentResourceToken get(EntityReference resource)
Gets the token of the resource referred by the specified EntityReference. If no token exists for the resource, then PersistentResourceToken.NoneToken is returned.

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.

get

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

Parameters:
token - the value of the token to get.
Returns:
either the token with the specified value or NoneToken if no such token exists.

remove

void remove(EntityReference resource)
Removes quietly the token of the resource referred by the specified entity reference.

Parameters:
resource - the resource for which the token has to be removed.

remove

void remove(String token)
Removes quietly the specified token.

Parameters:
token - the String representation of the token to remove.


Copyright © 2016 Silverpeas. All Rights Reserved.