Permalink
Browse files

Refactoring: Moved BaseProcess and BaseService; changed all dependents

  • Loading branch information...
1 parent 8cc36f2 commit a9c7c0cc780c7602fe278c9f19543663804cf43e Michael Meisinger committed Oct 5, 2010
Showing with 192 additions and 356 deletions.
  1. +7 −0 README.txt
  2. +1 −1 ion/agents/instrumentagents/SBE49_driver.py
  3. +0 −1 ion/agents/instrumentagents/test/test_SBE49.py
  4. +1 −1 ion/core/process/worker.py
  5. +5 −5 ion/data/backends/store_service.py
  6. +6 −6 ion/data/datastore/datastore_service.py
  7. +5 −5 ion/data/datastore/registry.py
  8. +1 −1 ion/data/datastore/test/test_registry.py
  9. +5 −5 ion/data/test/test_dataobject.py
  10. +3 −3 ion/demo/lca/javaint_service.py
  11. +1 −1 ion/play/hello_process.py
  12. +8 −8 ion/play/hello_service.py
  13. +0 −168 ion/services/base_service.py
  14. +5 −5 ion/services/cei/dtrs.py
  15. +3 −3 ion/services/cei/epu_controller.py
  16. +5 −5 ion/services/cei/provisioner.py
  17. +3 −3 ion/services/cei/sensor_aggregator.py
  18. +3 −3 ion/services/cei/sleeper/epu_work_producer.py
  19. +3 −3 ion/services/cei/sleeper/epu_worker.py
  20. +3 −3 ion/services/cei/test/mockloop/provisioner.py
  21. +3 −3 ion/services/coi/agent_registry.py
  22. +4 −4 ion/services/coi/attributestore.py
  23. +3 −3 ion/services/coi/authorization.py
  24. +3 −3 ion/services/coi/conversation_repository.py
  25. +5 −5 ion/services/coi/host_status.py
  26. +4 −4 ion/services/coi/identity_registry.py
  27. +5 −5 ion/services/coi/logger.py
  28. +4 −4 ion/services/coi/objstore.py
  29. +3 −3 ion/services/coi/resource_registry.py
  30. +4 −6 ion/services/coi/service_registry.py
  31. +3 −3 ion/services/coi/state_repository.py
  32. +3 −3 ion/services/dm/distribution/pubsub_registry.py
  33. +5 −5 ion/services/dm/distribution/pubsub_service.py
  34. +3 −3 ion/services/dm/ingestion/ingestion_registry.py
  35. +5 −5 ion/services/dm/ingestion/ingestion_service.py
  36. +3 −3 ion/services/dm/inventory/data_registry.py
  37. +5 −5 ion/services/dm/presentation/presentation_service.py
  38. +2 −2 ion/services/dm/preservation/persister.py
  39. +3 −3 ion/services/dm/preservation/preservation_registry.py
  40. +5 −5 ion/services/dm/preservation/preservation_service.py
  41. +4 −4 ion/services/dm/preservation/retriever.py
  42. +5 −5 ion/services/dm/scheduler/scheduler_service.py
  43. +5 −5 ion/services/dm/transformation/transformation_service.py
  44. +8 −8 ion/services/dm/util/eoi_data_stream_producer.py
  45. +5 −5 ion/services/sa/data_acquisition.py
  46. +3 −3 ion/services/sa/data_processing.py
  47. +3 −3 ion/services/sa/data_product_registry.py
  48. +5 −5 ion/services/sa/fetcher.py
  49. +5 −5 ion/services/sa/instrument_management.py
  50. +3 −3 ion/services/sa/instrument_registry.py
  51. +3 −3 ion/services/sa/proxy.py
View
@@ -134,6 +134,13 @@ To compile all code to see if there are Python compile errors anywhere:
Change log:
===========
+2010-10-05:
+- REFACTORING OF BASE CLASSES CONTINUED
+- Changed ion.core.base_process.BaseProcess to ion.core.process.process.Process
+- Changed ion.services.base_service.BaseService to
+ ion.core.process.service_process.ServiceProcess
+- Modified all dependent classes
+
2010-10-04:
- MASSIVE REFACTORING IN BASE CLASSES
- Refactored the former magnet code into more object oriented style.
@@ -12,7 +12,7 @@
"""
from ion.data.dataobject import LCStates as LCS
-from ion.services.base_service import BaseService
+from ion.core.process.service_process import ServiceProcess
"""
from twisted.internet.protocol import Protocol, ClientFactory, ClientCreator
@@ -21,7 +21,6 @@
from ion.core.messaging.receiver import Receiver
from ion.core.process.process import Process, ProcessDesc
from ion.services.dm.distribution.pubsub_service import DataPubsubClient
-from ion.services.base_service import BaseServiceClient
from ion.services.dm.distribution import base_consumer
from ion.services.dm.distribution.consumers import forwarding_consumer
@@ -13,7 +13,7 @@
from ion.core.process.process import Process, ProcessFactory
from ion.core.messaging.receiver import Receiver, WorkerReceiver, FanoutReceiver
-from ion.services.base_service import BaseService
+from ion.core.process.service_process import ServiceProcess
import ion.util.procutils as pu
class WorkerProcess(Process):
@@ -15,18 +15,18 @@
from ion.core import ioninit
from ion.core.process.process import ProcessFactory
from ion.data.store import Store, IStore
-from ion.services.base_service import BaseService, BaseServiceClient
+from ion.core.process.service_process import ServiceProcess, ServiceClient
import ion.util.procutils as pu
CONF = ioninit.config(__name__)
-class StoreService(BaseService):
+class StoreService(ServiceProcess):
"""
Service to store and retrieve key/value pairs.
"""
# Declaration of service
- declare = BaseService.service_declare(name='store',
+ declare = ServiceProcess.service_declare(name='store',
version='0.1.0',
dependencies=[])
@@ -102,14 +102,14 @@ def op_clear_store(self, content, headers, msg):
yield self.reply_ok(msg, {'result':res})
-class StoreServiceClient(BaseServiceClient, IStore):
+class StoreServiceClient(ServiceClient, IStore):
"""
Class for the client accessing the attribute store via Exchange
"""
def __init__(self, proc=None, **kwargs):
if not 'targetname' in kwargs:
kwargs['targetname'] = "store"
- BaseServiceClient.__init__(self, proc, **kwargs)
+ ServiceClient.__init__(self, proc, **kwargs)
@defer.inlineCallbacks
def get(self, key):
@@ -14,14 +14,14 @@
import ion.util.procutils as pu
from ion.core.process.process import ProcessFactory
-from ion.services.base_service import BaseService, BaseServiceClient
+from ion.core.process.service_process import ServiceProcess, ServiceClient
-class DataStoreService(BaseService):
+class DataStoreService(ServiceProcess):
"""
Example service interface
"""
# Declaration of service
- declare = BaseService.service_declare(name='DataStoreService',
+ declare = ServiceProcess.service_declare(name='DataStoreService',
version='0.1.0',
dependencies=[])
@@ -30,7 +30,7 @@ def __init__(self, *args, **kwargs):
@brief Init method for the DataStore Frontend service
@param frontend - an instance of a CAStore Frontend
"""
- BaseService.__init__(self, *args, **kwargs)
+ ServiceProcess.__init__(self, *args, **kwargs)
# Service class initializer. Basic config, but no yields allowed.
self.frontend = self.spawn_args['MyFrontend']
@@ -66,7 +66,7 @@ def op_clone(self, content, headers, msg):
-class DataStoreServiceClient(BaseServiceClient):
+class DataStoreServiceClient(ServiceClient):
"""
This is an exemplar service client that calls the hello service. It
makes service calls RPC style.
@@ -78,7 +78,7 @@ def __init__(self, frontend, proc=None, **kwargs):
"""
if not 'targetname' in kwargs:
kwargs['targetname'] = "DataStoreService"
- BaseServiceClient.__init__(self, proc, **kwargs)
+ ServiceClient.__init__(self, proc, **kwargs)
self.frontend=frontend
log.info('DataStoreServiceClient.__init__()')
@@ -20,7 +20,7 @@
from ion.core import ioninit
from ion.core.process.process import ProcessFactory, Process
-from ion.services.base_service import BaseService, BaseServiceClient
+from ion.core.process.service_process import ServiceProcess, ServiceClient
from ion.resources import coi_resource_descriptions
import ion.util.procutils as pu
@@ -255,7 +255,7 @@ def test(ns):
-class BaseRegistryService(BaseService):
+class BaseRegistryService(ServiceProcess):
"""
@brief Base Registry Service Clase
To create a Registry Service inherit this class and over ride the method
@@ -430,7 +430,7 @@ class RegistryService(BaseRegistryService):
@brief Example Registry Service implementation using the base class
"""
# Declaration of service
- declare = BaseService.service_declare(name='registry_service', version='0.1.0', dependencies=[])
+ declare = ServiceProcess.service_declare(name='registry_service', version='0.1.0', dependencies=[])
op_clear_registry = BaseRegistryService.base_clear_registry
op_register_resource = BaseRegistryService.base_register_resource
@@ -444,7 +444,7 @@ class RegistryService(BaseRegistryService):
factory = ProcessFactory(RegistryService)
-class BaseRegistryClient(BaseServiceClient):
+class BaseRegistryClient(ServiceClient):
"""
@brief BaseRegistryClient is the base class used to simplify implementation
of Registry Service Clients. The client for a particular registry should
@@ -613,7 +613,7 @@ class RegistryClient(BaseRegistryClient,IRegistry,LCStateMixin):
def __init__(self, proc=None, **kwargs):
if not 'targetname' in kwargs:
kwargs['targetname'] = "registry_service"
- BaseServiceClient.__init__(self, proc, **kwargs)
+ ServiceClient.__init__(self, proc, **kwargs)
def clear_registry(self):
@@ -17,7 +17,7 @@
from twisted.internet import defer
from ion.core.process.process import ProcessFactory
-from ion.services.base_service import BaseService, BaseServiceClient
+from ion.core.process.service_process import ServiceProcess, ServiceClient
class RegistryTest(unittest.TestCase):
"""
@@ -15,7 +15,7 @@
from twisted.internet import defer
from ion.core.process.process import ProcessFactory
-from ion.services.base_service import BaseService, BaseServiceClient
+from ion.core.process.service_process import ServiceProcess, ServiceClient
from ion.data.datastore import cas
@@ -581,11 +581,11 @@ def setUp(self):
('dt','DataType1\x00[["f", "float\\u00003.14159"], ["s", "str\\u0000Datatype1"]]'),
('name', 'str\x00a container with datatype1')]
-class ResponseService(BaseService):
+class ResponseService(ServiceProcess):
"""Example service implementation
"""
# Declaration of service
- declare = BaseService.service_declare(name='responder', version='0.1.0', dependencies=[])
+ declare = ServiceProcess.service_declare(name='responder', version='0.1.0', dependencies=[])
def slc_init(self):
pass
@@ -602,15 +602,15 @@ def op_respond(self, content, headers, msg):
# The following line shows how to reply to a message
yield self.reply_ok(msg, response)
-class ResponseServiceClient(BaseServiceClient):
+class ResponseServiceClient(ServiceClient):
"""
This is an exemplar service class that calls the hello service. It
applies the RPC pattern.
"""
def __init__(self, proc=None, **kwargs):
if not 'targetname' in kwargs:
kwargs['targetname'] = "responder"
- BaseServiceClient.__init__(self, proc, **kwargs)
+ ServiceClient.__init__(self, proc, **kwargs)
@defer.inlineCallbacks
def send_data_object(self, obj):
@@ -13,14 +13,14 @@
import ion.util.procutils as pu
from ion.core.process.process import ProcessFactory
-from ion.services.base_service import BaseService, BaseServiceClient
+from ion.core.process.service_process import ServiceProcess, ServiceClient
-class JavaIntegrationService(BaseService):
+class JavaIntegrationService(ServiceProcess):
"""
Example service interface
"""
# Declaration of service
- declare = BaseService.service_declare(name='javaint',
+ declare = ServiceProcess.service_declare(name='javaint',
version='0.1.0',
dependencies=[])
@@ -12,7 +12,7 @@
import ion.util.procutils as pu
from ion.core.process.process import ProcessFactory, Process, ProcessClient
-#from ion.services.base_service import BaseService, BaseServiceClient
+#from ion.core.process.service_process import ServiceProcess, ServiceClient
class HelloProcess(Process):
"""
View
@@ -12,20 +12,20 @@
import ion.util.procutils as pu
from ion.core.process.process import ProcessFactory
-from ion.services.base_service import BaseService, BaseServiceClient
+from ion.core.process.service_process import ServiceProcess, ServiceClient
-class HelloService(BaseService):
+class HelloService(ServiceProcess):
"""
Example service interface
"""
# Declaration of service
- declare = BaseService.service_declare(name='hello',
- version='0.1.0',
- dependencies=[])
+ declare = ServiceProcess.service_declare(name='hello',
+ version='0.1.0',
+ dependencies=[])
def __init__(self, *args, **kwargs):
# Service class initializer. Basic config, but no yields allowed.
- BaseService.__init__(self, *args, **kwargs)
+ ServiceProcess.__init__(self, *args, **kwargs)
log.info('HelloService.__init__()')
def slc_init(self):
@@ -40,15 +40,15 @@ def op_hello(self, content, headers, msg):
yield self.reply_ok(msg, {'value':'Hello there, '+str(content)}, {})
-class HelloServiceClient(BaseServiceClient):
+class HelloServiceClient(ServiceClient):
"""
This is an exemplar service client that calls the hello service. It
makes service calls RPC style.
"""
def __init__(self, proc=None, **kwargs):
if not 'targetname' in kwargs:
kwargs['targetname'] = "hello"
- BaseServiceClient.__init__(self, proc, **kwargs)
+ ServiceClient.__init__(self, proc, **kwargs)
@defer.inlineCallbacks
def hello(self, text='Hi there'):
Oops, something went wrong.

0 comments on commit a9c7c0c

Please sign in to comment.