public class PlatformModule extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
MODULE_ID
Module identifier.
|
| Constructor and Description |
|---|
PlatformModule() |
| Modifier and Type | Method and Description |
|---|---|
static Object |
adapt(Object source,
Class<?> target)
Adapt object to target type.
|
static void |
executeCommand(String commandId,
Map<String,String> parameters)
Execute a command from the command framework.
|
static Object |
getService(Class<?> type)
Get a platform service.
|
static String |
getSystemProperty(String key)
Get a system property value
|
static void |
postEvent(String topic,
Object data,
long delay)
Post an event on the event broker.
|
static Object |
readPreferences(String node,
String key,
Object defaultValue)
Read a preferences value.
|
static Future |
runProcess(String name,
String[] args)
Run an external process.
|
static org.osgi.service.event.Event |
waitForEvent(String topic,
long timeout)
Wait for a given event on the event bus.
|
static void |
writePreferences(String node,
String key,
Object value)
Set a preferences value.
|
public static final String MODULE_ID
public static Object adapt(Object source, Class<?> target)
source - object to adapttarget - target class to adapt tonullpublic static Object getService(Class<?> type)
type - service typenullpublic static void executeCommand(String commandId, @ScriptParameter(defaultValue="org.eclipse.ease.modules.ScriptParameter.null") Map<String,String> parameters) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException
commandId - full id of the command to executeparameters - command parametersExecutionExceptionNotDefinedExceptionNotEnabledExceptionNotHandledExceptionpublic static String getSystemProperty(String key)
key - key to querypublic static Future runProcess(String name, @ScriptParameter(defaultValue="org.eclipse.ease.modules.ScriptParameter.null") String[] args)
Future 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 argumentsFuture object tracking the programpublic static Object readPreferences(String node, String key, @ScriptParameter(defaultValue="") Object defaultValue)
node - node to read fromkey - key name to read fromdefaultValue - default value to use, if value is not setpublic static void writePreferences(String node, String key, Object value)
node - node to write tokey - key to store tovalue - value to storepublic static void postEvent(String topic, @ScriptParameter(defaultValue="org.eclipse.ease.modules.ScriptParameter.null") 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(String topic, @ScriptParameter(defaultValue="0") long timeout) throws 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 timeoutInterruptedException - when the script thread gets interrupted