Coverage for ion/services/coi/resource_registry/resource_registry : 95.56%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
#!/usr/bin/env python
@file ion/services/coi/resource_registry/resource_registry.py @author Michael Meisinger @author David Stuebe @brief service for registering resources """
""" An exception class for errors in the resource registry """
""" Resource registry service interface The resource registry uses the underlieing push and pull ops of the datastore to fetch, retrieve and create resource objects. """
# Declaration of service
# Service class initializer. Basic config, but no yields allowed.
#assert isinstance(backend, store.IStore) #self.backend = backend
def op_register_resource_instance(self, request, headers, msg): """ Service operation: Register a resource instance with the registry. The interceptor will unpack a resource description object. The registry will create a new resource of the described type and return the identifier for it to the process that requested it. """
# This will terminate the hello service. As an alternative reply okay with an error message raise ResourceRegistryError('Expected message type RESOURCE_DESCRIPTION_TYPE, received %s' % type(request))#, request.ResponseCodes.BAD_REQUEST)
def pull_owned_by(self):
def _register_resource_instance(self, resource_description, headers):
# only pull it once - predicates should not change!
# Get the user to associate with this new resource
# Always get the latest except workbench.WorkBenchError, we:
log.debug('Caught Workbench Error:'+str(we)) raise ResourceRegistryError('User ID does not exist. Can not create resource!', resource_description.ResponseCodes.BAD_REQUEST)
# Make sure we are associating to the latest state of the user
# Create a new repository to hold this resource
# Set the identity of the resource
# Create the new resource object # Set the object as the child of the resource
# Name and Description is set by the resource client
# Set the object type
# Set the resource type
# State is set to new by default
# Add the association to the user
# push the new resource to the data store # If the push fails hand back the workbench error
# Create the response object...
#@defer.inlineCallbacks """ Service operation: Get a resource instance. """ raise NotImplementedError, "Interface Method Not Implemented"
""" Service operation: Create or update a resource definition with the registry. """ raise NotImplementedError, "Interface Method Not Implemented"
""" Service operation: Get a resource definition. """ raise NotImplementedError, "Interface Method Not Implemented"
""" Service operation: Find the registered definition of a resource """ raise NotImplementedError, "Interface Method Not Implemented"
""" Service operation: Find the registered instances that matches the service class """ raise NotImplementedError, "Interface Method Not Implemented"
""" Class for the client accessing the resource registry. """
def register_resource_instance(self,RESOURCE_TYPE): """ @brief Client method to Register a Resource Instance This method is used to generate a new resource instance of type Resource Type @param RESOURCE_TYPE """
#log.info('Resource Registry Service reply with new resource ID: '+str(content))
#@defer.inlineCallbacks """ @brief Lookup an instance of a resource by the resource ID Forward a pull request to the datastore? """ raise NotImplementedError, "Interface Method Not Implemented"
#@defer.inlineCallbacks """ @brief Client method to register the definition of a Resource Type @param resource can be either an instance of a Resource Description or the class object of the resource to be described. """ raise NotImplementedError, "Interface Method Not Implemented"
#@defer.inlineCallbacks """ @brief find the registered definition of a resoruce @param query is a query object """ raise NotImplementedError, "Interface Method Not Implemented"
#@defer.inlineCallbacks """ @brief find all registered resources which match the attributes of description @param query object """ raise NotImplementedError, "Interface Method Not Implemented"
# Spawn of the process using the module name |