|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object livespace.services.Persistence
public final class Persistence
Livespace persistent storage services. Allows services to access settings and other data in the form of persistent data beans.
TODO use file locking to stop concurrent access.
Method Summary | |
---|---|
static void |
closeObject(IDataBean bean)
Close a persistent object previously returned by openObject(RoomEntity, String) . |
static String |
getDataFile(RoomEntity room,
String path)
Create a path for a general data file stored in the persistent storage area. |
static IDataBean |
openObject(RoomEntity room,
String path)
Open/create a persistent object identified by a given logical path. |
static IDataBean |
openObjectHostScope(RoomEntity room,
String path)
Open/create a persistent object identified by a given logical path. |
static IDataBean |
readObject(String persistenceFile)
Read a saved persistent object from a DBXML file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static IDataBean openObject(RoomEntity room, String path) throws ClassNotFoundException, IOException, IllegalArgumentException
The objects managed via this call are room-wide, i.e. the same
object will be opened regardless of which host the service runs
on. For services that need to run on multiple hosts concurrently,
use openObjectHostScope(RoomEntity, String)
instead.
Clients should closeObject(IDataBean)
when they're
finished with the object.
room
- The room. The base URI for data storage is taken from
here.path
- The logical path for the persistent object. This
usually has some obvious relationship to the service
type and may contain any number of "subdirectories" if
the service wants to have more than one persistent
object. Examples include: "lights/entities",
"volume/mixer1", "volume/stateCache".
IllegalArgumentException
- if an error is found in the
structure of an existing serialized object instance.
ClassNotFoundException
- If a class referenced by the
persistent object cannot be found.
IOException
- If a generic IO error occurs during reading
the persistent object.openObjectHostScope(RoomEntity, String)
public static IDataBean readObject(String persistenceFile) throws ClassNotFoundException, IOException, IllegalArgumentException
openObject(RoomEntity, String)
rather than this method.
persistenceFile
- The name of the file to open.
ClassNotFoundException
IOException
IllegalArgumentException
openObject(RoomEntity, String)
public static IDataBean openObjectHostScope(RoomEntity room, String path) throws ClassNotFoundException, IOException, IllegalArgumentException
The objects managed via this call are host-local, i.e. a separate objects will be opened on different hosts. This allows the same service to run on multiple hosts concurrently with per-host persistent state.
Clients should closeObject(IDataBean)
when they're
finished with the object.
room
- The room. The base URI for data storage is taken from
here.path
- The logical path for the persistent object. This
usually has some obvious relationship to the service
type and may contain any number of "subdirectories" if
the service wants to have more than one persistent
object. Examples include: "lights/entities",
"volume/mixer1", "volume/stateCache".
IllegalArgumentException
- if an error is found in the
structure of an existing serialized object instance.
ClassNotFoundException
- If a class referenced by the
persistent object cannot be found.
IOException
- If a generic IO error occurs during reading
the persistent object.
UnknownHostException
- if the host's name could
not be determined.openObject(RoomEntity, String)
,
Localhost
public static void closeObject(IDataBean bean)
openObject(RoomEntity, String)
.
bean
- The persistent object.public static String getDataFile(RoomEntity room, String path)
room
- The local room. The base URI for data storage is taken from
here.path
- The final part of the path for the file.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |