Package jadex.platform.service.registry
Class SuperpeerClientAgent
- java.lang.Object
-
- jadex.platform.service.registry.SuperpeerClientAgent
-
- All Implemented Interfaces:
ISearchQueryManagerService
public class SuperpeerClientAgent extends java.lang.Object implements ISearchQueryManagerService
The super peer client agent is responsible for managing connections to super peers for each network.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
SuperpeerClientAgent.NetworkManager
Manage the connection to a superpeer for a given network.protected class
SuperpeerClientAgent.QueryManager<T>
Internal handler for each user query.
-
Field Summary
Fields Modifier and Type Field Description protected IInternalAccess
agent
The agent.protected boolean
awaonly
Use only awareness for remote search, i.e.protected java.util.Map<java.lang.String,SuperpeerClientAgent.NetworkManager>
connections
The managed connections for each network.protected double
contimeout
The the connection timeout as factor of the default timeout.protected java.lang.Object
debugservices
Debug connection issues of polling mode for any of the named services (boolean or string with comma separated unqualified service interface names).static double
POLLING_RATE
The fallback polling search rate as factor of the default remote timeout.protected double
pollingrate
The fallback polling search rate as factor of the default timeout.protected ISecurityService
secser
-
Constructor Summary
Constructors Constructor Description SuperpeerClientAgent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> ISubscriptionIntermediateFuture<T>
addQuery(ServiceQuery<T> query)
Add a service query.protected void
adjustConnectionTimeout()
Set the connection timeout before calling a subscription service on the super peer.protected boolean
debug(ServiceQuery<?> query)
Check if a query should be debugged.protected java.lang.String[]
getQueryNetworks(ServiceQuery<?> query)
Gets the networks relevant to the query.protected IFuture<java.lang.Void>
init()
Find and connect to super peers.protected <T> TerminableIntermediateFuture<IServiceIdentifier>
searchRemoteServices(ServiceQuery<T> query)
Search for services on remote platforms using the polling fallback and awareness.<T> ITerminableFuture<IServiceIdentifier>
searchService(ServiceQuery<T> query)
Search for matching services using available remote information sources and provide first result.<T> ITerminableIntermediateFuture<IServiceIdentifier>
searchServices(ServiceQuery<T> query)
Search for all matching services.protected void
shutdown()
Close all connections on shutdown.
-
-
-
Field Detail
-
POLLING_RATE
public static final double POLLING_RATE
The fallback polling search rate as factor of the default remote timeout.- See Also:
- Constant Field Values
-
agent
protected IInternalAccess agent
The agent.
-
pollingrate
protected double pollingrate
The fallback polling search rate as factor of the default timeout.
-
contimeout
protected double contimeout
The the connection timeout as factor of the default timeout.
-
awaonly
protected boolean awaonly
Use only awareness for remote search, i.e. no superpeers at all.
-
debugservices
protected java.lang.Object debugservices
Debug connection issues of polling mode for any of the named services (boolean or string with comma separated unqualified service interface names).
-
connections
protected java.util.Map<java.lang.String,SuperpeerClientAgent.NetworkManager> connections
The managed connections for each network.
-
secser
protected ISecurityService secser
-
-
Method Detail
-
init
protected IFuture<java.lang.Void> init()
Find and connect to super peers.
-
shutdown
protected void shutdown()
Close all connections on shutdown.
-
searchService
public <T> ITerminableFuture<IServiceIdentifier> searchService(ServiceQuery<T> query)
Search for matching services using available remote information sources and provide first result.- Specified by:
searchService
in interfaceISearchQueryManagerService
- Parameters:
query
- The search query.- Returns:
- Future providing the corresponding service or ServiceNotFoundException when not found.
-
searchServices
public <T> ITerminableIntermediateFuture<IServiceIdentifier> searchServices(ServiceQuery<T> query)
Search for all matching services.- Specified by:
searchServices
in interfaceISearchQueryManagerService
- Parameters:
query
- The search query.- Returns:
- Each service as an intermediate result or a collection of services as final result.
-
addQuery
public <T> ISubscriptionIntermediateFuture<T> addQuery(ServiceQuery<T> query)
Add a service query. Continuously searches for matching services using available remote information sources.- Specified by:
addQuery
in interfaceISearchQueryManagerService
- Parameters:
query
- The search query.- Returns:
- Future providing the corresponding services as intermediate results.
-
adjustConnectionTimeout
protected void adjustConnectionTimeout()
Set the connection timeout before calling a subscription service on the super peer. Called before registerClient() and addQuery().
-
searchRemoteServices
protected <T> TerminableIntermediateFuture<IServiceIdentifier> searchRemoteServices(ServiceQuery<T> query)
Search for services on remote platforms using the polling fallback and awareness.
-
getQueryNetworks
protected java.lang.String[] getQueryNetworks(ServiceQuery<?> query)
Gets the networks relevant to the query.- Parameters:
query
- The query.- Returns:
- The relevant networks, may be empty for none.
-
debug
protected boolean debug(ServiceQuery<?> query)
Check if a query should be debugged.
-
-