Package jadex.platform.service.awareness
Class CatalogAwarenessAgent
- java.lang.Object
-
- jadex.platform.service.awareness.CatalogAwarenessAgent
-
- All Implemented Interfaces:
IAwarenessService
public class CatalogAwarenessAgent extends java.lang.Object implements IAwarenessService
Passive awareness based on a pre-defined catalog of platforms + addresses. Platforms are specified as URLs as defined in IPlatformCatalogService.
-
-
Field Summary
Fields Modifier and Type Field Description protected IInternalAccess
agent
The agent access.protected MultiCollection<IComponentIdentifier,TransportAddress>
catalog
The internal catalog.protected static java.lang.String
DEFAULT_URLS
protected java.lang.String
platformurls
protected static java.util.regex.Pattern
URL_PATTERN
Platform URL pattern.
-
Constructor Summary
Constructors Constructor Description CatalogAwarenessAgent()
Creates the catalog agent empty.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IFuture<java.lang.Void>
addPlatform(java.lang.String platformurl)
Adds a platform to the catalog.IFuture<java.util.List<TransportAddress>>
getPlatformAddresses(IComponentIdentifier platformid)
Gets the address for a platform ID using the awareness mechanism.IFuture<java.lang.Void>
init()
Agent start.protected TransportAddress
parseUrl(java.lang.String url)
Parse a platform URL.IFuture<java.lang.Void>
removePlatform(java.lang.String name)
Removes a platform from the catalog.IIntermediateFuture<IComponentIdentifier>
searchPlatforms()
Try to find other platforms and finish after timeout.
-
-
-
Field Detail
-
DEFAULT_URLS
protected static final java.lang.String DEFAULT_URLS
- See Also:
- Constant Field Values
-
URL_PATTERN
protected static final java.util.regex.Pattern URL_PATTERN
Platform URL pattern.
-
agent
protected IInternalAccess agent
The agent access.
-
catalog
protected MultiCollection<IComponentIdentifier,TransportAddress> catalog
The internal catalog.
-
platformurls
protected java.lang.String platformurls
-
-
Method Detail
-
init
public IFuture<java.lang.Void> init()
Agent start.- Returns:
- Null, when done.
-
addPlatform
public IFuture<java.lang.Void> addPlatform(java.lang.String platformurl)
Adds a platform to the catalog.- Parameters:
platformurl
- URL of the platform.- Returns:
- Null, when done.
-
removePlatform
public IFuture<java.lang.Void> removePlatform(java.lang.String name)
Removes a platform from the catalog.- Parameters:
name
- Name of the platform.- Returns:
- Null, when done.
-
searchPlatforms
public IIntermediateFuture<IComponentIdentifier> searchPlatforms()
Try to find other platforms and finish after timeout. Immediately returns known platforms and concurrently issues a new search, waiting for replies until the timeout.- Specified by:
searchPlatforms
in interfaceIAwarenessService
-
getPlatformAddresses
public IFuture<java.util.List<TransportAddress>> getPlatformAddresses(IComponentIdentifier platformid)
Gets the address for a platform ID using the awareness mechanism.- Specified by:
getPlatformAddresses
in interfaceIAwarenessService
- Parameters:
platformid
- The platform ID.- Returns:
- The transport addresses or null if not available.
-
parseUrl
protected TransportAddress parseUrl(java.lang.String url)
Parse a platform URL.- Parameters:
url
- The URL.- Returns:
- The transport address.
-
-