From d07fdae285690f699a70f97f36232e516dcad2bc Mon Sep 17 00:00:00 2001 From: Dwayne Boone Date: Mon, 18 Dec 2006 17:06:44 +0000 Subject: Object adapter properties now prefixed by "Ice.OA." --- java/src/Ice/CommunicatorI.java | 2 +- java/src/Ice/ObjectAdapterI.java | 116 ++++++++++++++++++--- java/src/IceBox/Admin.java | 14 ++- java/src/IceGridGUI/Application/PlainServer.java | 4 +- .../IceGridGUI/Application/PropertiesField.java | 4 +- java/src/IceGridGUI/Application/TreeNode.java | 2 +- .../IceGridGUI/LiveDeployment/AdapterEditor.java | 4 +- java/src/IceInternal/PropertyNames.java | 51 +++++---- 8 files changed, 153 insertions(+), 44 deletions(-) (limited to 'java/src') diff --git a/java/src/Ice/CommunicatorI.java b/java/src/Ice/CommunicatorI.java index 04114b7557a..25d51cb72db 100644 --- a/java/src/Ice/CommunicatorI.java +++ b/java/src/Ice/CommunicatorI.java @@ -62,7 +62,7 @@ public final class CommunicatorI extends LocalObjectImpl implements Communicator public ObjectAdapter createObjectAdapter(String name) { - return createObjectAdapterWithEndpoints(name, getProperties().getProperty(name + ".Endpoints")); + return _instance.objectAdapterFactory().createObjectAdapter(name, "", null); } public ObjectAdapter diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java index 17ed667b8ab..c016a5533a0 100644 --- a/java/src/Ice/ObjectAdapterI.java +++ b/java/src/Ice/ObjectAdapterI.java @@ -69,7 +69,11 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt if(!_noConfig) { final 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; } } @@ -707,13 +711,19 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt return; } + // + // DEPRECATED PROPERTIES: Remove extra code in future release. + // + // // Make sure named adapter has some configuration. // + final Properties properties = instance.initializationData().properties; + String[] oldProps = filterProperties(_name + "."); if(endpointInfo.length() == 0 && router == null) { - java.util.Map oaProps = instance.initializationData().properties.getPropertiesForPrefix(_name + "."); - if(oaProps.size() == 0) + String[] props = filterProperties(_propertyPrefix + _name + "."); + if(props.length == 0 && oldProps.length == 0) { InitializationException ex = new InitializationException(); ex.reason = "Object adapter \"" + _name + "\" requires configuration."; @@ -721,14 +731,32 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt } } - _id = instance.initializationData().properties.getProperty(name + ".AdapterId"); - _replicaGroupId = instance.initializationData().properties.getProperty(name + ".ReplicaGroupId"); + 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 = 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) { @@ -796,7 +824,16 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt // The connection factory might change it, for example, to // fill in the real port number. // - java.util.ArrayList endpoints = parseEndpoints(endpointInfo); + java.util.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.size(); ++i) { IceInternal.EndpointI endp = (IceInternal.EndpointI)endpoints.get(i); @@ -817,7 +854,8 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt // 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.size() == 0) { @@ -843,11 +881,16 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt } } - 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()); @@ -855,11 +898,24 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt 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); + } } } } @@ -1144,6 +1200,37 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt } } + static private String[] _suffixes = + { + "AdapterId", + "Endpoints", + "Locator", + "PublishedEndpoints", + "RegisterProcess", + "ReplicaGroupId", + "Router", + "ThreadPool.Size", + "ThreadPool.SizeMax", + "ThreadPool.SizeWarn", + "ThreadPool.StackSize" + }; + + String[] + filterProperties(String prefix) + { + java.util.ArrayList propertySet = new java.util.ArrayList(); + java.util.Map props = _instance.initializationData().properties.getPropertiesForPrefix(prefix); + for(int i = 0; i < _suffixes.length; ++i) + { + if(props.containsKey(prefix + _suffixes[i])) + { + propertySet.add(prefix + _suffixes[i]); + } + } + + return (String[])propertySet.toArray(new String[0]); + } + private static class ProcessI extends _ProcessDisp { ProcessI(Communicator communicator) @@ -1197,4 +1284,5 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt private boolean _waitForActivate; private boolean _waitForDeactivate; private boolean _noConfig; + static private String _propertyPrefix = "Ice.OA."; } diff --git a/java/src/IceBox/Admin.java b/java/src/IceBox/Admin.java index 0bc82241717..04397bb6fdb 100644 --- a/java/src/IceBox/Admin.java +++ b/java/src/IceBox/Admin.java @@ -68,7 +68,12 @@ public final class Admin String managerProxy; if(properties.getProperty("Ice.Default.Locator").length() == 0) { - String managerEndpoints = properties.getProperty("IceBox.ServiceManager.Endpoints"); + // + // DEPREACTED PROPERTIES: Remove extra code in future release. + // + String managerEndpoints = + properties.getPropertyWithDefault("Ice.OA.IceBox.ServiceManager.Endpoints", + properties.getProperty("IceBox.ServiceManager.Endpoints")); if(managerEndpoints.length() == 0) { System.err.println(appName() + ": property `IceBox.ServiceManager.Endpoints' is not set"); @@ -79,7 +84,12 @@ public final class Admin } else { - String managerAdapterId = properties.getProperty("IceBox.ServiceManager.AdapterId"); + // + // DEPREACTED PROPERTIES: Remove extra code in future release. + // + String managerAdapterId = + properties.getPropertyWithDefault("Ice.OA.IceBox.ServiceManager.AdapterId", + properties.getProperty("IceBox.ServiceManager.AdapterId")); if(managerAdapterId.length() == 0) { System.err.println(appName() + ": property `IceBox.ServiceManager.AdapterId' is not set"); diff --git a/java/src/IceGridGUI/Application/PlainServer.java b/java/src/IceGridGUI/Application/PlainServer.java index aa96cb4f8c1..fd854398a79 100755 --- a/java/src/IceGridGUI/Application/PlainServer.java +++ b/java/src/IceGridGUI/Application/PlainServer.java @@ -89,8 +89,8 @@ class PlainServer extends Communicator implements Server { java.util.LinkedList properties = new java.util.LinkedList(); properties.add(new PropertyDescriptor("IceBox.InstanceName", "${server}")); - properties.add(new PropertyDescriptor("IceBox.ServiceManager.Endpoints", "tcp -h 127.0.0.1")); - properties.add(new PropertyDescriptor("IceBox.RegisterProcess", "1")); + properties.add(new PropertyDescriptor("Ice.OA.IceBox.ServiceManager.Endpoints", "tcp -h 127.0.0.1")); + properties.add(new PropertyDescriptor("Ice.OA.IceBox.RegisterProcess", "1")); return new IceBoxDescriptor( new java.util.LinkedList(), diff --git a/java/src/IceGridGUI/Application/PropertiesField.java b/java/src/IceGridGUI/Application/PropertiesField.java index 0de2e690502..f5e84bf10ff 100755 --- a/java/src/IceGridGUI/Application/PropertiesField.java +++ b/java/src/IceGridGUI/Application/PropertiesField.java @@ -94,8 +94,8 @@ public class PropertiesField extends JTable while(p.hasNext()) { AdapterDescriptor ad = (AdapterDescriptor)p.next(); - hiddenPropertyNames.add(ad.name + ".Endpoints"); - hiddenPropertyNames.add(ad.name + ".PublishedEndpoints"); + hiddenPropertyNames.add("Ice.OA." + ad.name + ".Endpoints"); + hiddenPropertyNames.add("Ice.OA." + ad.name + ".PublishedEndpoints"); } } diff --git a/java/src/IceGridGUI/Application/TreeNode.java b/java/src/IceGridGUI/Application/TreeNode.java index b74fd1f2698..d974135f158 100755 --- a/java/src/IceGridGUI/Application/TreeNode.java +++ b/java/src/IceGridGUI/Application/TreeNode.java @@ -141,7 +141,7 @@ public abstract class TreeNode extends TreeNodeBase while(p.hasNext()) { AdapterDescriptor ad = (AdapterDescriptor)p.next(); - hiddenPropertyNames.add(ad.name + ".Endpoints"); + hiddenPropertyNames.add("Ice.OA." + ad.name + ".Endpoints"); } } diff --git a/java/src/IceGridGUI/LiveDeployment/AdapterEditor.java b/java/src/IceGridGUI/LiveDeployment/AdapterEditor.java index aa44dfc081c..e69428ea9b3 100755 --- a/java/src/IceGridGUI/LiveDeployment/AdapterEditor.java +++ b/java/src/IceGridGUI/LiveDeployment/AdapterEditor.java @@ -71,9 +71,9 @@ class AdapterEditor extends Editor java.util.Map properties = adapter.getProperties(); // getId() returns the name of the adapter! - _endpoints.setText(resolver.substitute((String)properties.get(adapter.getId() + ".Endpoints"))); + _endpoints.setText(resolver.substitute((String)properties.get("Ice.OA." + adapter.getId() + ".Endpoints"))); _publishedEndpoints.setText( - resolver.substitute((String)properties.get(adapter.getId() + ".PublishedEndpoints"))); + resolver.substitute((String)properties.get("Ice.OA." + adapter.getId() + ".PublishedEndpoints"))); _registerProcess.setSelected(descriptor.registerProcess); _serverLifetime.setSelected(descriptor.serverLifetime); diff --git a/java/src/IceInternal/PropertyNames.java b/java/src/IceInternal/PropertyNames.java index 5fa671f2164..fc4d6aa214a 100644 --- a/java/src/IceInternal/PropertyNames.java +++ b/java/src/IceInternal/PropertyNames.java @@ -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 @@ public final class PropertyNames "^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 @@ public final class PropertyNames "^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 @@ public final class PropertyNames "^IceBox\\.ServiceManager\\.ThreadPool\\.SizeMax$", "^IceBox\\.ServiceManager\\.ThreadPool\\.SizeWarn$", "^IceBox\\.ServiceManager\\.ThreadPool\\.StackSize$", - "^IceBox\\.UseSharedCommunicator\\.[^\\s.]+$", + "^IceBox\\.UseSharedCommunicator\\.[^\\s]+$", null }; @@ -253,10 +264,10 @@ public final class PropertyNames "^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 @@ public final class PropertyNames "^IceSSL\\.TrustOnly$", "^IceSSL\\.TrustOnly\\.Client$", "^IceSSL\\.TrustOnly\\.Server$", - "^IceSSL\\.TrustOnly\\.Server\\.[^\\s.]+$", + "^IceSSL\\.TrustOnly\\.Server\\.[^\\s]+$", null }; @@ -392,17 +403,17 @@ public final class PropertyNames public static final 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$", -- cgit v1.2.3