Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.bizapp.agent
Class TokenManager

java.lang.Object
  extended by org.hyperic.hq.bizapp.agent.TokenManager

public class TokenManager
extends java.lang.Object

The token manager is a class which knows how to read a properties file which contains a list of tokens with the following information: 1 - The Token - A simple string 2 - Create Time - The time when the token was generated 3 - Locked - A flag indicating whether the token is verified or it is just temporary, in which case it will timeout after a certain time after the creation time. Tokens which are pending and exceed the timeout are eliminated automagically.


Constructor Summary
TokenManager(long timeout, TokenStorer storer)
          Create a token manager with a timeout for pending tokens of 'timeout' milliseconds.
 
Method Summary
 void addToken(TokenData newToken)
           
 void deleteToken(TokenData token)
           
 TokenData getToken(java.lang.String token)
          Get a token with the specified string
 java.util.List getTokens()
          Get a list of all the tokens managed by the TokenManager
 void load(java.io.InputStream is)
           
 void setTokenLocked(TokenData token, boolean locked)
          Set the token managed by the manager to the given locked mode.
 void store()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TokenManager

public TokenManager(long timeout,
                    TokenStorer storer)
Create a token manager with a timeout for pending tokens of 'timeout' milliseconds.

Method Detail

addToken

public void addToken(TokenData newToken)

deleteToken

public void deleteToken(TokenData token)
                 throws TokenNotFoundException
Throws:
TokenNotFoundException

setTokenLocked

public void setTokenLocked(TokenData token,
                           boolean locked)
                    throws TokenNotFoundException
Set the token managed by the manager to the given locked mode.

Parameters:
token - Token to set locked/unlocked
locked - True or false if the token is locked or pending
Throws:
TokenNotFoundException

getTokens

public java.util.List getTokens()
Get a list of all the tokens managed by the TokenManager


getToken

public TokenData getToken(java.lang.String token)
                   throws TokenNotFoundException
Get a token with the specified string

Parameters:
token - The token to look for
Returns:
The TokenData object that matches the token
Throws:
TokenNotFoundException

store

public void store()
           throws java.io.IOException
Throws:
java.io.IOException

load

public void load(java.io.InputStream is)
          throws java.io.IOException
Throws:
java.io.IOException

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.