Package jadex.platform.service.registry
Class SuperpeerRegistryAgent
- java.lang.Object
-
- jadex.platform.service.registry.SuperpeerRegistryAgent
-
- All Implemented Interfaces:
IRemoteRegistryService,ISuperpeerCollaborationService,ISuperpeerService,ISuperpeerStatusService
public class SuperpeerRegistryAgent extends java.lang.Object implements ISuperpeerService, ISuperpeerCollaborationService, ISuperpeerStatusService
Super peer collects services from client and answers search requests and queries.
-
-
Field Summary
Fields Modifier and Type Field Description protected IInternalAccessagentThe agent.protected MultiCollection<IComponentIdentifier,ServiceQueryInfo<?>>clientqueriesQueries received from client.protected java.util.Set<IComponentIdentifier>clientsprotected MultiCollection<java.lang.String,IServiceRegistry>peercachesLookup for remote peer caches by network.protected java.util.Set<SubscriptionIntermediateFuture<IComponentIdentifier>>reglistenersprotected IServiceRegistryserviceregistryThe superpeer service registryprotected booleanunrestricted-
Fields inherited from interface jadex.bridge.service.types.registry.IRemoteRegistryService
REMOTE_REGISTRY_NAME
-
-
Constructor Summary
Constructors Constructor Description SuperpeerRegistryAgent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> ISubscriptionIntermediateFuture<T>addIntransitiveQuery(ServiceQuery<T> query)Add a service query to the superpeer registry only.protected voidaddPeer(ISuperpeerCollaborationService peer)Adds a peer.<T> ISubscriptionIntermediateFuture<T>addQuery(ServiceQuery<T> query)Add a service query to the registry.protected voiddispatchEventToRegistry(IServiceRegistry registry, ServiceEvent<IServiceIdentifier> event)Dispatches a service event to a target registry.protected voiddoRemoveQuery(IComponentIdentifier client, ServiceQuery<?> query)protected java.util.Set<IServiceRegistry>getApplicablePeers(ServiceQuery<?> query)Returns all peers applicable to a query.ISubscriptionIntermediateFuture<IComponentIdentifier>getRegisteredClients()Get the clients that are currently registered to super peer.IFuture<IServiceIdentifier>intransitiveSearchService(ServiceQuery<?> query)Search superpeer for a single service, restricted to the called superpeer.IFuture<java.util.Set<IServiceIdentifier>>intransitiveSearchServices(ServiceQuery<?> query)Search superpeer for services, restricted to the called superpeer.ISubscriptionIntermediateFuture<java.lang.Void>registerClient(java.lang.String networkname)Initiates the client registration procedure (super peer will answer initially with an empty intermediate result, client will send updates with backward commands).IFuture<IServiceIdentifier>searchService(ServiceQuery<?> query)Search remote registry for a single service.IFuture<java.util.Set<IServiceIdentifier>>searchServices(ServiceQuery<?> query)Search remote registry for services.
-
-
-
Field Detail
-
agent
protected IInternalAccess agent
The agent.
-
serviceregistry
protected IServiceRegistry serviceregistry
The superpeer service registry
-
unrestricted
protected boolean unrestricted
-
clientqueries
protected MultiCollection<IComponentIdentifier,ServiceQueryInfo<?>> clientqueries
Queries received from client.
-
peercaches
protected MultiCollection<java.lang.String,IServiceRegistry> peercaches
Lookup for remote peer caches by network.
-
reglisteners
protected java.util.Set<SubscriptionIntermediateFuture<IComponentIdentifier>> reglisteners
-
clients
protected java.util.Set<IComponentIdentifier> clients
-
-
Method Detail
-
registerClient
public ISubscriptionIntermediateFuture<java.lang.Void> registerClient(java.lang.String networkname)
Initiates the client registration procedure (super peer will answer initially with an empty intermediate result, client will send updates with backward commands).- Specified by:
registerClientin interfaceISuperpeerService- Parameters:
networkname- Network for this connection.- Returns:
- Does not return any more results while connection is running.
-
searchService
public IFuture<IServiceIdentifier> searchService(ServiceQuery<?> query)
Search remote registry for a single service.- Specified by:
searchServicein interfaceIRemoteRegistryService- Parameters:
query- The search query.- Returns:
- The first matching service or null if not found.
-
searchServices
public IFuture<java.util.Set<IServiceIdentifier>> searchServices(ServiceQuery<?> query)
Search remote registry for services.- Specified by:
searchServicesin interfaceIRemoteRegistryService- Parameters:
query- The search query.- Returns:
- The matching services or empty set if none are found.
-
addQuery
public <T> ISubscriptionIntermediateFuture<T> addQuery(ServiceQuery<T> query)
Add a service query to the registry.- Specified by:
addQueryin interfaceISuperpeerService- Parameters:
query- The service query.- Returns:
- Subscription to matching services.
-
intransitiveSearchService
public IFuture<IServiceIdentifier> intransitiveSearchService(ServiceQuery<?> query)
Search superpeer for a single service, restricted to the called superpeer.- Specified by:
intransitiveSearchServicein interfaceISuperpeerCollaborationService- Parameters:
query- The search query.- Returns:
- The first matching service or null if not found.
-
intransitiveSearchServices
public IFuture<java.util.Set<IServiceIdentifier>> intransitiveSearchServices(ServiceQuery<?> query)
Search superpeer for services, restricted to the called superpeer.- Specified by:
intransitiveSearchServicesin interfaceISuperpeerCollaborationService- Parameters:
query- The search query.- Returns:
- The matching services or empty set if none are found.
-
addIntransitiveQuery
public <T> ISubscriptionIntermediateFuture<T> addIntransitiveQuery(ServiceQuery<T> query)
Add a service query to the superpeer registry only.- Specified by:
addIntransitiveQueryin interfaceISuperpeerCollaborationService- Parameters:
query- The service query.- Returns:
- Subscription to matching services.
-
doRemoveQuery
protected void doRemoveQuery(IComponentIdentifier client, ServiceQuery<?> query)
-
addPeer
protected void addPeer(ISuperpeerCollaborationService peer)
Adds a peer.- Parameters:
peer- The peer.
-
getApplicablePeers
protected java.util.Set<IServiceRegistry> getApplicablePeers(ServiceQuery<?> query)
Returns all peers applicable to a query.- Parameters:
query- The query.- Returns:
- Applicable peers.
-
dispatchEventToRegistry
protected void dispatchEventToRegistry(IServiceRegistry registry, ServiceEvent<IServiceIdentifier> event)
Dispatches a service event to a target registry.- Parameters:
registry- The registry.event- The service event.
-
getRegisteredClients
public ISubscriptionIntermediateFuture<IComponentIdentifier> getRegisteredClients()
Get the clients that are currently registered to super peer.- Specified by:
getRegisteredClientsin interfaceISuperpeerStatusService
-
-