| org.cougaar.core.qos.frame.FrameSet
All known Subclasses: org.cougaar.core.qos.frame.SingleInheritanceFrameSet,
FrameSet | public interface FrameSet (Code) | | This interface is an abstract specification of an organized
collection of
Frame s. The main job of a FrameSet is to
handle inter-Frame relationships.
|
Field Summary | |
final public static String | CHILD One of two constants for the roles of frame relationship. | final public static String | PARENT One of two constants for the roles of frame relationship. |
Method Summary | |
public void | addAggregator(String slot, String relatedSlot, String relation, String role, String className) Creates an aggregator to compute and update the given slot. | public Class | classForPrototype(String prototypeName) | public Class | classForPrototype(PrototypeFrame prototype) | public int | countRelations(Frame frame, String role, String relation_proto) Returns a count of frames that are related to the given one
via a relationship matching the given prototype, and in which
the given frame plays the given role. | public boolean | descendsFrom(DataFrame frame, String prototype) Returns true iff the given frame matches the given prototype,
directly or indirectly. | public boolean | descendsFrom(PrototypeFrame frame, String prototype) Returns true iff the first prototype frame is an extension
of the second one, directly or indirectly. | public void | exportFrames(File file) Writes the frameset data as xml. | public void | exportFrames(File file, Set<String> prototypes) Writes a subset of the frameset data as xml.
For each DataFrame of the given prototypes, writes the current value of
any slot in that frame that is either defined locally or inherited via
the prototype hierarchy.
Parameters: file - The name of xml file to which the data will be written. Parameters: prototypes - Names of the prototypes whose frames should be written. | public void | exportFrames(File file, Set<String> prototypes, boolean allSlots) Write a subset of the frameset data as xml, optionally including
slot values inherited via containment.
Parameters: file - The name of the xml file to which the data will bewritten. Parameters: prototypes - Names of the prototypes whose frames should bewritten. | public DataFrame | findFirstRelation(Frame frame, String role, String relation_proto) Returns a
DataFrame that's related to the given one
via a relationship matching the given prototype, and in which
the given frame plays the given role.
If there's more than one such frame, a random one will be
returne. | public DataFrame | findFrame(String kind, String slot, Object value) Returns the DataFrame that matches the given triple, ie, whose
prototype matches the given kind and whose value for the given
slot matches the given value. | public Frame | findFrame(UID uid) Returns the frame with the given UID. | public Set<DataFrame> | findFrames(String kind, Properties slot_value_pairs) Returns a collection of DataFrames that match the given prototype and
whose slots match all the given pairs. | public Path | findPath(String name) Returns the path with the given name. | public Path | findPath(UID uid) Returns the path with the given UID. | public PrototypeFrame | findPrototypeFrame(String name) | public Set<DataFrame> | findRelations(Frame frame, String role, String relation_proto) | public Map<RelationFrame, DataFrame> | findRelationshipFrames(DataFrame frame, String role, String relation_proto) Returns a collection of
RelationFrame s representing
relationships of the given prototype in which the given frame
plays the given role. | public DataFrame | getContainer(DataFrame frame) Returns the container of the given frame, if any. | public Metric | getMetricValue(DataFrame frame, String path) | public String | getName() Returns the name of the FrameSet. | public String | getPackageName() Returns the package used by the code generator
when it writes Java classes for prototypes. | public PrototypeFrame | getPrototype(Frame frame) Returns the given DataFrame's PrototypeFrame. | public Collection<PrototypeFrame> | getPrototypes() | public DataFrame | getRelationshipChild(RelationFrame relationship) Returns the matching
FrameSet.CHILD Frame in the given relationship. | public DataFrame | getRelationshipParent(RelationFrame relationship) Returns the matching
FrameSet.PARENT Frame in the given relationship. | public void | importFrames(URL location) Loads DataFrames at the given location. | public void | initializeAggregators() Sets up subscriptions for all aggregators that haven't done so already.
Ordinarily this only needs to be called once after the prototypes are
loaded. | public boolean | isResolved(RelationFrame frame) | public DataFrame | makeFrame(DataFrame frame) Adds a previously constucted DataFrame to this FrameSet. | public DataFrame | makeFrame(String kind, Properties slots) Creates a DataFrame of the given kind and with the given intial
values, and adds it to this FrameSet. | public DataFrame | makeFrame(String kind, Properties slots, UID uid) Creates a DataFrame of the given kind and with the given intial
values, and adds it to this FrameSet. | public Path | makePath(String name, Path.Fork[] forks, String slot) Creates a Path and adds it to the FrameSet As a result of this
operation the Path will be published to the Blackboard. | public PrototypeFrame | makePrototype(String kind, String base, Attributes attrs, Map<String, Attributes> slots) Creates a PrototypeFrame with the given name and default slot values,
and that extends the given base prototype. | public PrototypeFrame | makePrototype(String kind, String base, Attributes attrs, Map<String, Attributes> slots, UID uid) Creates a PrototypeFrame with the given name UID, and intial values,
and that extends the given pase prototype. | public RelationFrame | makeRelationship(String kind, Properties slots, DataFrame parent, DataFrame child) Optimized way to create a new relationship that avoids the lookup
of the parent and child. | public void | processQueue() Forces the FrameSet to process any queued Blackboard operations. | public void | removeFrame(DataFrame frame) Removes the given Frame from the FrameSet. | public void | removeFrameAndRelations(DataFrame frame) Removes the given Frame and all its relationships from the FrameSet. | public void | runInTransaction(Runnable r) Runs a body of code using a lock that prevents a
simultaneous invocation of
FrameSet.processQueue . | public void | subscribeToMetric(DataFrame frame, Observer observer, String path) | public void | valueUpdated(DataFrame frame, String slot, Object value) Informs the FrameSet that the given frame was changed in the
given way. |
CHILD | final public static String CHILD(Code) | | One of two constants for the roles of frame relationship.
This one if something like the mathematical "range".
See Also: FrameSet.PARENT |
PARENT | final public static String PARENT(Code) | | One of two constants for the roles of frame relationship.
This one if something like the mathematical "domain".
See Also: FrameSet.CHILD |
addAggregator | public void addAggregator(String slot, String relatedSlot, String relation, String role, String className)(Code) | | Creates an aggregator to compute and update the given slot. Ordinarily this happens
automatically as part of loading the prototypes and wouldn't need to be called
explicitly in user code.
Parameters: slot - The slot whose value is computed by a SlotAggregator. Parameters: relatedSlot - If non-null, and the value of this slot changes in a related entity, the SlotAggregator will be reinvoked. Parameters: relation - The name of the RelationPrototype that's used to collect the relatedentites. Parameters: className - The name of the SlotAggregator. If it's qualified witha package the name is used as is. If not, the class should be in the framesetpackage, or in org.cougaar.core.qos.frame.aggregator. |
classForPrototype | public Class classForPrototype(String prototypeName)(Code) | | Returns the generated class for the given prototype
|
classForPrototype | public Class classForPrototype(PrototypeFrame prototype)(Code) | | Return the generated Java class for the given prototype
|
countRelations | public int countRelations(Frame frame, String role, String relation_proto)(Code) | | Returns a count of frames that are related to the given one
via a relationship matching the given prototype, and in which
the given frame plays the given role.
See Also: FrameSet.PARENT See Also: FrameSet.CHILD |
descendsFrom | public boolean descendsFrom(DataFrame frame, String prototype)(Code) | | Returns true iff the given frame matches the given prototype,
directly or indirectly.
|
descendsFrom | public boolean descendsFrom(PrototypeFrame frame, String prototype)(Code) | | Returns true iff the first prototype frame is an extension
of the second one, directly or indirectly.
|
exportFrames | public void exportFrames(File file) throws IOException(Code) | | Writes the frameset data as xml.
For each DataFrame in the frameset, writes the current value of
any slot in that frame that is either defined locally or inherited via
the prototype hierarchy.
Parameters: file - The name of xml file to which the data will be written. |
exportFrames | public void exportFrames(File file, Set<String> prototypes) throws IOException(Code) | | Writes a subset of the frameset data as xml.
For each DataFrame of the given prototypes, writes the current value of
any slot in that frame that is either defined locally or inherited via
the prototype hierarchy.
Parameters: file - The name of xml file to which the data will be written. Parameters: prototypes - Names of the prototypes whose frames should be written. If null, this method is equivalent to FrameSet.exportFrames. |
exportFrames | public void exportFrames(File file, Set<String> prototypes, boolean allSlots) throws IOException(Code) | | Write a subset of the frameset data as xml, optionally including
slot values inherited via containment.
Parameters: file - The name of the xml file to which the data will bewritten. Parameters: prototypes - Names of the prototypes whose frames should bewritten. If null, this method is likeFrameSet.exportFrames except that all slots can bewritten. Parameters: allSlots - If false, only writes current value of all slots thatare either defined locally or inherited via theprototype hierarchy. If true, also includes currentvalue of slots inherited via containment. |
findFirstRelation | public DataFrame findFirstRelation(Frame frame, String role, String relation_proto)(Code) | | Returns a
DataFrame that's related to the given one
via a relationship matching the given prototype, and in which
the given frame plays the given role.
If there's more than one such frame, a random one will be
returne. If there are no such frames, the return value
is null.
See Also: FrameSet.PARENT See Also: FrameSet.CHILD |
findFrame | public DataFrame findFrame(String kind, String slot, Object value)(Code) | | Returns the DataFrame that matches the given triple, ie, whose
prototype matches the given kind and whose value for the given
slot matches the given value. If more than one frame matches,
the first match is returned.
|
findFrame | public Frame findFrame(UID uid)(Code) | | Returns the frame with the given UID. There can be at most one.
|
findFrames | public Set<DataFrame> findFrames(String kind, Properties slot_value_pairs)(Code) | | Returns a collection of DataFrames that match the given prototype and
whose slots match all the given pairs.
|
findPath | public Path findPath(String name)(Code) | | Returns the path with the given name. There can be at most one.
|
findPath | public Path findPath(UID uid)(Code) | | Returns the path with the given UID. There can be at most one.
|
findPrototypeFrame | public PrototypeFrame findPrototypeFrame(String name)(Code) | | Parameters: name - The name of a prototype the corresponding PrototypeFrame |
getContainer | public DataFrame getContainer(DataFrame frame)(Code) | | Returns the container of the given frame, if any. The
exact meaning of 'containment' is specific to the FrameSet
instance.
|
getMetricValue | public Metric getMetricValue(DataFrame frame, String path)(Code) | | Queries the metric service for a value relative to a frame
|
getName | public String getName()(Code) | | Returns the name of the FrameSet.
|
getPackageName | public String getPackageName()(Code) | | Returns the package used by the code generator
when it writes Java classes for prototypes.
|
importFrames | public void importFrames(URL location) throws IOException(Code) | | Loads DataFrames at the given location.
Parameters: location - A file or resource path |
initializeAggregators | public void initializeAggregators()(Code) | | Sets up subscriptions for all aggregators that haven't done so already.
Ordinarily this only needs to be called once after the prototypes are
loaded. This is usually handled by
FrameSetLoaderPlugin .
|
makeFrame | public DataFrame makeFrame(DataFrame frame)(Code) | | Adds a previously constucted DataFrame to this FrameSet. The
Frame's current frameSet should be null. As a result of this
operation the Frame will be published to the Blackboard.
|
makeFrame | public DataFrame makeFrame(String kind, Properties slots)(Code) | | Creates a DataFrame of the given kind and with the given intial
values, and adds it to this FrameSet. A UID for the frame will
be generated automatically. As a result of this operation the
Frame will be published to the Blackboard.
|
makeFrame | public DataFrame makeFrame(String kind, Properties slots, UID uid)(Code) | | Creates a DataFrame of the given kind and with the given intial
values, and adds it to this FrameSet. The UID for the frame as
specified. As a result of this operation the Frame will be
published to the Blackboard.
|
makePath | public Path makePath(String name, Path.Fork[] forks, String slot)(Code) | | Creates a Path and adds it to the FrameSet As a result of this
operation the Path will be published to the Blackboard.
|
makePrototype | public PrototypeFrame makePrototype(String kind, String base, Attributes attrs, Map<String, Attributes> slots)(Code) | | Creates a PrototypeFrame with the given name and default slot values,
and that extends the given base prototype. A UID for the frame will
be generated automatically. As a result of this operation the Frame
will be published to the Blackboard.
|
makePrototype | public PrototypeFrame makePrototype(String kind, String base, Attributes attrs, Map<String, Attributes> slots, UID uid)(Code) | | Creates a PrototypeFrame with the given name UID, and intial values,
and that extends the given pase prototype. As a result of this
operation the Frame will be published to the Blackboard.
|
processQueue | public void processQueue()(Code) | | Forces the FrameSet to process any queued Blackboard operations.
This call will block if a transaction is in progress.
See Also: FrameSet.runInTransaction(Runnable) |
removeFrame | public void removeFrame(DataFrame frame)(Code) | | Removes the given Frame from the FrameSet. As a result of this
operation the Frame will also be removed from the Blackboard.
|
removeFrameAndRelations | public void removeFrameAndRelations(DataFrame frame)(Code) | | Removes the given Frame and all its relationships from the FrameSet.
As a result of this
operation the Frame will also be removed from the Blackboard.
|
runInTransaction | public void runInTransaction(Runnable r)(Code) | | Runs a body of code using a lock that prevents a
simultaneous invocation of
FrameSet.processQueue .
The runnable is executed in the caller's thread.
|
subscribeToMetric | public void subscribeToMetric(DataFrame frame, Observer observer, String path)(Code) | | Subscribes a DataFrame to a value in the MetricsService
|
valueUpdated | public void valueUpdated(DataFrame frame, String slot, Object value)(Code) | | Informs the FrameSet that the given frame was changed in the
given way. As a result of this operation, a change will be
published to the Blackboard.
|
|
|