|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object livespace.services.Livespace
public final class Livespace
Basic definitions and methods used by Livespace clients.
Field Summary | |
---|---|
static int |
ENTITY_RESPONSE_TIMEOUT
The default maximum amount of time to wait (in millis) before an entity is considered not to be responding. |
static int |
PROTOCOL_VERSION
The Livespace protocol version in use. |
Method Summary | |
---|---|
static Scheduler |
acquireScheduler()
Get a shared scheduler for background tasks. |
static String |
createUniqueId()
Create a unique ID. |
static String |
elvinToJava(String elvinName)
Convert an Elvin-style field name to a Java-style member name. |
static String |
escapeNtfnField(String field)
Escape a string that will be used as a field value in a notification. |
static String |
escapeNtfnString(String str)
Escape a string to be used as a string value in a notification. |
static String |
fileToUrl(String path)
Convert a file path into a "file:" based URL. |
static Class<? extends Entity> |
findEntityClass(String entityType)
Find the class registered to represent instances of a given entity type. |
static String |
getBuildDate()
Returns the time stamp when the Livespace software was built. |
static String |
getBundlePath()
Returns the location where the bundles were obtained from at startup |
static String |
getCurrentConfigPath()
Returns the path where the current configuration files were obtained from. |
static String |
getDefaultConfigPath()
Returns the path where the default configuration files were obtained from. |
static String |
getDeployConfigs()
Returns which deploy configuration were used at startup for the running OSGi client as a comma delimetered list eg. |
static String |
getElvinUrl()
Returns the configured url of the elvin router |
static String |
getHostCategory()
Alias for OsgiUtil.getHostCategory() . |
static String |
getHostName()
Alias for OsgiUtil.getHostName() . |
static String |
getIPAddress()
|
static RoomEntity |
getOrCreateLocalRoom(Elvin elvin)
Finds the local RoomEntity or creates it if it's not available
using the provided Elvin. |
static String |
getRelease()
Returns the Livespace release. |
static String |
getWorkingDirectory()
Returns the directory path to the Livespace client working directory. |
static boolean |
isFederated(Entity entity)
Determines whether the entity is a local entity or a federated entity |
static boolean |
isFederated(Object object)
Determines whether the object is a federated entity. |
static String |
javaToElvin(String javaName)
Convert Java-style member name to an Elvin-style field name. |
static Scheduler |
peekScheduler()
For testing only. |
static int |
peekSchedulerClients()
For testing only. |
static void |
readValue(Map<?,?> values,
String source,
IDataObject object,
String target)
Shortcut to read a value from a Map and copy it into an IDataObject (eg an Entity). |
static Map<String,Object> |
registeredEntityClasses()
Get an (unmodifiable) map from registered types -> class name. |
static void |
registerEntityClass(Class<? extends Entity> entityClass)
Shortcut to register a class for an entity type using Entity.getType(Class) to automatically get the type. |
static void |
registerEntityClass(String entityType,
Class<?> entityClass)
Register a given subclass of Entity to be used when entities of a given entity type are instantiated by a client or server. |
static void |
registerEntityClass(String entityType,
String entityClassName)
Register a given subclass of Entity to be used when entities of a given entity type are instantiated by a client or server. |
protected static void |
registerStandardEntityTypes()
Register standard, known entity types via registerEntityClass(String, String) . |
static void |
releaseScheduler()
Release a shared scheduler allocated by acquireScheduler() . |
static void |
schedule(Scheduler.Task task)
Shortcut to schedule a task on the shared scheduler. |
static void |
schedule(Scheduler.Task task,
long delay)
Shortcut to schedule a task on the shared scheduler. |
static void |
unschedule(Scheduler.Task task)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PROTOCOL_VERSION
Use the livespace.bus.protocol_version property to change the version at runtime. Use "livespace.bus.compress_xml=true|false" to enable/disable XML compression (compression is automatically disabled if you select the 1.0 protocol.
public static final int ENTITY_RESPONSE_TIMEOUT
EntityClient.setLivenessTimeouts(long, long, long)
,
Constant Field ValuesMethod Detail |
---|
protected static void registerStandardEntityTypes()
registerEntityClass(String, String)
. May be called more
than once.
public static void registerEntityClass(Class<? extends Entity> entityClass)
Entity.getType(Class)
to automatically get the type.
entityClass
- A subclass of Entity.registerEntityClass(String, Class)
public static void registerEntityClass(String entityType, Class<?> entityClass)
GenericEntity
is
used.
entityType
- The entity type (see Entity.getType()
.entityClass
- The class of entity. Must be a subclass of Entity.registerEntityClass(String, String)
,
findEntityClass(String)
public static void registerEntityClass(String entityType, String entityClassName)
GenericEntity
is used.
entityType
- The entity type (see Entity.getType()
.entityClassName
- The name of the entity class of entity.
Must be a subclass of Entity.registerEntityClass(String, Class)
,
findEntityClass(String)
public static Map<String,Object> registeredEntityClasses()
public static Class<? extends Entity> findEntityClass(String entityType)
registerEntityClass(String, Class)
public static Scheduler acquireScheduler()
releaseScheduler()
or the VM will not exit properly.
public static void releaseScheduler()
acquireScheduler()
.
public static void schedule(Scheduler.Task task)
acquireScheduler()
public static void schedule(Scheduler.Task task, long delay)
acquireScheduler()
public static void unschedule(Scheduler.Task task)
public static Scheduler peekScheduler()
public static int peekSchedulerClients()
public static String createUniqueId()
public static String escapeNtfnString(String str)
public static String escapeNtfnField(String field)
public static void readValue(Map<?,?> values, String source, IDataObject object, String target)
values
- The Map of values to read from.source
- The name of the source property in the map.object
- The target object.target
- The name of the target property in this entity.readValue(Map, String, IDataObject, String)
public static String elvinToJava(String elvinName)
javaToElvin(String)
public static String javaToElvin(String javaName)
elvinToJava(String)
public static String fileToUrl(String path)
public static String getHostName() throws IOException
OsgiUtil.getHostName()
.
IOException
public static String getIPAddress() throws IOException
IOException
public static String getHostCategory()
OsgiUtil.getHostCategory()
.
public static String getRelease()
public static String getBuildDate()
public static String getDeployConfigs()
public static String getBundlePath()
public static String getElvinUrl()
public static String getCurrentConfigPath()
public static String getDefaultConfigPath()
public static String getWorkingDirectory() throws InvalidParameterException
InvalidParameterException
- if the System property
livespace.osgi.work_dir
is not set.public static RoomEntity getOrCreateLocalRoom(Elvin elvin) throws IOException
RoomEntity
or creates it if it's not available
using the provided Elvin.
elvin
- The Elvin hosting the RoomEntity
RoomEntity
running on the provided Elvin.
IOException
- If an IO error occurs while contacting Elvin.public static boolean isFederated(Entity entity)
entity
- The entity to test.
public static boolean isFederated(Object object)
object
- The object value to test.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |