Skip to content

Commit

Permalink
Use getIceProperty where possible in IceGrid (#3136)
Browse files Browse the repository at this point in the history
  • Loading branch information
externl authored Nov 12, 2024
1 parent 58add93 commit 1720369
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 55 deletions.
2 changes: 1 addition & 1 deletion cpp/src/IceGrid/AdminI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ ApplicationDescriptor
AdminI::getDefaultApplicationDescriptor(const Current& current) const
{
auto properties = current.adapter->getCommunicator()->getProperties();
string path = properties->getProperty("IceGrid.Registry.DefaultTemplates");
string path = properties->getIceProperty("IceGrid.Registry.DefaultTemplates");
if (path.empty())
{
throw DeploymentException("no default templates configured, you need to set "
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/IceGrid/Database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ Database::Database(
_objectCache(_communicator),
_allocatableObjectCache(_communicator),
_serverCache(_communicator, _instanceName, _nodeCache, _adapterCache, _objectCache, _allocatableObjectCache),
_dbLock(_communicator->getProperties()->getProperty("IceGrid.Registry.LMDB.Path") + "/icedb.lock"),
_dbLock(_communicator->getProperties()->getIceProperty("IceGrid.Registry.LMDB.Path") + "/icedb.lock"),
_env(
_communicator->getProperties()->getProperty("IceGrid.Registry.LMDB.Path"),
_communicator->getProperties()->getIceProperty("IceGrid.Registry.LMDB.Path"),
8,
IceDB::getMapSize(_communicator->getProperties()->getPropertyAsInt("IceGrid.Registry.LMDB.MapSize"))),
IceDB::getMapSize(_communicator->getProperties()->getIcePropertyAsInt("IceGrid.Registry.LMDB.MapSize"))),
_pluginFacade(dynamic_pointer_cast<RegistryPluginFacadeI>(getRegistryPluginFacade())),
_lock(nullptr)
{
Expand Down
40 changes: 19 additions & 21 deletions cpp/src/IceGrid/IceGridNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ NodeService::startImpl(int argc, char* argv[], int& status)

auto properties = communicator()->getProperties();

string name = properties->getProperty("IceGrid.Node.Name");
string name = properties->getIceProperty("IceGrid.Node.Name");
if (name.empty())
{
error("property `IceGrid.Node.Name' is not set");
Expand Down Expand Up @@ -282,7 +282,7 @@ NodeService::startImpl(int argc, char* argv[], int& status)
//
// Collocate the IceGrid registry if we need to.
//
if (properties->getPropertyAsInt("IceGrid.Node.CollocateRegistry") > 0)
if (properties->getIcePropertyAsInt("IceGrid.Node.CollocateRegistry") > 0)
{
_registry =
make_shared<CollocatedRegistry>(communicator(), _activator, nowarn, readonly, initFromReplica, name);
Expand All @@ -299,7 +299,7 @@ NodeService::startImpl(int argc, char* argv[], int& status)
// activated server). The default locator is also needed by
// the node session manager.
//
if (properties->getProperty("Ice.Default.Locator").empty())
if (properties->getIceProperty("Ice.Default.Locator").empty())
{
properties->setProperty("Ice.Default.Locator", communicator()->getDefaultLocator()->ice_toString());
}
Expand All @@ -313,7 +313,7 @@ NodeService::startImpl(int argc, char* argv[], int& status)
//
// Initialize the database environment (first setup the directory structure if needed).
//
string dataPath = properties->getProperty("IceGrid.Node.Data");
string dataPath = properties->getIceProperty("IceGrid.Node.Data");
if (dataPath.empty())
{
error("property `IceGrid.Node.Data' is not set");
Expand Down Expand Up @@ -366,7 +366,7 @@ NodeService::startImpl(int argc, char* argv[], int& status)
//
// Check that required properties are set and valid.
//
if (properties->getProperty("IceGrid.Node.Endpoints").empty())
if (properties->getIceProperty("IceGrid.Node.Endpoints").empty())
{
error("property `IceGrid.Node.Endpoints' is not set");
return false;
Expand All @@ -381,7 +381,7 @@ NodeService::startImpl(int argc, char* argv[], int& status)
// Setup the user account mapper if configured.
//
string mapperProperty = "IceGrid.Node.UserAccountMapper";
string mapperPropertyValue = properties->getProperty(mapperProperty);
string mapperPropertyValue = properties->getIceProperty(mapperProperty);
optional<UserAccountMapperPrx> mapper;
if (!mapperPropertyValue.empty())
{
Expand All @@ -398,7 +398,7 @@ NodeService::startImpl(int argc, char* argv[], int& status)
}
else
{
string userAccountFileProperty = properties->getProperty("IceGrid.Node.UserAccounts");
string userAccountFileProperty = properties->getIceProperty("IceGrid.Node.UserAccounts");
if (!userAccountFileProperty.empty())
{
try
Expand All @@ -419,9 +419,7 @@ NodeService::startImpl(int argc, char* argv[], int& status)
//
_timer = make_shared<IceInternal::Timer>();

//
// The IceGrid instance name.
//
// The IceGrid instance name. We can't use getIceProperty as we don't want to get any default values.
string instanceName = properties->getProperty("IceGrid.InstanceName");
if (instanceName.empty())
{
Expand Down Expand Up @@ -483,7 +481,7 @@ NodeService::startImpl(int argc, char* argv[], int& status)
//
// Create Admin unless there is a collocated registry with its own Admin
//
if (!_registry && properties->getPropertyAsInt("Ice.Admin.Enabled") > 0)
if (!_registry && properties->getIcePropertyAsInt("Ice.Admin.Enabled") > 0)
{
// Replace Admin facet
auto origProcess = dynamic_pointer_cast<Process>(communicator()->removeAdminFacet("Process"));
Expand All @@ -507,7 +505,7 @@ NodeService::startImpl(int argc, char* argv[], int& status)
//
_sessions->activate();

string bundleName = properties->getProperty("IceGrid.Node.PrintServersReady");
string bundleName = properties->getIceProperty("IceGrid.Node.PrintServersReady");
if (!bundleName.empty() || !desc.empty())
{
enableInterrupt();
Expand Down Expand Up @@ -540,14 +538,14 @@ NodeService::startImpl(int argc, char* argv[], int& status)
registry = registry->ice_preferSecure(true); // Use SSL if available.

optional<AdminSessionPrx> session;
if (communicator()->getProperties()->getPropertyAsInt("IceGridAdmin.AuthenticateUsingSSL"))
if (communicator()->getProperties()->getIcePropertyAsInt("IceGridAdmin.AuthenticateUsingSSL"))
{
session = registry->createAdminSessionFromSecureConnection();
}
else
{
string username = communicator()->getProperties()->getProperty("IceGridAdmin.Username");
string password = communicator()->getProperties()->getProperty("IceGridAdmin.Password");
string username = communicator()->getProperties()->getIceProperty("IceGridAdmin.Username");
string password = communicator()->getProperties()->getIceProperty("IceGridAdmin.Password");
while (username.empty())
{
consoleOut << "user id: " << flush;
Expand Down Expand Up @@ -737,9 +735,9 @@ NodeService::initializeCommunicator(int& argc, char* argv[], const Initializatio
{
string verifier = "IceGrid.Registry." + type + "PermissionsVerifier";

if (initData.properties->getProperty(verifier).empty())
if (initData.properties->getIceProperty(verifier).empty())
{
string cryptPasswords = initData.properties->getProperty("IceGrid.Registry." + type + "CryptPasswords");
string cryptPasswords = initData.properties->getIceProperty("IceGrid.Registry." + type + "CryptPasswords");

if (!cryptPasswords.empty())
{
Expand All @@ -760,9 +758,9 @@ NodeService::initializeCommunicator(int& argc, char* argv[], const Initializatio
initData.properties->setProperty("Ice.Admin.Endpoints", "");

//
// Enable Admin unless explicitely disabled (or enabled) in configuration
// Enable Admin unless explicitly disabled (or enabled) in configuration
//
if (initData.properties->getProperty("Ice.Admin.Enabled").empty())
if (initData.properties->getIceProperty("Ice.Admin.Enabled").empty())
{
initData.properties->setProperty("Ice.Admin.Enabled", "1");
}
Expand Down Expand Up @@ -813,8 +811,8 @@ main(int argc, char* argv[])
#endif
{
NodeService svc;
// Initialize the service with a Properties object with the correct property prefix enabled.
// Initialize the service with a Properties object with the correct property prefixes enabled.
Ice::InitializationData initData;
initData.properties = make_shared<Properties>(vector<string>{"IceGrid"});
initData.properties = make_shared<Properties>(vector<string>{"IceGrid", "IceGridAdmin"});
return svc.main(argc, argv, initData);
}
6 changes: 3 additions & 3 deletions cpp/src/IceGrid/IceGridRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ RegistryService::initializeCommunicator(int& argc, char* argv[], const Initializ

if (initData.properties->getProperty(verifier).empty())
{
string cryptPasswords = initData.properties->getProperty("IceGrid.Registry." + *p + "CryptPasswords");
string cryptPasswords = initData.properties->getIceProperty("IceGrid.Registry." + *p + "CryptPasswords");

if (!cryptPasswords.empty())
{
Expand All @@ -180,15 +180,15 @@ RegistryService::initializeCommunicator(int& argc, char* argv[], const Initializ
//
// Enable Admin unless explicitly disabled (or enabled) in configuration
//
if (initData.properties->getProperty("Ice.Admin.Enabled").empty())
if (initData.properties->getIceProperty("Ice.Admin.Enabled").empty())
{
initData.properties->setProperty("Ice.Admin.Enabled", "1");
}

// Turn-off the inactivity timeout for the IceGrid.Registry.Client object adapter unless the application sets this
// property. That's because the IceGrid.Registry.Client object adapter hosts connection-bound sessions
// (admin sessions and resource allocation sessions).
if (initData.properties->getProperty("IceGrid.Registry.Client.Connection.InactivityTimeout").empty())
if (initData.properties->getIceProperty("IceGrid.Registry.Client.Connection.InactivityTimeout").empty())
{
initData.properties->setProperty("IceGrid.Registry.Client.Connection.InactivityTimeout", "0");
}
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/IceGrid/InternalRegistryI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ InternalRegistryI::getFilePath(const string& filename) const
string file;
if (filename == "stderr")
{
file = _database->getCommunicator()->getProperties()->getProperty("Ice.StdErr");
file = _database->getCommunicator()->getProperties()->getIceProperty("Ice.StdErr");
if (file.empty())
{
throw FileNotAvailableException("Ice.StdErr configuration property is not set");
}
}
else if (filename == "stdout")
{
file = _database->getCommunicator()->getProperties()->getProperty("Ice.StdOut");
file = _database->getCommunicator()->getProperties()->getIceProperty("Ice.StdOut");
if (file.empty())
{
throw FileNotAvailableException("Ice.StdOut configuration property is not set");
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/IceGrid/NodeI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,15 +780,15 @@ NodeI::getFilePath(const string& filename) const
string file;
if (filename == "stderr")
{
file = _communicator->getProperties()->getProperty("Ice.StdErr");
file = _communicator->getProperties()->getIceProperty("Ice.StdErr");
if (file.empty())
{
throw FileNotAvailableException("Ice.StdErr configuration property is not set");
}
}
else if (filename == "stdout")
{
file = _communicator->getProperties()->getProperty("Ice.StdOut");
file = _communicator->getProperties()->getIceProperty("Ice.StdOut");
if (file.empty())
{
throw FileNotAvailableException("Ice.StdOut configuration property is not set");
Expand Down
34 changes: 17 additions & 17 deletions cpp/src/IceGrid/RegistryI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,47 +182,47 @@ RegistryI::startImpl()
//
// Check that required properties are set and valid.
//
if (properties->getProperty("IceGrid.Registry.Client.Endpoints").empty())
if (properties->getIceProperty("IceGrid.Registry.Client.Endpoints").empty())
{
Error out(_communicator->getLogger());
out << "property `IceGrid.Registry.Client.Endpoints' is not set";
return false;
}

if (properties->getProperty("IceGrid.Registry.Server.Endpoints").empty())
if (properties->getIceProperty("IceGrid.Registry.Server.Endpoints").empty())
{
Error out(_communicator->getLogger());
out << "property `IceGrid.Registry.Server.Endpoints' is not set";
return false;
}

if (properties->getProperty("IceGrid.Registry.Internal.Endpoints").empty())
if (properties->getIceProperty("IceGrid.Registry.Internal.Endpoints").empty())
{
Error out(_communicator->getLogger());
out << "property `IceGrid.Registry.Internal.Endpoints' is not set";
return false;
}

if (!properties->getProperty("IceGrid.Registry.SessionManager.Endpoints").empty())
if (!properties->getIceProperty("IceGrid.Registry.SessionManager.Endpoints").empty())
{
if (!_nowarn)
{
Warning out(_communicator->getLogger());
out << "session manager endpoints `IceGrid.Registry.SessionManager.Endpoints' enabled";
if (properties->getPropertyAsInt("IceGrid.Registry.SessionFilters") <= 0)
if (properties->getIcePropertyAsInt("IceGrid.Registry.SessionFilters") <= 0)
{
out << " (with Glacier2 filters disabled)";
}
}
}

if (!properties->getProperty("IceGrid.Registry.AdminSessionManager.Endpoints").empty())
if (!properties->getIceProperty("IceGrid.Registry.AdminSessionManager.Endpoints").empty())
{
if (!_nowarn)
{
Warning out(_communicator->getLogger());
out << "administrative session manager endpoints `IceGrid.Registry.AdminSessionManager.Endpoints' enabled";
if (properties->getPropertyAsInt("IceGrid.Registry.AdminSessionFilters") <= 0)
if (properties->getIcePropertyAsInt("IceGrid.Registry.AdminSessionFilters") <= 0)
{
out << " (with Glacier2 filters disabled)";
}
Expand All @@ -241,7 +241,7 @@ RegistryI::startImpl()

properties->setProperty("IceGrid.Registry.AdminSessionManager.AdapterId", "");
properties->setProperty("IceGrid.Registry.Internal.AdapterId", "");
if (properties->getProperty("IceGrid.Registry.Internal.MessageSizeMax").empty())
if (properties->getIceProperty("IceGrid.Registry.Internal.MessageSizeMax").empty())
{
properties->setProperty("IceGrid.Registry.Internal.MessageSizeMax", "0"); // No limit on internal data exchanged
}
Expand Down Expand Up @@ -298,7 +298,7 @@ RegistryI::startImpl()
//
// Create the registry database.
//
string dbPath = _communicator->getProperties()->getProperty("IceGrid.Registry.LMDB.Path");
string dbPath = _communicator->getProperties()->getIceProperty("IceGrid.Registry.LMDB.Path");
if (dbPath.empty())
{
Ice::Error out(_communicator->getLogger());
Expand All @@ -323,7 +323,7 @@ RegistryI::startImpl()
//
try
{
string endpoints = properties->getProperty("IceGrid.Registry.Client.Endpoints");
string endpoints = properties->getIceProperty("IceGrid.Registry.Client.Endpoints");
string strPrx = _instanceName + "/Locator:" + endpoints;
_communicator->stringToProxy(strPrx)->ice_invocationTimeout(5s)->ice_ping();

Expand Down Expand Up @@ -494,7 +494,7 @@ RegistryI::startImpl()
//
// Setup file user account mapper object if the property is set.
//
string userAccountFileProperty = properties->getProperty("IceGrid.Registry.UserAccounts");
string userAccountFileProperty = properties->getIceProperty("IceGrid.Registry.UserAccounts");
if (!userAccountFileProperty.empty())
{
try
Expand Down Expand Up @@ -598,7 +598,7 @@ RegistryI::startImpl()
}
int port = properties->getIcePropertyAsInt("IceGrid.Registry.Discovery.Port");
string interface = properties->getIceProperty("IceGrid.Registry.Discovery.Interface");
if (properties->getProperty("IceGrid.Registry.Discovery.Endpoints").empty())
if (properties->getIceProperty("IceGrid.Registry.Discovery.Endpoints").empty())
{
ostringstream os;
os << "udp -h \"" << address << "\" -p " << port;
Expand All @@ -621,7 +621,7 @@ RegistryI::startImpl()
{
Warning out(_communicator->getLogger());
out << "failed to join the multicast group for IceGrid discovery:\n";
out << "endpoints = " << properties->getProperty("IceGrid.Registry.Discovery.Endpoints") << "\n";
out << "endpoints = " << properties->getIceProperty("IceGrid.Registry.Discovery.Endpoints") << "\n";
out << ex;
}
}
Expand Down Expand Up @@ -652,7 +652,7 @@ RegistryI::startImpl()
void
RegistryI::setupLocatorRegistry()
{
const bool dynReg = _communicator->getProperties()->getPropertyAsInt("IceGrid.Registry.DynamicRegistration") > 0;
const bool dynReg = _communicator->getProperties()->getIcePropertyAsInt("IceGrid.Registry.DynamicRegistration") > 0;
Identity locatorRegId = {"LocatorRegistry", _instanceName};
_serverAdapter->add(make_shared<LocatorRegistryI>(_database, dynReg, _master, *_session), locatorRegId);
}
Expand Down Expand Up @@ -703,7 +703,7 @@ RegistryI::setupInternalRegistry()
//
// Create Admin
//
if (_communicator->getProperties()->getPropertyAsInt("Ice.Admin.Enabled") > 0)
if (_communicator->getProperties()->getIcePropertyAsInt("Ice.Admin.Enabled") > 0)
{
// Replace Admin facet
auto origProcess = dynamic_pointer_cast<Process>(_communicator->removeAdminFacet("Process"));
Expand All @@ -722,7 +722,7 @@ RegistryI::setupClientSessionFactory(const IceGrid::LocatorPrx& locator)

ObjectAdapterPtr adapter;
shared_ptr<SessionServantManager> servantManager;
if (!properties->getProperty("IceGrid.Registry.SessionManager.Endpoints").empty())
if (!properties->getIceProperty("IceGrid.Registry.SessionManager.Endpoints").empty())
{
adapter = _communicator->createObjectAdapter("IceGrid.Registry.SessionManager");
servantManager = make_shared<
Expand Down Expand Up @@ -770,7 +770,7 @@ RegistryI::setupAdminSessionFactory(

ObjectAdapterPtr adapter;
shared_ptr<SessionServantManager> servantManager;
if (!properties->getProperty("IceGrid.Registry.AdminSessionManager.Endpoints").empty())
if (!properties->getIceProperty("IceGrid.Registry.AdminSessionManager.Endpoints").empty())
{
adapter = _communicator->createObjectAdapter("IceGrid.Registry.AdminSessionManager");
servantManager = make_shared<SessionServantManager>(
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/IceGrid/ReplicaSessionI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ ReplicaSessionI::setAdapterDirectProxy(
optional<Ice::ObjectPrx> proxy,
const Ice::Current&)
{
if (_database->getCommunicator()->getProperties()->getPropertyAsInt("IceGrid.Registry.DynamicRegistration") <= 0)
if (_database->getCommunicator()->getProperties()->getIcePropertyAsInt("IceGrid.Registry.DynamicRegistration") <= 0)
{
throw AdapterNotExistException();
}
Expand Down
Loading

0 comments on commit 1720369

Please sign in to comment.