com.novell.zos.jdl
Class GridObjectInfo

java.lang.Object
  extended by com.novell.zos.jdl.GridObjectInfo
Direct Known Subclasses:
GroupInfo, Job, JobInfo, Joblet, JobletInfo, MatrixInfo, PolicyInfo, RepositoryInfo, ResourceInfo, UserInfo, VMHostInfo

public class GridObjectInfo
extends java.lang.Object

The GridObjectInfo class is the base class representation of all Grid Objects in the system. This provides accessors and setters to a Grid Object's fact set.


Method Summary
 void deleteFact(java.lang.String factname)
          Remove a fact from this grid object.
 boolean factExists(java.lang.String factname)
          Determine if given factname exists in this grid object.
 org.python.core.PyObject getFact(java.lang.String factname)
          Retrieve the value of the named fact on this grid object.
 long getFactLastModified(java.lang.String factname)
          Retrieve the last modified timestamp for a fact.
 org.python.core.PyList getFactNames()
          Retrieve a list of all fact names for this grid object.
 void refresh()
          Refresh fact set for this grid object.
 void setArrayFact(java.lang.String factname, org.python.core.PyList list)
          Set an Array typed fact on this grid object.
 void setBooleanArrayFact(java.lang.String factname, org.python.core.PyList list)
          Set a Boolean Array fact on this grid object.
 void setDateArrayFact(java.lang.String factname, org.python.core.PyList list)
          Set an Date Array fact on this grid object.
 void setDateFact(java.lang.String factname, org.python.core.PyObject value)
          Set the value of a fact of type Date.
 void setFact(java.lang.String factname, org.python.core.PyObject value)
          Set the value of a fact.
 void setIntegerArrayFact(java.lang.String factname, org.python.core.PyList list)
          Set a Integer Array fact on this grid object.
 void setRealArrayFact(java.lang.String factname, org.python.core.PyList list)
          Set a Real Array fact on this grid object.
 void setStringArrayFact(java.lang.String factname, org.python.core.PyList list)
          Set a String Array fact on this grid object.
 void setTimeArrayFact(java.lang.String factname, org.python.core.PyList list)
          Set a Time Array fact on this grid object.
 void setTimeFact(java.lang.String factname, org.python.core.PyObject value)
          Set the value of a fact of type Time.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFactNames

public org.python.core.PyList getFactNames()
Retrieve a list of all fact names for this grid object.

Returns:
list of all fact names

getFact

public org.python.core.PyObject getFact(java.lang.String factname)
Retrieve the value of the named fact on this grid object. Factname must be fully qualified with the object's namespace.

Example of retrieving the value of a job argument fact (from quickie example):

      def job_started_event(self):
          numJoblets = self.getFact("jobargs.numJoblets")
 

Example of retrieving the value of a date fact and displaying in a readable form:

      def job_started_event(self):
          d = self.getFact("jobinstance.time.submitted")
          print "time.ctime(d/1000)=",time.ctime(d/1000)
 

Parameters:
factname - Name of fact to retrieve value for
Returns:
Value of fact. Can be None.
Throws:
java.lang.Exception - if fact does not exist

setFact

public void setFact(java.lang.String factname,
                    org.python.core.PyObject value)
Set the value of a fact. Creates a new fact if fact does not exist. Factname must be fully qualified with the object's namespace.

Parameters:
factname - Name of fact to set
value - Value of fact to set

setArrayFact

public void setArrayFact(java.lang.String factname,
                         org.python.core.PyList list)
Set an Array typed fact on this grid object. Creates a new fact if fact does not exist. The type of all list elements must match. Factname must be fully qualified with the object's namespace.

Parameters:
factname - Factname to set
list - Fact value to set. Must be a Python List where all elements are the same type

setTimeFact

public void setTimeFact(java.lang.String factname,
                        org.python.core.PyObject value)
Set the value of a fact of type Time. Creates a new fact if fact does not exist. Factname must be fully qualified with the object's namespace. Time fact values are floating point numbers indicating seconds elapsed in the day.

Example to set a jobinstance time fact to indicate 5 minutes elapsed:

      def job_started_event(self):
          self.setTimeFact("myTimeFact",5*60)
 

Parameters:
factname - Name of fact to set
value - Time value of fact to set.

setTimeArrayFact

public void setTimeArrayFact(java.lang.String factname,
                             org.python.core.PyList list)
Set a Time Array fact on this grid object. Creates a new fact if fact does not exist. The type of all list elements must match. Factname must be fully qualified with the object's namespace.

Parameters:
factname - Factname to set
list - Fact value to set. Must be a Python List where all elements are the same type

setDateFact

public void setDateFact(java.lang.String factname,
                        org.python.core.PyObject value)
Set the value of a fact of type Date. Creates a new fact if the fact does not exist. Factname must be fully qualified with the object's namespace. Date fact values are floating point numbers indicating seconds since the epoch.

Example to set a jobinstance date fact to indicate the current date and time:

      def job_started_event(self):
          import time
          self.setDateFact("myDateFact",time.ctime())
 

Parameters:
factname - Name of fact to set
value - Integer or floating poitn number in seconds since the epoch

setDateArrayFact

public void setDateArrayFact(java.lang.String factname,
                             org.python.core.PyList list)
Set an Date Array fact on this grid object. Creates a new fact if fact does not exist. The type of all list elements must match. Factname must be fully qualified with the object's namespace.

Parameters:
factname - Factname to set
list - Fact value to set. Must be a Python List where all elements are the same type

setStringArrayFact

public void setStringArrayFact(java.lang.String factname,
                               org.python.core.PyList list)
Set a String Array fact on this grid object. Creates a new fact if fact does not exist. The type of all list elements must match. Factname must be fully qualified with the object's namespace. Note: this is the only way to set empty string array facts.

Parameters:
factname - Factname to set
list - Fact value to set. Must be a Python List where all elements are the same type

setIntegerArrayFact

public void setIntegerArrayFact(java.lang.String factname,
                                org.python.core.PyList list)
Set a Integer Array fact on this grid object. Creates a new fact if fact does not exist. The type of all list elements must match. Factname must be fully qualified with the object's namespace. Note: this is the only way to set empty integer array facts.

Parameters:
factname - Factname to set
list - Fact value to set. Must be a Python List where all elements are the same type

setRealArrayFact

public void setRealArrayFact(java.lang.String factname,
                             org.python.core.PyList list)
Set a Real Array fact on this grid object. Creates a new fact if fact does not exist. The type of all list elements must match. Factname must be fully qualified with the object's namespace. Note: this is the only way to set empty real array facts.

Parameters:
factname - Factname to set
list - Fact value to set. Must be a Python List where all elements are the same type

setBooleanArrayFact

public void setBooleanArrayFact(java.lang.String factname,
                                org.python.core.PyList list)
Set a Boolean Array fact on this grid object. Creates a new fact if fact does not exist. The type of all list elements must match. Factname must be fully qualified with the object's namespace. Note: this is the only way to set empty boolean array facts.

Parameters:
factname - Factname to set
list - Fact value to set. Must be a Python List where all elements are the same type

factExists

public boolean factExists(java.lang.String factname)
Determine if given factname exists in this grid object.

Parameters:
factname - Name of fact to check
Returns:
true if fact exists, false if not

getFactLastModified

public long getFactLastModified(java.lang.String factname)
Retrieve the last modified timestamp for a fact. Factname must be fully qualified with the object's namespace.

Example to retrieve a fact's last modified timestamp and print it in a displayable form in the job log

      def job_started_event(self):
          last_modified_secs = self.getFact("job.timeout") / 1000
          import time
          print time.ctime(last_modified_secs)
 

Parameters:
factname - job instance fact name
Returns:
last modified timestamp in milliseconds from epoch

deleteFact

public void deleteFact(java.lang.String factname)
Remove a fact from this grid object. Factname must be fully qualified with the object's namespace.

Parameters:
factname - fact to remove
Throws:
java.lang.Exception - if fact does not exist or fact is not deleteable

refresh

public void refresh()
Refresh fact set for this grid object. Only applies for grid objects retrieved remotely such as when running on the resource.



Copyright (c) 2008 Novell, Inc. All rights reserved.