public class PlatformModule
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
MODULE_ID
Module identifier.
|
| Constructor and Description |
|---|
PlatformModule() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.Object |
adapt(java.lang.Object source,
java.lang.Class<?> target)
Adapt object to target type.
|
static void |
executeCommand(java.lang.String commandId,
java.util.Map<java.lang.String,java.lang.String> parameters)
Execute a command from the command framework.
|
static java.lang.Object |
getService(java.lang.Class<?> type)
Get a platform service.
|
static java.lang.String |
getSystemProperty(java.lang.String key)
Get a system property value
|
static void |
postEvent(java.lang.String topic,
java.lang.Object data,
long delay)
Post an event on the event broker.
|
static java.lang.Object |
readPreferences(java.lang.String node,
java.lang.String key,
java.lang.Object defaultValue)
Read a preferences value.
|
static java.lang.Process |
runProcess(java.lang.String name,
java.lang.String[] args)
Run an external process.
|
static org.osgi.service.event.Event |
waitForEvent(java.lang.String topic,
long timeout)
Wait for a given event on the event bus.
|
static void |
writePreferences(java.lang.String node,
java.lang.String key,
java.lang.Object value)
Set a preferences value.
|
public static final java.lang.String MODULE_ID
public static java.lang.Object adapt(java.lang.Object source,
java.lang.Class<?> target)
source - object to adapttarget - target class to adapt tonullpublic static java.lang.Object getService(java.lang.Class<?> type)
type - service typenullpublic static void executeCommand(java.lang.String commandId,
@ScriptParameter(defaultValue="org.eclipse.ease.modules.ScriptParameter.null")
java.util.Map<java.lang.String,java.lang.String> parameters)
throws ExecutionException,
NotDefinedException,
NotEnabledException,
NotHandledException
commandId - full id of the command to executeparameters - command parametersExecutionException - If the handler has problems executing this command.NotDefinedException - If the command you are trying to execute is not defined.NotEnabledException - If the command you are trying to execute is not enabled.NotHandledException - If there is no handler.public static java.lang.String getSystemProperty(java.lang.String key)
key - key to querypublic static java.lang.Process runProcess(java.lang.String name,
@ScriptParameter(defaultValue="org.eclipse.ease.modules.ScriptParameter.null")
java.lang.String[] args)
throws java.io.IOException
FutureX object is returned. Query the result for finished state, output
and error streams of the executed process.name - program to run (with full path if necessary)args - program argumentsjava.io.IOException - if an I/O error occurspublic static java.lang.Object readPreferences(java.lang.String node,
java.lang.String key,
@ScriptParameter(defaultValue="")
java.lang.Object defaultValue)
node - node to read fromkey - key name to read fromdefaultValue - default value to use, if value is not setnullpublic static void writePreferences(java.lang.String node,
java.lang.String key,
java.lang.Object value)
node - node to write tokey - key to store tovalue - value to storepublic static void postEvent(java.lang.String topic,
@ScriptParameter(defaultValue="org.eclipse.ease.modules.ScriptParameter.null")
java.lang.Object data,
@ScriptParameter(defaultValue="0")
long delay)
topic - topic to postdata - topic datadelay - delay to post this even in [ms]public static org.osgi.service.event.Event waitForEvent(java.lang.String topic,
@ScriptParameter(defaultValue="0")
long timeout)
throws java.lang.InterruptedException
topic - topic to subscribe fortimeout - maximum time to wait for event in [ms]. Use 0 to wait without timeout.null in case of a timeoutjava.lang.InterruptedException - when the script thread gets interrupted