com.buildforge.services.client.dbo
Class CollectorProperty

java.lang.Object
  extended by com.buildforge.services.client.dbo.CollectorProperty

public final class CollectorProperty
extends java.lang.Object

An object representing a collector property within the Build Forge system. Collectors are assigned to servers, and they gather information from those servers that can later be used by selectors when determining which server should be used for running a step. The pieces of information to gather from the server are specified using collector properties.


Field Summary
static java.lang.Class<CollectorProperty> CLASS
           
 
Constructor Summary
CollectorProperty(APIClientConnection conn, Collector parent)
          Defines a new collector property object.
 
Method Summary
 void delete()
          Removes this collector property from its parent collector.
 java.lang.String getCollectorName()
          The name of the collector to which this property belongs.
 Collector getParent()
          Returns a reference to this collector property's parent collector.
 java.lang.String getPropertyName()
          The name of this collector property.
 java.lang.String getPropertyValue()
          The value of this collector property.
 java.lang.String getRegex()
          Returns the regular expression to use for this collector property.
 int getSequenceNumber()
          Returns the sequence number for this collector property.
 boolean getUserDefined()
          Whether or not this is a user-defined property, as opposed to a built-in property.
 void moveTo(int newIndex)
          Moves this property to a new index.
 void setPropertyName(java.lang.String propertyName)
          Sets the name of this collector property.
 void setPropertyValue(java.lang.String propertyValue)
          Sets the value of the collector property.
 void setRegex(java.lang.String regex)
          Sets the regular expression for this collector property.
 void setUserDefined(boolean userDefined)
          Sets whether or not this CollectorProperty references a built-in property.
 java.lang.String toString()
           
 CollectorProperty update()
          Updates this existing collector property to use the updated values in this object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS

public static final java.lang.Class<CollectorProperty> CLASS
Constructor Detail

CollectorProperty

public CollectorProperty(APIClientConnection conn,
                         Collector parent)
Defines a new collector property object. The collector property will not exist until after it has either been added to a live parent Collector or until the offline parent Collector has been .create()ed.

Parameters:
conn - the services layer connection that the collector property should use when submitting requests
parent - the collector to which this property belongs
Method Detail

update

public CollectorProperty update()
                         throws java.io.IOException,
                                ServiceException
Updates this existing collector property to use the updated values in this object.

Restrictions: Requires Permission.EditCollector.

Returns:
the updated collector property
Throws:
java.io.IOException
ServiceException

delete

public void delete()
            throws java.io.IOException,
                   ServiceException
Removes this collector property from its parent collector. If the collector is live, then this method will also delete it from the system.

Restrictions: Requires Permission.EditCollector if the parent collector is live.

Throws:
java.io.IOException
ServiceException

moveTo

public void moveTo(int newIndex)
            throws java.io.IOException,
                   ServiceException
Moves this property to a new index. This is a convenience method for Collector.moveCollectorProperty(int, int), and the same behavior and restrictions apply

Parameters:
newIndex - as for Collector.moveCollectorProperty(int, int)
Throws:
java.io.IOException
ServiceException

getParent

public Collector getParent()
Returns a reference to this collector property's parent collector.


getCollectorName

public java.lang.String getCollectorName()
The name of the collector to which this property belongs.


getPropertyName

public java.lang.String getPropertyName()
The name of this collector property.


getPropertyValue

public java.lang.String getPropertyValue()
The value of this collector property. If a regular expression is set, then this value is the command to run whose output will be matched against the regular expression to determine the final value of this collector property by using the first matching group from the regular expression. For example, a value of "perl -v" as the value and "^This is perl, v(\\d+\\.\\d+\\.\\d+)" as the regular expression will set the value of this collector property, at runtime, to the version of perl that is installed on the machine.

If the command fails to execute, or if its output does not match the regular expression, or if the regular expression fails to return any match groups, then the property is left unset. If the regular expression is null, then this value is used directly as the value for this collector property.


getRegex

public java.lang.String getRegex()
Returns the regular expression to use for this collector property. For a full explanation, see the getPropertyValue() entry.


getUserDefined

public boolean getUserDefined()
Whether or not this is a user-defined property, as opposed to a built-in property.


getSequenceNumber

public int getSequenceNumber()
Returns the sequence number for this collector property. The sequence numbers are 1-based ordinals indicating the position of the property within the property list.


setPropertyName

public void setPropertyName(java.lang.String propertyName)
Sets the name of this collector property.


setPropertyValue

public void setPropertyValue(java.lang.String propertyValue)
Sets the value of the collector property. See getPropertyValue() for more information.


setRegex

public void setRegex(java.lang.String regex)
Sets the regular expression for this collector property. See getPropertyValue() for more information.


setUserDefined

public void setUserDefined(boolean userDefined)
Sets whether or not this CollectorProperty references a built-in property. Use Collector.getBuiltIns() for a list of built-in property names, or see CollectorPropertyDBO.BuiltIn. Use true unless you are certain that you want one of the built-ins.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object