예제 #1
0
    def __init__(self):
        '''
    Constructor
    '''

        self.command = Command()
        self.result = {}
예제 #2
0
 def __init__( self ):
   '''
   Constructor
   '''
   
   self.command = Command()
   self.result  = {}
예제 #3
0
class PolicyBase( object ):
  '''
  Base class for all the policies. Do not instantiate directly.
  To use, you should call at least `setArgs` and, alternatively,
  `setCommand` or `setCommandName` on the real policy instance.
  '''

  def __init__( self ):
    '''
    Constructor
    '''
    
    self.command = Command()
    self.result  = {}

  def setCommand( self, policyCommand ):
    '''
    Set `self.command`.

    :params:
      :attr:`commandIn`: a command object
    '''
    if policyCommand is not None:
      self.command = policyCommand

  def evaluate( self ):
    '''
    Before use, call at least `setArgs` and, alternatively,
    `setCommand` or `setCommandName`.

    Invoking `super(PolicyCLASS, self).evaluate` will invoke
    the command (if necessary) as it is provided and returns the results.
    '''

    commandResult = self.command.doCommand()
    return self._evaluate( commandResult )
  
  @staticmethod  
  def _evaluate( commandResult ):
    '''
      Method that will do the real processing of the policy, it has to be extended
      on the real policies.
    '''    
    
    return commandResult  

################################################################################
#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF
예제 #4
0
class PolicyBase(object):
    '''
  Base class for all the policies. Do not instantiate directly.
  To use, you should call at least `setArgs` and, alternatively,
  `setCommand` or `setCommandName` on the real policy instance.
  '''
    def __init__(self):
        '''
    Constructor
    '''

        self.command = Command()
        self.result = {}

    def setCommand(self, policyCommand):
        '''
    Set `self.command`.

    :params:
      :attr:`commandIn`: a command object
    '''
        if policyCommand is not None:
            self.command = policyCommand

    def evaluate(self):
        '''
    Before use, call at least `setArgs` and, alternatively,
    `setCommand` or `setCommandName`.

    Invoking `super(PolicyCLASS, self).evaluate` will invoke
    the command (if necessary) as it is provided and returns the results.
    '''

        commandResult = self.command.doCommand()
        return self._evaluate(commandResult)

    @staticmethod
    def _evaluate(commandResult):
        '''
      Method that will do the real processing of the policy, it has to be extended
      on the real policies.
    '''

        return commandResult


################################################################################
#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF
예제 #5
0
class PolicyBase( object ):
  """ Base class for all the policies. Do not instantiate directly.
      To use, you should call `setCommand` on the real policy instance.
  """

  def __init__( self ):
    """ Constructor
    """

    self.command = Command()
    self.result = {}

  def setCommand( self, policyCommand ):
    """
    Set `self.command`.

    :params:
      :attr:`commandIn`: a command object
    """
    if policyCommand is not None:
      self.command = policyCommand

  def evaluate( self ):
    """
    Before use, call `setCommand`.

    Invoking `super(PolicyCLASS, self).evaluate` will invoke
    the command (if necessary) as it is provided and returns the results.
    """

    commandResult = self.command.doCommand()
    return self._evaluate( commandResult )

  @staticmethod
  def _evaluate( commandResult ):
    """
      Method that will do the real processing of the policy, it has to be extended
      on the real policies.
    """

    return commandResult
예제 #6
0
파일: PolicyBase.py 프로젝트: pmusset/DIRAC
    def __init__(self):
        """ Constructor
    """

        self.command = Command()
        self.result = {}
예제 #7
0
  def __init__( self ):
    """ Constructor
    """

    self.command = Command()
    self.result = {}