01: /*
02: * <copyright>
03: *
04: * Copyright 1997-2004 Mobile Intelligence Corp
05: * under sponsorship of the Defense Advanced Research Projects
06: * Agency (DARPA).
07: *
08: * You can redistribute this software and/or modify it under the
09: * terms of the Cougaar Open Source License as published on the
10: * Cougaar Open Source Website (www.cougaar.org).
11: *
12: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
14: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
15: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
16: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
17: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23: *
24: * </copyright>
25: */
26: package org.cougaar.core.service.community;
27:
28: import java.util.Collection;
29: import java.util.Set;
30:
31: /**
32: * Defines the attributes and child entities for a community. This is the
33: * primary class used by the community service infrastructure to describe the
34: * details of a single community. Instances of this class are published
35: * to the blackboards of community members and other interested agents.
36: */
37: public interface Community extends Entity {
38:
39: // Search qualifiers
40: public static final int AGENTS_ONLY = 0;
41: public static final int COMMUNITIES_ONLY = 1;
42: public static final int ALL_ENTITIES = 2;
43:
44: /**
45: * Returns a collection containing all entities associated with this
46: * community.
47: * @return Collection of Entity objects
48: */
49: public Collection getEntities();
50:
51: /**
52: * Returns named Entity or null if it doesn't exist.
53: * @param name of requested entity
54: * @return named entity
55: */
56: public Entity getEntity(String name);
57:
58: /**
59: * Returns true if community contains entity.
60: * @param name of requested entity
61: * @return true if community contains entity
62: */
63: public boolean hasEntity(String name);
64:
65: /**
66: * Adds an Entity to the community.
67: * @param entity Entity to add to community
68: */
69: public void addEntity(Entity entity);
70:
71: /**
72: * Removes an Entity from the community.
73: * @param entityName Name of Entity to remove from community
74: */
75: public void removeEntity(String entityName);
76:
77: /**
78: * Performs search of community and returns collection of matching Entity
79: * objects.
80: * @param filter JNDI style search filter
81: * @param qualifier Search qualifier (e.g., AGENTS_ONLY, COMMUNITIES_ONLY, or
82: * ALL_ENTITIES)
83: * @return Set of Entity objects satisfying search filter
84: */
85: public Set search(String filter, int qualifier);
86:
87: public String qualifierToString(int qualifier);
88:
89: }
|