Coverage for ion/services/coi/exchange/exchange_management : 84.52%
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/play/hello_resource.py @author David Stuebe @brief An example service definition that can be used as template for resource management. """
""" An error class for the ems... """
# Declaration of service version='0.1.0', dependencies=[])
def slc_init(self):
def slc_deactivate(self):
def op_create_object(self, object, headers, msg): """ For testing purposes only. """ object, "TestObject", "This is not a valid system object." )
def op_get_object(self, sha1, headers, msg): """ For testing purposes only. """
# EXCHANGESPACE CRUD
def op_create_exchangespace(self, exchangespace, headers, msg): """ Creates an ExchangeSpace distributed resource from the parameter exchangespace. The following restrictions are enforced: request.name must be defined, must be a uniquely named ExchangeSpace, and must not already exist in the system. request.description must not be a trivial string and should provide a useful description of the ExchangeSpace. """
# Object creation
# Field validation
# Field population
# Response
def op_create_exchangename(self, exchangename, headers, msg): """ Creates an ExchangeSpace distributed resource from the parameter exchangespace. The following restrictions are enforced: request.name must be defined, must be a uniquely named ExchangeSpace, and must not already exist in the system. request.description must not be a trivial string and should provide a useful description of the ExchangeSpace.
net.ooici.services.coi.exchange_management.proto defines the following Exchange types: PROCESS = 1; SERVICE = 2; EXCHANGE_POINT = 3; QUEUE = 4;
"""
# Object creation
# Field validation raise res_wrapper.ExchangeManagementError("exchangename.name is required") raise res_wrapper.ExchangeManagementError("exchangename.exchangespace is required")
except res_wrapper.ExchangeManagementError, err: yield self.reply_err(msg, str(err)) return
# Field population
#if object.type
# Response
def op_create_queue(self, queue, headers, msg): """ Creates a queue and binds it to the appropriate namespace and exchange. """
# Object creation
def op_create_binding(self, binding, headers, msg): """ Creates a queue and binds it to the appropriate namespace and exchange. """ b = binding.MessageObject desc = b.configuration.description bname = b.configuration.name xn = b.configuration.exchangename xs = b.configuration.exchangespace topic = b.configuration.topic q = b.configuration.queuename
self.controller.bind( name = xs + "." + xn + "." + q, exchange = xs + "." + xn, routing_key = topic )
log.debug('op_create_queue()')
# Object creation yield self.reply_ok(msg, None)
def op_update_exchangename(self, request, headers, msg): """ Updates an ExchangeSpace distributed resource using the parameter request. """ log.info('op_update_exchangename: ') yield self.reply_ok(msg)
def op_set_exchangename_life_cycle(self, request, headers, msg): """ Sets the ExchangeName resource life cycle. All changes are subject to ownership and permission check. """ log.info('op_set_exchangename_life_cycle: ') yield self.reply_ok(msg)
def _create_object(self, msg): """ Used for testing purposes only. """
def _get_object(self, msg): """ Used for testing purposes only. """
def create_exchangespace(self, name, description ): """ Creates an ExchangeSpace. @param name a string uniquely identifying the ExchangeSpace in all scopes and contexts. @param description a free text string containing a description of the ExchangeSpace. """
self, name, description, exchangespace, type='EXCHANGE_POINT' ): """ Creates an ExchangeName. @param name a string uniquely identifying the ExchangeName in the scope of the ExchangeSpace. @param description a free text string containing a description of the ExchangeName. @param exchangespace a string uniquely identifying the ExchangeSpace to which this ExchangeName will belong. This must be previously defined with a call to create_exchangespace() @param type a string that must contain one of the following constants: 'EXCHANGE_POINT', 'PROCESS', 'SERVICE'. """
elif type == 'PROCESS': msg.configuration.type = msg.configuration.Type.PROCESS elif type == 'SERVICE': msg.configuration.type = msg.configuration.Type.SERVICE else: raise EMSError('Invalid type specified in create_exchangename operation')
def create_queue( self, name, description, exchangespace, exchangename ): """ Creates a Queue. @param name a string uniquely identifying the Queue in the scope of the ExchangeSpace and ExchangeName. @param description a free text string containing a description of the ExchangeName. @param exchangespace a string uniquely identifying the ExchangeSpace to which ExchangeName belongs. This must be previously defined with a call to create_exchangespace() @param exchangename a string uniquely identifying the ExchangeName to which this queue will be bound. This must be previously defined with a call to create_exchangename() """
def create_binding( self, name, description, exchangespace, exchangename, queuename, topic ): """ Creates a Binding. @param name a string uniquely identifying the Queue in the scope of the ExchangeSpace and ExchangeName. @param description a free text string containing a description of the ExchangeName. @param exchangespace a string uniquely identifying the ExchangeSpace to which ExchangeName belongs. This must be previously defined with a call to create_exchangespace() @param exchangename a string uniquely identifying the ExchangeName to which this queue will be bound. This must be previously defined with a call to create_exchangename() """
|