[asterisk-scf-commits] asterisk-scf/integration/logger.git branch "filename" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon Mar 14 10:45:40 CDT 2011
branch "filename" has been updated
via 99b842b1a4246af6d9a994dfcd038945af45ba3d (commit)
via 7a21a63526f7d87c5b406e5982eee034d0e64088 (commit)
via db0541d2be19e8315654a7a93eb2e9965ea72834 (commit)
via a6199b7aeeddffc9808bee7677dda3bab2f722a6 (commit)
from 7dc0dcea1e006aa36b58018cb5ca6775430c5a68 (commit)
Summary of changes:
server/src/Configuration.cpp | 68 +++++++++++++++++++++---------------------
server/src/LoggingServer.cpp | 4 +--
server/src/LoggingServer.h | 2 +-
server/src/main.cpp | 10 ++----
4 files changed, 40 insertions(+), 44 deletions(-)
- Log -----------------------------------------------------------------
commit 99b842b1a4246af6d9a994dfcd038945af45ba3d
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Mar 14 10:41:19 2011 -0500
Change to using const references where allowable.
diff --git a/server/src/Configuration.cpp b/server/src/Configuration.cpp
index 34fba8e..c29a140 100644
--- a/server/src/Configuration.cpp
+++ b/server/src/Configuration.cpp
@@ -77,7 +77,7 @@ ConfigurationGroupSeq ConfigurationService::getConfiguration(const Configuration
class visitor : public LoggerConfigurationGroupVisitor
{
public:
- visitor(ConfigurationServiceImplPtr impl, ConfigurationGroupSeq &groups)
+ visitor(const ConfigurationServiceImplPtr &impl, ConfigurationGroupSeq &groups)
: mImpl(impl), mGroups(groups) { }
private:
/**
@@ -135,7 +135,7 @@ ConfigurationGroupSeq ConfigurationService::getConfigurationAll(const Configurat
class visitor : public LoggerConfigurationGroupVisitor
{
public:
- visitor(ConfigurationServiceImplPtr impl, ConfigurationGroupSeq &groups)
+ visitor(const ConfigurationServiceImplPtr &impl, ConfigurationGroupSeq &groups)
: mImpl(impl), mGroups(groups) { }
private:
void visitLoggerGeneralGroup(const LoggerGeneralGroupPtr &group)
@@ -187,9 +187,9 @@ void ConfigurationService::setConfiguration(const ConfigurationGroupSeq& groups,
/**
* Helper function which performs serial number checking of items
*/
- void performSerialCheck(ConfigurationItemDict& changedItems, ConfigurationGroupPtr localGroup)
+ void performSerialCheck(const ConfigurationItemDict& changedItems, const ConfigurationGroupPtr localGroup)
{
- for (ConfigurationItemDict::iterator item = changedItems.begin();
+ for (ConfigurationItemDict::const_iterator item = changedItems.begin();
item != changedItems.end();
++item)
{
@@ -271,11 +271,11 @@ void ConfigurationService::removeConfigurationItems(const ConfigurationGroupSeq&
class GroupsVisitor : public LoggerConfigurationGroupVisitor
{
public:
- GroupsVisitor(ConfigurationServiceImplPtr impl)
+ GroupsVisitor(const ConfigurationServiceImplPtr &impl)
: mImpl(impl) { }
private:
- void removeItems(LoggerConfigurationItemVisitor* visitor, ConfigurationItemDict& itemsToRemove,
+ void removeItems(LoggerConfigurationItemVisitor* visitor, const ConfigurationItemDict& itemsToRemove,
ConfigurationItemDict& localItems)
{
for (ConfigurationItemDict::const_iterator item = itemsToRemove.begin();
@@ -320,7 +320,7 @@ void ConfigurationService::removeConfigurationItems(const ConfigurationGroupSeq&
removeItems(&generalVisitor, group->configurationItems, mImpl->mGeneralConfiguration->mGroup->configurationItems);
}
- ConfigurationServiceImplPtr &mImpl;
+ ConfigurationServiceImplPtr mImpl;
};
LoggerConfigurationGroupVisitorPtr v = new GroupsVisitor(mImpl);
@@ -336,7 +336,7 @@ void ConfigurationService::removeConfigurationGroups(const ConfigurationGroupSeq
class visitor : public LoggerConfigurationGroupVisitor
{
public:
- visitor(ConfigurationServiceImplPtr &impl)
+ visitor(const ConfigurationServiceImplPtr &impl)
: mImpl(impl) { }
private:
void visitLoggerGeneralGroup(const LoggerGeneralGroupPtr &group)
commit 7a21a63526f7d87c5b406e5982eee034d0e64088
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Mar 14 10:37:24 2011 -0500
Throw SerialConflict if there is one.
diff --git a/server/src/Configuration.cpp b/server/src/Configuration.cpp
index 14242d7..34fba8e 100644
--- a/server/src/Configuration.cpp
+++ b/server/src/Configuration.cpp
@@ -181,13 +181,13 @@ void ConfigurationService::setConfiguration(const ConfigurationGroupSeq& groups,
class GroupsVisitor : public LoggerConfigurationGroupVisitor
{
public:
- GroupsVisitor(ConfigurationServiceImplPtr impl)
+ GroupsVisitor(const ConfigurationServiceImplPtr &impl)
: mImpl(impl) { }
private:
/**
* Helper function which performs serial number checking of items
*/
- void performSerialCheck(ConfigurationItemDict& changedItems, ConfigurationItemDict& localItems)
+ void performSerialCheck(ConfigurationItemDict& changedItems, ConfigurationGroupPtr localGroup)
{
for (ConfigurationItemDict::iterator item = changedItems.begin();
item != changedItems.end();
@@ -199,9 +199,9 @@ void ConfigurationService::setConfiguration(const ConfigurationGroupSeq& groups,
continue;
}
- ConfigurationItemDict::iterator localItem = localItems.find(item->first);
+ ConfigurationItemDict::iterator localItem = localGroup->configurationItems.find(item->first);
- if (localItem == localItems.end())
+ if (localItem == localGroup->configurationItems.end())
{
// This is a new item so serial checking does not apply
continue;
@@ -209,7 +209,7 @@ void ConfigurationService::setConfiguration(const ConfigurationGroupSeq& groups,
if (item->second->serialNumber < localItem->second->serialNumber)
{
- /* XXX Need to throw the exception */
+ throw SerialConflict(localGroup, localItem->second);
}
}
}
@@ -222,7 +222,7 @@ void ConfigurationService::setConfiguration(const ConfigurationGroupSeq& groups,
}
else
{
- performSerialCheck(group->configurationItems, mImpl->mGeneralConfiguration->mGroup->configurationItems);
+ performSerialCheck(group->configurationItems, mImpl->mGeneralConfiguration->mGroup);
}
class GeneralItemsVisitor : public LoggerConfigurationItemVisitor
commit db0541d2be19e8315654a7a93eb2e9965ea72834
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Mar 14 09:51:45 2011 -0500
LoggerGeneralGroupI -> LoggerGeneralConfiguration. Don't derive from LoggerGeneralGroup.
diff --git a/server/src/Configuration.cpp b/server/src/Configuration.cpp
index a190110..14242d7 100644
--- a/server/src/Configuration.cpp
+++ b/server/src/Configuration.cpp
@@ -47,16 +47,16 @@ public:
typedef boost::shared_ptr<FileItemI> FileItemIPtr;
-class LoggerGeneralGroupI : public LoggerGeneralGroup
+class LoggerGeneralConfiguration
{
public:
- LoggerGeneralGroupI(LoggerGeneralGroupPtr group)
+ LoggerGeneralConfiguration(LoggerGeneralGroupPtr group)
: mGroup(group) { }
FileItemIPtr mOutputFile;
LoggerGeneralGroupPtr mGroup;
};
-typedef boost::shared_ptr<LoggerGeneralGroupI> LoggerGeneralGroupIPtr;
+typedef boost::shared_ptr<LoggerGeneralConfiguration> LoggerGeneralConfigurationPtr;
class ConfigurationServiceImpl
{
@@ -64,7 +64,7 @@ public:
ConfigurationServiceImpl(LoggingServerIPtr server)
: mServer(server) { }
LoggingServerIPtr mServer;
- LoggerGeneralGroupIPtr mGeneralGroupI;
+ LoggerGeneralConfigurationPtr mGeneralConfiguration;
};
typedef boost::shared_ptr<ConfigurationServiceImpl> ConfigurationServiceImplPtr;
@@ -105,13 +105,13 @@ ConfigurationGroupSeq ConfigurationService::getConfiguration(const Configuration
void visitLoggerGeneralGroup(const LoggerGeneralGroupPtr &group)
{
- if (!mImpl->mGeneralGroupI)
+ if (!mImpl->mGeneralConfiguration)
{
return;
}
LoggerGeneralGroupPtr returnedGroup = new LoggerGeneralGroup();
- insertRequestedConfigurationItems(group->configurationItems, mImpl->mGeneralGroupI->mGroup->configurationItems, returnedGroup->configurationItems);
+ insertRequestedConfigurationItems(group->configurationItems, mImpl->mGeneralConfiguration->mGroup->configurationItems, returnedGroup->configurationItems);
mGroups.push_back(returnedGroup);
}
@@ -140,12 +140,12 @@ ConfigurationGroupSeq ConfigurationService::getConfigurationAll(const Configurat
private:
void visitLoggerGeneralGroup(const LoggerGeneralGroupPtr &group)
{
- if (!mImpl->mGeneralGroupI)
+ if (!mImpl->mGeneralConfiguration)
{
return;
}
- mGroups.push_back(mImpl->mGeneralGroupI->mGroup);
+ mGroups.push_back(mImpl->mGeneralConfiguration->mGroup);
}
ConfigurationServiceImplPtr mImpl;
@@ -167,7 +167,7 @@ ConfigurationGroupSeq ConfigurationService::getConfigurationGroups(const Ice::Cu
{
ConfigurationGroupSeq groups;
- if (mImpl->mGeneralGroupI)
+ if (mImpl->mGeneralConfiguration)
{
LoggerGeneralGroupPtr general = new LoggerGeneralGroup();
groups.push_back(general);
@@ -216,13 +216,13 @@ void ConfigurationService::setConfiguration(const ConfigurationGroupSeq& groups,
void visitLoggerGeneralGroup(const LoggerGeneralGroupPtr &group)
{
- if (!mImpl->mGeneralGroupI)
+ if (!mImpl->mGeneralConfiguration)
{
- mImpl->mGeneralGroupI.reset(new LoggerGeneralGroupI(new LoggerGeneralGroup));
+ mImpl->mGeneralConfiguration.reset(new LoggerGeneralConfiguration(new LoggerGeneralGroup));
}
else
{
- performSerialCheck(group->configurationItems, mImpl->mGeneralGroupI->mGroup->configurationItems);
+ performSerialCheck(group->configurationItems, mImpl->mGeneralConfiguration->mGroup->configurationItems);
}
class GeneralItemsVisitor : public LoggerConfigurationItemVisitor
@@ -233,15 +233,15 @@ void ConfigurationService::setConfiguration(const ConfigurationGroupSeq& groups,
private:
void visitFileItem(const FileItemPtr &fileItem)
{
- if (mImpl->mGeneralGroupI->mOutputFile &&
- mImpl->mGeneralGroupI->mOutputFile->fileName == fileItem->fileName)
+ if (mImpl->mGeneralConfiguration->mOutputFile &&
+ mImpl->mGeneralConfiguration->mOutputFile->fileName == fileItem->fileName)
{
// The new configuration has the same file name as
// the old. Don't interrupt things. Just return.
return;
}
- mImpl->mGeneralGroupI->mOutputFile.reset(new FileItemI(mImpl->mServer, fileItem->fileName));
+ mImpl->mGeneralConfiguration->mOutputFile.reset(new FileItemI(mImpl->mServer, fileItem->fileName));
}
ConfigurationServiceImplPtr mImpl;
};
@@ -252,7 +252,7 @@ void ConfigurationService::setConfiguration(const ConfigurationGroupSeq& groups,
item != group->configurationItems.end();
++item)
{
- mImpl->mGeneralGroupI->mGroup->configurationItems.insert(make_pair(item->first, item->second));
+ mImpl->mGeneralConfiguration->mGroup->configurationItems.insert(make_pair(item->first, item->second));
item->second->visit(generalVisitor);
}
}
@@ -297,7 +297,7 @@ void ConfigurationService::removeConfigurationItems(const ConfigurationGroupSeq&
void visitLoggerGeneralGroup(const LoggerGeneralGroupPtr &group)
{
- if (!mImpl->mGeneralGroupI)
+ if (!mImpl->mGeneralConfiguration)
{
return;
}
@@ -305,7 +305,7 @@ void ConfigurationService::removeConfigurationItems(const ConfigurationGroupSeq&
class GeneralItemsVisitor : public LoggerConfigurationItemVisitor
{
public:
- GeneralItemsVisitor(const LoggerGeneralGroupIPtr &group)
+ GeneralItemsVisitor(const LoggerGeneralConfigurationPtr &group)
: mGroup(group) { }
private:
void visitFileItem(const FileItemPtr &fileItem)
@@ -315,10 +315,10 @@ void ConfigurationService::removeConfigurationItems(const ConfigurationGroupSeq&
mGroup->mOutputFile.reset();
}
}
- LoggerGeneralGroupIPtr mGroup;
- } generalVisitor(mImpl->mGeneralGroupI);
+ LoggerGeneralConfigurationPtr mGroup;
+ } generalVisitor(mImpl->mGeneralConfiguration);
- removeItems(&generalVisitor, group->configurationItems, mImpl->mGeneralGroupI->mGroup->configurationItems);
+ removeItems(&generalVisitor, group->configurationItems, mImpl->mGeneralConfiguration->mGroup->configurationItems);
}
ConfigurationServiceImplPtr &mImpl;
};
@@ -341,7 +341,7 @@ void ConfigurationService::removeConfigurationGroups(const ConfigurationGroupSeq
private:
void visitLoggerGeneralGroup(const LoggerGeneralGroupPtr &group)
{
- mImpl->mGeneralGroupI.reset();
+ mImpl->mGeneralConfiguration.reset();
}
ConfigurationServiceImplPtr mImpl;
};
commit a6199b7aeeddffc9808bee7677dda3bab2f722a6
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Mar 14 09:39:43 2011 -0500
Get rid of default output file logic from logging server startup.
diff --git a/server/src/LoggingServer.cpp b/server/src/LoggingServer.cpp
index 0b4d642..764a236 100644
--- a/server/src/LoggingServer.cpp
+++ b/server/src/LoggingServer.cpp
@@ -142,11 +142,9 @@ bool LoggingServerI::isSubpathOf(const std::string& path,
// <prefix>.logger=level
// <prefix>.logger.<name>=level
-void LoggingServerI::configure(const boost::shared_ptr<ChainedLogOut>& out,
- const ServerConfigurationListenerPrx& configurationListener,
+void LoggingServerI::configure(const ServerConfigurationListenerPrx& configurationListener,
const Ice::PropertiesPtr& props)
{
- mLogsOut.push_back(out);
this->mConfigurationListener = configurationListener;
Ice::PropertyDict myProps = props->getPropertiesForPrefix(
diff --git a/server/src/LoggingServer.h b/server/src/LoggingServer.h
index 8c0d805..9c672b0 100644
--- a/server/src/LoggingServer.h
+++ b/server/src/LoggingServer.h
@@ -76,7 +76,7 @@ public:
ASTERISK_SCF_ICEBOX_EXPORT Level getEffectiveLevel(const std::string& name) const;
ASTERISK_SCF_ICEBOX_EXPORT void setLevel(const std::string& name, Level level);
- ASTERISK_SCF_ICEBOX_EXPORT void configure(const boost::shared_ptr<ChainedLogOut>& out, const ServerConfigurationListenerPrx& configurationListener, const Ice::PropertiesPtr& props);
+ ASTERISK_SCF_ICEBOX_EXPORT void configure(const ServerConfigurationListenerPrx& configurationListener, const Ice::PropertiesPtr& props);
void removeLogOut(const boost::shared_ptr<ChainedLogOut> &out);
void addLogOut(const boost::shared_ptr<ChainedLogOut> &out);
diff --git a/server/src/main.cpp b/server/src/main.cpp
index 7f1d5ca..16b29f4 100644
--- a/server/src/main.cpp
+++ b/server/src/main.cpp
@@ -31,7 +31,6 @@ using namespace AsteriskSCF::Core::Discovery::V1;
namespace
{
const std::string AdapterName = "AsteriskSCF.LoggingService";
-const std::string LogFileName = "asterisk-scf.log";
class LoggingService : public IceBox::Service
{
@@ -149,14 +148,13 @@ void LoggingService::start(const std::string& name,
std::clog << e.what() << '\n';
}
- boost::shared_ptr<ChainedLogOut> logOut(new FileChainedLogOut(LogFileName));
+ IceUtil::Handle<LoggingServerI> server = new LoggingServerI;
if (std::cout)
{
- // only append stdout if cout is open.
- logOut.reset(new OstreamChainedLogOut(std::cout, logOut));
+ boost::shared_ptr<ChainedLogOut> logOut(new OstreamChainedLogOut(std::cout));
+ server->addLogOut(logOut);
}
- IceUtil::Handle<LoggingServerI> server = new LoggingServerI;
- server->configure(logOut, configurationListener,
+ server->configure(configurationListener,
communicator->getProperties());
LoggingServerPrx serverProxy = LoggingServerPrx::uncheckedCast(
-----------------------------------------------------------------------
--
asterisk-scf/integration/logger.git
More information about the asterisk-scf-commits
mailing list