[hydra-commits] hydra/team/ken.hunt/routing.git branch "master" updated.
Commits to the Hydra project code repositories
hydra-commits at lists.digium.com
Thu Aug 12 23:06:40 CDT 2010
branch "master" has been updated
via acc1a6f6f6518dc4c76645b691d64de0a2ab0cf1 (commit)
from 43fe873e3297d30d60d5a025bcd6f1180934ff7e (commit)
Summary of changes:
slice | 2 +-
src/BasicRoutingService.cpp | 65 -------------
src/BasicRoutingServiceApp.cpp | 135 ++++++++++++++++++++++++++++
src/BasicRoutingServiceApp.h | 30 ++++++
src/CMakeLists.txt | 3 +-
src/EndpointRegistry.cpp | 20 ++++
src/EndpointRegistry.h | 45 +++++++++-
src/RoutingAdmin.cpp | 42 +++++++++
src/RoutingAdmin.h | 38 ++++++++
src/RoutingServiceEventPublisher.cpp | 164 +++++++++++++++++++++++++---------
src/RoutingServiceEventPublisher.h | 68 ++++++++++----
11 files changed, 483 insertions(+), 129 deletions(-)
delete mode 100644 src/BasicRoutingService.cpp
create mode 100644 src/BasicRoutingServiceApp.cpp
create mode 100644 src/BasicRoutingServiceApp.h
- Log -----------------------------------------------------------------
commit acc1a6f6f6518dc4c76645b691d64de0a2ab0cf1
Author: Ken Hunt <ken.hunt at digium.com>
Date: Thu Aug 12 23:03:32 2010 -0500
Completed implementation. (Untested)
diff --git a/slice b/slice
index 5c46b79..2886381 160000
--- a/slice
+++ b/slice
@@ -1 +1 @@
-Subproject commit 5c46b79112a585e54925e1913bfe61f9945fa520
+Subproject commit 2886381a2c693563ed1a8955e32e4105d6da6fc0
diff --git a/src/BasicRoutingService.cpp b/src/BasicRoutingService.cpp
deleted file mode 100644
index c34e19d..0000000
--- a/src/BasicRoutingService.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#include <Ice/Ice.h>
-#include <IceStorm/IceStorm.h>
-
-#include <boost/thread.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include "RoutingIf.h"
-#include "LuaScriptProcessor.h"
-#include "RoutingServiceEventPublisher.h"
-#include "EndpointRegistry.h"
-
-using namespace std;
-using namespace Hydra::BasicRoutingService;
-using namespace Hydra::Core::Routing::V1;
-
-class BasicRoutingServiceApp : public Ice::Application
-{
-public:
- BasicRoutingServiceApp() : mDone(false) {}
-
- // Overrides
- virtual int run(int, char*[]);
- virtual void interruptCallback(int);
-
-private:
- bool mDone;
- std::string mAppName;
- // EndpointRegistry mRegistry;
-};
-
-static BasicRoutingServiceApp app;
-int main(int argc, char* argv[])
-{
- app.callbackOnInterrupt();
- return app.main(argc, argv);
-}
-
-void BasicRoutingServiceApp::interruptCallback(int val)
-{
- cout << "Interrupted..." << endl;
- mDone = true;
- _exit(EXIT_SUCCESS);
-}
-
-/**
- * Overload of the Ice::Application::run method.
- */
-int BasicRoutingServiceApp::run(int argc, char* argv[])
-{
- mAppName = argv[0];
- Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("BasicRoutingServiceAdapter");
-
- EndpointRegistry *registry(new EndpointRegistry());
- boost::shared_ptr<ScriptProcessor> scriptProcesor(new LuaScriptProcessor());
- registry->setScriptProcessor(scriptProcesor);
-
- LocatorRegistryPtr locatorRegistry(registry);
- adapter->add(locatorRegistry, communicator()->stringToIdentity("RoutingService"));
-
- adapter->activate();
-
- communicator()->waitForShutdown();
-
- return EXIT_SUCCESS;
-}
\ No newline at end of file
diff --git a/src/BasicRoutingServiceApp.cpp b/src/BasicRoutingServiceApp.cpp
new file mode 100644
index 0000000..69fc11d
--- /dev/null
+++ b/src/BasicRoutingServiceApp.cpp
@@ -0,0 +1,135 @@
+#include <Ice/Ice.h>
+#include <IceStorm/IceStorm.h>
+
+#include <boost/thread.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include "BasicRoutingServiceApp.h"
+#include "RoutingIf.h"
+#include "LuaScriptProcessor.h"
+#include "RoutingServiceEventPublisher.h"
+#include "EndpointRegistry.h"
+#include "RoutingAdmin.h"
+
+using namespace std;
+using namespace Hydra::BasicRoutingService;
+using namespace Hydra::Core::Routing::V1;
+
+namespace Hydra
+{
+namespace BasicRoutingService
+{
+/**
+ * Private implementation of the BasicRoutingServiceDataModel singleton.
+ */
+class BasicRoutingServiceDataModelImpl : public BasicRoutingServiceDataModel
+{
+public:
+ virtual const Ice::CommunicatorPtr getCommunicator()
+ {
+ return mCommunicator;
+ }
+
+ virtual const RoutingServiceEventPublisher& getEventPublisher()
+ {
+ return *mEventPublisher;
+ }
+
+ virtual EndpointRegistry& getEndpointRegistry()
+ {
+ return *mEndpointRegistry;
+ }
+
+ /**
+ * Cleanup the dangling cruft.
+ */
+ void cleanup()
+ {
+ mCommunicator = 0;
+
+ if (mEventPublisher != 0)
+ {
+ delete mEventPublisher;
+ mEventPublisher = 0;
+ }
+ }
+
+ Ice::CommunicatorPtr mCommunicator;
+ RoutingServiceEventPublisher *mEventPublisher;
+ EndpointRegistry *mEndpointRegistry;
+};
+static BasicRoutingServiceDataModelImpl mDataModelInstance;
+
+BasicRoutingServiceDataModel& BasicRoutingServiceDataModel::getInstance()
+{
+ return mDataModelInstance;
+}
+
+/**
+ * This private class defines the service's main entry point.
+ */
+class BasicRoutingServiceApp : public Ice::Application
+{
+public:
+ BasicRoutingServiceApp() : mDone(false) {}
+
+ // Overrides
+ virtual int run(int, char*[]);
+ virtual void interruptCallback(int);
+
+private:
+ bool mDone;
+ std::string mAppName;
+};
+
+void BasicRoutingServiceApp::interruptCallback(int val)
+{
+ cout << "Interrupted..." << endl;
+ mDone = true;
+ _exit(EXIT_SUCCESS);
+}
+
+/**
+ * Overload of the Ice::Application::run method.
+ */
+int BasicRoutingServiceApp::run(int argc, char* argv[])
+{
+ // Init the Data Model singleton.
+ mDataModelInstance.mCommunicator = communicator();
+
+ mDataModelInstance.mEventPublisher = new RoutingServiceEventPublisher();
+
+ // Create the adapter.
+ mAppName = argv[0];
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("BasicRoutingServiceAdapter");
+
+ // Create and configure the EndpointRegistry.
+ mDataModelInstance.mEndpointRegistry = new EndpointRegistry();
+ boost::shared_ptr<ScriptProcessor> scriptProcesor(new LuaScriptProcessor());
+ mDataModelInstance.mEndpointRegistry->setScriptProcessor(scriptProcesor);
+
+ LocatorRegistryPtr locatorRegistry(mDataModelInstance.mEndpointRegistry);
+ adapter->add(locatorRegistry, communicator()->stringToIdentity("RoutingService"));
+
+ // Create and configure the Admin interface
+ RoutingServiceAdminPtr adminInterface = new RoutingAdmin();
+ adapter->add(adminInterface, communicator()->stringToIdentity("RoutingAdmin"));
+
+ adapter->activate();
+
+ communicator()->waitForShutdown();
+
+ mDataModelInstance.cleanup();
+
+ return EXIT_SUCCESS;
+}
+
+}; // end BasicRoutingService
+}; // end Hydra
+
+static BasicRoutingServiceApp app;
+int main(int argc, char* argv[])
+{
+ app.callbackOnInterrupt();
+ return app.main(argc, argv);
+}
\ No newline at end of file
diff --git a/src/BasicRoutingServiceApp.h b/src/BasicRoutingServiceApp.h
new file mode 100644
index 0000000..1be79be
--- /dev/null
+++ b/src/BasicRoutingServiceApp.h
@@ -0,0 +1,30 @@
+#pragma once
+
+#include <Ice/Ice.h>
+
+namespace Hydra
+{
+namespace BasicRoutingService
+{
+class RoutingServiceEventPublisher;
+class EndpointRegistry;
+
+/**
+ * Singleton for access to the service's data model.
+ */
+class BasicRoutingServiceDataModel
+{
+public:
+ static BasicRoutingServiceDataModel &getInstance();
+
+ virtual const Ice::CommunicatorPtr getCommunicator() = 0;
+ virtual const RoutingServiceEventPublisher& getEventPublisher() = 0;
+ virtual EndpointRegistry& getEndpointRegistry() = 0;
+
+protected:
+ BasicRoutingServiceDataModel() {};
+ ~BasicRoutingServiceDataModel() {};
+};
+
+}; // BasicRoutingService
+}; // Hydra
\ No newline at end of file
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ac26c72..4ca784c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -5,7 +5,8 @@ get_filename_component(LUA_LOC ${LUA_LIBRARIES} PATH)
LINK_DIRECTORIES(${LUA_LOC})
include_directories(${LUA_INCLUDE_DIR})
hydra_component_add_slice(BasicRoutingService RoutingIf)
-hydra_component_add_file(BasicRoutingService BasicRoutingService.cpp)
+hydra_component_add_file(BasicRoutingService BasicRoutingServiceApp.cpp)
+hydra_component_add_file(BasicRoutingService BasicRoutingServiceApp.h)
hydra_component_add_file(BasicRoutingService RoutingAdmin.cpp)
hydra_component_add_file(BasicRoutingService RoutingAdmin.h)
hydra_component_add_file(BasicRoutingService EndpointRegistry.cpp)
diff --git a/src/EndpointRegistry.cpp b/src/EndpointRegistry.cpp
index 69a2dc6..82316a3 100644
--- a/src/EndpointRegistry.cpp
+++ b/src/EndpointRegistry.cpp
@@ -176,5 +176,25 @@ void EndpointRegistry::setScriptProcessor(boost::shared_ptr<ScriptProcessor> scr
mImpl->mScriptProcessor = scriptProcessor;
}
+/**
+ * Drop references to all EndpointLocators that have been registered.
+ * Note: Admin function.
+ */
+void EndpointRegistry::clearEndpointLocators()
+{
+ mImpl->mEndpointLocatorMap.clear();
+}
+
+/**
+ * Sends a policy string to the script processor. The default implementation is a no-op,
+ * but site-specific scripts may make use it.
+ * Note: Admin function.
+ * @param policy A site-specific policy specification.
+ */
+void EndpointRegistry::setPolicy(::std::string policy)
+{
+ mImpl->mScriptProcessor->setPolicy(policy);
+}
+
}; // end BasicRoutingService
}; // end Hydra
\ No newline at end of file
diff --git a/src/EndpointRegistry.h b/src/EndpointRegistry.h
index fd5f93f..4f66dc2 100644
--- a/src/EndpointRegistry.h
+++ b/src/EndpointRegistry.h
@@ -19,18 +19,59 @@ public:
void EndpointRegistry::setScriptProcessor(boost::shared_ptr<ScriptProcessor> scriptProcessor);
- // LocatorRegistry overrides
+public:
+ // LocatorRegistry overrides
+
+ /**
+ * Register an EndpointLocator that can provide endpoints.
+ * @param id A unique identifier for the added EndpointLocator.
+ * @param destinationIdRangeList A set of regular expressions that define the valid endpoint ids
+ * the locator being added supports.
+ */
virtual void addEndpointLocator(const ::std::string& locatorId,
const ::Hydra::Core::Routing::V1::RegExSeq& regexList,
const ::Hydra::Core::Routing::V1::EndpointLocatorPrx& locator,
const ::Ice::Current& = ::Ice::Current());
+
+ /**
+ * Remove an EndpointLocator from the registry. The EndpointLocator must have been previously added
+ * via a call to addEndpointLocator.
+ * @param The unique id of the locator to remove.
+ */
virtual void removeEndpointLocator(const ::std::string& locatorId, const ::Ice::Current& = ::Ice::Current());
+
+
+ /**
+ * Modify the range of ids managed by a previously added EndpointLocator.
+ * @param id A unique identifier for the added EndpointLocator.
+ * @param A list of reqular expressions that define the the valid endpoint ids. This
+ * set of regular expressions completely replaces the current set.
+ */
virtual void setEndpointLocatorDestinationIds(const ::std::string& locatorId,
const ::Hydra::Core::Routing::V1::RegExSeq& regexList,
const ::Ice::Current& = ::Ice::Current());
// EndpointLocator overrides
- virtual ::Hydra::Core::Endpoint::V1::EndpointSeq lookup(const ::std::string& , const ::Ice::Current& = ::Ice::Current());
+
+ /**
+ * Returns the endpoints that match the specified destination id.
+ * @param id String identifier of the the destination.
+ */
+ virtual ::Hydra::Core::Endpoint::V1::EndpointSeq lookup(const ::std::string& destination, const ::Ice::Current& = ::Ice::Current());
+
+public:
+
+ /**
+ * Drop references to all EndpointLocators that have been registered.
+ */
+ void clearEndpointLocators();
+
+ /**
+ * Sends a policy string to the script processor. The default implementation is a no-op,
+ * but site-specific scripts may make use it.
+ * @param policy A site-specific policy specification.
+ */
+ void setPolicy(::std::string policy);
private:
diff --git a/src/RoutingAdmin.cpp b/src/RoutingAdmin.cpp
index e69de29..6a02280 100644
--- a/src/RoutingAdmin.cpp
+++ b/src/RoutingAdmin.cpp
@@ -0,0 +1,42 @@
+#include <boost/regex.hpp>
+
+#include "RoutingAdmin.h"
+#include "BasicRoutingServiceApp.h"
+#include "EndpointRegistry.h"
+
+using namespace ::Hydra::Core::Routing::V1;
+using namespace ::std;
+
+namespace Hydra
+{
+namespace BasicRoutingService
+{
+
+RoutingAdmin::RoutingAdmin()
+{
+}
+
+/**
+ * Drop references to all EndpointLocators that have been registered.
+ */
+void RoutingAdmin::clearEndpointLocators(const ::Ice::Current&)
+{
+ // For now we just forward to the registry. Some type of authentication may be required
+ // in the future, or perhaps the access to the interface is controlled externally.
+ BasicRoutingServiceDataModel::getInstance().getEndpointRegistry().clearEndpointLocators();
+}
+
+/**
+ * Sends a policy string to the script processor. The default implementation is a no-op,
+ * but site-specific scripts may make use it.
+ * @param policy A site-specific policy specification.
+ */
+void RoutingAdmin::setPolicy(const ::std::string& policy, const ::Ice::Current&)
+{
+ // For now we just forward to the registry. Some type of authentication may be required
+ // in the future, or perhaps the access to the interface is controlled externally.
+ BasicRoutingServiceDataModel::getInstance().getEndpointRegistry().setPolicy(policy);
+}
+
+}; // end BasicRoutingService
+}; // end Hydra
\ No newline at end of file
diff --git a/src/RoutingAdmin.h b/src/RoutingAdmin.h
index e69de29..b7f6fb0 100644
--- a/src/RoutingAdmin.h
+++ b/src/RoutingAdmin.h
@@ -0,0 +1,38 @@
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+
+#include "RoutingIf.h"
+
+namespace Hydra
+{
+namespace BasicRoutingService
+{
+class EndpointRegistryPriv;
+
+/**
+ * This class exists to provide separation between the EndpointRegistry and the administrative functions.
+ */
+class RoutingAdmin : public Hydra::Core::Routing::V1::RoutingServiceAdmin
+{
+public:
+ RoutingAdmin();
+
+public: // RoutingServiceAdmin overrides
+
+ /**
+ * Drop references to all EndpointLocators that have been registered.
+ */
+ virtual void clearEndpointLocators(const ::Ice::Current& = ::Ice::Current());
+
+ /**
+ * Sends a policy string to the script processor. The default implementation is a no-op,
+ * but site-specific scripts may make use it.
+ * @param policy A site-specific policy specification.
+ */
+ virtual void setPolicy(const ::std::string& policy, const ::Ice::Current& = ::Ice::Current());
+
+};
+
+}; // end BasicRoutingService
+}; // end Hydra
\ No newline at end of file
diff --git a/src/RoutingServiceEventPublisher.cpp b/src/RoutingServiceEventPublisher.cpp
index 7888f1c..b5766c9 100644
--- a/src/RoutingServiceEventPublisher.cpp
+++ b/src/RoutingServiceEventPublisher.cpp
@@ -1,6 +1,7 @@
#include <Ice/Ice.h>
#include <IceStorm/IceStorm.h>
+#include "BasicRoutingServiceApp.h"
#include "RoutingServiceEventPublisher.h"
using namespace ::std;
@@ -11,42 +12,41 @@ namespace Hydra
namespace BasicRoutingService
{
+/**
+ * The private implementation of RoutingServiceEventPublisher.
+ */
class RoutingServiceEventPublisherPriv
{
public:
- RoutingServiceEventPublisherPriv(const Ice::CommunicatorPtr& communicator) : mCommunicator(communicator), mInitialized(false)
+ RoutingServiceEventPublisherPriv() : mInitialized(false)
{
+ initialize();
}
- const Ice::CommunicatorPtr& mCommunicator;
- Event::RoutingEventsPrx mEventTopic;
- bool mInitialized;
-};
-
-RoutingServiceEventPublisher::RoutingServiceEventPublisher(const Ice::CommunicatorPtr& communicator)
- : mImpl(new RoutingServiceEventPublisherPriv(communicator))
-{
-}
+ /**
+ * Initialization. Primarily involves acquring access to specific IceStorm topic.
+ */
+ void initialize()
+ {
+ const Ice::CommunicatorPtr& communicator = BasicRoutingServiceDataModel::getInstance().getCommunicator();
-void RoutingServiceEventPublisher::initialize()
-{
- IceStorm::TopicManagerPrx topicManager =
- IceStorm::TopicManagerPrx::checkedCast(mImpl->mCommunicator->propertyToProxy("TopicManager.Proxy"));
+ IceStorm::TopicManagerPrx topicManager =
+ IceStorm::TopicManagerPrx::checkedCast(communicator->propertyToProxy("TopicManager.Proxy"));
- if(!topicManager)
- {
+ if(!topicManager)
+ {
cerr << "Invalid proxy to IceStorm. Missing config for TopicManager.Proxy?" << endl;
- }
+ }
- cout << "RoutingServiceEventPublisher::initialize(): Got IceStorm proxy: TopicManager.Proxy" << endl;
+ cout << "RoutingServiceEventPublisher::initialize(): Got IceStorm proxy: TopicManager.Proxy" << endl;
- IceStorm::TopicPrx topic;
- try
- {
+ IceStorm::TopicPrx topic;
+ try
+ {
topic = topicManager->retrieve(Event::TopicId);
- }
- catch(const IceStorm::NoSuchTopic&)
- {
+ }
+ catch(const IceStorm::NoSuchTopic&)
+ {
try
{
topic = topicManager->create(Event::TopicId);
@@ -55,44 +55,124 @@ void RoutingServiceEventPublisher::initialize()
{
cerr << "Possible race condition creating IceStorm topic " << Event::TopicId << ". Suggest Restart!" << endl;
}
- }
+ }
- Ice::ObjectPrx publisher = topic->getPublisher();
- mImpl->mEventTopic = Event::RoutingEventsPrx::uncheckedCast(publisher);
-
- mImpl->mInitialized = true;
-}
+ Ice::ObjectPrx publisher = topic->getPublisher();
+ mEventTopic = Event::RoutingEventsPrx::uncheckedCast(publisher);
+
+ mInitialized = true;
+ }
-void RoutingServiceEventPublisher::lookupEvent(const ::std::string&,
- ::Hydra::Core::Routing::V1::Event::OperationResult)
+ /**
+ * Utiltity to check for initialization state.
+ */
+ bool isInitialized()
+ {
+ if (!mInitialized)
+ {
+ cout << "Attempting to use RoutingServiceEventPublisher in uninitialized state! IceStorm may be inaccessible." << endl;
+ }
+
+ return mInitialized;
+ }
+
+public:
+ Event::RoutingEventsPrx mEventTopic;
+ bool mInitialized;
+};
+
+/**
+ * Class constructor.
+ */
+RoutingServiceEventPublisher::RoutingServiceEventPublisher()
+ : mImpl(new RoutingServiceEventPublisherPriv())
{
}
-void RoutingServiceEventPublisher::addEndpointLocatorEvent(const ::std::string&,
- const ::Hydra::Core::Routing::V1::RegExSeq&,
- ::Hydra::Core::Routing::V1::Event::OperationResult)
+/**
+ * Send a message to the service's event topic to report a lookup event.
+ */
+void RoutingServiceEventPublisher::sendLookupEvent(const ::std::string& destination,
+ ::Hydra::Core::Routing::V1::Event::OperationResult result)
{
+ if (!mImpl->isInitialized())
+ {
+ return;
+ }
+
+ mImpl->mEventTopic->lookupEvent(destination, result);
}
-void RoutingServiceEventPublisher::removeEndpointLocatorEvent(const ::std::string&,
- ::Hydra::Core::Routing::V1::Event::OperationResult)
+
+/**
+ * Send a message to the service's event topic to report the addEndpointLocator event.
+ */
+void RoutingServiceEventPublisher::sendAddEndpointLocatorEvent(const ::std::string& locatorId,
+ const ::Hydra::Core::Routing::V1::RegExSeq& regexList,
+ ::Hydra::Core::Routing::V1::Event::OperationResult result)
{
+ if (!mImpl->isInitialized())
+ {
+ return;
+ }
+
+ mImpl->mEventTopic->addEndpointLocatorEvent(locatorId, regexList, result);
}
-void RoutingServiceEventPublisher::setEndpointLocatorDestinationIdsEvent(const ::std::string&,
- const ::Hydra::Core::Routing::V1::RegExSeq&,
- ::Hydra::Core::Routing::V1::Event::OperationResult)
+/**
+ * Send a message to the service's event topic to report the removeEndpointLocator event.
+ */
+void RoutingServiceEventPublisher::sendRemoveEndpointLocatorEvent(const ::std::string& locatorId,
+ ::Hydra::Core::Routing::V1::Event::OperationResult result)
{
+ if (!mImpl->isInitialized())
+ {
+ return;
+ }
+
+ mImpl->mEventTopic->removeEndpointLocatorEvent(locatorId, result);
}
-void RoutingServiceEventPublisher::clearEndpointLocatorsEvent()
+/**
+ * Send a message to the service's event topic to report the setEndpointLocatorDestinationIds event.
+ */
+void RoutingServiceEventPublisher::sendSetEndpointLocatorDestinationIdsEvent(const ::std::string& locatorId,
+ const ::Hydra::Core::Routing::V1::RegExSeq& regexList,
+ ::Hydra::Core::Routing::V1::Event::OperationResult result)
{
+ if (!mImpl->isInitialized())
+ {
+ return;
+ }
+
+ mImpl->mEventTopic->setEndpointLocatorDestinationIdsEvent(locatorId, regexList, result);
}
-void RoutingServiceEventPublisher::setPolicyEvent(const ::std::string& policy)
+/**
+ * Send a message to the service's event topic to report the clearEndpointLocators event.
+ */
+void RoutingServiceEventPublisher::sendClearEndpointLocatorsEvent()
{
+ if (!mImpl->isInitialized())
+ {
+ return;
+ }
+
+ mImpl->mEventTopic->clearEndpointLocatorsEvent();
}
+/**
+ * Send a message to the service's event topic to report the setPolicy event.
+ */
+void RoutingServiceEventPublisher::sendSetPolicyEvent(const ::std::string& policy)
+{
+ if (!mImpl->isInitialized())
+ {
+ return;
+ }
+
+ mImpl->mEventTopic->setPolicyEvent(policy);
+}
}; // end BasicRoutingService
}; // end Hydra
\ No newline at end of file
diff --git a/src/RoutingServiceEventPublisher.h b/src/RoutingServiceEventPublisher.h
index 55921a6..d507216 100644
--- a/src/RoutingServiceEventPublisher.h
+++ b/src/RoutingServiceEventPublisher.h
@@ -11,30 +11,62 @@ namespace BasicRoutingService
class RoutingServiceEventPublisherPriv;
/**
- *
+ * Publishes key events to the rest of the system.
*/
class RoutingServiceEventPublisher
{
public:
- RoutingServiceEventPublisher(const Ice::CommunicatorPtr&);
-
- // RoutingEvents Overrides
- virtual void lookupEvent(const ::std::string&,
- ::Hydra::Core::Routing::V1::Event::OperationResult);
- virtual void addEndpointLocatorEvent(const ::std::string&,
- const ::Hydra::Core::Routing::V1::RegExSeq&,
- ::Hydra::Core::Routing::V1::Event::OperationResult);
- virtual void removeEndpointLocatorEvent(const ::std::string&,
- ::Hydra::Core::Routing::V1::Event::OperationResult);
- virtual void setEndpointLocatorDestinationIdsEvent(const ::std::string&,
- const ::Hydra::Core::Routing::V1::RegExSeq&,
- ::Hydra::Core::Routing::V1::Event::OperationResult);
- virtual void clearEndpointLocatorsEvent();
- virtual void setPolicyEvent(const ::std::string&);
+ RoutingServiceEventPublisher();
+
+ /**
+ * Send a message to the service's event topic to report a lookup event.
+ * @param destination The destination to be looked up.
+ * @param result Informs event listeners of the operations success or failure.
+ */
+ void sendLookupEvent(const ::std::string& destination,
+ ::Hydra::Core::Routing::V1::Event::OperationResult result);
+
+ /**
+ * Send a message to the service's event topic to report an addEndpointLocator event.
+ * @param locatorId The identity of the EndpointLocator being added.
+ * @param regexList List of regex strings used to identify the destinations available by this locator.
+ * @param result Informs event listeners of the operations success or failure.
+ */
+ void sendAddEndpointLocatorEvent(const ::std::string& locatorId,
+ const ::Hydra::Core::Routing::V1::RegExSeq& regexList,
+ ::Hydra::Core::Routing::V1::Event::OperationResult result);
+
+ /**
+ * Send a message to the service's event topic to report a removeEndpointLocator event.
+ * @param locatorId The identity of the EndpointLocator being removed.
+ * @param result Informs event listeners of the operations success or failure.
+ */
+ void sendRemoveEndpointLocatorEvent(const ::std::string& locatorId,
+ ::Hydra::Core::Routing::V1::Event::OperationResult result);
+
+ /**
+ * Send a message to the service's event topic to report a aetEndpointLocatorDestinationIds event.
+ * @param locatorId The identity of the EndpointLocator whose destination specifications should be changed.
+ * @param regexList New list of regex strings to be used to identify the destinations available by this locator.
+ * @param result Informs event listeners of the operations success or failure.
+ */
+ void sendSetEndpointLocatorDestinationIdsEvent(const ::std::string& locatorId,
+ const ::Hydra::Core::Routing::V1::RegExSeq& regexList,
+ ::Hydra::Core::Routing::V1::Event::OperationResult result);
+
+
+ /**
+ * Send a message to the service's event topic to report the clearEndpointLocators event.
+ */
+ void sendClearEndpointLocatorsEvent();
+
+ /**
+ * Send a message to the service's event topic to report the setPolicy event.
+ */
+ void sendSetPolicyEvent(const ::std::string& policy);
private:
- void initialize();
- boost::shared_ptr<RoutingServiceEventPublisherPriv> mImpl;
+ boost::shared_ptr<RoutingServiceEventPublisherPriv> mImpl; // pimpl idiom applied.
};
}; // end BasicRoutingService
-----------------------------------------------------------------------
--
hydra/team/ken.hunt/routing.git
More information about the asterisk-scf-commits
mailing list