com.novell.zos.jdl
Class ComputedFactContext

java.lang.Object
  extended by com.novell.zos.jdl.ComputedFactContext

public class ComputedFactContext
extends java.lang.Object

ComputedFactContext provides access to the evaluation context.

The context contains the Grid Objects that the constraint engine is using to evaluate constraints. The ComputedFactContext provides access to the current job instance, deployed job, user, resource, vm host, vbridge, repository grid objects if they are available in the current context.

The VmHost, Vbridge and Repository Grid Objects are only in the context for the evaluation of the provisioning constraints such as vmHost. The Job and Job Instance objects are only in the context for a resource or allocation constraint evaluation.

Example to retrieve the current job instance in which a computed fact is being executed during a resource constraint:

      class myComputedFact(ComputedFact):
          def compute(self):
              ctx = self.getContext()
              if ctx == None:
                  print "No context"
                  ...
              else:
                  jobInstance = ctx.getJobInstance()
                  if jobInstance == None:
                      print "No job instance in context"
                      ...
                  else:
                      print "jobInstance.id=%s" % (jobInstance.getFact("jobinstance.id"))
                      ...
  


Method Summary
 JobInfo getJob()
          Retrieve the JobInfo Grid Object from the context for a Computed Fact evaluation.
 JobInstanceInfo getJobInstance()
          Retrieve the JobInstanceInfo Grid Object from the context for a Computed Fact evaluation.
 RepositoryInfo getRepository()
          Retrieve the RepositoryInfo Grid Object from the context for a Computed Fact evaluation.
 ResourceInfo getResource()
          Retrieve the ResourceInfo Grid Object from the context for a Computed Fact evaluation.
 UserInfo getUser()
          Retrieve the UserInfo Grid Object from the context for a Computed Fact evaluation.
 VbridgeInfo getVbridge()
          Retrieve the VbridgeInfo Grid Object from the context for a Computed Fact evaluation.
 VMHostInfo getVmHost()
          Retrieve the VmHostInfo Grid Object from the context for a Computed Fact evaluation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getUser

public UserInfo getUser()
Retrieve the UserInfo Grid Object from the context for a Computed Fact evaluation.

The returned Grid Object allows read-only access to its factset. For example, when a computed fact is evaluated in the context of a Start constraint, the returned UserInfo Grid Object provides access to the factset of the user who started the job.

Returns:
UserInfo Grid Object for this computed fact evaluation. None if object is not in the context

getJob

public JobInfo getJob()
Retrieve the JobInfo Grid Object from the context for a Computed Fact evaluation.

The returned Grid Object allows read-only access to its factset. For example, when a computed fact is evaluated in the context of a Start constraint, the returned JobInfo Grid Object provides access to the factset of the deployed job.

Returns:
JobInfo Grid Object for this computed fact evaluation. None if object is not in the context

getResource

public ResourceInfo getResource()
Retrieve the ResourceInfo Grid Object from the context for a Computed Fact evaluation.

The returned Grid Object allows read-only access to its factset. For example, when a computed fact is evaluated in the context of a resource constraint, the returned ResourceInfo Grid Object provides access to the factset of the resource.

Returns:
ResourceInfo Grid Object for this computed fact evaluation. None if object is not in the context

getJobInstance

public JobInstanceInfo getJobInstance()
Retrieve the JobInstanceInfo Grid Object from the context for a Computed Fact evaluation.

The returned Grid Object allows read-only access to its factset. For example, when a computed fact is evaluated in the context of a Start constraint, the returned JobInstanceInfo Grid Object provides access to the factset of the current job instance.

Returns:
JobInstanceInfo representing a job instance for this computed fact evaluation. None if object is not in the context

getVmHost

public VMHostInfo getVmHost()
Retrieve the VmHostInfo Grid Object from the context for a Computed Fact evaluation.

The returned Grid Object allows read-only access to its factset. For example, when a computed fact is evaluated in the context of a vm host constraint, the returned VmHostInfo Grid Object provides access to the factset of a vm host.

Returns:
VmHostInfo Grid Object for this computed fact evaluation. None if object is not in the context

getRepository

public RepositoryInfo getRepository()
Retrieve the RepositoryInfo Grid Object from the context for a Computed Fact evaluation.

The returned Grid Object allows read-only access to its factset. For example, when a computed fact is evaluated in the context of a repository constraint, the returned RepositoryInfo Grid Object provides access to the factset of a repository.

Returns:
RepositoryInfo representing a repository instance for this computed fact evaluation. None if object is not in the context

getVbridge

public VbridgeInfo getVbridge()
Retrieve the VbridgeInfo Grid Object from the context for a Computed Fact evaluation.

The returned Grid Object allows read-only access to its factset. For example, when a computed fact is evaluated in the context of a vbridge constraint, the returned VbridgeInfo Grid Object provides access to the factset of a vbridge.

Returns:
VbridgeInfo representing a vbridge instance for this computed fact evaluation. None if object is not in the context


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