Package org.codehaus.cargo.daemon
Class HandleDatabase
- java.lang.Object
-
- org.codehaus.cargo.daemon.HandleDatabase
-
public class HandleDatabase extends Object
Keeps track of handles in memory, with support to load from and save to disk.
-
-
Constructor Summary
Constructors Constructor Description HandleDatabase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<Map.Entry<String,Handle>>entrySet()Handleget(String handleId)Gets the handle object by handle id.voidload(InputStream inStream)Loads the handles database from diskvoidput(String handleId, Handle handle)Puts the handle object in database (in memory).HandleputIfAbsent(String handleId, Handle handle)Puts the handle object in database (in memory) if absent.voidremove(String handleId)Removes the handle from the database.voidstore(OutputStream outStream)Stores handle database to disk
-
-
-
Method Detail
-
load
public void load(InputStream inStream) throws IOException
Loads the handles database from disk- Parameters:
inStream- the input stream containing the handle records- Throws:
IOException- if errors occurs
-
store
public void store(OutputStream outStream) throws IOException
Stores handle database to disk- Parameters:
outStream- Output stream to write data to.- Throws:
IOException- if error occurs
-
get
public Handle get(String handleId)
Gets the handle object by handle id.- Parameters:
handleId- The handle id.- Returns:
- the handle object.
-
put
public void put(String handleId, Handle handle)
Puts the handle object in database (in memory).- Parameters:
handleId- The handle id.handle- The handle object
-
putIfAbsent
public Handle putIfAbsent(String handleId, Handle handle)
Puts the handle object in database (in memory) if absent.- Parameters:
handleId- The handle id.handle- The handle object- Returns:
- The previous handle instance or null
-
remove
public void remove(String handleId)
Removes the handle from the database.- Parameters:
handleId- The handle id.
-
-