public class JobAd extends Ad
jobAd, TYPE_AD, TYPE_BOOL, TYPE_EXPRESSION, TYPE_INTEGER, TYPE_REAL, TYPE_STRING, TYPE_UNKNOWN
Constructor and Description |
---|
JobAd()
Default Constructor Instantiates an empty JobAd object
|
JobAd(condor.classad.RecordExpr ad)
Instantiates a JobAd object from the given recordExpr
|
JobAd(String ad)
Constructor from String: parse the string and create a JobAd
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(String attrName,
Ad attrValue)
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.
|
void |
checkAll()
Check the JobAd instance for both syntax and semanthic errors.
|
void |
checkAll(String[] attributes)
Check the JobAd instance for both syntax and semanthic errors
|
void |
clear()
Reset the JobAd Instance.
|
Object |
clone()
Copy all the attributes of the instance into a new JobAd
|
JobAd |
copy(condor.classad.RecordExpr source)
Make a deep copy of the JobAd instance
|
condor.classad.RecordExpr |
copyAd()
Copy the attributes of the classAd into a new Record Expression
|
void |
delAttribute(String attrName)
Delete an Attribute.
|
String |
getAttributeExpr(String attrName)
Retreive the value of the specified Expression attribute as a string
|
boolean |
getBoolean(String attrName)
Retrieve the value of the specified attribute, only if it is of non-list type
|
double |
getDouble(String attrName)
Retrieve the value of the specified attribute, only if it is of non-list type
|
int |
getInt(String attrName)
Retrieve the value of the specified attribute, only if it is of non-list type
|
JobAd |
getJobAdValue(String attrName)
Retreive the JobAd value of the specified attribute
|
String |
getString(String attrName)
Retrieve the value of the specified attribute, only if it is of non-list type
|
boolean |
hasAttribute(String attrName,
String attrValue)
Check wheater an atribute has the value between its values.
|
boolean |
hasAttribute(String attrName,
String attrValue,
boolean unsensitive)
Check wheater an atribute has the value between its values.
|
void |
setAttribute(String attrName,
boolean attrValue)
Add The specified String Attribute to the jdl istance
|
void |
setAttribute(String attrName,
double attrValue)
Add The specified String Attribute to the jdl istance
|
void |
setAttribute(String attrName,
condor.classad.Expr attrValue)
Add The specified Expression Attribute to the jdl istance
|
void |
setAttribute(String attrName,
int attrValue)
Add The specified Integer Attribute to the jdl istance
|
void |
setAttribute(String attrName,
String attrValue)
Add The specified String Attribute to the jdl istance
|
void |
setAttributeExpr(String attrName,
String attrValue)
Add The specified Expression Attribute to the jdl istance
|
void |
setDefaultRank(String attrValue)
Rank default attribute initialisation
|
void |
setDefaultRequirements(String attrValue)
Requirements default attribute initialisation
|
void |
setLocalAccess(boolean lookInto)
If JobAd is used inside an applet, it is impossible to look into the local hard-disk
by default this parameter is set to TRUE
|
void |
setSchema(JobAdSchema schema)
Set the JobAd checking attributes utilised schema (Default Schema: Glue)
|
void |
toFile(String filePath)
Print the JobAd instance into the specified file, with its multi-lines representation
|
String |
toLines()
Convert the JobAd Instance into its String representation, one line per attribute, multi line for listed attribute active
This method is the same as toString ( true , true )
|
String |
toString()
Convert the JobAd Instance into a sinlge-line String representation
|
String |
toString(boolean multiLines,
boolean multiLists)
Convert the JobAd Instance into its String representation, one line per attribute, multi line for listed attribute active
|
String |
toSubmissionString()
Perform a check over the JobAd instance and if possible convert it into its String representation as it would be ready for a submission
|
appendValue, attributes, copy, fromFile, fromRecord, fromString, getAd, getAdValue, getBooleanValue, getConstant, getDoubleValue, getIntValue, getStringValue, getType, getValue, hasAttribute, isSet, lookup, setAttribute, size
public JobAd()
public JobAd(String ad) throws ParseException, JobAdException
ad
- the JDL string to be parsedParseException
JobAdException
public JobAd(condor.classad.RecordExpr ad) throws JobAdException
ad
- 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)public JobAd copy(condor.classad.RecordExpr source) throws JobAdException
source
- the expression to copy fromJobAdException
public Object clone()
public condor.classad.RecordExpr copyAd()
public boolean hasAttribute(String attrName, String attrValue)
attrName
- the name of the attribute to be checkedattrValue
- the String value to search for. The case of the seek is unsensitivepublic boolean hasAttribute(String attrName, String attrValue, boolean unsensitive)
attrName
- the name of the attribute to be checkedattrValue
- the String value to search fordetermine
- wheater the case of the value should be sensitive or unsensitivepublic String toLines()
toSubmissionString()
,
toString()
public String toString(boolean multiLines, boolean multiLists)
toString
in class Ad
multiLines
- one-attribute per line representation enablngmultiLists
- list attributes splitted into multi line representation enablngtoSubmissionString()
,
toString()
public String toSubmissionString() throws JobAdException
JobAdException
- - one or more values do not match with jobad semantic ruletoString()
,
toLines()
public String toString()
toString
in class Ad
toSubmissionString()
,
toLines()
public void toFile(String filePath) throws Exception
filePath
- where to write the JobAdIOException
- - if unable to write the specified fileException
toLines()
public void setLocalAccess(boolean lookInto)
lookInto
- allow all the check methods to access to the local hard disk (true) or skip the check (false)public void setAttribute(String attrName, condor.classad.Expr attrValue) throws InvalidAttributeValueException, IllegalArgumentException
setAttribute
in class Ad
attrName
- - The Name of the attribute to be addedattrValue
- - The Expression of the value to be addedIllegalArgumentException
- The type of value is not allowed for the specified attribute nameInvalidAttributeValueException
- The value has not the right format for the specified attributepublic void setAttributeExpr(String attrName, String attrValue) throws IllegalArgumentException, InvalidAttributeValueException
attrName
- - The Name of the attribute to be addedattrValue
- - The value of the attribute to be addedIllegalArgumentException
- - The type of value is not allowed for the specified attribute nameInvalidAttributeValueException
- - the value has not the right format for the specifiedattributepublic void setAttribute(String attrName, int attrValue) throws IllegalArgumentException, InvalidAttributeValueException
setAttribute
in class Ad
attrName
- - The Name of the attribute to be addedattrValue
- - The value of the attribute to be addedIllegalArgumentException
- - The type of value is not allowed for the specified attribute nameInvalidAttributeValueException
- - The specified value is out of limits for the specified attributepublic void setAttribute(String attrName, String attrValue) throws IllegalArgumentException, InvalidAttributeValueException
setAttribute
in class Ad
attrName
- - The Name of the attribute to be addedattrValue
- - The value of the attribute to be addedIllegalArgumentException
- - The type of value is not allowed for the specified attribute nameInvalidAttributeValueException
- - the value has not the right format for the specified attributepublic void setAttribute(String attrName, double attrValue) throws IllegalArgumentException, InvalidAttributeValueException
setAttribute
in class Ad
attrName
- - The Name of the attribute to be addedattrValue
- - The value of the attribute to be addedIllegalArgumentException-
- The attribute attrName had beenInvalidAttributeValueException
- - the value is out of limits for the specified attributeIllegalArgumentException
public void setAttribute(String attrName, boolean attrValue) throws IllegalArgumentException, InvalidAttributeValueException
setAttribute
in class Ad
attrName
- - The Name of the attribute to be addedattrValue
- - The value of the attribute to be addedIllegalArgumentException-
- The attribute attrName had been already setInvalidAttributeValueException
- - A value has not the right type for an attributeIllegalArgumentException
public void addAttribute(String attrName, Ad attrValue) throws IllegalArgumentException, InvalidAttributeValueException
addAttribute
in class Ad
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
addAttribute
in class Ad
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
addAttribute
in class Ad
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
addAttribute
in class Ad
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
addAttribute
in class Ad
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 String getAttributeExpr(String attrName) throws Exception
attrName
- The name of the attribute name to be retrievedInvalidAttributeValueException
- - Not an Expression value is allowed for the specified attributeNoSuchFieldException
- - The attribute is not present in the JobAdException
public JobAd getJobAdValue(String attrName) throws NoSuchFieldException, IllegalArgumentException, JobAdException
attrName
- The name of the attribute name to be retrievednvalidAttributeValueException
- The specified attribute is of list typeIllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute nameNoSuchFieldException
- - The requested attribute has not been set yetJobAdException
public String getString(String attrName) throws NoSuchFieldException, IllegalArgumentException, InvalidAttributeValueException
attrName
- The name of the attribute to be retrievednvalidAttributeValueException
- The specified attribute is of list typeIllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute nameNoSuchFieldException
- - The requested attribute has not been set yetInvalidAttributeValueException
Ad.getStringValue(java.lang.String)
public int getInt(String attrName) throws NoSuchFieldException, IllegalArgumentException, InvalidAttributeValueException
attrName
- The name of the attribute to be retrievedInvalidAttributeValueException
- The specified attribute is of list typeIllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute nameNoSuchFieldException
- - The requested attribute has not been set yetAd.getIntValue(java.lang.String)
public boolean getBoolean(String attrName) throws NoSuchFieldException, IllegalArgumentException, InvalidAttributeValueException
attrName
- The name of the attribute to be retrievedInvalidAttributeValueException
- The specified attribute is of list typeIllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute nameNoSuchFieldException
- - The requested attribute has not been set yetAd.getBooleanValue(java.lang.String)
public double getDouble(String attrName) throws NoSuchFieldException, IllegalArgumentException, InvalidAttributeValueException
attrName
- The name of the attribute to be retrievedInvalidAttributeValueException
- The specified attribute is of list typeIllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute nameNoSuchFieldException
- - The requested attribute has not been set yetAd.getDoubleValue(java.lang.String)
public void delAttribute(String attrName) throws NoSuchFieldException
delAttribute
in class Ad
attrName
- The name of the attibute to be deletedNoSuchFieldException
- - The attribute has not been set yetpublic void clear()
public void checkAll() throws JobAdException
IllegalArgumentException
- - A value is not of the right type/format/value for an attribute name in the JobAdNoSuchFieldException
- - Unable to find a JobAd mandatory attribute/valueJobAdException
- - one or more values do not match with jobad semantic rulecheckAll( String[] )
public void checkAll(String[] attributes) throws JobAdException
attributes
- specify attributes to be checkedIllegalArgumentException
- - A value is not of the right type/format/value for an attribute name in the JobAdNoSuchFieldException
- - Unable to find a JobAd mandatory attribute/valueJobAdException
- - one or more values do not match with jobad semantic rulecheckAll( )
public void setSchema(JobAdSchema schema)
public void setDefaultRank(String attrValue)
public void setDefaultRequirements(String attrValue)
Copyright © 2016 EMI - European Middleware Initiative. All Rights Reserved.