# coding=utf-8 # # Copyright (C) 2010-2012 Platform Computing # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Module which holds a abstract registry definition class and one simple implementation.
Created on Aug 22, 2011
@author: tmetsch '''
# disabling 'Abstract class only ref. once' pylint check (designed for ext.) # disabling 'Unsued argument' pylint check (is there to be overwritten) # disabling 'Method could be function' pylint check (see above) # pylint: disable=R0922,W0613,R0201
''' Abstract class so users can implement registries themselves. '''
''' Returns the hostname of the service. '''
''' Set the hostname of the service. '''
''' Returns the default mime type. '''
''' Retrieve a rendering for a given mime type.
mime_type -- The mime type you a looking for. ''' ' incomplete.')
''' Retrieve a rendering for a given mime type.
mime_type -- The mime type you want to add a rendering for. renderer -- Instance of an Rendering class. ''' ' incomplete.')
""" Retrieve a backend which is able to deal with the given category.
category -- The category a backend is needed for. extras -- Extras object - same as the one passed on to the backends. """ ' incomplete.')
""" Retrieve all backends associated with a resource instance
entity -- The resource instance. extras -- Extras object - same as the one passed on to the backends. """ ' incomplete.')
""" Set a backend which is able to deal with the given category.
category -- The category a backend is needed for. backend -- The backend which should handle this category. extras -- Extras object - same as the one passed on to the backends. """ ' incomplete.')
''' Remove a mixin from the service.
mixin -- The mixin extras -- Extras object - same as the one passed on to the backends. ''' ' incomplete.')
''' Return the category which is associated with an Location.
path -- The location which the category should define. extras -- Extras object - same as the one passed on to the backends. ''' ' incomplete.')
''' Return all registered categories.
extras -- Extras object - same as the one passed on to the backends. ''' ' incomplete.')
''' Return a certain resource.
key -- Unique identifier of the resource. extras -- Extras object - same as the one passed on to the backends. ''' ' incomplete.')
''' Add a resource.
key -- the unique identifier. entity -- the OCCI representation. extras -- Extras object - same as the one passed on to the backends. ''' ' incomplete.')
''' Delete a resource.
key -- Unique identifier of the resource. extras -- Extras object - same as the one passed on to the backends. ''' ' incomplete.')
''' Return all keys of all resources.
extras -- Extras object - same as the one passed on to the backends. ''' ' incomplete.')
''' Return all resources.
extras -- Extras object - same as the one passed on to the backends. ''' ' incomplete.')
''' Will return what goes into the extras attribute of the entity and category. '''
''' None optimized/persistent registry for the OCCI service.
It is encouraged to write an own registry with e.g. DB lookups.
Created on Jun 28, 2011
@author: tmetsch '''
' mime type: ' + repr(mime_type)) else:
# no need to check - a get_categories or get_categroy will be called # first. ActionBackend):
# remove duplicates - only need to call backs once - right?
# category belongs to single user...
# no need to check because in get_category in renderer it is assured # that the user only sees own. Will get not found if he tries to delete # mixin from other user.
# no need for ownership check - paths cannot overlap!
# categories visible to all! # categories visible to this user!
.extras != self.get_extras(extras):
# get_resources and get_resource is called before this - no need for # ownership checking.
self.resources[key].extras == self.get_extras(extras):
item.extras == self.get_extras(extras): |