wt.vc.config
Class ConfigHelper

java.lang.Object
  extended bywt.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
private static String CLASSNAME
           
static long EXTERNALIZATION_VERSION_UID
           
protected static long OLD_FORMAT_VERSION_UID
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
static ConfigService service
          

Supported API: true
 
Constructor Summary
ConfigHelper()
           
 
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.
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(ConfigHelper thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
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.
private static QueryResult removeDuplicates(QueryResult qr)
           
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.
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

service

public static final ConfigService service


Supported API: true


serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values
Constructor Detail

ConfigHelper

public ConfigHelper()
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(ConfigHelper thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

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

removeDuplicates

private static QueryResult removeDuplicates(QueryResult qr)