|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.glite.jdl.Ad
org.glite.jdl.JobAd
public class JobAd
Provides a representation of the job description in the JDL language and the functions for building and manipulating it. Basically the JDL is the Condor ClassAd language, so it is legitimate the direct use of the Condor API library for creating, modifying, deleting a job description. However the JobAd class extends the ClassAd class of the Condor ClassAd library additionally providing some helper methods that ease the construction of job descriptions being fully compliant to WP1 WMS specification.
Field Summary |
---|
Fields inherited from class org.glite.jdl.Ad |
---|
jobAd, TYPE_AD, TYPE_BOOL, TYPE_EXPRESSION, TYPE_INTEGER, TYPE_REAL, TYPE_STRING, TYPE_UNKNOWN |
Constructor Summary | |
---|---|
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 |
Method Summary | |
---|---|
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 |
Methods inherited from class org.glite.jdl.Ad |
---|
appendValue, attributes, copy, fromFile, fromRecord, fromString, getAd, getAdValue, getBooleanValue, getConstant, getDoubleValue, getIntValue, getStringValue, getType, getValue, hasAttribute, isSet, lookup, setAttribute, size |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JobAd()
public JobAd(String ad) throws ParseException, JobAdException
ad
- the JDL string to be parsed
ParseException
JobAdException
public JobAd(condor.classad.RecordExpr ad) throws JobAdException
ad
- classAd Expression representing the Ad
ParseException
- The Classad has JDL syntax error. Unable to build a valid Ad
JobAdException
- One or more attributes contain syntax error(s)Method Detail |
---|
public JobAd copy(condor.classad.RecordExpr source) throws JobAdException
source
- the expression to copy from
JobAdException
public Object clone()
clone
in class Ad
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 unsensitive
public 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 unsensitive
public 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 JobAd
IOException
- - if unable to write the specified file
Exception
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 added
IllegalArgumentException
- The type of value is not allowed for the specified attribute name
InvalidAttributeValueException
- 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 added
IllegalArgumentException
- - The type of value is not allowed for the specified attribute name
InvalidAttributeValueException
- - 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 added
IllegalArgumentException
- - The type of value is not allowed for the specified attribute name
InvalidAttributeValueException
- - 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 added
IllegalArgumentException
- - The type of value is not allowed for the specified attribute name
InvalidAttributeValueException
- - 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 added
IllegalArgumentException-
- The attribute attrName had been
InvalidAttributeValueException
- - the value is out of limits for the specified attribute
IllegalArgumentException
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 added
IllegalArgumentException-
- The attribute attrName had been already set
InvalidAttributeValueException
- - A value has not the right type for an attribute
IllegalArgumentException
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 added
IllegalArgumentException-
- The specified value is not allowed for the attribute
InvalidAttributeValueException
- - A value has not the right type for an attribute
IllegalArgumentException
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 added
IllegalArgumentException-
- The specified value is not allowed for the attribute
InvalidAttributeValueException
- - A value has not the right type for an attribute
IllegalArgumentException
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 added
IllegalArgumentException-
- The specified value is not allowed for the attribute
InvalidAttributeValueException
- - the has not the right format for the attribute
IllegalArgumentException
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 added
IllegalArgumentException-
- The specified value is not allowed for the attribute
InvalidAttributeValueException
- - the value has not the right format for the attribute
IllegalArgumentException
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 added
IllegalArgumentException
- The specified type is not allowed for the attribute value
InvalidAttributeValueException
- 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 retrieved
InvalidAttributeValueException
- - Not an Expression value is allowed for the specified attribute
NoSuchFieldException
- - The attribute is not present in the JobAd
Exception
public JobAd getJobAdValue(String attrName) throws NoSuchFieldException, IllegalArgumentException, JobAdException
attrName
- The name of the attribute name to be retrieved
nvalidAttributeValueException
- The specified attribute is of list type
IllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute name
NoSuchFieldException
- - The requested attribute has not been set yet
JobAdException
public String getString(String attrName) throws NoSuchFieldException, IllegalArgumentException, InvalidAttributeValueException
attrName
- The name of the attribute to be retrieved
nvalidAttributeValueException
- The specified attribute is of list type
IllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute name
NoSuchFieldException
- - The requested attribute has not been set yet
InvalidAttributeValueException
Ad.getStringValue(java.lang.String)
public int getInt(String attrName) throws NoSuchFieldException, IllegalArgumentException, InvalidAttributeValueException
attrName
- The name of the attribute to be retrieved
InvalidAttributeValueException
- The specified attribute is of list type
IllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute name
NoSuchFieldException
- - 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 retrieved
InvalidAttributeValueException
- The specified attribute is of list type
IllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute name
NoSuchFieldException
- - 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 retrieved
InvalidAttributeValueException
- The specified attribute is of list type
IllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute name
NoSuchFieldException
- - 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 deleted
NoSuchFieldException
- - The attribute has not been set yetpublic void clear()
clear
in class Ad
public void checkAll() throws JobAdException
IllegalArgumentException
- - A value is not of the right type/format/value for an attribute name in the JobAd
NoSuchFieldException
- - Unable to find a JobAd mandatory attribute/value
JobAdException
- - one or more values do not match with jobad semantic rulecheckAll( String[] )
public void checkAll(String[] attributes) throws JobAdException
attributes
- specify attributes to be checked
IllegalArgumentException
- - A value is not of the right type/format/value for an attribute name in the JobAd
NoSuchFieldException
- - Unable to find a JobAd mandatory attribute/value
JobAdException
- - 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)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |