Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start using and adding default properties #2146

Merged
merged 6 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"language": "en",
"words": [
"decoratee",
"icegrid",
"ICESTORM",
"nohup",
"nullopt",
"unmarshal",
"unmarshaling"
Expand Down
181 changes: 91 additions & 90 deletions config/PropertyNames.xml

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions cpp/src/Glacier2/Blobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ using namespace Glacier2::Instrumentation;

namespace
{
const string serverForwardContext = "Glacier2.Server.ForwardContext";
const string clientForwardContext = "Glacier2.Client.ForwardContext";
const string serverTraceRequest = "Glacier2.Server.Trace.Request";
const string clientTraceRequest = "Glacier2.Client.Trace.Request";
const string serverTraceOverride = "Glacier2.Server.Trace.Override";
const string clientTraceOverride = "Glacier2.Client.Trace.Override";
constexpr string_view serverForwardContext = "Glacier2.Server.ForwardContext";
constexpr string_view clientForwardContext = "Glacier2.Client.ForwardContext";
constexpr string_view serverTraceRequest = "Glacier2.Server.Trace.Request";
constexpr string_view clientTraceRequest = "Glacier2.Client.Trace.Request";
constexpr string_view serverTraceOverride = "Glacier2.Server.Trace.Override";
constexpr string_view clientTraceOverride = "Glacier2.Client.Trace.Override";
}

Glacier2::Blobject::Blobject(shared_ptr<Instance> instance, ConnectionPtr reverseConnection, const Context& context)
: _instance(std::move(instance)),
_reverseConnection(std::move(reverseConnection)),
_forwardContext(
_reverseConnection ? _instance->properties()->getPropertyAsInt(serverForwardContext) > 0
: _instance->properties()->getPropertyAsInt(clientForwardContext) > 0),
_reverseConnection ? _instance->properties()->getIcePropertyAsInt(serverForwardContext) > 0
: _instance->properties()->getIcePropertyAsInt(clientForwardContext) > 0),
_requestTraceLevel(
_reverseConnection ? _instance->properties()->getPropertyAsInt(serverTraceRequest)
: _instance->properties()->getPropertyAsInt(clientTraceRequest)),
_reverseConnection ? _instance->properties()->getIcePropertyAsInt(serverTraceRequest)
: _instance->properties()->getIcePropertyAsInt(clientTraceRequest)),
_overrideTraceLevel(
reverseConnection ? _instance->properties()->getPropertyAsInt(serverTraceOverride)
: _instance->properties()->getPropertyAsInt(clientTraceOverride)),
reverseConnection ? _instance->properties()->getIcePropertyAsInt(serverTraceOverride)
: _instance->properties()->getIcePropertyAsInt(clientTraceOverride)),
_context(context)
{
auto t = _reverseConnection ? _instance->serverRequestQueueThread() : _instance->clientRequestQueueThread();
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/Glacier2/ClientBlobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Glacier2::ClientBlobject::ClientBlobject(
Glacier2::Blobject(std::move(instance), nullptr, sslContext),
_routingTable(std::move(routingTable)),
_filters(std::move(filters)),
_rejectTraceLevel(_instance->properties()->getPropertyAsInt("Glacier2.Client.Trace.Reject"))
_rejectTraceLevel(_instance->properties()->getIcePropertyAsInt("Glacier2.Client.Trace.Reject"))
{
}

Expand Down
12 changes: 4 additions & 8 deletions cpp/src/Glacier2/FilterManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,13 @@ shared_ptr<Glacier2::FilterManager>
Glacier2::FilterManager::create(shared_ptr<Instance> instance, const string& userId, bool allowAddUser)
{
auto props = instance->properties();
string allow = props->getProperty("Glacier2.Filter.Category.Accept");
string allow = props->getIceProperty("Glacier2.Filter.Category.Accept");
vector<string> allowSeq;
stringToSeq(allow, allowSeq);

if (allowAddUser)
{
int addUserMode = 0;
if (!props->getProperty("Glacier2.Filter.Category.AcceptUser").empty())
{
addUserMode = props->getPropertyAsInt("Glacier2.Filter.Category.AcceptUser");
}
int addUserMode = props->getIcePropertyAsInt("Glacier2.Filter.Category.AcceptUser");

if (addUserMode > 0 && !userId.empty())
{
Expand All @@ -199,15 +195,15 @@ Glacier2::FilterManager::create(shared_ptr<Instance> instance, const string& use
//
// TODO: refactor initialization of filters.
//
allow = props->getProperty("Glacier2.Filter.AdapterId.Accept");
allow = props->getIceProperty("Glacier2.Filter.AdapterId.Accept");
stringToSeq(allow, allowSeq);
auto adapterIdFilter = make_shared<Glacier2::StringSetI>(allowSeq);

//
// TODO: Object id's from configurations?
//
IdentitySeq allowIdSeq;
allow = props->getProperty("Glacier2.Filter.Identity.Accept");
allow = props->getIceProperty("Glacier2.Filter.Identity.Accept");
stringToSeq(allow, allowIdSeq);
auto identityFilter = make_shared<Glacier2::IdentitySetI>(allowIdSeq);

Expand Down
11 changes: 5 additions & 6 deletions cpp/src/Glacier2/Glacier2Router.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ RouterService::start(int argc, char* argv[], int& status)
// Initialize the client object adapter.
//
const string clientEndpointsProperty = "Glacier2.Client.Endpoints";
if (properties->getProperty(clientEndpointsProperty).empty())
if (properties->getIceProperty(clientEndpointsProperty).empty())
{
error("property `" + clientEndpointsProperty + "' is not set");
return false;
Expand All @@ -149,12 +149,12 @@ RouterService::start(int argc, char* argv[], int& status)
//
const string serverEndpointsProperty = "Glacier2.Server.Endpoints";
ObjectAdapterPtr serverAdapter;
if (!properties->getProperty(serverEndpointsProperty).empty())
if (!properties->getIceProperty(serverEndpointsProperty).empty())
{
serverAdapter = communicator()->createObjectAdapter("Glacier2.Server");
}

string instanceName = communicator()->getProperties()->getPropertyWithDefault("Glacier2.InstanceName", "Glacier2");
string instanceName = communicator()->getProperties()->getIceProperty("Glacier2.InstanceName");

vector<string> verifierProperties;
verifierProperties.push_back("Glacier2.PermissionsVerifier");
Expand Down Expand Up @@ -428,10 +428,9 @@ RouterService::initializeCommunicator(
// If Glacier2.PermissionsVerifier is not set and Glacier2.CryptPasswords is set,
// load the Glacier2CryptPermissionsVerifier plug-in
//
string verifier = "Glacier2.PermissionsVerifier";
if (initData.properties->getProperty(verifier).empty())
if (initData.properties->getIceProperty("Glacier2.PermissionsVerifier").empty())
{
string cryptPasswords = initData.properties->getProperty("Glacier2.CryptPasswords");
string cryptPasswords = initData.properties->getIceProperty("Glacier2.CryptPasswords");

if (!cryptPasswords.empty())
{
Expand Down
21 changes: 10 additions & 11 deletions cpp/src/Glacier2/Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ using namespace Glacier2;

namespace
{
const string serverSleepTime = "Glacier2.Server.SleepTime";
const string clientSleepTime = "Glacier2.Client.SleepTime";
const string serverBuffered = "Glacier2.Server.Buffered";
const string clientBuffered = "Glacier2.Client.Buffered";
constexpr string_view serverSleepTime = "Glacier2.Server.SleepTime";
constexpr string_view clientSleepTime = "Glacier2.Client.SleepTime";
constexpr string_view serverBuffered = "Glacier2.Server.Buffered";
constexpr string_view clientBuffered = "Glacier2.Client.Buffered";
}

Glacier2::Instance::Instance(
Expand All @@ -29,16 +29,16 @@ Glacier2::Instance::Instance(
_serverAdapter(std::move(serverAdapter)),
_proxyVerifier(make_shared<ProxyVerifier>(_communicator))
{
if (_properties->getPropertyAsIntWithDefault(serverBuffered, 0) > 0)
if (_properties->getIcePropertyAsInt(serverBuffered) > 0)
{
auto sleepTime = chrono::milliseconds(_properties->getPropertyAsInt(serverSleepTime));
auto sleepTime = chrono::milliseconds(_properties->getIcePropertyAsInt(serverSleepTime));
const_cast<shared_ptr<RequestQueueThread>&>(_serverRequestQueueThread) =
make_shared<RequestQueueThread>(sleepTime);
}

if (_properties->getPropertyAsIntWithDefault(clientBuffered, 0) > 0)
if (_properties->getIcePropertyAsInt(clientBuffered) > 0)
{
auto sleepTime = chrono::milliseconds(_properties->getPropertyAsInt(clientSleepTime));
auto sleepTime = chrono::milliseconds(_properties->getIcePropertyAsInt(clientSleepTime));
const_cast<shared_ptr<RequestQueueThread>&>(_clientRequestQueueThread) =
make_shared<RequestQueueThread>(sleepTime);
}
Expand All @@ -49,9 +49,8 @@ Glacier2::Instance::Instance(
auto o = dynamic_pointer_cast<IceInternal::CommunicatorObserverI>(_communicator->getObserver());
if (o)
{
const_cast<shared_ptr<Instrumentation::RouterObserver>&>(_observer) = make_shared<RouterObserverI>(
o->getFacet(),
_properties->getPropertyWithDefault("Glacier2.InstanceName", "Glacier2"));
const_cast<shared_ptr<Instrumentation::RouterObserver>&>(_observer) =
make_shared<RouterObserverI>(o->getFacet(), _properties->getIceProperty("Glacier2.InstanceName"));
}
}

Expand Down
8 changes: 4 additions & 4 deletions cpp/src/Glacier2/ProxyVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,13 +779,13 @@ namespace Glacier2

Glacier2::ProxyVerifier::ProxyVerifier(CommunicatorPtr communicator)
: _communicator(std::move(communicator)),
_traceLevel(_communicator->getProperties()->getPropertyAsInt("Glacier2.Client.Trace.Reject"))
_traceLevel(_communicator->getProperties()->getIcePropertyAsInt("Glacier2.Client.Trace.Reject"))
{
//
// Evaluation order is dependant on how the rules are stored to the
// rules vectors.
//
string s = _communicator->getProperties()->getProperty("Glacier2.Filter.Address.Accept");
string s = _communicator->getProperties()->getIceProperty("Glacier2.Filter.Address.Accept");
if (s != "")
{
try
Expand All @@ -800,7 +800,7 @@ Glacier2::ProxyVerifier::ProxyVerifier(CommunicatorPtr communicator)
}
}

s = _communicator->getProperties()->getProperty("Glacier2.Filter.Address.Reject");
s = _communicator->getProperties()->getIceProperty("Glacier2.Filter.Address.Reject");
if (s != "")
{
try
Expand All @@ -815,7 +815,7 @@ Glacier2::ProxyVerifier::ProxyVerifier(CommunicatorPtr communicator)
}
}

s = _communicator->getProperties()->getProperty("Glacier2.Filter.ProxySizeMax");
s = _communicator->getProperties()->getIceProperty("Glacier2.Filter.ProxySizeMax");
if (s != "")
{
try
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/Glacier2/RouterI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Glacier2::RouterI::RouterI(
// If Glacier2 will be used with pre 3.2 clients, then the client proxy must be set.
// Otherwise getClientProxy just needs to return a nil proxy.
//
if (_instance->properties()->getPropertyAsInt("Glacier2.ReturnClientProxy") > 0)
if (_instance->properties()->getIcePropertyAsInt("Glacier2.ReturnClientProxy") > 0)
{
const_cast<optional<ObjectPrx>&>(_clientProxy) =
_instance->clientObjectAdapter()->createProxy(stringToIdentity("dummy"));
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/Glacier2/RoutingTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ using namespace Glacier2;

Glacier2::RoutingTable::RoutingTable(CommunicatorPtr communicator, shared_ptr<ProxyVerifier> verifier)
: _communicator(std::move(communicator)),
_traceLevel(_communicator->getProperties()->getPropertyAsInt("Glacier2.Trace.RoutingTable")),
_maxSize(_communicator->getProperties()->getPropertyAsIntWithDefault("Glacier2.RoutingTable.MaxSize", 1000)),
_traceLevel(_communicator->getProperties()->getIcePropertyAsInt("Glacier2.Trace.RoutingTable")),
_maxSize(_communicator->getProperties()->getIcePropertyAsInt("Glacier2.RoutingTable.MaxSize")),
_verifier(std::move(verifier))
{
}
Expand Down
11 changes: 5 additions & 6 deletions cpp/src/Glacier2/SessionRouterI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ CreateSession::CreateSession(shared_ptr<SessionRouterI> sessionRouter, const str
ctx.erase("_con.peerCert");
const_cast<Ice::Current&>(_current).ctx = ctx;

if (_instance->properties()->getPropertyAsInt("Glacier2.AddConnectionContext") > 0)
if (_instance->properties()->getIcePropertyAsInt("Glacier2.AddConnectionContext") > 0)
{
_context["_con.type"] = current.con->type();
{
Expand Down Expand Up @@ -412,7 +412,7 @@ CreateSession::sessionCreated(const optional<SessionPrx>& session)
ident = _control->ice_getIdentity();
}

if (_instance->properties()->getPropertyAsInt("Glacier2.AddConnectionContext") == 1)
if (_instance->properties()->getIcePropertyAsInt("Glacier2.AddConnectionContext") == 1)
{
router = make_shared<RouterI>(_instance, _current.con, _user, session, ident, _filterManager, _context);
}
Expand Down Expand Up @@ -506,8 +506,8 @@ SessionRouterI::SessionRouterI(
optional<SSLPermissionsVerifierPrx> sslVerifier,
optional<SSLSessionManagerPrx> sslSessionManager)
: _instance(std::move(instance)),
_sessionTraceLevel(_instance->properties()->getPropertyAsInt("Glacier2.Trace.Session")),
_rejectTraceLevel(_instance->properties()->getPropertyAsInt("Glacier2.Client.Trace.Reject")),
_sessionTraceLevel(_instance->properties()->getIcePropertyAsInt("Glacier2.Trace.Session")),
_rejectTraceLevel(_instance->properties()->getIcePropertyAsInt("Glacier2.Client.Trace.Reject")),
_verifier(std::move(verifier)),
_sessionManager(std::move(sessionManager)),
_sslVerifier(std::move(sslVerifier)),
Expand Down Expand Up @@ -745,8 +745,7 @@ SessionRouterI::getSessionTimeout(const Ice::Current& current) const
int
SessionRouterI::getACMTimeout(const Ice::Current&) const
{
// TODO: better way to retrieve idle timeout
int idleTimeout = _instance->properties()->getPropertyAsIntWithDefault("Ice.Connection.IdleTimeout", 60);
int idleTimeout = _instance->properties()->getIcePropertyAsInt("Ice.Connection.IdleTimeout");
return _instance->properties()->getPropertyAsIntWithDefault("Glacier2.Client.Connection.IdleTimeout", idleTimeout);
}

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/Glacier2Lib/SessionHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ Glacier2::SessionFactoryHelper::createInitData()
Ice::InitializationData initData = _initData;
initData.properties = initData.properties->clone();

if (initData.properties->getProperty("Ice.Default.Router").size() == 0 && !_identity.name.empty())
if (initData.properties->getIceProperty("Ice.Default.Router").size() == 0 && !_identity.name.empty())
{
initData.properties->setProperty("Ice.Default.Router", createProxyStr(_identity));
}
Expand All @@ -842,7 +842,7 @@ Glacier2::SessionFactoryHelper::createInitData()
// plug-in has already been setup we don't want to override the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems I forgot to remove this, when moving SSL transport into the core.

// configuration so it can be loaded from a custom location.
//
if ((_protocol == "ssl" || _protocol == "wss") && initData.properties->getProperty("Ice.Plugin.IceSSL").empty())
if ((_protocol == "ssl" || _protocol == "wss") && initData.properties->getIceProperty("Ice.Plugin.IceSSL").empty())
{
initData.properties->setProperty("Ice.Plugin.IceSSL", "IceSSL:createIceSSL");
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/Ice/ConnectionFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,7 @@ IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(
_acceptorStarted(false),
_acceptorStopped(false),
_adapter(adapter),
_warn(_instance->initializationData().properties->getPropertyAsInt("Ice.Warn.Connections") > 0),
_warn(_instance->initializationData().properties->getIcePropertyAsInt("Ice.Warn.Connections") > 0),
_state(StateHolding)
{
}
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/Ice/ConnectionI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1904,8 +1904,8 @@ Ice::ConnectionI::ConnectionI(
// suppress inactivity timeout for datagram connections
_inactivityTimeout(endpoint->datagram() ? chrono::seconds::zero() : options.inactivityTimeout),
_removeFromFactory(std::move(removeFromFactory)),
_warn(_instance->initializationData().properties->getPropertyAsInt("Ice.Warn.Connections") > 0),
_warnUdp(_instance->initializationData().properties->getPropertyAsInt("Ice.Warn.Datagrams") > 0),
_warn(_instance->initializationData().properties->getIcePropertyAsInt("Ice.Warn.Connections") > 0),
_warnUdp(_instance->initializationData().properties->getIcePropertyAsInt("Ice.Warn.Datagrams") > 0),
_compressionLevel(1),
_nextRequestId(1),
_asyncRequestsHint(_asyncRequests.end()),
Expand All @@ -1923,7 +1923,7 @@ Ice::ConnectionI::ConnectionI(
const Ice::PropertiesPtr& properties = _instance->initializationData().properties;

int& compressionLevel = const_cast<int&>(_compressionLevel);
compressionLevel = properties->getPropertyAsIntWithDefault("Ice.Compression.Level", 1);
compressionLevel = properties->getIcePropertyAsInt("Ice.Compression.Level");
if (compressionLevel < 1)
{
compressionLevel = 1;
Expand Down
Loading
Loading