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

Class FunctionMap

source code

UserDict.DictMixin --+    
                     |    
      utils.VettedDict --+
                         |
                        FunctionMap

Map function IDs to their class implementations in the various function sub-modules. It provide a layer over the various FunctionClassFactoryInterface implementations so that a function class can be obtained directly from a given XACML function URN.

Instance Methods [hide private]
 
__init__(self)
Force type for dictionary key value pairs: function values must be of AbstractFunction derived type and ID keys string type
source code
 
loadAllCore(self)
Load all core XACML functions
source code
 
loadFunction(self, functionNs)
Get package to retrieve function class for the given XACML function namespace
source code
 
load_custom_function(self, function_ns, function_factory=None, function_factory_path=None)
Add a user defined function to the list of functions supported
source code
ndg.xacml.core.functions.AbstractFunction / NotImplemented
__getitem__(self, key)
Override base class implementation to load and cache function classes if they don't otherwise exist
source code
ndg.xacml.core.functions.AbstractFunction / NotImplemented
get(self, key, *arg)
Likewise to __getitem__, enable loading and caching of function classes if they don't otherwise exist
source code

Inherited from utils.VettedDict: __contains__, __repr__, __setitem__, items, keys, values

Inherited from utils.VettedDict (private): _verifyKeyValPair

Inherited from UserDict.DictMixin: __cmp__, __iter__, __len__, clear, has_key, iteritems, iterkeys, itervalues, pop, popitem, setdefault, update

Static Methods [hide private]
bool
keyFilter(key)
Enforce string type keys
source code
bool
valueFilter(value)
Enforce AbstractFunction derived types for match functions
source code
Class Variables [hide private]
string FUNCTION_PKG_PREFIX = 'ndg.xacml.core.functions.'
python package path for functions package
string V1_0_PKG_PREFIX = 'ndg.xacml.core.functions.v1.'
python package path for XACML 1.0 functions package
string V2_0_PKG_PREFIX = 'ndg.xacml.core.functions.v2.'
python package path for XACML 2.0 functions package
dict SUPPORTED_NSS = {'urn:oasis:names:tc:xacml:1.0:function:': 'nd...
mapping of function URN prefix to Python package
string FUNCTION_CLASS_FACTORY_CLASSNAME = 'FunctionClassFactory'
standard name for class factory which should be present in each generic function module.
Method Details [hide private]

__init__(self)
(Constructor)

source code 

Force type for dictionary key value pairs: function values must be of AbstractFunction derived type and ID keys string type

Parameters:
  • args - two arguments: the first is a callable which filters for permissable keys in this dict, the second sets the type or list of types permissable for items in this dict
Overrides: utils.VettedDict.__init__

keyFilter(key)
Static Method

source code 

Enforce string type keys

Parameters:
  • key (basestring) - function URN
Returns: bool
True for valid key type
Raises:
  • TypeError - invalid key type

valueFilter(value)
Static Method

source code 

Enforce AbstractFunction derived types for match functions

Parameters:
  • value (ndg.xacml.core.functions.AbstractFunction / NotImplemented) - function URN
Returns: bool
True for valid function type
Raises:
  • TypeError - invlaid key type

loadFunction(self, functionNs)

source code 

Get package to retrieve function class for the given XACML function namespace

Parameters:
  • functionNs (basestring) - XACML function namespace

__getitem__(self, key)
(Indexing operator)

source code 

Override base class implementation to load and cache function classes if they don't otherwise exist

Parameters:
  • key (basestring) - function URN
Returns: ndg.xacml.core.functions.AbstractFunction / NotImplemented
function class
Overrides: utils.VettedDict.__getitem__

get(self, key, *arg)

source code 

Likewise to __getitem__, enable loading and caching of function classes if they don't otherwise exist

Parameters:
  • key (basestring) - XACML function URN
  • arg (tuple) - set a single additional argument if required which is used as the default value should the key not be found in the map
Returns: ndg.xacml.core.functions.AbstractFunction / NotImplemented
function class
Overrides: UserDict.DictMixin.get

Class Variable Details [hide private]

SUPPORTED_NSS

mapping of function URN prefix to Python package
Type:
dict
Value:
{'urn:oasis:names:tc:xacml:1.0:function:': 'ndg.xacml.core.functions.v\
1.',
 'urn:oasis:names:tc:xacml:2.0:function:': 'ndg.xacml.core.functions.v\
2.'}

FUNCTION_CLASS_FACTORY_CLASSNAME

standard name for class factory which should be present in each generic function module. This factory is invoked to create the function class for any given function URN related to that module
Type:
string
Value:
'FunctionClassFactory'