[asterisk-scf-commits] asterisk-scf/integration/test_channel.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Sat Sep 11 09:31:36 CDT 2010
branch "master" has been updated
via 5fc5fcdb39d379b76a33eeff91a378f4447714b9 (commit)
from bc023b4cc1f6659850b9a008b549065065d3dc79 (commit)
Summary of changes:
{src => include}/Commands.h | 16 +++++++++++++++-
{src => include}/ConsoleDriver.h | 7 +++----
{src => include}/TestEndpoint.h | 11 +++++++++--
src/CMakeLists.txt | 4 ++++
src/ConsoleDriver.cpp | 1 -
src/Service.cpp | 3 +--
src/TestEndpoint.cpp | 4 ++--
7 files changed, 34 insertions(+), 12 deletions(-)
rename {src => include}/Commands.h (75%)
rename {src => include}/ConsoleDriver.h (80%)
rename {src => include}/TestEndpoint.h (64%)
- Log -----------------------------------------------------------------
commit 5fc5fcdb39d379b76a33eeff91a378f4447714b9
Author: Brent Eagles <beagles at digium.com>
Date: Sat Sep 11 11:56:46 2010 -0230
Move some header files into an "accessible" directory to allow collocation
and extension.
diff --git a/src/Commands.h b/include/Commands.h
similarity index 75%
rename from src/Commands.h
rename to include/Commands.h
index 208882f..aa1a60e 100644
--- a/src/Commands.h
+++ b/include/Commands.h
@@ -19,7 +19,7 @@
#include <IceUtil/Handle.h>
//
-// Add more commands.
+// TODO: Add more commands.
//
class Commands : public virtual IceUtil::Shared
{
@@ -68,3 +68,17 @@ public:
};
typedef IceUtil::Handle<Commands> CommandsPtr;
+
+//
+// Abstract base class for command "drivers". Basically implementations
+// of things that implement the commands or intelligence for the
+// test channel driver.
+//
+class CommandDriver : virtual public IceUtil::Shared
+{
+public:
+ virtual ~CommandDriver() {}
+ virtual void setHandler(const CommandsPtr& handler) = 0;
+};
+
+typedef IceUtil::Handle<CommandDriver> CommandDriverPtr;
diff --git a/src/ConsoleDriver.h b/include/ConsoleDriver.h
similarity index 80%
rename from src/ConsoleDriver.h
rename to include/ConsoleDriver.h
index 465306a..ab0fdaa 100644
--- a/src/ConsoleDriver.h
+++ b/include/ConsoleDriver.h
@@ -10,10 +10,10 @@
#include <IceUtil/Monitor.h>
#include <IceUtil/Thread.h>
#include <string>
-#include "Logger.h"
-#include "Commands.h"
+#include <Commands.h>
-class ConsoleDriver : public IceUtil::Thread
+class ConsoleDriver : virtual public CommandDriver,
+ virtual public IceUtil::Thread
{
public:
ConsoleDriver();
@@ -25,7 +25,6 @@ public:
private:
IceUtil::Monitor<IceUtil::Mutex> mMonitor;
bool mDone;
- AsteriskSCF::TestUtil::Logger mLogger;
CommandsPtr mCommandHandler;
};
diff --git a/src/TestEndpoint.h b/include/TestEndpoint.h
similarity index 64%
rename from src/TestEndpoint.h
rename to include/TestEndpoint.h
index 717c785..77abd5a 100644
--- a/src/TestEndpoint.h
+++ b/include/TestEndpoint.h
@@ -11,16 +11,23 @@
#include <Core/Routing/RoutingIf.h>
#include <boost/thread/shared_mutex.hpp>
-#include "ConsoleDriver.h"
+#include <Commands.h>
namespace AsteriskSCF
{
namespace TestUtil
{
+ //
+ // For the moment basically a factory that creates
class TestEndpoint
{
+ //
+ // TestEndpoint currently doesn't support any instance specific
+ // functionality so creating an instance of it is pointless.
+ //
+ TestEndpoint() {}
public:
- static AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr initialize(const ConsoleDriverPtr& driver, const Ice::ObjectAdapterPtr& adapter, const std::string& id);
+ static AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr initialize(const CommandDriverPtr& driver, const Ice::ObjectAdapterPtr& adapter, const std::string& id);
private:
static boost::shared_mutex mMutex;
static AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr mImpl;
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 91c0483..c39005e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,4 +1,5 @@
hydra_component_init(test_channel CXX)
+include_directories("../include")
hydra_component_add_slice(test_channel EndpointIf)
hydra_component_add_slice(test_channel ComponentServiceIf)
hydra_component_add_slice(test_channel SessionCommunicationsIf)
@@ -8,6 +9,9 @@ hydra_component_add_file(test_channel MediaEchoThread.cpp)
hydra_component_add_file(test_channel MediaSession.cpp)
hydra_component_add_file(test_channel ConsoleDriver.cpp)
hydra_component_add_file(test_channel TestEndpoint.cpp)
+hydra_component_add_file(test_channel ../include/TestEndpoint.h)
+hydra_component_add_file(test_channel ../include/Commands.h)
+hydra_component_add_file(test_channel ../include/ConsoleDriver.h)
hydra_component_add_ice_libraries(test_channel IceStorm)
hydra_component_add_boost_libraries(test_channel thread)
hydra_component_add_boost_libraries(test_channel date_time)
diff --git a/src/ConsoleDriver.cpp b/src/ConsoleDriver.cpp
index 0785e7a..a9086b4 100644
--- a/src/ConsoleDriver.cpp
+++ b/src/ConsoleDriver.cpp
@@ -124,7 +124,6 @@ void ConsoleDriver::write(const std::string& message)
void ConsoleDriver::destroy()
{
IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mMonitor);
- mLogger.getDebugStream() << __FUNCTION__ << " : destroyed. " << std::endl;
mDone = true;
mMonitor.notifyAll();
}
diff --git a/src/Service.cpp b/src/Service.cpp
index e0a9782..c17b02b 100644
--- a/src/Service.cpp
+++ b/src/Service.cpp
@@ -13,7 +13,6 @@
#include "Logger.h"
#include "TestEndpoint.h"
#include "ConsoleDriver.h"
-#include "Commands.h"
class TestChannelDriver : public Ice::Application
{
@@ -62,7 +61,7 @@ int TestChannelDriver::run(int, char*[])
AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr servant = AsteriskSCF::TestUtil::TestEndpoint::initialize(mConsoleDriver, adapter, "TestChannel.Locator");
AsteriskSCF::Core::Routing::V1::EndpointLocatorPrx endpointLocatorPrx =
- AsteriskSCF::Core::Routing::V1::EndpointLocatorPrx::checkedCast(adapter->add(servant, communicator()->stringToIdentity("TestChannel.Locator")));
+ AsteriskSCF::Core::Routing::V1::EndpointLocatorPrx::checkedCast(adapter->add(servant, communicator()->stringToIdentity("TestChannel")));
AsteriskSCF::Core::Discovery::V1::ServiceLocatorManagementPrx management = AsteriskSCF::Core::Discovery::V1::ServiceLocatorManagementPrx::checkedCast(communicator()->propertyToProxy("ServiceLocatorManagementProxy"));
AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx service_management = AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx::uncheckedCast(management->addService(endpointLocatorPrx, "TestChannel"));
diff --git a/src/TestEndpoint.cpp b/src/TestEndpoint.cpp
index 6b5fd5d..238da6a 100644
--- a/src/TestEndpoint.cpp
+++ b/src/TestEndpoint.cpp
@@ -460,13 +460,13 @@ typedef IceUtil::Handle<EndpointLocatorI> EndpointLocatorIPtr;
boost::shared_mutex AsteriskSCF::TestUtil::TestEndpoint::mMutex;
AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr AsteriskSCF::TestUtil::TestEndpoint::mImpl;
- AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr TestEndpoint::initialize(const ConsoleDriverPtr& console, const Ice::ObjectAdapterPtr& adapter, const std::string& id)
+ AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr TestEndpoint::initialize(const CommandDriverPtr& driver, const Ice::ObjectAdapterPtr& adapter, const std::string& id)
{
boost::unique_lock<boost::shared_mutex> lock(mMutex);
if(mImpl.get() == 0)
{
EndpointLocatorIPtr impl(new EndpointLocatorI(adapter, id));
- console->setHandler(CommandsPtr::dynamicCast(impl->getCommandInterface()));
+ driver->setHandler(CommandsPtr::dynamicCast(impl->getCommandInterface()));
mImpl = AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr::dynamicCast(impl);
}
return mImpl;
-----------------------------------------------------------------------
--
asterisk-scf/integration/test_channel.git
More information about the asterisk-scf-commits
mailing list