public static void addConsoleListener(IExternalAccess platformaccess, final String id, final IRemoteChangeListener rcl) { platformaccess.scheduleImmediate(new IComponentStep<Void>() { @Classname("installListener") public IFuture<Void> execute(IInternalAccess ia) { ConsoleListener cl = new ConsoleListener(id, ia, rcl); SUtil.addSystemOutListener(cl); SUtil.addSystemErrListener(cl); return IFuture.DONE; } }); }
public static void removeConsoleListener(IExternalAccess platformaccess, final String id) { platformaccess.scheduleImmediate(new IComponentStep<Void>() { @Classname("removeListener") public IFuture<Void> execute(IInternalAccess ia) { ConsoleListener cl = new ConsoleListener(id, ia, null); SUtil.removeSystemOutListener(cl); SUtil.removeSystemErrListener(cl); return IFuture.DONE; } }); }
/** * Log a warning on a component. */ public static IFuture<Void> logWarning(final String msg, IExternalAccess exta) { return exta.scheduleImmediate(new IComponentStep<Void>() { public IFuture<Void> execute(IInternalAccess ia) { ia.getLogger().warning(msg); return IFuture.DONE; } }); }
/** * Redirect some text to the remote input stream. */ public static void redirectInput(IExternalAccess access, final String txt) { access.scheduleImmediate(new IComponentStep<Void>() { @Classname("redir") public IFuture<Void> execute(IInternalAccess ia) { try { SUtil.getOutForSystemIn().write(txt.getBytes()); } catch(IOException e) { } return IFuture.DONE; } }); }
/** * Compare a model to a path. */ public static IFuture<Boolean> matchModel(final String path, final String model, IExternalAccess exta) { return exta.scheduleImmediate(new IComponentStep<Boolean>() { @Classname("matchModel") public IFuture<Boolean> execute(IInternalAccess ia) { boolean match = false; try { File pathfile = SUtil.urlToFile(path); File modelfile = SUtil.urlToFile(model); match = pathfile!=null && modelfile!=null && modelfile.getCanonicalPath().startsWith(pathfile.getCanonicalPath()); } catch(IOException e) { } return new Future<Boolean>(Boolean.valueOf(match)); } }); }
return ea.scheduleImmediate(new IComponentStep<Object[]>()
public void run() access.scheduleImmediate(new IComponentStep<Void>()
instance.getExternalAccess().scheduleImmediate(new IComponentStep<Void>()
/** * Update from given properties. */ public IFuture<Void> setProperties(Properties props) { final boolean exe = props.getBooleanProperty("executing"); return access.getExternalAccess().scheduleImmediate(new IComponentStep<Void>() { public IFuture<Void> execute(IInternalAccess ia) { // startoninit==false means service already running if(exe && !executing && !startoninit) { start(); } else if(!exe && executing) { pause(); } else if(!exe) { startoninit = false; } return IFuture.DONE; } }); }
/** * Update from given properties. */ public IFuture<Void> setProperties(Properties props) { final boolean exe = props.getBooleanProperty("executing"); return access.getExternalAccess().scheduleImmediate(new IComponentStep<Void>() { public IFuture<Void> execute(IInternalAccess ia) { // startoninit==false means service already running if(exe && !executing && !startoninit) { start(); } else if(!exe && executing) { pause(); } else if(!exe) { startoninit = false; } return IFuture.DONE; } }); }
getExternalAccess().scheduleImmediate(new IComponentStep<Void>()
return access.scheduleImmediate(new IComponentStep<Boolean>()
instance.getExternalAccess().scheduleImmediate(new IComponentStep<Void>()
instance.getExternalAccess().scheduleImmediate(new IComponentStep<Void>()
instance.getExternalAccess().scheduleImmediate(new IComponentStep<Void>()