[asterisk-scf-commits] asterisk-scf/release/servicediscovery.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Jun 23 15:16:31 CDT 2011


branch "master" has been updated
       via  8f135cc47b45a9b3099b5a71c6c2a05b0a3b4836 (commit)
      from  319c1b4439acfb3f28e524da673c4b434e3e78ee (commit)

Summary of changes:
 src/CMakeLists.txt         |    4 +--
 src/CollocatedIceStorm.cpp |   87 --------------------------------------------
 src/CollocatedIceStorm.h   |   56 ----------------------------
 src/ServiceLocator.cpp     |    8 ++--
 4 files changed, 5 insertions(+), 150 deletions(-)
 delete mode 100644 src/CollocatedIceStorm.cpp
 delete mode 100644 src/CollocatedIceStorm.h


- Log -----------------------------------------------------------------
commit 8f135cc47b45a9b3099b5a71c6c2a05b0a3b4836
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Thu Jun 23 15:15:59 2011 -0500

    Remove local copies of CollocatedIceStorm.
    
    The CollocatedIceStorm facilities are now available from ice-util-cpp, so
    there is no need for a copy in this repository.

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e57bafc..cfd57d9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -6,8 +6,6 @@ astscf_component_add_slices(service_locator PROJECT AsteriskSCF/Replication/Serv
 astscf_component_add_files(service_locator ServiceLocator.cpp)
 astscf_component_add_files(service_locator ServiceLocatorManagement.cpp)
 astscf_component_add_files(service_locator ServiceManagement.cpp)
-astscf_component_add_files(service_locator CollocatedIceStorm.cpp)
-astscf_component_add_files(service_locator CollocatedIceStorm.h)
 astscf_component_add_files(service_locator ServiceManagement.h)
 astscf_component_add_files(service_locator ServiceLocatorManagement.h)
 astscf_component_add_files(service_locator ServiceLocatorStateReplicator.h)
@@ -15,7 +13,7 @@ astscf_component_add_files(service_locator ServiceLocatorStateListener.cpp)
 astscf_component_add_ice_libraries(service_locator IceStorm)
 astscf_component_add_boost_libraries(service_locator core thread date_time)
 astscf_component_build_icebox(service_locator)
-target_link_libraries(service_locator logging-client)
+target_link_libraries(service_locator logging-client astscf-ice-util-cpp)
 astscf_component_install(service_locator)
 
 astscf_component_init(ServiceLocatorStateReplicator)
diff --git a/src/CollocatedIceStorm.cpp b/src/CollocatedIceStorm.cpp
deleted file mode 100644
index 54c05fc..0000000
--- a/src/CollocatedIceStorm.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Asterisk SCF -- An open-source communications framework.
- *
- * Copyright (C) 2010, Digium, Inc.
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk SCF project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE.txt file
- * at the top of the source tree.
- */
-#include <Ice/Ice.h>
-#include <IceStorm/IceStorm.h>
-#include <assert.h>
-#include <algorithm>
-#include "CollocatedIceStorm.h"
-
-using namespace AsteriskSCF::ServiceDiscovery;
-
-//
-// The idea behind this class is that it needs to access the entry point that IceBox would
-// have used and then invoke the methods that are needed to start and stop the IceStorm
-// service.
-//
-typedef IceBox::Service* (*FACTORY)(Ice::CommunicatorPtr);
-
-CollocatedIceStorm::CollocatedIceStorm(const std::string& namePrefix, const Ice::PropertiesPtr& properties) :
-    mStopped(false)
-{
-    //
-    // We create our own communicator to avoid issues with call order on shutdown.
-    //
-    Ice::InitializationData initData;
-    initData.properties = properties;
-    mCommunicator = Ice::initialize(initData);
-
-    std::string loadString = mCommunicator->getProperties()->getPropertyWithDefault("IceStorm.EntryPoint", "IceStormService:createIceStorm");
-
-    mLibrary = new IceUtilInternal::DynamicLibrary;
-    IceUtilInternal::DynamicLibrary::symbol_type entry = mLibrary->loadEntryPoint(loadString);
-    if(entry == 0)
-    {
-        throw mLibrary->getErrorMessage();
-    }
-    FACTORY factory = (FACTORY)entry;
-    mService = factory(mCommunicator);
-    assert(mService != 0);
-    Ice::StringSeq options;
-    mService->start(namePrefix, mCommunicator, options);
-}
-
-CollocatedIceStorm::~CollocatedIceStorm()
-{
-    if(!mStopped)
-    {
-        try
-        {
-            stop();
-            mCommunicator->destroy();
-        }
-        catch(...)
-        {
-        }
-    }
-}
-
-void CollocatedIceStorm::stop()
-{
-    //
-    // NOTE: there isn't any mutex protection here. It can be added later if needed, but at the moment multiple threads
-    // do not have access to this object instance.
-    //
-    if(!mStopped)
-    {
-        if(mService)
-        {
-            mService->stop();
-        }
-        mCommunicator->shutdown();
-        mCommunicator->waitForShutdown();
-        mStopped = true;
-    }
-}
diff --git a/src/CollocatedIceStorm.h b/src/CollocatedIceStorm.h
deleted file mode 100644
index fb598ae..0000000
--- a/src/CollocatedIceStorm.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Asterisk SCF -- An open-source communications framework.
- *
- * Copyright (C) 2010, Digium, Inc.
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk SCF project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE.txt file
- * at the top of the source tree.
- */
-#pragma once
-
-#include <IceUtil/DynamicLibrary.h>
-#include <Ice/Service.h>
-#include <IceBox/IceBox.h>
-#include <Ice/Ice.h>
-#include <IceStorm/IceStorm.h>
-#include <string>
-
-namespace AsteriskSCF
-{
-namespace ServiceDiscovery
-{
-/**
- * A helper class that instantiates IceStorm in-process, removing the need to launch
- * a separate process to access IceStorm services.
- */
-
-class CollocatedIceStorm : public IceUtil::Shared
-{
-public:
-    CollocatedIceStorm(const std::string&, const Ice::PropertiesPtr&);
-    ~CollocatedIceStorm();
-
-    /**
-     * "nice" applications should explictly call stop !
-     */
-    void stop();
-
-private:
-    IceUtilInternal::DynamicLibraryPtr mLibrary;
-    IceBox::ServicePtr mService;
-    Ice::CommunicatorPtr mCommunicator;
-    bool mStopped;
-};
-
-typedef IceUtil::Handle<CollocatedIceStorm> CollocatedIceStormPtr;
-
-} /* end of ServiceDiscovery */
-} /* end of AsteriskSCF */
-
diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index ab3bb0d..34fe063 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -23,11 +23,11 @@
 #include <AsteriskSCF/logger.h>
 #include <AsteriskSCF/Logger/IceLogger.h>
 #include <AsteriskSCF/System/Component/ReplicaIf.h>
+#include <AsteriskSCF/CollocatedIceStorm/CollocatedIceStorm.h>
 
 #include "ServiceLocatorManagement.h"
 #include "ServiceManagement.h"
 #include "ServiceLocatorStateReplicator.h"
-#include "CollocatedIceStorm.h"
 
 using namespace std;
 using namespace AsteriskSCF::System::Discovery;
@@ -58,7 +58,7 @@ private:
     Ice::ObjectAdapterPtr mLocalAdapter;
     Ice::ObjectAdapterPtr mDiscoveryAdapter;
     Ice::ObjectAdapterPtr mManagementAdapter;
-    AsteriskSCF::ServiceDiscovery::CollocatedIceStormPtr mIceStorm;
+    AsteriskSCF::CollocatedIceStorm::CollocatedIceStormPtr mIceStorm;
     ReplicaPtr mReplicaService;
     ServiceLocatorStateReplicatorPrx mStateReplicator;
 };
@@ -168,9 +168,9 @@ void ServiceLocatorImpl::locateAll_async(const AMD_ServiceLocator_locateAllPtr&
 void ServiceLocatorApp::start(const string&, const Ice::CommunicatorPtr& communicator,
     const Ice::StringSeq&)
 {
-    mIceStorm = new AsteriskSCF::ServiceDiscovery::CollocatedIceStorm("AsteriskSCFIceStorm", communicator->getProperties());
+    mIceStorm = new AsteriskSCF::CollocatedIceStorm::CollocatedIceStorm("AsteriskSCFIceStorm", communicator->getProperties());
 
-	mLocalAdapter = communicator->createObjectAdapter("ServiceLocatorLocalAdapter");
+    mLocalAdapter = communicator->createObjectAdapter("ServiceLocatorLocalAdapter");
 
     ConfiguredIceLoggerPtr mIceLogger = createIceLogger(mLocalAdapter);
 

-----------------------------------------------------------------------


-- 
asterisk-scf/release/servicediscovery.git



More information about the asterisk-scf-commits mailing list