/** * Get the service provider. */ public IServiceProvider getServiceProvider() { return getServiceContainer(); }
/** * Get a raw reference to a provided service implementation. */ public Object[] getRawServices(Class type) { IService[] sers = getServiceContainer().getProvidedServices(type); Object[] ret = new Object[sers.length]; for(int i=0; i<ret.length; i++) { convertRawService(sers[i]); } return ret; }
/** * Create an external access. */ public ExternalAccess(StatelessAbstractInterpreter interpreter) { this.interpreter = interpreter; this.adapter = interpreter.getComponentAdapter(); this.tostring = interpreter.getComponentIdentifier().getLocalName(); this.provider = interpreter.getServiceContainer(); }
/** * Start the services. */ public IFuture startServiceContainer() { assert !getComponentAdapter().isExternalThread(); return getServiceContainer().start(); }
ret = interpreter.getServiceContainer();
/** * Get a raw reference to a provided service implementation. */ public Object getRawService(String name) { assert !getComponentAdapter().isExternalThread(); return convertRawService(getServiceContainer().getProvidedService(name)); }
/** * Get a raw reference to a provided service implementation. */ public Object getRawService(Class type) { assert !getComponentAdapter().isExternalThread(); IService[] sers = getServiceContainer().getProvidedServices(type); return convertRawService(sers[0]); }
/** * Kill the component. */ public IFuture<Map<String, Object>> killComponent() { // if(getComponentIdentifier().getParent()==null) // { // System.err.println("inter: "+getComponentIdentifier().getName()); // Thread.dumpStack(); // } final Future<Map<String, Object>> ret = new Future<Map<String, Object>>(); IFuture<IComponentManagementService> fut = SServiceProvider.getService(getServiceContainer(), IComponentManagementService.class, RequiredServiceInfo.SCOPE_PLATFORM); fut.addResultListener(new ExceptionDelegationResultListener<IComponentManagementService, Map<String, Object>>(ret) { public void customResultAvailable(IComponentManagementService cms) { cms.destroyComponent(getComponentAdapter().getComponentIdentifier()) .addResultListener(new DelegationResultListener<Map<String, Object>>(ret)); } }); return ret; }
getServiceContainer().shutdown().addResultListener(new IResultListener<Void>()
/** * Schedule a step of the component. * May safely be called from external threads. * @param step Code to be executed as a step of the component. * @param delay The delay to wait before step should be done. * @return The result of the step. */ public <T> IFuture<T> scheduleStep(final IComponentStep<T> step, final long delay) { final Future<T> ret = new Future<T>(); SServiceProvider.getService(interpreter.getServiceContainer(), IClockService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(interpreter.createResultListener(new DelegationResultListener(ret) { public void customResultAvailable(Object result) { IClockService cs = (IClockService)result; cs.createTimer(delay, new ITimedObject() { public void timeEventOccurred(long currenttime) { scheduleStep(step).addResultListener(new DelegationResultListener(ret)); } }); } })); return ret; }
SServiceProvider.getService(interpreter.getServiceContainer(), IClockService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(interpreter.createResultListener(new DelegationResultListener(ret)
SServiceProvider.getService(getServiceContainer(), IClockService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(createResultListener(new ExceptionDelegationResultListener<IClockService, T>(ret)
SServiceProvider.getService(getServiceContainer(), IClockService.class, RequiredServiceInfo.SCOPE_PLATFORM) .addResultListener(createResultListener(new ExceptionDelegationResultListener<IClockService, Void>(ret)
SServiceProvider.getServiceUpwards(getServiceContainer(), IComponentManagementService.class) .addResultListener(createResultListener(new ExceptionDelegationResultListener<IComponentManagementService, IComponentIdentifier>(ret)
ConfigurationInfo conf = model.getConfiguration(config); final ComponentInstanceInfo[] components = conf.getComponentInstances(); SServiceProvider.getServiceUpwards(getServiceContainer(), IComponentManagementService.class) .addResultListener(createResultListener(new ExceptionDelegationResultListener<IComponentManagementService, Void>(ret)
IFuture<IClockService> fut = SServiceProvider.getService(getServiceContainer(), IClockService.class, RequiredServiceInfo.SCOPE_PLATFORM); fut.addResultListener(createResultListener(new ExceptionDelegationResultListener<IClockService, Void>(ret)
getServiceContainer().addRequiredServiceInfos(rservices); for(RequiredServiceInfo rsi: rservices) if(nfprops!=null) INFMixedPropertyProvider nfpp = getServiceContainer().getRequiredServicePropertyProvider(null); // null for unbound
getInternalAccess(), getComponentAdapter(), service, name, type, proxytype, ics, isCopy(), isRealtime(), getModel().getResourceIdentifier(), moni, componentfetcher); getServiceContainer().addService(proxy, info).addResultListener(new ExceptionDelegationResultListener<Void, IInternalService>(ret)
final IInternalService service = BasicServiceInvocationHandler.createDelegationProvidedServiceProxy( getInternalAccess(), getComponentAdapter(), sid, rsi, impl.getBinding(), getClassLoader(), isRealtime()); getServiceContainer().addService(service, info).addResultListener(createResultListener(new DelegationResultListener<Void>(ret)));