/** * Get one service of a type. // * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> IFuture<T> getService(IInternalAccess component, Class<T> type, boolean proxy) { return getService(component, type, null, proxy); }
/** * Get one service of a type. * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> T getLocalService(IComponentIdentifier component, Class<T> type) { return getLocalService(component, type, null); }
/** * Get all services of a type. // * (Returns required service proxy). * @param type The class. * @return The corresponding services. */ public static <T> ITerminableIntermediateFuture<T> getServices(IInternalAccess component, Class<T> type, String scope, boolean proxy) { return getServices(component, type, scope, (IAsyncFilter<T>)null, proxy); }
/** * Start the service. * @return A future that is done when the service has completed starting. */ public IFuture<Void> start() { final Future<Void> ret = new Future<Void>(); // System.out.println("search clock: "+getId()); SServiceProvider.getServiceUpwards(ComponentServiceContainer.this, IComponentManagementService.class) .addResultListener(new ExceptionDelegationResultListener<IComponentManagementService, Void>(ret) { public void customResultAvailable(IComponentManagementService result) { cms = result; // System.out.println("Has cms: "+getId()+" "+cms); // Services may need other services and thus need to be able to search // the container. ComponentServiceContainer.super.start().addResultListener(new DelegationResultListener<Void>(ret)); } }); return ret; }
/** * Get the (cached) cms. */ protected IFuture<IComponentManagementService> getCMS() { // Change comments below to test performance of cached cms vs. direct access. if(getServiceContainer()==null) { System.out.println("container is null: "+component+", "+getComponentIdentifier()); } // return SServiceProvider.getServiceUpwards(getServiceContainer(), IComponentManagementService.class); if(cms==null || cms.getException()!=null) { cms = SServiceProvider.getServiceUpwards(getServiceContainer(), IComponentManagementService.class); } return cms; }
/** * Get a service from a specific component. // * (Returns required service proxy). * @param component The component. * @param cid The target component identifier. * @param type The service type. * @return The corresponding service. */ public static <T> IFuture<T> getService(final IInternalAccess component, final IComponentIdentifier cid, final Class<T> type, final boolean proxy) { return getService(component, cid, RequiredServiceInfo.SCOPE_LOCAL, type, proxy); }
/** * Get one service of a type. * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> T getLocalService(final IInternalAccess component, final ClassInfo type, final String scope) { return getLocalService(component, type, scope, null, true); }
/** * Get all services of a type. * @param type The class. * @return The corresponding services. */ public static <T> ITerminableIntermediateFuture<T> getServices(IExternalAccess provider, Class<T> type) { return getServices(provider, type, null); }
/** * */ public static void main(String[] args) { String[] pargs = new String[] { "-gui", "false" }; IExternalAccess rootcomp = (IExternalAccess)Starter.createPlatform(pargs).get(new ThreadSuspendable()); IComponentManagementService cms = (IComponentManagementService)SServiceProvider.getServiceUpwards(rootcomp.getServiceProvider(), IComponentManagementService.class).get(new ThreadSuspendable()); dorun(cms, "jadex/micro/testcases/blocking/ShutdownAgent.class"); // dorun(cms, "jadex/micro/benchmarks/MessagePerformanceAgent.class"); // dorun(cms, "jadex/micro/examples/ping/PingScenario.application.xml"); } }
/** * Get one service of a type. // * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> IFuture<T> getService(IInternalAccess component, ClassInfo type, String scope) { return getService(component, type, scope, (IAsyncFilter<T>)null, true); }
/** * Get one service of a type. * (Returns required service proxy). * @param component The internal access. * @param type The class. * @return The corresponding service. */ public static <T> T getLocalService(final IInternalAccess component, final ClassInfo type, final String scope, final IFilter<T> filter) { return getLocalService(component, type, scope, filter, true); }
/** * Get all services of a type. * @param type The class. * @return The corresponding services. */ public static <T> ITerminableIntermediateFuture<T> getServices(IInternalAccess component, ClassInfo type) { return getServices(component, type, null, true); }
/** * Get one service of a type. * @param type The class. * @return The corresponding service. */ public static <T> IFuture<T> getService(IExternalAccess provider, ClassInfo type, String scope) { return getService(provider, type, scope, (IAsyncFilter<T>)null); }
/** * Get one service of a type. * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> T getLocalService(final IInternalAccess component, final Class<T> type, final String scope) { return getLocalService(component, type, scope, null, true); }
/** * Get all services of a type. * @param type The class. * @return The corresponding services. */ public static <T> ITerminableIntermediateFuture<T> getServices(IInternalAccess component, ClassInfo type, String scope, IAsyncFilter<T> filter) { return getServices(component, type, scope, filter, true); }
/** * Get all declared services of the given provider. * @return The corresponding services. */ public static <T> IFuture<T> getDeclaredService(IServiceProvider provider, Class<T> type) { return SServiceProvider.getService(provider, type, RequiredServiceInfo.SCOPE_LOCAL); }
/** * Get one service of a type. * (Returns required service proxy). * @param component The internal access. * @param type The class. * @return The corresponding service. */ public static <T> T getLocalService(final IInternalAccess component, final Class<T> type, final IComponentIdentifier target) { return getLocalService(component, type, target, true); }
/** * Get all services of a type. * @param type The class. * @return The corresponding services. */ public static <T> ITerminableIntermediateFuture<T> getServices(IServiceProvider provider, Class<T> type) { return getServices(provider, type, null); }
/** * Get one service of a type. // * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> IFuture<T> getService(IInternalAccess component, Class<T> type, String scope, boolean proxy) { return getService(component, type, scope, (IAsyncFilter<T>)null, proxy); }
/** * Get one service of a type. * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> T getLocalService(final IInternalAccess component, final Class<T> type, final String scope, boolean proxy) { return getLocalService(component, type, scope, null, proxy); }