Package ndg :: Package xacml :: Package core :: Package functions :: Class FunctionClassFactoryBase
[hide private]

Class FunctionClassFactoryBase

source code

                   object --+    
                            |    
FunctionClassFactoryInterface --+
                                |
                               FunctionClassFactoryBase
Known Subclasses:

Base implementation for XACML Function Class Factory. There should be one derived type for each function family implemented in sub-modules of ndg.xacml.core.functions

e.g.

for urn:oasis:names:tc:xacml:1.0:function:<type>-at-least-one-member-of a class factory should exist,

ndg.xacml.core.functions.v1.at_least_one_member_of.FunctionClassFactory

which will be capable of returning a type derived from AbstractFunction:

<type>AtLeastOneMemberOf

e.g. StringAtLeastOneMemberOf, BooleanAtLeastOneMemberOf.

This class is for convenience only some function factories are better derived directly from FunctionClassFactoryInterface

Derived classes MUST define these class variables:

Nested Classes [hide private]

Inherited from FunctionClassFactoryInterface: __meta__

Instance Methods [hide private]
 
__init__(self)
This class is in fact abstract - derived types must define the FUNCTION_NS_SUFFIX and FUNCTION_BASE_CLASS class variables
source code
 
initAllFunctionClasses(self)
Create classes for all functions for a data type e.g.
source code
 
loadFunction(self, identifier)
Create a class for the given function namespace and cache it in the function class look-up table for future requests.
source code
AtLeastOneMemberOfBase derived type or None if no match is found
__call__(self, identifier)
Return the class for the given XACML type function identifier
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
NoneType (but basestring in derived class) FUNCTION_NS_SUFFIX = None
urn suffix for the family of function to define e.g.
NoneType (but list in derived class) FUNCTION_NAMES = None
list of function identifiers that this factory can produce classes for e.g.:
NoneType (but AbstractFunction derived type in derived function factory class) FUNCTION_BASE_CLASS = None
base class for this family of functions e.g for urn:oasis:names:tc:xacml:1.0:function:string-at-least-one-member-of, ndg.xacml.core.functions.v1.at_least_one_member_of.AtLeastOneMemberOfBase
  URN_SEP = ':'
  FUNCTION_NAME_SEP = '-'
Properties [hide private]
  __map
  attributeValueClassFactory
  functionSuffix

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

This class is in fact abstract - derived types must define the FUNCTION_NS_SUFFIX and FUNCTION_BASE_CLASS class variables

Overrides: object.__init__

initAllFunctionClasses(self)

source code 

Create classes for all functions for a data type e.g. a derived class could implement a factory for <type>-at-least-one-member-of functions: string-at-least-one-member-of, boolean-at-least-one-member-of, etc.

Function classes are placed in a look-up table __map for the __call__() method to access

In practice, there shouldn't be a need to load all the functions in one go. The __call__ method loads functions and caches them as needed.

loadFunction(self, identifier)

source code 

Create a class for the given function namespace and cache it in the function class look-up table for future requests. Note that this call overwrites any existing entry in the cache whereas __call__ will try to use an entry in the cache if it already exists

Parameters:
  • identifier (basestring) - XACML function namespace

__call__(self, identifier)
(Call operator)

source code 

Return the class for the given XACML type function identifier

Parameters:
  • identifier (basestring) - XACML *-at-least-one-member-of type function identifier
Returns: AtLeastOneMemberOfBase derived type or None if no match is found
at least one member of class corresponding to the given input identifier
Overrides: FunctionClassFactoryInterface.__call__

Class Variable Details [hide private]

FUNCTION_NS_SUFFIX

urn suffix for the family of function to define e.g. -at-least-one-member-of is the suffix for the URN:

urn:oasis:names:tc:xacml:1.0:function:string-at-least-one-member-of

Type:
NoneType (but basestring in derived class)
Value:
None

FUNCTION_NAMES

list of function identifiers that this factory can produce classes for e.g.:

('urn:oasis:names:tc:xacml:1.0:function:string-at-least-one-member-of', ...)

Type:
NoneType (but list in derived class)
Value:
None