/** * Get the registry from a component. */ public static IServiceRegistry getRegistry(IInternalAccess ia) { return getRegistry(ia.getComponentIdentifier()); }
/** * Get a subregistry. * @param cid The platform id. * @return The registry. */ public IServiceRegistry getSubregistry(IComponentIdentifier cid) { if(cid!=null) cid = cid.getRoot(); if(registries==null) registries = new HashMap<IComponentIdentifier, IServiceRegistry>(); IServiceRegistry ret = registries.get(cid); if(ret==null) { ret = new ServiceRegistry(); // System.out.println("Created registry for: "+cid); addSubregistry(cid, ret); } return ret; }
services.remove(key); notifyListeners(new RegistryListenerEvent(RegistryListenerEvent.Type.REMOVED, key, service));
final IRemoteServiceManagementService rms = getService(IRemoteServiceManagementService.class); if(rms!=null) Iterator<IService> sers = getServices(new ClassInfo(IProxyAgentService.class)); if(sers!=null && sers.hasNext()) Set<IService> smap = getServiceMap().get(new ClassInfo(IProxyAgentService.class)); int size = smap==null? 0: smap.size();
searchServices(type, cid, RequiredServiceInfo.SCOPE_PLATFORM, filter).addResultListener(new IntermediateDefaultResultListener<T>() searchRemoteServices(IComponentIdentifier.LOCAL.get(), type, filter).addResultListener(new IntermediateDefaultResultListener<T>()
public void terminated(Exception reason) { removeQuery(query); } });
public void exceptionOccurred(Exception exception) { searchRemoteService(lcid, type, filter).addResultListener(new DelegationResultListener<T>(ret)); } });
final IRemoteServiceManagementService rms = getService(IRemoteServiceManagementService.class); if(rms!=null) final IComponentManagementService cms = reschedule ? getService(IComponentManagementService.class) : null;
Iterator<T> sers = (Iterator<T>)getServices(query.getType()); if(sers!=null)
super.addQuery(query).addIntermediateResultListener(new IntermediateDelegationResultListener<T>(ret));
/** * Remove all service queries of a specific component from the registry. * @param owner The query owner. */ public void removeQueries(IComponentIdentifier owner) { if(queries!=null) { for(Map.Entry<ClassInfo, Set<ServiceQueryInfo<?>>> entry: new HashSet<Map.Entry<ClassInfo, Set<ServiceQueryInfo<?>>>>(queries.entrySet())) { for(ServiceQueryInfo<?> query: entry.getValue().toArray(new ServiceQueryInfo<?>[entry.getValue().size()])) { if(owner.equals(query.getQuery().getOwner())) { removeQuery(query.getQuery()); // entry.getValue().remove(query); } } } } }
/** * Get the registry. * @return The registry. */ protected IServiceRegistry getRegistry() { return ServiceRegistry.getRegistry(component.getComponentIdentifier()); }
notifyListeners(new RegistryListenerEvent(RegistryListenerEvent.Type.ADDED, key, service));
/** * Remove a service. * @param service The service object. * @param info The service info. */ protected void removeService(IInternalService service) { // Find service types Class<?> type = service.getServiceIdentifier().getServiceType().getType(component.getClassLoader(), component.getModel().getAllImports()); Set<Class<?>> types = new LinkedHashSet<Class<?>>(); types.add(type); for(Class<?> sin: SReflect.getSuperInterfaces(new Class[]{type})) { if(sin.isAnnotationPresent(Service.class)) { types.add(sin); } } IServiceRegistry registry = ServiceRegistry.getRegistry(component.getComponentIdentifier()); if(registry!=null) // Maybe null on rescue thread (todo: why remove() on rescue thread?) { for(Class<?> servicetype: types) { registry.removeService(new ClassInfo(servicetype), service); } } }
IServiceRegistry reg = ServiceRegistry.getRegistry(component.getComponentIdentifier()); reg.getSubregistry(component.getComponentIdentifier()).removeEventListener(this);
IServiceRegistry reg = ServiceRegistry.getRegistry(component.getComponentIdentifier()); IServiceRegistry subreg = reg.getSubregistry(component.getComponentIdentifier()); if(subreg!=null)
IServiceRegistry reg = ServiceRegistry.getRegistry(component); T ser = reg==null? null: (T)reg.searchService(new ClassInfo(type), component.getComponentIdentifier(), scope);
IServiceRegistry reg = ServiceRegistry.getRegistry(component); T ser = reg==null? null: (T)reg.searchService(type, component.getComponentIdentifier(), scope);