diff options
author | Benoit Foucher <benoit@zeroc.com> | 2012-11-16 15:52:28 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2012-11-16 15:52:28 +0100 |
commit | 44bd0c07505a6841f4315eedcab0a228a6819852 (patch) | |
tree | 7e5d08f5beb7941ea68f8659217efd2379e8acc4 /java/src | |
parent | More changes to windows installers (diff) | |
download | ice-44bd0c07505a6841f4315eedcab0a228a6819852.tar.bz2 ice-44bd0c07505a6841f4315eedcab0a228a6819852.tar.xz ice-44bd0c07505a6841f4315eedcab0a228a6819852.zip |
Added support for proxy-options to IceGrid adapter, replica group and object descriptors
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/IceGridGUI/Application/Adapter.java | 2 | ||||
-rw-r--r-- | java/src/IceGridGUI/Application/AdapterEditor.java | 26 | ||||
-rw-r--r-- | java/src/IceGridGUI/Application/Communicator.java | 7 | ||||
-rw-r--r-- | java/src/IceGridGUI/Application/PropertiesField.java | 1 | ||||
-rw-r--r-- | java/src/IceGridGUI/Application/ReplicaGroup.java | 10 | ||||
-rw-r--r-- | java/src/IceGridGUI/Application/ReplicaGroupEditor.java | 36 | ||||
-rw-r--r-- | java/src/IceGridGUI/Application/ReplicaGroups.java | 1 | ||||
-rw-r--r-- | java/src/IceGridGUI/Application/TreeNode.java | 6 | ||||
-rw-r--r-- | java/src/IceInternal/LocatorInfo.java | 10 |
9 files changed, 80 insertions, 19 deletions
diff --git a/java/src/IceGridGUI/Application/Adapter.java b/java/src/IceGridGUI/Application/Adapter.java index d06147971fd..f6be64c83d9 100644 --- a/java/src/IceGridGUI/Application/Adapter.java +++ b/java/src/IceGridGUI/Application/Adapter.java @@ -115,6 +115,7 @@ class Adapter extends TreeNode implements DescriptorHolder { removeProperty(_descriptor.name + ".Endpoints"); removeProperty(_descriptor.name + ".PublishedEndpoints"); + removeProperty(_descriptor.name + ".ProxyOptions"); ((Communicator)_parent).getAdapters().destroyChild(this); } @@ -167,6 +168,7 @@ class Adapter extends TreeNode implements DescriptorHolder String oaPrefix = _descriptor.name + "."; attributes.add(createAttribute("endpoints", getProperty(oaPrefix + "Endpoints"))); + attributes.add(createAttribute("proxy-options", getProperty(oaPrefix + "ProxyOptions"))); attributes.add(createAttribute("id", _descriptor.id)); if(_descriptor.registerProcess) { diff --git a/java/src/IceGridGUI/Application/AdapterEditor.java b/java/src/IceGridGUI/Application/AdapterEditor.java index 57af6662444..ead80289271 100644 --- a/java/src/IceGridGUI/Application/AdapterEditor.java +++ b/java/src/IceGridGUI/Application/AdapterEditor.java @@ -37,8 +37,8 @@ class AdapterEditor extends CommunicatorChildEditor { AdapterEditor() { - _objects = new ArrayMapField(this, true, "Identity", "Type", "Property"); - _allocatables = new ArrayMapField(this, true, "Identity", "Type", "Property"); + _objects = new ArrayMapField(this, true, "Identity", "Type", "Property", "Proxy Options"); + _allocatables = new ArrayMapField(this, true, "Identity", "Type", "Property", "Proxy Options"); // // Create buttons @@ -151,6 +151,9 @@ class AdapterEditor extends CommunicatorChildEditor + " ssl -h venus.foo.com (accepts SSL connections instead of plain TCP)" + "</html>"); + _proxyOptions.getDocument().addDocumentListener(_updateListener); + _proxyOptions.setToolTipText("<html>The proxy options used for proxies created by the object adapter.</html>"); + _description.getDocument().addDocumentListener(_updateListener); _description.setToolTipText("An optional description for this object adapter"); @@ -238,6 +241,10 @@ class AdapterEditor extends CommunicatorChildEditor builder.append(_publishedEndpoints, 3); builder.nextLine(); + builder.append("Proxy Options" ); + builder.append(_proxyOptions, 3); + builder.nextLine(); + builder.append("", _registerProcess); builder.nextLine(); builder.append("", _serverLifetime); @@ -287,6 +294,7 @@ class AdapterEditor extends CommunicatorChildEditor { adapter.removeProperty(_oldName + ".Endpoints"); adapter.removeProperty(_oldName + ".PublishedEndpoints"); + adapter.removeProperty(_oldName + ".ProxyOptions"); _oldName = name; } @@ -302,6 +310,11 @@ class AdapterEditor extends CommunicatorChildEditor adapter.setProperty(name + ".PublishedEndpoints", published.toString().trim()); } + if(!_proxyOptions.getText().trim().isEmpty()) + { + adapter.setProperty(name + ".ProxyOptions", _proxyOptions.getText().trim()); + } + // // Set all objects and allocatables properties // @@ -516,6 +529,10 @@ class AdapterEditor extends CommunicatorChildEditor _publishedEndpoints.setEnabled(isEditable); _publishedEndpoints.setEditable(isEditable); + _proxyOptions.setEnabled(true); + _proxyOptions.setEditable(true); + _proxyOptions.setText(Utils.substitute(adapter.getProperty(oaPrefix + "ProxyOptions"), resolver)); + // // Objects // @@ -549,7 +566,7 @@ class AdapterEditor extends CommunicatorChildEditor for(ObjectDescriptor p : objects) { String k = Ice.Util.identityToString(p.id); - result.put(k, new String[]{p.type, getAdapter().lookupPropertyValue(k)}); + result.put(k, new String[]{p.type, getAdapter().lookupPropertyValue(k),p.proxyOptions}); } return result; } @@ -564,7 +581,7 @@ class AdapterEditor extends CommunicatorChildEditor { Ice.Identity id = Ice.Util.stringToIdentity(p.getKey()); String[] val = p.getValue(); - result.add(new ObjectDescriptor(id, val[0])); + result.add(new ObjectDescriptor(id, val[0], val[2])); } catch(Ice.IdentityParseException ex) { @@ -611,6 +628,7 @@ class AdapterEditor extends CommunicatorChildEditor private JTextField _endpoints = new JTextField(20); private JComboBox<Object> _publishedEndpoints = new JComboBox<Object>(new Object[]{PUBLISH_ACTUAL}); + private JTextField _proxyOptions = new JTextField(20); private JTextField _currentStatus = new JTextField(20); private JTextField _currentEndpoints = new JTextField(20); diff --git a/java/src/IceGridGUI/Application/Communicator.java b/java/src/IceGridGUI/Application/Communicator.java index 738140f1f0b..6d17944b29b 100644 --- a/java/src/IceGridGUI/Application/Communicator.java +++ b/java/src/IceGridGUI/Application/Communicator.java @@ -543,6 +543,13 @@ abstract class Communicator extends TreeNode implements DescriptorHolder { parentProperties.put(newName + ".PublishedEndpoints", val); } + + key = descriptor.name + ".ProxyOptions"; + val = parentProperties.remove(key); + if(val != null) + { + parentProperties.put(newName + ".ProxyOptions", val); + } } descriptor.name = newName; diff --git a/java/src/IceGridGUI/Application/PropertiesField.java b/java/src/IceGridGUI/Application/PropertiesField.java index c76356015b0..f3e280703d1 100644 --- a/java/src/IceGridGUI/Application/PropertiesField.java +++ b/java/src/IceGridGUI/Application/PropertiesField.java @@ -108,6 +108,7 @@ public class PropertiesField extends JTable { hiddenPropertyNames.add(p.name + ".Endpoints"); hiddenPropertyNames.add(p.name + ".PublishedEndpoints"); + hiddenPropertyNames.add(p.name + ".ProxyOptions"); for(ObjectDescriptor q : p.objects) { diff --git a/java/src/IceGridGUI/Application/ReplicaGroup.java b/java/src/IceGridGUI/Application/ReplicaGroup.java index 0abb730ec13..88012316e01 100644 --- a/java/src/IceGridGUI/Application/ReplicaGroup.java +++ b/java/src/IceGridGUI/Application/ReplicaGroup.java @@ -125,6 +125,7 @@ class ReplicaGroup extends TreeNode _descriptor.description = clone.description; _descriptor.objects = clone.objects; _descriptor.loadBalancing = clone.loadBalancing; + _descriptor.proxyOptions = clone.proxyOptions; } void commit() @@ -160,9 +161,14 @@ class ReplicaGroup extends TreeNode { java.util.List<String[]> attributes = new java.util.LinkedList<String[]>(); attributes.add(createAttribute("id", _descriptor.id)); - + if(_descriptor.proxyOptions.length() > 0) + { + attributes.add(createAttribute("proxy-options", _descriptor.proxyOptions)); + } + if(_descriptor.loadBalancing == null && - _descriptor.description.length() == 0 && _descriptor.objects.isEmpty()) + _descriptor.description.length() == 0 && + _descriptor.objects.isEmpty()) { writer.writeElement("replica-group", attributes); } diff --git a/java/src/IceGridGUI/Application/ReplicaGroupEditor.java b/java/src/IceGridGUI/Application/ReplicaGroupEditor.java index b5a4ecee570..cb700de7f28 100644 --- a/java/src/IceGridGUI/Application/ReplicaGroupEditor.java +++ b/java/src/IceGridGUI/Application/ReplicaGroupEditor.java @@ -173,7 +173,7 @@ class ReplicaGroupEditor extends Editor ReplicaGroupEditor() { - _objects = new SimpleMapField(this, true, "Identity", "Type"); + _objects = new ArrayMapField(this, true, "Identity", "Type", "Proxy Options"); // // load balancing @@ -215,6 +215,9 @@ class ReplicaGroupEditor extends Editor JTextField loadSampleTextField = (JTextField)_loadSample.getEditor().getEditorComponent(); loadSampleTextField.getDocument().addDocumentListener(_updateListener); _loadSample.setToolTipText("Use the load average or CPU usage over the last 1, 5 or 15 minutes?"); + + _proxyOptions.getDocument().addDocumentListener(_updateListener); + _proxyOptions.setToolTipText("The proxy options used for proxies created by IceGrid for the replica group"); } void writeDescriptor() @@ -224,7 +227,7 @@ class ReplicaGroupEditor extends Editor descriptor.id = _id.getText().trim(); descriptor.description = _description.getText(); descriptor.objects = _objectList; - + descriptor.proxyOptions = _proxyOptions.getText().trim(); Object loadBalancing = _loadBalancing.getSelectedItem(); if(loadBalancing == ORDERED) { @@ -271,6 +274,10 @@ class ReplicaGroupEditor extends Editor builder.nextRow(2); builder.nextLine(); + builder.append("Proxy Options"); + builder.append(_proxyOptions, 3); + builder.nextLine(); + builder.append("Well-known Objects"); builder.nextLine(); builder.append(""); @@ -338,6 +345,9 @@ class ReplicaGroupEditor extends Editor _description.setEditable(isEditable); _description.setOpaque(isEditable); + _proxyOptions.setText(descriptor.proxyOptions); + _proxyOptions.setEditable(isEditable); + _objects.set(objectDescriptorSeqToMap(descriptor.objects), resolver, isEditable); _loadBalancing.setEnabled(true); @@ -396,28 +406,28 @@ class ReplicaGroupEditor extends Editor return (ReplicaGroup)_target; } - private java.util.Map<String, String> objectDescriptorSeqToMap(java.util.List<ObjectDescriptor> objects) + private java.util.Map<String, String[]> objectDescriptorSeqToMap(java.util.List<ObjectDescriptor> objects) { - java.util.Map<String, String> result = new java.util.TreeMap<String, String>(); + java.util.Map<String, String[]> result = new java.util.TreeMap<String, String[]>(); for(ObjectDescriptor p : objects) { - result.put(Ice.Util.identityToString(p.id), p.type); + result.put(Ice.Util.identityToString(p.id), new String[]{p.type, p.proxyOptions}); } return result; } - private java.util.LinkedList<ObjectDescriptor> mapToObjectDescriptorSeq(java.util.Map<String, String> map) + private java.util.LinkedList<ObjectDescriptor> mapToObjectDescriptorSeq(java.util.Map<String, String[]> map) { String badIdentities = ""; java.util.LinkedList<ObjectDescriptor> result = new java.util.LinkedList<ObjectDescriptor>(); - for(java.util.Map.Entry<String, String> p : map.entrySet()) + for(java.util.Map.Entry<String, String[]> p : map.entrySet()) { try { Ice.Identity id = Ice.Util.stringToIdentity(p.getKey()); - String type = p.getValue(); - result.add(new ObjectDescriptor(id, type)); + String[] val = p.getValue(); + result.add(new ObjectDescriptor(id, val[0], val[1])); } catch(Ice.IdentityParseException ex) { @@ -447,14 +457,18 @@ class ReplicaGroupEditor extends Editor private JTextField _id = new JTextField(20); private JTextArea _description = new JTextArea(3, 20); + private JTextField _proxyOptions = new JTextField(20); - private JComboBox<String> _loadBalancing = new JComboBox<String>(new String[] {ADAPTIVE, ORDERED, RANDOM, ROUND_ROBIN}); + private JComboBox<String> _loadBalancing = new JComboBox<String>(new String[] {ADAPTIVE, + ORDERED, + RANDOM, + ROUND_ROBIN}); private JTextField _nReplicas = new JTextField(20); private JLabel _loadSampleLabel; private JComboBox<String> _loadSample = new JComboBox<String>(new String[] {"1", "5", "15"}); - private SimpleMapField _objects; + private ArrayMapField _objects; private java.util.LinkedList<ObjectDescriptor> _objectList; } diff --git a/java/src/IceGridGUI/Application/ReplicaGroups.java b/java/src/IceGridGUI/Application/ReplicaGroups.java index 0c81f778007..c7363cced3b 100644 --- a/java/src/IceGridGUI/Application/ReplicaGroups.java +++ b/java/src/IceGridGUI/Application/ReplicaGroups.java @@ -64,6 +64,7 @@ class ReplicaGroups extends ListTreeNode ReplicaGroupDescriptor( makeNewChildId("NewReplicaGroup"), null, + "", new java.util.LinkedList<ObjectDescriptor>(), ""); diff --git a/java/src/IceGridGUI/Application/TreeNode.java b/java/src/IceGridGUI/Application/TreeNode.java index e99d227220a..d8511a38707 100644 --- a/java/src/IceGridGUI/Application/TreeNode.java +++ b/java/src/IceGridGUI/Application/TreeNode.java @@ -140,6 +140,7 @@ public abstract class TreeNode extends TreeNodeBase for(AdapterDescriptor p : adapters) { hiddenPropertyNames.add(p.name + ".Endpoints"); + hiddenPropertyNames.add(p.name + ".ProxyOptions"); for(ObjectDescriptor q : p.objects) { @@ -278,7 +279,10 @@ public abstract class TreeNode extends TreeNodeBase attributes.add(createAttribute("property", prop)); } } - + if(p.proxyOptions != null && !p.proxyOptions.equals("")) + { + attributes.add(createAttribute("proxy-options", p.proxyOptions)); + } writer.writeElement(elt, attributes); } } diff --git a/java/src/IceInternal/LocatorInfo.java b/java/src/IceInternal/LocatorInfo.java index 9639351b661..5355d3759ac 100644 --- a/java/src/IceInternal/LocatorInfo.java +++ b/java/src/IceInternal/LocatorInfo.java @@ -26,7 +26,15 @@ public final class LocatorInfo if(proxy != null) { Reference r = ((Ice.ObjectPrxHelperBase)proxy).__reference(); - if(!r.isIndirect()) + if(_ref.isWellKnown() && !Protocol.isSupported(_ref.getEncoding(), r.getEncoding())) + { + // + // If a well-known proxy and the returned proxy encoding isn't + // supported, we're done: there are no compatible endpoints + // we can use. + // + } + else if(!r.isIndirect()) { endpoints = r.getEndpoints(); } |