/** * Get one service of a type. * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> Collection<T> getLocalServices(final IInternalAccess component, final ClassInfo type, final String scope, boolean proxy) { return getLocalServices(component, type, scope, null, proxy); }
/** * Get one service of a type. * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> Collection<T> getLocalServices(final IInternalAccess component, final ClassInfo type, final String scope) { return getLocalServices(component, type, scope, null, true); }
/** * Get one service of a type. * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> Collection<T> getLocalServices(final IInternalAccess component, final ClassInfo type, final String scope, final IFilter<T> filter) { return getLocalServices(component, type, scope, filter, true); }
/** * Get one service of a type. * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> Collection<T> getLocalServices(final IInternalAccess component, final Class<T> type) { return getLocalServices(component, type, null, true); }
/** * Get one service of a type. * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> Collection<T> getLocalServices(final IInternalAccess component, final ClassInfo type) { return getLocalServices(component, type, null, true); }
/** * Get one service of a type. * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> Collection<T> getLocalServices(final IInternalAccess component, final Class<T> type, final String scope) { return getLocalServices(component, type, scope, null, true); }
/** * Get one service of a type. * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> Collection<T> getLocalServices(final IInternalAccess component, final ClassInfo type, boolean proxy) { return getLocalServices(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> Collection<T> getLocalServices(final IInternalAccess component, final Class<T> type, final String scope, final IFilter<T> filter) { return getLocalServices(component, type, scope, filter, true); }
/** * Get one service of a type. * (Returns required service proxy). * @param type The class. * @return The corresponding service. */ public static <T> Collection<T> getLocalServices(final IInternalAccess component, final Class<T> type, boolean proxy) { return getLocalServices(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> Collection<T> getLocalServices(final IInternalAccess component, final Class<T> type, final String scope, boolean proxy) { return getLocalServices(component, type, scope, null, proxy); }
public IFuture<Void> execute(IInternalAccess ia) { Collection<IProxyAgentService> sers = SServiceProvider.getLocalServices(component, IProxyAgentService.class, RequiredServiceInfo.SCOPE_PLATFORM); if(sers!=null && sers.size()>0) { for(IProxyAgentService ser: sers) { ser.getRemoteComponentIdentifier().addResultListener(new IResultListener<ITransportComponentIdentifier>() { public void resultAvailable(ITransportComponentIdentifier rcid) { newPlatformFound(rcid); } public void exceptionOccurred(Exception exception) { exception.printStackTrace(); } }); } } component.getComponentFeature(IExecutionFeature.class).waitForDelay(10000, this, true); return IFuture.DONE; } });
/** * The plan body. */ public void body() { TestReport tr = new TestReport("#1", "Tests if own service can be found."); Collection services = (Collection)SServiceProvider.getLocalServices(getAgent(), IBeliefGetter.class, RequiredServiceInfo.SCOPE_LOCAL); // System.out.println("Found: "+services); if(services!=null) { for(Iterator it=services.iterator(); it.hasNext(); ) { IBeliefGetter getter = (IBeliefGetter)it.next(); /*Object fact =*/ getter.getFact("money").get(); // System.out.println("Fact is: "+fact); tr.setSucceeded(true); } } else { tr.setReason("No service found."); } getBeliefbase().getBeliefSet("testcap.reports").addFact(tr); } }
/** * Announce that addresses of transports might have changed. */ public IFuture<Void> refreshAddresses() { addresses = null; for(IDiscoveryService ds: SServiceProvider.getLocalServices(component, IDiscoveryService.class, RequiredServiceInfo.SCOPE_PLATFORM)) { ds.republish(); } // this is suboptimal currently because internalGetAddresses has to rebuild addresses immediately so // it could be done here return addrservice.addPlatformAddresses(new ComponentIdentifier(component.getComponentIdentifier().getRoot().getName(), internalGetAddresses())); }