com.sun.faban.harness.webclient
Class TagEngine

java.lang.Object
  extended by com.sun.faban.harness.webclient.TagEngine
All Implemented Interfaces:
Serializable

public class TagEngine
extends Object
implements Serializable

This class maintains the tags to runs mapping.

Author:
Sheetal Patil
See Also:
Serialized Form

Method Summary
 void add(String runId, String[] tags)
          Adds a set of tags for a run id to the tag engine.
static TagEngine getInstance()
          Obtains the singleton instance of the tag engine.
 void removeRun(String runId)
          Removes a run from the tag engine.
 void save()
          Serializes the tag engine to file.
 Set<String> search(String tags)
          Searches the tag engine for runs matching the given tags.
 Set<String> search(String[] tags)
          Searches the tag engine for runs matching the given tags given an array of tags.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TagEngine getInstance()
                             throws IOException,
                                    ClassNotFoundException
Obtains the singleton instance of the tag engine.

Returns:
The singleton instance of the tag engine
Throws:
IOException - Error reading tag information
ClassNotFoundException - Error creating the singleton

save

public void save()
          throws IOException
Serializes the tag engine to file. It is located at $FABAN/config/tagengine.ser.

Throws:
IOException - Error writing to the file.

search

public Set<String> search(String tags)
Searches the tag engine for runs matching the given tags. The tags are given as a string separated by space, comma, colon, or semicolon.

Parameters:
tags - The tag in question, '/' seperated from sub-tags
Returns:
The set of run ids matching the given tags

search

public Set<String> search(String[] tags)
Searches the tag engine for runs matching the given tags given an array of tags.

Parameters:
tags - The tags in question, '/' seperated from sub-tags
Returns:
The set of run ids matching the given tags

removeRun

public void removeRun(String runId)
Removes a run from the tag engine.

Parameters:
runId - The id of the run

add

public void add(String runId,
                String[] tags)
Adds a set of tags for a run id to the tag engine. Old tags for the run id will be replaced with the new one. If tags is null or an empty array, all tags will be removed for the given run id.

Parameters:
runId - The runId
tags - The list of tags to add