wt.vc.config
Class ConfigHelper

java.lang.Object
  extended by wt.vc.config.ConfigHelper
All Implemented Interfaces:
Externalizable, Serializable

public final class ConfigHelper
extends Object
implements Externalizable

This helper for the ConfigService provides convenience APIs useful for converting lists of links into lists of masters or iterations and for filtering lists.

Supported API: true

Extendable: false

See Also:
ConfigSpec, ConfigService, Serialized Form

Field Summary
static ConfigService service
          

Supported API: true
 
Method Summary
static QueryResult buildConfigResultFromLinks(QueryResult linksToMasters, String role, QueryResult configResults)
          Given a QueryResult of links to masters and the iterations for those masters, this method returns a new QueryResult of Persistable[] in which each element is a Persistable[] containing the link in the 0th position and the iteration (or master, if no iteration was found) for the master specified in the link in the 1th position.
static QueryResult iterationsOf(QueryResult arrayedElements, int index)
          Returns a QueryResult of iterations found at the index position of the Persistable[] elements in the provided QueryResult.
static QueryResult iterationsOf(QueryResult links, String role)
          Returns a QueryResult of iterations by applying the role to the QueryResult of Links.
static QueryResult mastersOf(QueryResult arrayedElements, int index)
          Returns a QueryResult of masters found at the index position of the Persistable[] elements in the provided QueryResult.
static QueryResult mastersOf(QueryResult links, String role)
          Returns a QueryResult of masters by applying the role to the QueryResult of Links.
static QueryResult recoverMissingMasters(QueryResult masters, QueryResult iterations)
          Given a QueryResult of masters and a QueryResult of the iterations for those masters, this method returns a (new) QueryResult containing the iterations and any masters for which no corresponding iterations were found.
static QueryResult removeExtraLinks(QueryResult linksToIterations, String role, QueryResult configResults)
          Given a QueryResult of links to iterations and a QueryResult of filtered iterations, return a new QueryResult of only those links for which their iterations matched.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

service

public static final ConfigService service


Supported API: true

Method Detail

mastersOf

public static QueryResult mastersOf(QueryResult links,
                                    String role)
                             throws WTException
Returns a QueryResult of masters by applying the role to the QueryResult of Links.

Supported API: true

Parameters:
links - A QueryResult of links.
role - The role the masters play in the link.
Returns:
QueryResult
Throws:
WTException
See Also:
Mastered, BinaryLink, QueryResult

mastersOf

public static QueryResult mastersOf(QueryResult arrayedElements,
                                    int index)
                             throws WTException
Returns a QueryResult of masters found at the index position of the Persistable[] elements in the provided QueryResult.

Supported API: true

Parameters:
arrayedElements - A QueryResult of elements of type Persistable[].
index - The position in the Persistable[] the masters can be found in.
Returns:
QueryResult
Throws:
WTException
See Also:
Mastered, Persistable, QueryResult, Persistable

iterationsOf

public static QueryResult iterationsOf(QueryResult links,
                                       String role)
                                throws WTException
Returns a QueryResult of iterations by applying the role to the QueryResult of Links.

Supported API: true

Parameters:
links - A QueryResult of links.
role - The role the iterations play in the link.
Returns:
QueryResult
Throws:
WTException
See Also:
Iterated, BinaryLink, QueryResult

iterationsOf

public static QueryResult iterationsOf(QueryResult arrayedElements,
                                       int index)
                                throws WTException
Returns a QueryResult of iterations found at the index position of the Persistable[] elements in the provided QueryResult.

Supported API: true

Parameters:
arrayedElements - A QueryResult of elements of type Persistable[].
index - The position in the Persistable[] the iterations can be found in.
Returns:
QueryResult
Throws:
WTException
See Also:
Iterated, Persistable, QueryResult, Persistable

recoverMissingMasters

public static QueryResult recoverMissingMasters(QueryResult masters,
                                                QueryResult iterations)
                                         throws WTException
Given a QueryResult of masters and a QueryResult of the iterations for those masters, this method returns a (new) QueryResult containing the iterations and any masters for which no corresponding iterations were found. This method is useful to indicate that a master was found but no matching iteration was found for that master.

Supported API: true

Parameters:
masters - The masters the iterations belong to.
iterations - The iterations for the masters.
Returns:
QueryResult
Throws:
WTException
See Also:
Mastered, Iterated, QueryResult

buildConfigResultFromLinks

public static QueryResult buildConfigResultFromLinks(QueryResult linksToMasters,
                                                     String role,
                                                     QueryResult configResults)
                                              throws WTException
Given a QueryResult of links to masters and the iterations for those masters, this method returns a new QueryResult of Persistable[] in which each element is a Persistable[] containing the link in the 0th position and the iteration (or master, if no iteration was found) for the master specified in the link in the 1th position.

Supported API: true

Parameters:
linksToMasters - The links to masters.
role - The role those masters play in the links.
configResults - The iterations for those masters.
Returns:
QueryResult
Throws:
WTException
See Also:
Mastered, Iterated, BinaryLink, Persistable, QueryResult

removeExtraLinks

public static QueryResult removeExtraLinks(QueryResult linksToIterations,
                                           String role,
                                           QueryResult configResults)
                                    throws WTException
Given a QueryResult of links to iterations and a QueryResult of filtered iterations, return a new QueryResult of only those links for which their iterations matched.

Supported API: true

Parameters:
linksToIterations - The links to iterations.
role - The role those iterations play in the links.
configResults - The iterations for those links. These are typically the iterations that matched given a ConfigSpec.
Returns:
QueryResult
Throws:
WTException
See Also:
Iterated, BinaryLink, QueryResult