|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.glite.jdl.Ad
public class Ad
This class is used to user-friendly represent and manipulate a condor classad it provides several utilities such us string and file constructor and manipulation of native classes (String, int, boolean) instead of classad Expression
Field Summary | |
---|---|
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 Summary | |
---|---|
Ad()
Default Constructor |
|
Ad(condor.classad.RecordExpr ad)
Instantiates a Ad object from the given Ad-string |
|
Ad(java.lang.String ad)
Instantiates a Ad object from the given Ad-string |
Method Summary | |
---|---|
void |
addAttribute(java.lang.String attrName,
Ad attrValue)
ADD ATTRIBUTE METHODS /** Allow adding a value to an already set attribute of the JobAd instance (i.e. |
void |
addAttribute(java.lang.String attrName,
boolean attrValue)
Allow adding a value to an already set attribute of the JobAd instance (i.e. |
void |
addAttribute(java.lang.String attrName,
double attrValue)
Allow adding a value to an already set attribute of the JobAd instance (i.e. |
void |
addAttribute(java.lang.String attrName,
int attrValue)
Allow adding a value to an already set attribute of the JobAd instance (i.e. |
void |
addAttribute(java.lang.String attrName,
java.lang.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 |
java.util.Iterator |
attributes()
Enumerate the attribute names. |
void |
clear()
Reset the JobAd Instance. |
java.lang.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(java.lang.String attrName)
Remove the specified attribute from the Ad instance |
void |
fromFile(java.lang.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(java.lang.String jdl)
Update and load the Ad object with the given ClassAd-jdl String |
Ad |
getAd(java.lang.String attrName)
Retrieve the Ad |
java.util.Vector |
getAdValue(java.lang.String attrName)
Retreive the value of the specified attribute |
java.util.Vector |
getBooleanValue(java.lang.String attrName)
Retreive the value of the specified attribute |
protected java.lang.Object |
getConstant(java.lang.String attrName,
condor.classad.Expr value,
int exprType)
|
java.util.Vector |
getDoubleValue(java.lang.String attrName)
Retreive the value of the specified attribute |
java.util.Vector |
getIntValue(java.lang.String attrName)
Retreive the value of the specified attribute |
java.util.Vector |
getStringValue(java.lang.String attrName)
Retreive the value of the specified attribute |
int |
getType(java.lang.String attrName)
GET METHODS /** Retrieve the type of the specified attribute, if present |
protected java.util.Vector |
getValue(java.lang.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(java.lang.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(java.lang.String attrName)
Find the attribute with the given name. |
void |
setAttribute(java.lang.String attrName,
Ad attrValue)
Insert an attribute of Ad type |
void |
setAttribute(java.lang.String attrName,
boolean attrValue)
Insert an attribute of boolean type |
void |
setAttribute(java.lang.String attrName,
double attrValue)
Insert an attribute of double type |
void |
setAttribute(java.lang.String attrName,
condor.classad.Expr attrValue)
Insert an attribute of Expr type |
void |
setAttribute(java.lang.String attrName,
int attrValue)
SET METHODS /** Insert an attribute of integer type |
void |
setAttribute(java.lang.String attrName,
java.lang.String attrValue)
Insert an attribute of String type |
int |
size()
Return the number of attributes that have been inserted so far |
java.lang.String |
toString()
Convert the JobAd Instance into a sinlge-line String representation This method is equivalent as toString (false , false ) |
java.lang.String |
toString(boolean multiLines,
boolean multiLists)
Convert the JobAd Instance into its String representation, one line per attribute, multi line for listed attribute active |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int TYPE_UNKNOWN
getType(java.lang.String)
,
Constant Field Valuespublic static final int TYPE_INTEGER
getType(java.lang.String)
,
Constant Field Valuespublic static final int TYPE_BOOL
getType(java.lang.String)
,
Constant Field Valuespublic static final int TYPE_STRING
getType(java.lang.String)
,
Constant Field Valuespublic static final int TYPE_REAL
getType(java.lang.String)
,
Constant Field Valuespublic static final int TYPE_AD
getType(java.lang.String)
,
Constant Field Valuespublic static final int TYPE_EXPRESSION
getType(java.lang.String)
,
Constant Field Valuesprotected condor.classad.RecordExpr jobAd
Constructor Detail |
---|
public Ad()
public Ad(java.lang.String ad) throws java.text.ParseException, JobAdException
ad
- A String representing the Ad
java.text.ParseException
- The Classad has JDL syntax error. Unable to build a valid Ad
JobAdException
- One or more attributes contain syntax error(s)public Ad(condor.classad.RecordExpr ad) throws JobAdException
ad
- A classAd Expression representing the Ad
java.text.ParseException
- The Classad has JDL syntax error. Unable to build a valid Ad
JobAdException
- One or more attributes contain syntax error(s)Method Detail |
---|
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 attributes
JobAdException
- all the error occurred while inserting the attributespublic java.lang.Object clone()
clone
in class java.lang.Object
public void setAttribute(java.lang.String attrName, int attrValue) throws javax.naming.directory.InvalidAttributeValueException
attrName
- the name of the attribute to be setattrValue
- the value for the attribute to be set
javax.naming.directory.InvalidAttributeValueException
public void setAttribute(java.lang.String attrName, boolean attrValue) throws javax.naming.directory.InvalidAttributeValueException
attrName
- the name of the attribute to be setattrValue
- the value for the attribute to be set
javax.naming.directory.InvalidAttributeValueException
public void setAttribute(java.lang.String attrName, double attrValue) throws javax.naming.directory.InvalidAttributeValueException
attrName
- the name of the attribute to be setattrValue
- the value for the attribute to be set
javax.naming.directory.InvalidAttributeValueException
public void setAttribute(java.lang.String attrName, java.lang.String attrValue) throws javax.naming.directory.InvalidAttributeValueException
attrName
- the name of the attribute to be setattrValue
- the value for the attribute to be set
javax.naming.directory.InvalidAttributeValueException
public void setAttribute(java.lang.String attrName, Ad attrValue) throws javax.naming.directory.InvalidAttributeValueException
attrName
- the name of the attribute to be setattrValue
- the value for the attribute to be set
javax.naming.directory.InvalidAttributeValueException
public void setAttribute(java.lang.String attrName, condor.classad.Expr attrValue) throws javax.naming.directory.InvalidAttributeValueException, java.lang.IllegalArgumentException
attrName
- the name of the attribute to be setattrValue
- the value for the attribute to be set
javax.naming.directory.InvalidAttributeValueException
java.lang.IllegalArgumentException
public void addAttribute(java.lang.String attrName, Ad attrValue) throws java.lang.IllegalArgumentException, javax.naming.directory.InvalidAttributeValueException
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
javax.naming.directory.InvalidAttributeValueException
- - A value has not the right type for an attribute
java.lang.IllegalArgumentException
public void addAttribute(java.lang.String attrName, int attrValue) throws java.lang.IllegalArgumentException, javax.naming.directory.InvalidAttributeValueException
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
javax.naming.directory.InvalidAttributeValueException
- - A value has not the right type for an attribute
java.lang.IllegalArgumentException
public void addAttribute(java.lang.String attrName, double attrValue) throws java.lang.IllegalArgumentException, javax.naming.directory.InvalidAttributeValueException
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
javax.naming.directory.InvalidAttributeValueException
- - the has not the right format for the attribute
java.lang.IllegalArgumentException
public void addAttribute(java.lang.String attrName, boolean attrValue) throws java.lang.IllegalArgumentException, javax.naming.directory.InvalidAttributeValueException
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
javax.naming.directory.InvalidAttributeValueException
- - the value has not the right format for the attribute
java.lang.IllegalArgumentException
public void addAttribute(java.lang.String attrName, java.lang.String attrValue) throws java.lang.IllegalArgumentException, javax.naming.directory.InvalidAttributeValueException
attrName
- a String representing the attribute nameattrValue
- - The value of the attribute to be added
java.lang.IllegalArgumentException
- The specified type is not allowed for the attribute value
javax.naming.directory.InvalidAttributeValueException
- The value has not the right format for the attributepublic int getType(java.lang.String attrName) throws java.lang.NoSuchFieldException
attrName
- the name of the attribute to look for
java.lang.NoSuchFieldException
- - Unable to find the attribute inside the Adpublic java.util.Vector getIntValue(java.lang.String attrName) throws java.lang.NoSuchFieldException, java.lang.IllegalArgumentException
attrName
- The name of the attribute name to be retrieved
java.lang.IllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute name
java.lang.NoSuchFieldException
- - The requested attribute has not been set yetpublic java.util.Vector getDoubleValue(java.lang.String attrName) throws java.lang.NoSuchFieldException, java.lang.IllegalArgumentException
attrName
- The name of the attribute to be retrieved
java.lang.NoSuchFieldException
java.lang.IllegalArgumentException
public java.util.Vector getBooleanValue(java.lang.String attrName) throws java.lang.NoSuchFieldException, java.lang.IllegalArgumentException
attrName
- The name of the attribute to be retrieved
java.lang.IllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute name
java.lang.NoSuchFieldException
- - The requested attribute has not been set yetpublic java.util.Vector getStringValue(java.lang.String attrName) throws java.lang.NoSuchFieldException, java.lang.IllegalArgumentException
attrName
- The name of the attribute to be retrieved
java.lang.IllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute name
java.lang.NoSuchFieldException
- - The requested attribute has not been set yetpublic java.util.Vector getAdValue(java.lang.String attrName) throws java.lang.NoSuchFieldException, java.lang.IllegalArgumentException
attrName
- The name of the attribute to be retrieved
java.lang.IllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute name
java.lang.NoSuchFieldException
- - The requested attribute has not been set yetpublic Ad getAd(java.lang.String attrName) throws java.lang.NoSuchFieldException, java.lang.IllegalArgumentException
attrName
- the name of the attribute to be retrieved
java.lang.IllegalArgumentException
- - The type of retrieved value is not allowed for the specified attribute name
java.lang.NoSuchFieldException
- - The requested attribute has not been set yetprotected java.lang.Object getConstant(java.lang.String attrName, condor.classad.Expr value, int exprType) throws java.lang.IllegalArgumentException, java.lang.NoSuchFieldException
java.lang.IllegalArgumentException
java.lang.NoSuchFieldException
protected java.util.Vector getValue(java.lang.String attrName, condor.classad.Expr value, int exprType) throws java.lang.NoSuchFieldException, java.lang.IllegalArgumentException
java.lang.NoSuchFieldException
java.lang.IllegalArgumentException
public condor.classad.Expr lookup(java.lang.String attrName)
name
- - the attribute name to look for
public java.util.Iterator attributes()
public boolean hasAttribute(java.lang.String attrName)
attrName
- The name of the attibute to be looked for
public boolean isSet()
public int size()
public void clear()
public void delAttribute(java.lang.String attrName) throws java.lang.NoSuchFieldException
attrName
- the attribute to be retrieved
java.lang.NoSuchFieldException
- The attribute is not presentprotected condor.classad.ListExpr appendValue(condor.classad.Expr attrValue, condor.classad.ListExpr list)
public void fromFile(java.lang.String path) throws java.lang.Exception
path
- the path of the file from where the jobAd is supposed to be read
java.text.ParseException
- - The string doesn't seem to be a valid classad
JobAdException
- - One or more attributes contain syntax error(s)
java.io.FileNotFoundException
- the specified path does not exist
java.lang.Exception
public java.lang.String toString()
toString
in class java.lang.Object
toString(boolean multiLines , boolean multiLists)
public java.lang.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 from
JobAdException
- if unable to load any of the classad expression attributepublic void fromString(java.lang.String jdl) throws java.text.ParseException, JobAdException
jdl
- A String representig the description of the job
java.text.ParseException
- The string doesn't seem to be a valid classad
JobAdException
- One or more attributes contain syntax error(s)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |