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()
Handle
get(String handleId)
Gets the handle object by handle id.void
load(InputStream inStream)
Loads the handles database from diskvoid
put(String handleId, Handle handle)
Puts the handle object in database (in memory).Handle
putIfAbsent(String handleId, Handle handle)
Puts the handle object in database (in memory) if absent.void
remove(String handleId)
Removes the handle from the database.void
store(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.
-
-