diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2006-12-18 17:06:44 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2006-12-18 17:06:44 +0000 |
commit | d07fdae285690f699a70f97f36232e516dcad2bc (patch) | |
tree | c239def689c5e6cc53ac76dbe3e60ec11c306964 /cs/src | |
parent | Fixed tryLock() comment (diff) | |
download | ice-d07fdae285690f699a70f97f36232e516dcad2bc.tar.bz2 ice-d07fdae285690f699a70f97f36232e516dcad2bc.tar.xz ice-d07fdae285690f699a70f97f36232e516dcad2bc.zip |
Object adapter properties now prefixed by "Ice.OA."
Diffstat (limited to 'cs/src')
-rwxr-xr-x | cs/src/Ice/CommunicatorI.cs | 2 | ||||
-rwxr-xr-x | cs/src/Ice/ObjectAdapterI.cs | 124 | ||||
-rw-r--r-- | cs/src/Ice/PropertyNames.cs | 51 |
3 files changed, 139 insertions, 38 deletions
diff --git a/cs/src/Ice/CommunicatorI.cs b/cs/src/Ice/CommunicatorI.cs index 3f94dddfd42..c2b5f744426 100755 --- a/cs/src/Ice/CommunicatorI.cs +++ b/cs/src/Ice/CommunicatorI.cs @@ -54,7 +54,7 @@ namespace Ice public ObjectAdapter createObjectAdapter(string name) { - return createObjectAdapterWithEndpoints(name, getProperties().getProperty(name + ".Endpoints")); + return instance_.objectAdapterFactory().createObjectAdapter(name, "", null); } public ObjectAdapter createObjectAdapterWithEndpoints(string name, string endpoints) diff --git a/cs/src/Ice/ObjectAdapterI.cs b/cs/src/Ice/ObjectAdapterI.cs index e2657eb31cb..a50898f9fb4 100755 --- a/cs/src/Ice/ObjectAdapterI.cs +++ b/cs/src/Ice/ObjectAdapterI.cs @@ -69,7 +69,12 @@ namespace Ice if(!_noConfig) { Properties properties = instance_.initializationData().properties; - registerProcess = properties.getPropertyAsInt(_name + ".RegisterProcess") > 0; + // + // DEPRECATED PROPERTY: Remove extra code in future release. + // + registerProcess = properties.getPropertyAsIntWithDefault( + _propertyPrefix + _name + ".RegisterProcess", + properties.getPropertyAsInt(_name + ".RegisterProcess")) > 0; printAdapterReady = properties.getPropertyAsInt("Ice.PrintAdapterReady") > 0; } } @@ -715,27 +720,51 @@ namespace Ice } // + // DEPRECATED PROPERTIES: Remove extra code in future release. + // + + // // Make sure named adapter has configuration. // + Properties properties = instance_.initializationData().properties; + string[] oldProps = filterProperties(_name + "."); if(endpointInfo.Length == 0 && router == null) { - PropertyDict oaProps = instance.initializationData().properties.getPropertiesForPrefix(_name + "."); - if(oaProps.Count == 0) + string[] props = filterProperties(_propertyPrefix + _name + "."); + if(props.Length == 0 && oldProps.Length == 0) { InitializationException ex = new InitializationException(); ex.reason = "Object adapter \"" + _name + "\" requires configuration."; throw ex; } } + + if(oldProps.Length != 0) + { + string message = "The following properties have been deprecated, please prepend \"Ice.OA.\":"; + for(int i = 0; i < oldProps.Length; ++i) + { + message += "\n " + oldProps[i]; + } + instance_.initializationData().logger.warning(message); + } - _id = instance.initializationData().properties.getProperty(name + ".AdapterId"); - _replicaGroupId = instance.initializationData().properties.getProperty(name + ".ReplicaGroupId"); + _id = properties.getPropertyWithDefault(_propertyPrefix + _name + ".AdapterId", + properties.getProperty(_name + ".AdapterId")); + _replicaGroupId = properties.getPropertyWithDefault(_propertyPrefix + _name + ".ReplicaGroupId", + properties.getProperty(_name + ".ReplicaGroupId")); try { if(router == null) { - router = RouterPrxHelper.uncheckedCast(instance_.proxyFactory().propertyToProxy(name + ".Router")); + router = RouterPrxHelper.uncheckedCast( + instance_.proxyFactory().propertyToProxy(_propertyPrefix + _name + ".Router")); + if(router == null) + { + router = RouterPrxHelper.uncheckedCast( + instance_.proxyFactory().propertyToProxy(_name + ".Router")); + } } if(router != null) { @@ -804,7 +833,17 @@ namespace Ice // The connection factory might change it, for example, to // fill in the real port number. // - ArrayList endpoints = parseEndpoints(endpointInfo); + ArrayList endpoints; + if(endpointInfo.Length == 0) + { + endpoints = parseEndpoints(properties.getPropertyWithDefault( + _propertyPrefix + _name + ".Endpoints", + properties.getProperty(_name + ".Endpoints"))); + } + else + { + endpoints = parseEndpoints(endpointInfo); + } for(int i = 0; i < endpoints.Count; ++i) { IceInternal.EndpointI endp = (IceInternal.EndpointI)endpoints[i]; @@ -817,7 +856,7 @@ namespace Ice if(tl.network >= 2) { instance_.initializationData().logger.trace(tl.networkCat, - "created adapter `" + name + "' without endpoints"); + "created adapter `" + _name + "' without endpoints"); } } @@ -825,7 +864,8 @@ namespace Ice // Parse published endpoints. If set, these are used in proxies // instead of the connection factory endpoints. // - string endpts = instance_.initializationData().properties.getProperty(name + ".PublishedEndpoints"); + string endpts = properties.getPropertyWithDefault(_propertyPrefix + _name + ".PublishedEndpoints", + properties.getProperty(_name + ".PublishedEndpoints")); _publishedEndpoints = parseEndpoints(endpts); if(_publishedEndpoints.Count == 0) { @@ -849,12 +889,17 @@ namespace Ice _publishedEndpoints = tmp; } - string locatorProperty = name + ".Locator"; - if(instance_.initializationData().properties.getProperty(locatorProperty).Length > 0) + string locatorProperty = _propertyPrefix + _name + ".Locator"; + if(properties.getProperty(locatorProperty).Length > 0) { setLocator(LocatorPrxHelper.uncheckedCast( instance_.proxyFactory().propertyToProxy(locatorProperty))); } + else if(properties.getProperty(_name + ".Locator").Length > 0) + { + setLocator(LocatorPrxHelper.uncheckedCast( + instance_.proxyFactory().propertyToProxy(_name + ".Locator"))); + } else { setLocator(instance_.referenceFactory().getDefaultLocator()); @@ -862,12 +907,26 @@ namespace Ice if(!instance_.threadPerConnection()) { - int size = instance_.initializationData().properties.getPropertyAsInt(_name + ".ThreadPool.Size"); - int sizeMax = - instance_.initializationData().properties.getPropertyAsInt(_name + ".ThreadPool.SizeMax"); - if(size > 0 || sizeMax > 0) + if(properties.getProperty(_propertyPrefix + _name + ".ThreadPool.Size").Length != 0 || + properties.getProperty(_propertyPrefix + _name + ".ThreadPool.SizeMax").Length != 0) + { + int size = properties.getPropertyAsInt(_propertyPrefix + _name + ".ThreadPool.Size"); + int sizeMax = properties.getPropertyAsInt(_propertyPrefix + _name + ".ThreadPool.SizeMax"); + if(size > 0 || sizeMax > 0) + { + _threadPool = + new IceInternal.ThreadPool(instance_, _propertyPrefix + _name + ".ThreadPool", 0); + } + } + else { - _threadPool = new IceInternal.ThreadPool(instance_, _name + ".ThreadPool", 0); + int size = properties.getPropertyAsInt(_name + ".ThreadPool.Size"); + int sizeMax = properties.getPropertyAsInt(_name + ".ThreadPool.SizeMax"); + if(size > 0 || sizeMax > 0) + { + _threadPool = + new IceInternal.ThreadPool(instance_, _name + ".ThreadPool", 0); + } } } } @@ -1168,6 +1227,37 @@ namespace Ice } } + static private readonly string[] _suffixes = + { + "AdapterId", + "Endpoints", + "Locator", + "PublishedEndpoints", + "RegisterProcess", + "ReplicaGroupId", + "Router", + "ThreadPool.Size", + "ThreadPool.SizeMax", + "ThreadPool.SizeWarn", + "ThreadPool.StackSize" + }; + + private string[] + filterProperties(string prefix) + { + ArrayList propertySet = new ArrayList(); + PropertyDict props = instance_.initializationData().properties.getPropertiesForPrefix(prefix); + for(int i = 0; i < _suffixes.Length; ++i) + { + if(props.Contains(prefix + _suffixes[i])) + { + propertySet.Add(prefix + _suffixes[i]); + } + } + + return (string[])propertySet.ToArray(typeof(string)); + } + private sealed class ProcessI : ProcessDisp_ { public ProcessI(Communicator communicator) @@ -1220,6 +1310,6 @@ namespace Ice private bool _waitForActivate; private bool _waitForDeactivate; private bool _noConfig; + static private string _propertyPrefix = "Ice.OA."; } - } diff --git a/cs/src/Ice/PropertyNames.cs b/cs/src/Ice/PropertyNames.cs index 34b02d34f6a..88acc2f65fd 100644 --- a/cs/src/Ice/PropertyNames.cs +++ b/cs/src/Ice/PropertyNames.cs @@ -7,7 +7,7 @@ // // ********************************************************************** -// Generated by makeprops.py from file `./config/PropertyNames.def', Mon Dec 11 11:13:50 2006 +// Generated by makeprops.py from file `../config/PropertyNames.def', Mon Dec 18 13:40:21 2006 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -52,12 +52,23 @@ namespace IceInternal @"^Ice\.MonitorConnections$", @"^Ice\.Nohup$", @"^Ice\.NullHandleAbort$", + @"^Ice\.OA\.[^\s]+\.AdapterId$", + @"^Ice\.OA\.[^\s]+\.Endpoints$", + @"^Ice\.OA\.[^\s]+\.Locator$", + @"^Ice\.OA\.[^\s]+\.PublishedEndpoints$", + @"^Ice\.OA\.[^\s]+\.RegisterProcess$", + @"^Ice\.OA\.[^\s]+\.ReplicaGroupId$", + @"^Ice\.OA\.[^\s]+\.Router$", + @"^Ice\.OA\.[^\s]+\.ThreadPool\.Size$", + @"^Ice\.OA\.[^\s]+\.ThreadPool\.SizeMax$", + @"^Ice\.OA\.[^\s]+\.ThreadPool\.SizeWarn$", + @"^Ice\.OA\.[^\s]+\.ThreadPool\.StackSize$", @"^Ice\.Override\.Compress$", @"^Ice\.Override\.ConnectTimeout$", @"^Ice\.Override\.Timeout$", @"^Ice\.Override\.Secure$", - @"^Ice\.Package\.[^\s.]+$", - @"^Ice\.Plugin\.[^\s.]+$", + @"^Ice\.Package\.[^\s]+$", + @"^Ice\.Plugin\.[^\s]+$", @"^Ice\.PluginLoadOrder$", @"^Ice\.PrintAdapterReady$", @"^Ice\.PrintProcessId$", @@ -101,7 +112,7 @@ namespace IceInternal @"^IceBox\.InstanceName$", @"^IceBox\.LoadOrder$", @"^IceBox\.PrintServicesReady$", - @"^IceBox\.Service\.[^\s.]+$", + @"^IceBox\.Service\.[^\s]+$", @"^IceBox\.ServiceManager\.AdapterId$", @"^IceBox\.ServiceManager\.ReplicaGroupId$", @"^IceBox\.ServiceManager\.Endpoints$", @@ -111,7 +122,7 @@ namespace IceInternal @"^IceBox\.ServiceManager\.ThreadPool\.SizeMax$", @"^IceBox\.ServiceManager\.ThreadPool\.SizeWarn$", @"^IceBox\.ServiceManager\.ThreadPool\.StackSize$", - @"^IceBox\.UseSharedCommunicator\.[^\s.]+$", + @"^IceBox\.UseSharedCommunicator\.[^\s]+$", null }; @@ -253,10 +264,10 @@ namespace IceInternal @"^IceSSL\.CheckCRL$", @"^IceSSL\.Ciphers$", @"^IceSSL\.DefaultDir$", - @"^IceSSL\.DH\.[^\s.]+$", + @"^IceSSL\.DH\.[^\s]+$", @"^IceSSL\.EntropyDaemon$", - @"^IceSSL\.FindCert\.[^\s.]+\.[^\s.]+$", - @"^IceSSL\.ImportCert\.[^\s.]+\.[^\s.]+$", + @"^IceSSL\.FindCert\.[^\s]+$", + @"^IceSSL\.ImportCert\.[^\s]+$", @"^IceSSL\.KeyFile$", @"^IceSSL\.Keystore$", @"^IceSSL\.KeystorePassword$", @@ -274,7 +285,7 @@ namespace IceInternal @"^IceSSL\.TrustOnly$", @"^IceSSL\.TrustOnly\.Client$", @"^IceSSL\.TrustOnly\.Server$", - @"^IceSSL\.TrustOnly\.Server\.[^\s.]+$", + @"^IceSSL\.TrustOnly\.Server\.[^\s]+$", null }; @@ -392,17 +403,17 @@ namespace IceInternal public static string[] FreezeProps = { - @"^Freeze\.DbEnv\.[^\s.]+\.CheckpointPeriod$", - @"^Freeze\.DbEnv\.[^\s.]+\.DbHome$", - @"^Freeze\.DbEnv\.[^\s.]+\.DbPrivate$", - @"^Freeze\.DbEnv\.[^\s.]+\.DbRecoverFatal$", - @"^Freeze\.DbEnv\.[^\s.]+\.OldLogsAutoDelete$", - @"^Freeze\.DbEnv\.[^\s.]+\.PeriodicCheckpointMinSize$", - @"^Freeze\.Evictor\.[^\s.]+\.[^\s.]+\.MaxTxSize$", - @"^Freeze\.Evictor\.[^\s.]+\.[^\s.]+\.SavePeriod$", - @"^Freeze\.Evictor\.[^\s.]+\.[^\s.]+\.SaveSizeTrigger$", - @"^Freeze\.Evictor\.[^\s.]+\.[^\s.]+\.StreamTimeout$", - @"^Freeze\.Evictor\.[^\s.]+\.[^\s.]+\.PopulateEmptyIndices$", + @"^Freeze\.DbEnv\.[^\s]+\.CheckpointPeriod$", + @"^Freeze\.DbEnv\.[^\s]+\.DbHome$", + @"^Freeze\.DbEnv\.[^\s]+\.DbPrivate$", + @"^Freeze\.DbEnv\.[^\s]+\.DbRecoverFatal$", + @"^Freeze\.DbEnv\.[^\s]+\.OldLogsAutoDelete$", + @"^Freeze\.DbEnv\.[^\s]+\.PeriodicCheckpointMinSize$", + @"^Freeze\.Evictor\.[^\s]+\.MaxTxSize$", + @"^Freeze\.Evictor\.[^\s]+\.SavePeriod$", + @"^Freeze\.Evictor\.[^\s]+\.SaveSizeTrigger$", + @"^Freeze\.Evictor\.[^\s]+\.StreamTimeout$", + @"^Freeze\.Evictor\.[^\s]+\.PopulateEmptyIndices$", @"^Freeze\.Evictor\.UseNonmutating$", @"^Freeze\.Trace\.DbEnv$", @"^Freeze\.Trace\.Evictor$", |