| java.lang.Object org.cougaar.community.AbstractCommunityService
All known Subclasses: org.cougaar.community.test.CommunityServiceTestImpl, org.cougaar.community.DefaultCommunityServiceImpl,
AbstractCommunityService | abstract public class AbstractCommunityService implements CommunityService,java.io.Serializable(Code) | | Base class for implementations of CommunityService API. Methods that are used
for remote operations are abstract enabling the use of different
communication mechanisms.
|
Method Summary | |
public void | addListener(CommunityChangeListener l) Add listener for CommunityChangeEvents. | protected void | addParentAttribute(Community community, String parent) Adds "Parent=XXX" attribute to nested community. | public void | createCommunity(String communityName, Attributes attrs, CommunityResponseListener crl) Request to create a community. | abstract public void | findCommunity(String communityName, FindCommunityCallback fccb, long timeout) Invokes callback when specified community is found.
Parameters: communityName - Name of community Parameters: fccb - Callback invoked after community is found or timeout has lapsed Parameters: timeout - Length of time (in milliseconds) to wait for community to belocated. | abstract protected String | getAgentName() | public Community | getCommunity(String communityName, CommunityResponseListener crl) Request to get a Community instance from local cache. | protected Collection | getMatches(String communityName, String filter) Returns a collection of MessageAddress objects for all agents from
specified community that match search filter. | public String[] | getParentCommunities(boolean allLevels) Returns an array of community names of all communities of which caller is a
member.
Parameters: allLevels - Set to false if the list should contain only those communities inwhich the caller is explicitly referenced. | protected void | handleResponse(String communityName, CommunityResponse resp, Set listeners) Handle response to community request returned by manager. | public void | joinCommunity(String communityName, String entityName, int entityType, Attributes entityAttrs, boolean createIfNotFound, Attributes newCommunityAttrs, long timeout, CommunityResponseListener crl) Request to join a named community. | public void | joinCommunity(String communityName, String entityName, int entityType, Attributes entityAttrs, boolean createIfNotFound, Attributes newCommunityAttrs, CommunityResponseListener crl) Request to join a named community. | public void | leaveCommunity(String communityName, String entityName, CommunityResponseListener crl) Request to leave named community. | public void | leaveCommunity(String communityName, String entityName, long timeout, CommunityResponseListener crl) Request to leave named community. | abstract public Collection | listAllCommunities() | abstract public void | listAllCommunities(CommunityResponseListener crl) | public Collection | listParentCommunities(String member, String filter, CommunityResponseListener crl) Requests a collection of community names identifying the communities that
contain the specified member. | public Collection | listParentCommunities(String member) Requests a collection of community names identifying the communities that
contain the specified member. | public Collection | listParentCommunities(String member, String filter) Requests a collection of community names identifying the communities that
contain the specified member and satisfy a given set of attributes. | public void | modifyAttributes(String communityName, String entityName, ModificationItem[] mods, CommunityResponseListener crl) Request to modify an Entity's attributes. | abstract protected void | queueCommunityRequest(String communityName, int requestType, Entity entity, ModificationItem[] attrMods, CommunityResponseListener crl, long timeout, long delay) | public void | removeListener(CommunityChangeListener l) Remove listener for CommunityChangeEvents. | protected void | removeParentAttribute(Community community, String parent) Removes "Parent=XXX" attribute from nested community. | public Collection | search(String communityName, String filter) Performs attribute based search of community entities. | public Collection | searchCommunity(String communityName, String searchFilter, boolean recursiveSearch, int resultQualifier, CommunityResponseListener crl) Initiates a community search operation. | abstract protected void | sendResponse(CommunityResponse resp, Set listeners) |
addParentAttribute | protected void addParentAttribute(Community community, String parent)(Code) | | Adds "Parent=XXX" attribute to nested community.
Parameters: community - Community Parameters: parent - String |
createCommunity | public void createCommunity(String communityName, Attributes attrs, CommunityResponseListener crl)(Code) | | Request to create a community. If the specified community does not exist it
will be created and the caller will become the community manager. It the
community already exists a Community reference is obtained from its
community manager and returned.
Parameters: communityName - Name of community to create Parameters: attrs - Attributes to associate with new community Parameters: crl - Listener to receive response |
findCommunity | abstract public void findCommunity(String communityName, FindCommunityCallback fccb, long timeout)(Code) | | Invokes callback when specified community is found.
Parameters: communityName - Name of community Parameters: fccb - Callback invoked after community is found or timeout has lapsed Parameters: timeout - Length of time (in milliseconds) to wait for community to belocated. A value of -1 disables the timeout. |
getCommunity | public Community getCommunity(String communityName, CommunityResponseListener crl)(Code) | | Request to get a Community instance from local cache. If community is found
in cache a reference is returned by method call. If the community is not
found in the cache a null value is returned and the Community reference is
requested from the community manager. After the Community instance has been
obtained from the community manager the supplied CommunityResponseListener
callback is invoked to notify the requester. Note that the supplied
callback is not invoked if a non-null value is returned.
Parameters: communityName - Community of interest Parameters: crl - Listener to receive response after remote fetch Community instance if found in cache or null if not found |
getMatches | protected Collection getMatches(String communityName, String filter)(Code) | | Returns a collection of MessageAddress objects for all agents from
specified community that match search filter.
Parameters: communityName - String Parameters: filter - String Collection Collection of MessageAddress objects |
getParentCommunities | public String[] getParentCommunities(boolean allLevels)(Code) | | Returns an array of community names of all communities of which caller is a
member.
Parameters: allLevels - Set to false if the list should contain only those communities inwhich the caller is explicitly referenced. If true the list willalso include those communities in which the caller is implicitly amember as a result of community nesting. Array of community names |
handleResponse | protected void handleResponse(String communityName, CommunityResponse resp, Set listeners)(Code) | | Handle response to community request returned by manager.
Parameters: resp - CommunityResponse from manager Parameters: listeners - CommunityResponseListeners to be notified |
joinCommunity | public void joinCommunity(String communityName, String entityName, int entityType, Attributes entityAttrs, boolean createIfNotFound, Attributes newCommunityAttrs, long timeout, CommunityResponseListener crl)(Code) | | Request to join a named community. If the specified community does not
exist it may be created in which case the caller becomes the community
manager. It the community doesn't exist and the caller has set the
"createIfNotFound flag to false the join request will be queued until the
community is found.
Parameters: communityName - Community to join Parameters: entityName - New member name Parameters: entityType - Type of member entity to create (AGENT or COMMUNITY) Parameters: entityAttrs - Attributes for new member Parameters: createIfNotFound - Create community if it doesn't exist, otherwise wait Parameters: newCommunityAttrs - Attributes for created community (used if createIfNotFound set totrue, otherwise ignored) Parameters: crl - Listener to receive response |
joinCommunity | public void joinCommunity(String communityName, String entityName, int entityType, Attributes entityAttrs, boolean createIfNotFound, Attributes newCommunityAttrs, CommunityResponseListener crl)(Code) | | Request to join a named community. If the specified community does not
exist it may be created in which case the caller becomes the community
manager. It the community doesn't exist and the caller has set the
"createIfNotFound flag to false the join request will be queued until the
community is found.
Parameters: communityName - Community to join Parameters: entityName - New member name Parameters: entityType - Type of member entity to create (AGENT or COMMUNITY) Parameters: entityAttrs - Attributes for new member Parameters: createIfNotFound - Create community if it doesn't exist, otherwise wait Parameters: newCommunityAttrs - Attributes for created community (used if createIfNotFound set totrue, otherwise ignored) Parameters: crl - Listener to receive response |
leaveCommunity | public void leaveCommunity(String communityName, String entityName, CommunityResponseListener crl)(Code) | | Request to leave named community.
Parameters: communityName - Community to leave Parameters: entityName - Entity to remove from community Parameters: crl - Listener to receive response |
leaveCommunity | public void leaveCommunity(String communityName, String entityName, long timeout, CommunityResponseListener crl)(Code) | | Request to leave named community.
Parameters: communityName - Community to leave Parameters: entityName - Entity to remove from community Parameters: timeout - How long to attempt operation before giving up Parameters: crl - Listener to receive response |
listParentCommunities | public Collection listParentCommunities(String member, String filter, CommunityResponseListener crl)(Code) | | Requests a collection of community names identifying the communities that
contain the specified member. If the member name is null the immediate
parent communities for calling agent are returned. If member is the name of
a nested community the names of all immediate parent communities is
returned. The results are returned directly if the member name is null or
if a copy of the specified community is available in local cache.
Otherwise, the results will be returned in the CommunityResponseListener
callback in which case the method returns a null value.
Parameters: member - Member name (either null or name of a nested community) Parameters: crl - Listner to receive results if remote lookup is required A collection of community names if operation can be resolved usingdata from local cache, otherwise null |
listParentCommunities | public Collection listParentCommunities(String member)(Code) | | Requests a collection of community names identifying the communities that
contain the specified member.
Parameters: member - Member name A collection of community names |
listParentCommunities | public Collection listParentCommunities(String member, String filter)(Code) | | Requests a collection of community names identifying the communities that
contain the specified member and satisfy a given set of attributes.
Parameters: member - Member name Parameters: filter - Search filter defining community attributes A collection of community names |
modifyAttributes | public void modifyAttributes(String communityName, String entityName, ModificationItem[] mods, CommunityResponseListener crl)(Code) | | Request to modify an Entity's attributes.
Parameters: communityName - Name of community Parameters: entityName - Name of affected Entity or null if modifying community attributes Parameters: mods - Attribute modifications Parameters: crl - Listener to receive response |
removeParentAttribute | protected void removeParentAttribute(Community community, String parent)(Code) | | Removes "Parent=XXX" attribute from nested community.
Parameters: community - Community Parameters: parent - String |
search | public Collection search(String communityName, String filter)(Code) | | Performs attribute based search of community entities. This is a general
purpose search operation using a JNDI search filter. This method is
non-blocking. An empty Collection will be returned if the local cache is
empty. Updated search results can be obtained by using the addListener
method to receive change notifications.
Parameters: communityName - Name of community to search Parameters: filter - JNDI search filter Collection of MessageAddress objects |
searchCommunity | public Collection searchCommunity(String communityName, String searchFilter, boolean recursiveSearch, int resultQualifier, CommunityResponseListener crl)(Code) | | Initiates a community search operation. The results of the search are
immediately returned as part of the method call if the search can be
resolved using locally cached data. However, if the search requires
interaction with a remote community manager a null value is returned by the
method call and the search results are returned via the
CommunityResponseListener callback after the remote operation has been
completed. In the case where the search can be satisified using local data
(i.e., the method returns a non-null value) the CommunityResponseListener
is not invoked.
Parameters: communityName - Name of community to search Parameters: searchFilter - JNDI compliant search filter Parameters: recursiveSearch - True for recursive search into nested communities [false = searchtop community only] Parameters: resultQualifier - Type of entities to return in result [ALL_ENTITIES, AGENTS_ONLY,or COMMUNITIES_ONLY] Parameters: crl - Callback object to receive search results Collection of Entity objects matching search criteria if availablein local cache. A null value is returned if cache doesn't containednamed community. |
|
|