public class Ad extends Object
Modifier and Type | Field and Description |
---|---|
protected condor.classad.RecordExpr |
jobAd
The internal Ad representation
|
static int |
TYPE_AD
Attribute Ad type value
|
static int |
TYPE_BOOL
Attribute Boolean type value
|
static int |
TYPE_EXPRESSION
Attribute Expression type value
|
static int |
TYPE_INTEGER
Attribute Integer type value
|
static int |
TYPE_REAL
Attribute Real/Double type value
|
static int |
TYPE_STRING
Attribute String type value
|
static int |
TYPE_UNKNOWN
unknown Attribute value
|
Constructor and Description |
---|
Ad()
Default Constructor
|
Ad(condor.classad.RecordExpr ad)
Instantiates a Ad object from the given Ad-string
|
Ad(String ad)
Instantiates a Ad object from the given Ad-string
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(String attrName,
Ad attrValue)
ADD ATTRIBUTE METHODS
/**
Allow adding a value to an already set attribute of the JobAd instance
(i.e.
|
void |
addAttribute(String attrName,
boolean attrValue)
Allow adding a value to an already set attribute of the JobAd instance
(i.e.
|
void |
addAttribute(String attrName,
double attrValue)
Allow adding a value to an already set attribute of the JobAd instance
(i.e.
|
void |
addAttribute(String attrName,
int attrValue)
Allow adding a value to an already set attribute of the JobAd instance
(i.e.
|
void |
addAttribute(String attrName,
String attrValue)
Allow adding a value to an already set attribute of the JobAd instance
(i.e.
|
protected condor.classad.ListExpr |
appendValue(condor.classad.Expr attrValue,
condor.classad.ListExpr list)
Append a value to a list and return the corresponding Expression List
|
Iterator |
attributes()
Enumerate the attribute names.
|
void |
clear()
Reset the JobAd Instance.
|
Object |
clone()
Copy all the attributes of the instance into a new JobAd
|
protected static void |
copy(condor.classad.RecordExpr re,
Ad target)
Copy all the attributes of the instance into a new Ad
|
void |
delAttribute(String attrName)
Remove the specified attribute from the Ad instance
|
void |
fromFile(String path)
Retrieve the JobAd from the specified file path
|
void |
fromRecord(condor.classad.RecordExpr re)
Load the classad from a classad Expression and create a new Ad instance
|
void |
fromString(String jdl)
Update and load the Ad object with the given ClassAd-jdl String
|
Ad |
getAd(String attrName)
Retrieve the Ad
|
Vector |
getAdValue(String attrName)
Retreive the value of the specified attribute
|
Vector |
getBooleanValue(String attrName)
Retreive the value of the specified attribute
|
protected Object |
getConstant(String attrName,
condor.classad.Expr value,
int exprType) |
Vector |
getDoubleValue(String attrName)
Retreive the value of the specified attribute
|
Vector |
getIntValue(String attrName)
Retreive the value of the specified attribute
|
Vector |
getStringValue(String attrName)
Retreive the value of the specified attribute
|
int |
getType(String attrName)
GET METHODS
/**
Retrieve the type of the specified attribute, if present
|
protected Vector |
getValue(String attrName,
condor.classad.Expr value,
int exprType)
get the value(s) from an Expression and return it/them as a Vector of Expr
|
boolean |
hasAttribute(String attrName)
Check If the specified attribute has already been set
|
boolean |
isSet()
Check whether the JobAd has been initialised (true) or not (false)
|
condor.classad.Expr |
lookup(String attrName)
Find the attribute with the given name.
|
void |
setAttribute(String attrName,
Ad attrValue)
Insert an attribute of Ad type
|
void |
setAttribute(String attrName,
boolean attrValue)
Insert an attribute of boolean type
|
void |
setAttribute(String attrName,
double attrValue)
Insert an attribute of double type
|
void |
setAttribute(String attrName,
condor.classad.Expr attrValue)
Insert an attribute of Expr type
|
void |
setAttribute(String attrName,
int attrValue)
SET METHODS
/** Insert an attribute of integer type
|
void |
setAttribute(String attrName,
String attrValue)
Insert an attribute of String type
|
int |
size()
Return the number of attributes that have been inserted so far
|
String |
toString()
Convert the JobAd Instance into a sinlge-line String representation
This method is equivalent as toString (false , false )
|
String |
toString(boolean multiLines,
boolean multiLists)
Convert the JobAd Instance into its String representation, one line per attribute, multi line for listed attribute active
|
public static final int TYPE_UNKNOWN
public static final int TYPE_INTEGER
public static final int TYPE_BOOL
public static final int TYPE_STRING
public static final int TYPE_REAL
public static final int TYPE_AD
public static final int TYPE_EXPRESSION
protected condor.classad.RecordExpr jobAd
public Ad()
public Ad(String ad) throws ParseException, JobAdException
ad
- A String representing the AdParseException
- The Classad has JDL syntax error. Unable to build a valid AdJobAdException
- One or more attributes contain syntax error(s)public Ad(condor.classad.RecordExpr ad) throws JobAdException
ad
- A classAd Expression representing the AdParseException
- The Classad has JDL syntax error. Unable to build a valid AdJobAdException
- One or more attributes contain syntax error(s)protected static void copy(condor.classad.RecordExpr re, Ad target) throws JobAdException
re
- a classad recordExpr containing all the attributes to be copied fromtarget
- the Ad instance to be filled with the attributesJobAdException
- all the error occurred while inserting the attributespublic Object clone()
public void setAttribute(String attrName, int attrValue) throws InvalidAttributeValueException
attrName
- the name of the attribute to be setattrValue
- the value for the attribute to be setInvalidAttributeValueException
public void setAttribute(String attrName, boolean attrValue) throws InvalidAttributeValueException
attrName
- the name of the attribute to be setattrValue
- the value for the attribute to be setInvalidAttributeValueException
public void setAttribute(String attrName, double attrValue) throws InvalidAttributeValueException
attrName
- the name of the attribute to be setattrValue
- the value for the attribute to be setInvalidAttributeValueException
public void setAttribute(String attrName, String attrValue) throws InvalidAttributeValueException
attrName
- the name of the attribute to be setattrValue
- the value for the attribute to be setInvalidAttributeValueException
public void setAttribute(String attrName, Ad attrValue) throws InvalidAttributeValueException
attrName
- the name of the attribute to be setattrValue
- the value for the attribute to be setInvalidAttributeValueException
public void setAttribute(String attrName, condor.classad.Expr attrValue) throws InvalidAttributeValueException, IllegalArgumentException
attrName
- the name of the attribute to be setattrValue
- the value for the attribute to be setInvalidAttributeValueException
IllegalArgumentException
public void addAttribute(String attrName, Ad attrValue) throws IllegalArgumentException, InvalidAttributeValueException
attrName
- a String representing the attribute nameattrValue
- - The value of the attribute to be addedIllegalArgumentException-
- The specified value is not allowed for the attributeInvalidAttributeValueException
- - A value has not the right type for an attributeIllegalArgumentException
public void addAttribute(String attrName, int attrValue) throws IllegalArgumentException, InvalidAttributeValueException
attrName
- a String representing the attribute nameattrValue
- - The value of the attribute to be addedIllegalArgumentException-
- The specified value is not allowed for the attributeInvalidAttributeValueException
- - A value has not the right type for an attributeIllegalArgumentException
public void addAttribute(String attrName, double attrValue) throws IllegalArgumentException, InvalidAttributeValueException
attrName
- a String representing the attribute nameattrValue
- - The value of the attribute to be addedIllegalArgumentException-
- The specified value is not allowed for the attributeInvalidAttributeValueException
- - the has not the right format for the attributeIllegalArgumentException
public void addAttribute(String attrName, boolean attrValue) throws IllegalArgumentException, InvalidAttributeValueException
attrName
- a String representing the attribute nameattrValue
- - The value of the attribute to be addedIllegalArgumentException-
- The specified value is not allowed for the attributeInvalidAttributeValueException
- - the value has not the right format for the attributeIllegalArgumentException
public void addAttribute(String attrName, String attrValue) throws IllegalArgumentException, InvalidAttributeValueException
attrName
- a String representing the attribute nameattrValue
- - The value of the attribute to be addedIllegalArgumentException
- The specified type is not allowed for the attribute valueInvalidAttributeValueException
- The value has not the right format for the attributepublic int getType(String attrName) throws NoSuchFieldException
attrName
- the name of the attribute to look forNoSuchFieldException
- - Unable to find the attribute inside the Adpublic Vector getIntValue(String attrName) throws NoSuchFieldException, IllegalArgumentException
attrName
- The name of the attribute name to be retrievedIllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute nameNoSuchFieldException
- - The requested attribute has not been set yetpublic Vector getDoubleValue(String attrName) throws NoSuchFieldException, IllegalArgumentException
attrName
- The name of the attribute to be retrievedNoSuchFieldException
IllegalArgumentException
public Vector getBooleanValue(String attrName) throws NoSuchFieldException, IllegalArgumentException
attrName
- The name of the attribute to be retrievedIllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute nameNoSuchFieldException
- - The requested attribute has not been set yetpublic Vector getStringValue(String attrName) throws NoSuchFieldException, IllegalArgumentException
attrName
- The name of the attribute to be retrievedIllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute nameNoSuchFieldException
- - The requested attribute has not been set yetpublic Vector getAdValue(String attrName) throws NoSuchFieldException, IllegalArgumentException
attrName
- The name of the attribute to be retrievedIllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute nameNoSuchFieldException
- - The requested attribute has not been set yetpublic Ad getAd(String attrName) throws NoSuchFieldException, IllegalArgumentException
attrName
- the name of the attribute to be retrievedIllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute nameNoSuchFieldException
- - The requested attribute has not been set yetprotected Object getConstant(String attrName, condor.classad.Expr value, int exprType) throws IllegalArgumentException, NoSuchFieldException
protected Vector getValue(String attrName, condor.classad.Expr value, int exprType) throws NoSuchFieldException, IllegalArgumentException
public condor.classad.Expr lookup(String attrName)
name
- - the attribute name to look forpublic Iterator attributes()
public boolean hasAttribute(String attrName)
attrName
- The name of the attibute to be looked forpublic boolean isSet()
public int size()
public void clear()
public void delAttribute(String attrName) throws NoSuchFieldException
attrName
- the attribute to be retrievedNoSuchFieldException
- The attribute is not presentprotected condor.classad.ListExpr appendValue(condor.classad.Expr attrValue, condor.classad.ListExpr list)
public void fromFile(String path) throws Exception
path
- the path of the file from where the jobAd is supposed to be readParseException
- - The string doesn't seem to be a valid classadJobAdException
- - One or more attributes contain syntax error(s)FileNotFoundException
- the specified path does not existException
public String toString()
toString
in class Object
toString(boolean multiLines , boolean multiLists)
public String toString(boolean multiLines, boolean multiLists)
multiLines
- one-attribute per line representation enablngmultiLists
- list attributes splitted into multi line representation enablngtoString()
public void fromRecord(condor.classad.RecordExpr re) throws JobAdException
re
- the expression to load the Ad fromJobAdException
- if unable to load any of the classad expression attributepublic void fromString(String jdl) throws ParseException, JobAdException
jdl
- A String representig the description of the jobParseException
- The string doesn't seem to be a valid classadJobAdException
- One or more attributes contain syntax error(s)Copyright © 2016 EMI - European Middleware Initiative. All Rights Reserved.