com.novell.zos.jdl
Class MatchContext

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

public class MatchContext
extends java.lang.Object

The MatchContext defines a context for evaluating a constraint.

An instance of this class is supplied to match() for evaluating constraints. The MatchContext provides a way to setup an evaluation context that the constraint engine is using to evaluate constraints. The MatchContext is filled out with the context that is required for evaluating your constraints. This includes assigning a deployed Job, User, Resource, VM Host, Vbridge, Vnic, and Repository grid objects.


Constructor Summary
MatchContext()
          Construct a new MatchContext
 
Method Summary
 void setContextArrayFact(java.lang.String factname, org.python.core.PyList list)
          Create and store an array fact on the Context that can be accessed from constraint with the 'context.{factname}'.
 void setContextFact(java.lang.String factname, org.python.core.PyObject value)
          Create and store a fact on the Context that can be accessed from constraint with the 'context.{factname}'.
 void setJob(java.lang.String job)
          Set the Job Grid Object to use in constraint context.
 void setJobInstanceId(java.lang.String jobInstanceId)
          Set the Job Instance ID to use in constraint context.
 void setMatchIterator(java.lang.String iteratorType)
          Set the Grid Object type to use in building the array of IDs to match against.
 void setRepository(java.lang.String repositoryId)
          Set the Repository Grid Object to use in constraint context.
 void setResource(java.lang.String resourceId)
          Set the Resource Grid Object to use in constraint context.
 void setUser(java.lang.String userId)
          Set the User Grid Object to use in constraint context.
 void setVbridge(java.lang.String vbridgeId)
          Set the Vbridge Grid Object to use in constraint context.
 void setVmHost(java.lang.String vmHostId)
          Set the VmHost Grid Object to use in constraint context.
 void setVnic(java.lang.String vnicId)
          Set the Vnic Grid Object to use in constraint context.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatchContext

public MatchContext()
Construct a new MatchContext

Method Detail

setRepository

public void setRepository(java.lang.String repositoryId)
Set the Repository Grid Object to use in constraint context.

Parameters:
repositoryId - Repository Grid Object ID

setVbridge

public void setVbridge(java.lang.String vbridgeId)
Set the Vbridge Grid Object to use in constraint context.

Parameters:
vbridgeId - Vbridge Grid Object ID

setVnic

public void setVnic(java.lang.String vnicId)
Set the Vnic Grid Object to use in constraint context.

Parameters:
vnicId - Vnic Grid Object ID

setUser

public void setUser(java.lang.String userId)
Set the User Grid Object to use in constraint context.

Parameters:
userId - User Grid Object ID

setVmHost

public void setVmHost(java.lang.String vmHostId)
Set the VmHost Grid Object to use in constraint context.

Parameters:
vmHostId - Vm Host Grid Object ID

setResource

public void setResource(java.lang.String resourceId)
Set the Resource Grid Object to use in constraint context.

Parameters:
resourceId - Resource Grid Object ID

setJob

public void setJob(java.lang.String job)
Set the Job Grid Object to use in constraint context.

Parameters:
job - Job Grid Object ID to use in constraint context.

setJobInstanceId

public void setJobInstanceId(java.lang.String jobInstanceId)
Set the Job Instance ID to use in constraint context. This defaults to the current Job instance. Set to None to not use the current job instance.

Parameters:
jobInstanceId - None to not use the current Job instance context.

setMatchIterator

public void setMatchIterator(java.lang.String iteratorType)
Set the Grid Object type to use in building the array of IDs to match against.
For example, to run constraint evaluation on all resources in the system, set the matchIterator to TYPE_RESOURCE.

Parameters:
iteratorType - Grid Object type to match

setContextFact

public void setContextFact(java.lang.String factname,
                           org.python.core.PyObject value)
Create and store a fact on the Context that can be accessed from constraint with the 'context.{factname}'.

Parameters:
factname - the simple name of the fact
value - the desired fact value

setContextArrayFact

public void setContextArrayFact(java.lang.String factname,
                                org.python.core.PyList list)
Create and store an array fact on the Context that can be accessed from constraint with the 'context.{factname}'.
For example, to set the mode fact to 'provision' for evaluating the VmHost constraints:
     matchContext = MatchContext()
     matchContext.setVmHost("host1_demoAdapter")
     matchContext.setMatchIterator(TYPE_REPOSITORY)
     matchContext.setContextArrayFact("mode",["provision"])
     getMatrix().matchAll(matchContext,"vmhost")

Parameters:
factname - the simple name of the fact
list - List to be stored as an array fact value


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