diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/PropertiesI.cpp | 211 | ||||
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 15 |
2 files changed, 226 insertions, 0 deletions
diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp index e9ac4cffddd..55b49505b04 100644 --- a/cpp/src/Ice/PropertiesI.cpp +++ b/cpp/src/Ice/PropertiesI.cpp @@ -94,11 +94,222 @@ Ice::PropertiesI::getPropertiesForPrefix(const string& prefix) return result; } +// +// Valid properties for each application. +// A '*' character is a wildcard. If used, it must appear at the end of the string. +// Examples: "Ice.Foo.*" allows all properties with that prefix, such as "Ice.Foo.Bar". +// "Ice.Foo*" allows properties such as "Ice.Foo.Bar" and "Ice.FooBar". +// +static const string iceProps[] = { + "ChangeUser", + "Config", + "ConnectionIdleTime", + "Daemon", + "DaemonNoChdir", + "DaemonNoClose", + "Default.Host", + "Default.Locator", + "Default.Protocol", + "Default.Router", + "Logger.Timestamp", + "MonitorConnections", + "NullHandleAbort", + "Override.Compress", + "Override.Timeout", + "Plugin.*", + "PrintAdapterReady", + "PrintProcessId", + "ProgramName", + "RetryIntervals", + "ServerIdleTime", + "ThreadPool.Client.Size", + "ThreadPool.Client.SizeMax", + "ThreadPool.Client.SizeWarn", + "ThreadPool.Server.Size", + "Trace.Network", + "Trace.Protocol", + "Trace.Retry", + "UseSyslog", + "Warn.AMICallback", + "Warn.Connections", + "Warn.Dispatch", + "Warn.Leaks" + }; + +static const string iceSSLProps[] = { + "Client.CertificateVerifier", + "Client.CertPath.*", + "Client.Config", + "Client.Handshake.Retries", + "Client.Overrides.CACertificate", + "Client.Overrides.DSA.Certificate", + "Client.Overrides.DSA.PrivateKey", + "Client.Overrides.RSA.Certificate", + "Client.Overrides.RSA.PrivateKey", + "Client.Passphrase.Retries", + "Server.CertificateVerifier", + "Server.CertPath.*", + "Server.Config", + "Server.Overrides.CACertificate", + "Server.Overrides.DSA.Certificate", + "Server.Overrides.DSA.PrivateKey", + "Server.Overrides.RSA.Certificate", + "Server.Overrides.RSA.PrivateKey", + "Server.Passphrase.Retries", + "Trace.Security" + }; + +static const string iceBoxProps[] = { + "DBEnvName.*", + "PrintServicesReady", + "Service.*", + "ServiceManager.AdapterId", + "ServiceManager.Endpoints", + "ServiceManager.Identity", + "UseSharedCommunicator.*" + }; + +static const string icePackProps[] = { + "Node.AdapterId", + "Node.CollocateRegistry", + "Node.Data", + "Node.Endpoints", + "Node.Name", + "Node.PropertiesOverride", + "Node.Trace.Activator", + "Node.Trace.Adapter", + "Node.Trace.Server", + "Node.WaitTime", + "Registry.Admin.AdapterId", + "Registry.Admin.Endpoints", + "Registry.Client.Endpoints", + "Registry.Data", + "Registry.DynamicRegistration", + "Registry.Internal.AdapterId", + "Registry.Internal.Endpoints", + "Registry.Server.Endpoints", + "Registry.Trace.AdapterRegistry", + "Registry.Trace.NodeRegistry", + "Registry.Trace.ObjectRegistry", + "Registry.Trace.ServerRegistry" + }; + +static const string iceStormProps[] = { + "Flush.Timeout", + "Publish.Endpoints", + "TopicManager.Endpoints", + "TopicManager.Proxy", + "Trace.Flush", + "Trace.Subscriber", + "Trace.Topic", + "Trace.TopicManager" + }; + +static const string glacierProps[] = { + "Router.AcceptCert", + "Router.AllowCategories", + "Router.Client.BatchSleepTime", + "Router.Client.Endpoints", + "Router.Client.ForwardContext", + "Router.Endpoints", + "Router.Identity", + "Router.PrintProxyOnFd", + "Router.Server.BatchSleepTime", + "Router.Server.Endpoints", + "Router.Server.ForwardContext", + "Router.SessionManager", + "Router.Trace.Client", + "Router.Trace.RoutingTable", + "Router.Trace.Server", + "Router.UserId", + "Starter.AddUserToAllowCategories", + "Starter.Certificate.BitStrength", + "Starter.Certificate.CommonName", + "Starter.Certificate.Country", + "Starter.Certificate.IssuedAdjust", + "Starter.Certificate.Locality", + "Starter.Certificate.Organization", + "Starter.Certificate.OrganizationalUnit", + "Starter.Certificate.SecondsValid", + "Starter.Certificate.StateProvince", + "Starter.CryptPasswords", + "Starter.Endpoints", + "Starter.PasswordVerifier", + "Starter.PropertiesOverride", + "Starter.RouterPath", + "Starter.StartupTimeout", + "Starter.Trace" + }; + +static const string freezeProps[] = { + "Trace.DB", + "Trace.Evictor" + }; + +struct PropertyValues { + string prefix; + const string* props; + size_t propsSize; +}; + +// +// Array of valid properties for each application. +// +static const PropertyValues validProps[] = { + { "Freeze", freezeProps, sizeof(freezeProps) / sizeof(freezeProps[0]) }, + { "Glacier", glacierProps, sizeof(glacierProps) / sizeof(glacierProps[0]) }, + { "IceBox", iceBoxProps, sizeof(iceBoxProps) / sizeof(iceBoxProps[0]) }, + { "Ice", iceProps, sizeof(iceProps) / sizeof(iceProps[0]) }, + { "IcePack", icePackProps, sizeof(icePackProps) / sizeof(icePackProps[0]) }, + { "IceSSL", iceSSLProps, sizeof(iceSSLProps) / sizeof(iceSSLProps[0]) }, + { "IceStorm", iceStormProps, sizeof(iceStormProps) / sizeof(iceStormProps[0]) } + }; + +static const size_t validPropsSize = sizeof(validProps) / sizeof(validProps[0]); + void Ice::PropertiesI::setProperty(const string& key, const string& value) { + // + // Check if the property is legal. (We write to cerr instead of using + // a logger because no logger may be established at the time the property + // is parsed.) + // + string::size_type dotPos = key.find('.'); + if(dotPos != string::npos) + { + string prefix = key.substr(0, dotPos); + bool found = false; + for(size_t i = 0; i != validPropsSize && !found; ++i) + { + if(validProps[i].prefix == prefix) + { + string suffix = key.substr(++dotPos, string::npos); + for(size_t j = 0; j != validProps[i].propsSize && !found; ++j) + { + string::size_type starPos = validProps[i].props[j].find('*'); + if(starPos == string::npos) + { + found = validProps[i].props[j].compare(suffix) == 0; + } + else + { + found = validProps[i].props[j].compare(0, starPos - 1, suffix.substr(0, starPos - 1)) == 0; + } + } + if(!found) + { + cerr << "warning: unknown property: " << key << endl; + } + } + } + } + IceUtil::Mutex::Lock sync(*this); + // + // Set or clear the property. + // if(!key.empty()) { if(!value.empty()) diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index b546bd10445..afb68d357ae 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -3620,6 +3620,21 @@ Slice::Operation::setExceptionList(const ExceptionList& el) _throws = el; // + // Local interfaces and classes cannot have an exception specification. + // + if(el.size() != 0) { + ClassDefPtr parent = ClassDefPtr::dynamicCast(container()); + assert(parent); + if(parent->isLocal()) + { + string msg = "operation `" + name() + "' cannot have a throws clause because it is an operation on a "; + msg += parent->kindOf(); + _unit->error(msg); + return; + } + } + + // // Check that no exception occurs more than once in the throws clause // ExceptionList uniqueExceptions = el; |