ADK CVS

tryllian.are.persistence.spi
Interface ARLPersistencePlugin


public interface ARLPersistencePlugin

Objects that implement the ARLPersistencePlugin are created by the PersistencePlugin and manage the persisting of the AgentResourceLocator data (proxied by the ARLSerializer). The data in the JarURL table has a close relation to the myriad numbered jar files in your /tmp directory.


Method Summary
 void clear(Transaction transaction)
          Completely clean out the arl cache and all its dependencies.
 boolean contains(java.lang.String arlID, Transaction transaction)
          Checks whether this arl has already been entered in the database.
 void gc(Transaction transaction)
          Make the contents of the arl cache consistent by doing garbage collection.
 void get(java.lang.String agentID, ARLBuilder builder, Transaction transaction)
          Retrieve an arl object from the data contained in the database.
 java.util.Map getJars(Transaction transaction)
          Gets a map of all the jars in the database.
 java.lang.String getURL(java.lang.String jarID, Transaction transaction)
          Returns the URL related to the specified jarID.
 java.util.Set getURLs(Transaction transaction)
          Returns a list of all URLs still in use.
 void put(ARLSerializer arlSerializer, Transaction transaction)
          Persist an arl and its dependencies.
 void putURL(java.lang.String arlID, java.lang.String jarID, java.lang.String url, java.lang.String type, Transaction transaction)
          Puts the URL in the jarcache and creates the mapping between the jarfile and the arl.
 void remove(java.lang.String arlID, Transaction transaction)
          Removes an arl from the database.
 

Method Detail

clear

public void clear(Transaction transaction)
           throws PersistenceException
Completely clean out the arl cache and all its dependencies.

Parameters:
transaction - the transaction within which the action should take place.
Throws:
PersistenceException

gc

public void gc(Transaction transaction)
        throws PersistenceException
Make the contents of the arl cache consistent by doing garbage collection. That is to say, all ARL's that are no longer associated with an agent are removed. All ARLJars that no longer are associated with an ARL are removed, too.

Parameters:
transaction - the transaction within which the action should take place.
Throws:
PersistenceException

put

public void put(ARLSerializer arlSerializer,
                Transaction transaction)
         throws PersistenceException
Persist an arl and its dependencies. If any of the jarfiles associated with the arl are already present in the database, only a mapping is created.

Parameters:
arlSerializer - The agentresourcelocatorserializer object.
transaction - the transaction within which the action should take place.
Throws:
PersistenceException

get

public void get(java.lang.String agentID,
                ARLBuilder builder,
                Transaction transaction)
         throws PersistenceException
Retrieve an arl object from the data contained in the database.

Parameters:
agentID - The ID of the agent whose ARL we want to retrieve.
builder - A builder object that can construct and ARL.
transaction - the transaction within which the action should take place.
Throws:
PersistenceException

contains

public boolean contains(java.lang.String arlID,
                        Transaction transaction)
                 throws PersistenceException
Checks whether this arl has already been entered in the database.

Parameters:
arlID - The AgentLocatorResource ID
transaction - the transaction within which the action should take place.
Returns:
True if it is already present
Throws:
PersistenceException

remove

public void remove(java.lang.String arlID,
                   Transaction transaction)
            throws PersistenceException
Removes an arl from the database.

Parameters:
transaction - the transaction within which the action should take place.
Throws:
PersistenceException

getURLs

public java.util.Set getURLs(Transaction transaction)
                      throws PersistenceException
Returns a list of all URLs still in use.

Parameters:
transaction - the transaction within which the action should take place.
Throws:
PersistenceException

getURL

public java.lang.String getURL(java.lang.String jarID,
                               Transaction transaction)
                        throws PersistenceException
Returns the URL related to the specified jarID.

Parameters:
transaction - the transaction within which the action should take place.
Throws:
PersistenceException

putURL

public void putURL(java.lang.String arlID,
                   java.lang.String jarID,
                   java.lang.String url,
                   java.lang.String type,
                   Transaction transaction)
            throws PersistenceException
Puts the URL in the jarcache and creates the mapping between the jarfile and the arl. If the jarfile already exists, only the mapping is made.

Parameters:
arlID - The ID of the arl this jar should be mapped too.
jarID - The ID of the jarfile that should be saved.
url - The url that locates the jarfile on the filesystem
type - The type of the jar: ARLSerializer.SPECIAL_JARS or ARLSerializer.ORDINARY_JARS.
transaction - The transaction within which the action should take place.
Throws:
PersistenceException - if the arlID is not already present or if any other database error occurs.

getJars

public java.util.Map getJars(Transaction transaction)
                      throws PersistenceException
Gets a map of all the jars in the database. Key: String JarID Value: String URL

Parameters:
transaction - The transaction within whit the action should take place
Returns:
HashMap containing all the the jars
Throws:
PersistenceException

Copyright 2005, Tryllian Solutions B.V.