summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2007-06-11 14:01:30 +0800
committerMatthew Newhook <matthew@zeroc.com>2007-06-11 14:01:30 +0800
commit65b26c51781207fbeba685a4e3f75a796ac3a798 (patch)
treed612f15e31bca110a2f926b62c9694c5b793cc74 /java/src
parentmore clean stuff (diff)
downloadice-65b26c51781207fbeba685a4e3f75a796ac3a798.tar.bz2
ice-65b26c51781207fbeba685a4e3f75a796ac3a798.tar.xz
ice-65b26c51781207fbeba685a4e3f75a796ac3a798.zip
Merged Bernards change for http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=2204.
Diffstat (limited to 'java/src')
-rwxr-xr-xjava/src/Freeze/KeyCodec.java16
-rwxr-xr-xjava/src/Freeze/SubMap.java936
-rwxr-xr-xjava/src/IceGridGUI/Application/AdapterEditor.java56
-rwxr-xr-xjava/src/IceGridGUI/Application/Nodes.java4
-rwxr-xr-xjava/src/IceGridGUI/Application/ReplicaGroupEditor.java45
-rwxr-xr-xjava/src/IceGridGUI/SimpleInternalFrame.java2
6 files changed, 566 insertions, 493 deletions
diff --git a/java/src/Freeze/KeyCodec.java b/java/src/Freeze/KeyCodec.java
index 956b7e71ec3..98d4fe74a49 100755
--- a/java/src/Freeze/KeyCodec.java
+++ b/java/src/Freeze/KeyCodec.java
@@ -6,11 +6,11 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
-
-package Freeze;
-
-public interface KeyCodec
-{
- public abstract byte[] encodeKey(Object o, Ice.Communicator communicator);
- public abstract Object decodeKey(byte[] b, Ice.Communicator communicator);
-}
+
+package Freeze;
+
+public interface KeyCodec
+{
+ public abstract byte[] encodeKey(Object o, Ice.Communicator communicator);
+ public abstract Object decodeKey(byte[] b, Ice.Communicator communicator);
+}
diff --git a/java/src/Freeze/SubMap.java b/java/src/Freeze/SubMap.java
index 97312f0dcf1..829aa027769 100755
--- a/java/src/Freeze/SubMap.java
+++ b/java/src/Freeze/SubMap.java
@@ -6,471 +6,471 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
-
-package Freeze;
-
-//
-// Sub-map of a Freeze Map or of another submap
-//
-//
-// When it's based of an index, the key is the index key and the value
-// is a Set of Map.Entry.
-//
-
-class SubMap extends java.util.AbstractMap implements java.util.SortedMap
-{
- private class IndexValue extends java.util.AbstractSet
- {
- public java.util.Iterator
- iterator()
- {
- return _index.untypedFind(_myKey, true);
- }
-
- public int
- size()
- {
- return _index.untypedCount(_myKey);
- }
-
- public boolean equals(Object o)
- {
- if(o instanceof IndexValue)
- {
- IndexValue indexValue = (IndexValue)o;
- return indexValue._myKey.equals(_myKey);
- }
- else
- {
- return false;
- }
- }
-
- public int hashCode()
- {
- return _myKey.hashCode();
- }
-
- private IndexValue(Object key)
- {
- _myKey = key;
- }
-
- private Object
- getKey()
- {
- return _myKey;
- }
-
- private Object _myKey;
- }
-
- private class IndexEntry implements java.util.Map.Entry
- {
- public Object getKey()
- {
- return _value.getKey();
- }
-
- public Object getValue()
- {
- return _value;
- }
-
- public Object setValue(Object value)
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean equals(Object o)
- {
- if(o instanceof IndexEntry)
- {
- IndexEntry indexEntry = (IndexEntry)o;
- return indexEntry._value.equals(_value);
- }
- else
- {
- return false;
- }
- }
-
- public int hashCode()
- {
- return _value.hashCode();
- }
-
- SubMap parent()
- {
- return SubMap.this;
- }
-
- private IndexEntry(Object key)
- {
- _value = new IndexValue(key);
- }
-
- private IndexValue _value;
- }
-
- private class IndexIterator implements Map.EntryIterator
- {
- public boolean hasNext()
- {
- return _iterator.hasNext();
- }
-
- public Object next()
- {
- Map.Entry entry = (Map.Entry)_iterator.next();
- return new IndexEntry(_index.decodeKey(entry.getIndexBytes(),
- _map.connection().communicator()));
- }
-
- public void remove()
- {
- _iterator.remove();
- }
-
- public void close()
- {
- _iterator.close();
- }
-
- public void destroy()
- {
- close();
- }
-
- private IndexIterator()
- {
- assert _index != null;
- _iterator = _map.createIterator(_index, _fromKey, _toKey);
- }
-
- Map.EntryIterator _iterator;
- }
-
- SubMap(Map map, Object fromKey, Object toKey)
- {
- _fromKey = fromKey;
- _toKey = toKey;
- _map = map;
- _index = null;
-
- if(fromKey != null && toKey != null)
- {
- if(map.comparator().compare(fromKey, toKey) >= 0)
- {
- throw new IllegalArgumentException();
- }
- }
- }
-
- SubMap(Map.Index index, Object fromKey, Object toKey)
- {
- _fromKey = fromKey;
- _toKey = toKey;
- _map = index.parent();
- _index = index;
-
- if(fromKey != null && toKey != null)
- {
- if(index.comparator().compare(fromKey, toKey) >= 0)
- {
- throw new IllegalArgumentException();
- }
- }
- }
-
- private SubMap(SubMap subMap, Object fromKey, Object toKey)
- {
- _fromKey = fromKey;
- _toKey = toKey;
- _map = subMap._map;
- _index = subMap._index;
-
- if(fromKey != null && toKey != null)
- {
- if(comparator().compare(fromKey, toKey) >= 0)
- {
- throw new IllegalArgumentException();
- }
- }
- }
-
- //
- // SortedMap methods
- //
- public java.util.Comparator comparator()
- {
- if(_index != null)
- {
- return _index.comparator();
- }
- else
- {
- return _map.comparator();
- }
- }
-
- public Object firstKey()
- {
- return _index != null ?
- _index.firstKey(_fromKey, _toKey) :
- _map.firstKey(_fromKey, _toKey);
- }
-
- public Object lastKey()
- {
- return _index != null ?
- _index.lastKey(_fromKey, _toKey) :
- _map.lastKey(_fromKey, _toKey);
- }
-
- public java.util.SortedMap headMap(Object toKey)
- {
- if(toKey == null)
- {
- throw new NullPointerException();
- }
- return new SubMap(this, _fromKey, toKey);
-
- }
-
- public java.util.SortedMap tailMap(Object fromKey)
- {
- if(fromKey == null)
- {
- throw new NullPointerException();
- }
- return new SubMap(this, fromKey, _toKey);
- }
-
- public java.util.SortedMap subMap(Object fromKey, Object toKey)
- {
- if(fromKey == null || toKey == null )
- {
- throw new NullPointerException();
- }
- return new SubMap(this, fromKey, toKey);
- }
-
- //
- // java.util.Map methods
- //
- public java.util.Set
- entrySet()
- {
- if(_entrySet == null)
- {
- _entrySet = new java.util.AbstractSet()
- {
- public java.util.Iterator
- iterator()
- {
- if(_index == null)
- {
- return _map.createIterator(_index, _fromKey, _toKey);
- }
- else
- {
- return new IndexIterator();
- }
- }
-
- public boolean
- contains(Object o)
- {
- if(_index == null)
- {
- //
- // If the main map contains this object, check it's within [fromKey, toKey[
- //
- if(_map.entrySet().contains(o))
- {
- Map.Entry entry = (Map.Entry)o;
- return inRange(entry.getKey());
- }
- else
- {
- return false;
- }
- }
- else
- {
- if(o instanceof IndexEntry)
- {
- IndexEntry indexEntry = (IndexEntry)o;
- return indexEntry.parent() == SubMap.this &&
- _index.containsKey(indexEntry.getKey());
- }
- else
- {
- return false;
- }
- }
- }
-
- public boolean
- remove(Object o)
- {
- if(_index == null)
- {
- if(o instanceof Map.Entry)
- {
- Map.Entry entry = (Map.Entry)o;
- return inRange(entry.getKey()) && _map.entrySet().remove(o);
- }
- else
- {
- return false;
- }
- }
- else
- {
- //
- // Not yet implemented, should remove all objects that
- // match this index-key
- //
- throw new UnsupportedOperationException();
- }
- }
-
- public int
- size()
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean
- isEmpty()
- {
- try
- {
- firstKey();
- return false;
- }
- catch(NoSuchElementException e)
- {
- return true;
- }
- }
- };
- }
- return _entrySet;
- }
-
- //
- // Put is not implemented (you have to put in the main map view)
- //
-
-
- public boolean constainsKey(Object key)
- {
- if(!inRange(key))
- {
- return false;
- }
-
- //
- // Then check if it's in the map
- //
- if(_index == null)
- {
- return _map.containsKey(key);
- }
- else
- {
- return _index.containsKey(key);
- }
- }
-
-
- public Object
- get(Object key)
- {
- if(!inRange(key))
- {
- return null;
- }
-
- if(_index == null)
- {
- return _map.get(key);
- }
- else
- {
- if(_index.containsKey(key))
- {
- return new IndexValue(key);
- }
- else
- {
- return null;
- }
- }
- }
-
- public Object
- remove(Object key)
- {
- if(!inRange(key))
- {
- return null;
- }
-
- if(_index == null)
- {
- return _map.remove(key);
- }
- else
- {
- //
- // Not yet implemented
- //
- throw new UnsupportedOperationException();
- }
- }
-
- public boolean
- fastRemove(Object key)
- {
- if(!inRange(key))
- {
- return false;
- }
-
- if(_index == null)
- {
- return _map.fastRemove(key);
- }
- else
- {
- //
- // Not yet implemented
- //
- throw new UnsupportedOperationException();
- }
- }
-
-
- private boolean inRange(Object key)
- {
- if(_fromKey != null && comparator().compare(_fromKey, key) > 0)
- {
- return false;
- }
- if(_toKey != null && comparator().compare(key, _toKey) >= 0)
- {
- return false;
- }
- return true;
- }
-
- private final Object _fromKey;
- private final Object _toKey;
- private final Map _map;
- private final Map.Index _index;
- private java.util.Set _entrySet;
-}
+
+package Freeze;
+
+//
+// Sub-map of a Freeze Map or of another submap
+//
+//
+// When it's based of an index, the key is the index key and the value
+// is a Set of Map.Entry.
+//
+
+class SubMap extends java.util.AbstractMap implements java.util.SortedMap
+{
+ private class IndexValue extends java.util.AbstractSet
+ {
+ public java.util.Iterator
+ iterator()
+ {
+ return _index.untypedFind(_myKey, true);
+ }
+
+ public int
+ size()
+ {
+ return _index.untypedCount(_myKey);
+ }
+
+ public boolean equals(Object o)
+ {
+ if(o instanceof IndexValue)
+ {
+ IndexValue indexValue = (IndexValue)o;
+ return indexValue._myKey.equals(_myKey);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public int hashCode()
+ {
+ return _myKey.hashCode();
+ }
+
+ private IndexValue(Object key)
+ {
+ _myKey = key;
+ }
+
+ private Object
+ getKey()
+ {
+ return _myKey;
+ }
+
+ private Object _myKey;
+ }
+
+ private class IndexEntry implements java.util.Map.Entry
+ {
+ public Object getKey()
+ {
+ return _value.getKey();
+ }
+
+ public Object getValue()
+ {
+ return _value;
+ }
+
+ public Object setValue(Object value)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean equals(Object o)
+ {
+ if(o instanceof IndexEntry)
+ {
+ IndexEntry indexEntry = (IndexEntry)o;
+ return indexEntry._value.equals(_value);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public int hashCode()
+ {
+ return _value.hashCode();
+ }
+
+ SubMap parent()
+ {
+ return SubMap.this;
+ }
+
+ private IndexEntry(Object key)
+ {
+ _value = new IndexValue(key);
+ }
+
+ private IndexValue _value;
+ }
+
+ private class IndexIterator implements Map.EntryIterator
+ {
+ public boolean hasNext()
+ {
+ return _iterator.hasNext();
+ }
+
+ public Object next()
+ {
+ Map.Entry entry = (Map.Entry)_iterator.next();
+ return new IndexEntry(_index.decodeKey(entry.getIndexBytes(),
+ _map.connection().communicator()));
+ }
+
+ public void remove()
+ {
+ _iterator.remove();
+ }
+
+ public void close()
+ {
+ _iterator.close();
+ }
+
+ public void destroy()
+ {
+ close();
+ }
+
+ private IndexIterator()
+ {
+ assert _index != null;
+ _iterator = _map.createIterator(_index, _fromKey, _toKey);
+ }
+
+ Map.EntryIterator _iterator;
+ }
+
+ SubMap(Map map, Object fromKey, Object toKey)
+ {
+ _fromKey = fromKey;
+ _toKey = toKey;
+ _map = map;
+ _index = null;
+
+ if(fromKey != null && toKey != null)
+ {
+ if(map.comparator().compare(fromKey, toKey) >= 0)
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+
+ SubMap(Map.Index index, Object fromKey, Object toKey)
+ {
+ _fromKey = fromKey;
+ _toKey = toKey;
+ _map = index.parent();
+ _index = index;
+
+ if(fromKey != null && toKey != null)
+ {
+ if(index.comparator().compare(fromKey, toKey) >= 0)
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+
+ private SubMap(SubMap subMap, Object fromKey, Object toKey)
+ {
+ _fromKey = fromKey;
+ _toKey = toKey;
+ _map = subMap._map;
+ _index = subMap._index;
+
+ if(fromKey != null && toKey != null)
+ {
+ if(comparator().compare(fromKey, toKey) >= 0)
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+
+ //
+ // SortedMap methods
+ //
+ public java.util.Comparator comparator()
+ {
+ if(_index != null)
+ {
+ return _index.comparator();
+ }
+ else
+ {
+ return _map.comparator();
+ }
+ }
+
+ public Object firstKey()
+ {
+ return _index != null ?
+ _index.firstKey(_fromKey, _toKey) :
+ _map.firstKey(_fromKey, _toKey);
+ }
+
+ public Object lastKey()
+ {
+ return _index != null ?
+ _index.lastKey(_fromKey, _toKey) :
+ _map.lastKey(_fromKey, _toKey);
+ }
+
+ public java.util.SortedMap headMap(Object toKey)
+ {
+ if(toKey == null)
+ {
+ throw new NullPointerException();
+ }
+ return new SubMap(this, _fromKey, toKey);
+
+ }
+
+ public java.util.SortedMap tailMap(Object fromKey)
+ {
+ if(fromKey == null)
+ {
+ throw new NullPointerException();
+ }
+ return new SubMap(this, fromKey, _toKey);
+ }
+
+ public java.util.SortedMap subMap(Object fromKey, Object toKey)
+ {
+ if(fromKey == null || toKey == null )
+ {
+ throw new NullPointerException();
+ }
+ return new SubMap(this, fromKey, toKey);
+ }
+
+ //
+ // java.util.Map methods
+ //
+ public java.util.Set
+ entrySet()
+ {
+ if(_entrySet == null)
+ {
+ _entrySet = new java.util.AbstractSet()
+ {
+ public java.util.Iterator
+ iterator()
+ {
+ if(_index == null)
+ {
+ return _map.createIterator(_index, _fromKey, _toKey);
+ }
+ else
+ {
+ return new IndexIterator();
+ }
+ }
+
+ public boolean
+ contains(Object o)
+ {
+ if(_index == null)
+ {
+ //
+ // If the main map contains this object, check it's within [fromKey, toKey[
+ //
+ if(_map.entrySet().contains(o))
+ {
+ Map.Entry entry = (Map.Entry)o;
+ return inRange(entry.getKey());
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ if(o instanceof IndexEntry)
+ {
+ IndexEntry indexEntry = (IndexEntry)o;
+ return indexEntry.parent() == SubMap.this &&
+ _index.containsKey(indexEntry.getKey());
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+
+ public boolean
+ remove(Object o)
+ {
+ if(_index == null)
+ {
+ if(o instanceof Map.Entry)
+ {
+ Map.Entry entry = (Map.Entry)o;
+ return inRange(entry.getKey()) && _map.entrySet().remove(o);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ //
+ // Not yet implemented, should remove all objects that
+ // match this index-key
+ //
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ public int
+ size()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean
+ isEmpty()
+ {
+ try
+ {
+ firstKey();
+ return false;
+ }
+ catch(NoSuchElementException e)
+ {
+ return true;
+ }
+ }
+ };
+ }
+ return _entrySet;
+ }
+
+ //
+ // Put is not implemented (you have to put in the main map view)
+ //
+
+
+ public boolean constainsKey(Object key)
+ {
+ if(!inRange(key))
+ {
+ return false;
+ }
+
+ //
+ // Then check if it's in the map
+ //
+ if(_index == null)
+ {
+ return _map.containsKey(key);
+ }
+ else
+ {
+ return _index.containsKey(key);
+ }
+ }
+
+
+ public Object
+ get(Object key)
+ {
+ if(!inRange(key))
+ {
+ return null;
+ }
+
+ if(_index == null)
+ {
+ return _map.get(key);
+ }
+ else
+ {
+ if(_index.containsKey(key))
+ {
+ return new IndexValue(key);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ public Object
+ remove(Object key)
+ {
+ if(!inRange(key))
+ {
+ return null;
+ }
+
+ if(_index == null)
+ {
+ return _map.remove(key);
+ }
+ else
+ {
+ //
+ // Not yet implemented
+ //
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ public boolean
+ fastRemove(Object key)
+ {
+ if(!inRange(key))
+ {
+ return false;
+ }
+
+ if(_index == null)
+ {
+ return _map.fastRemove(key);
+ }
+ else
+ {
+ //
+ // Not yet implemented
+ //
+ throw new UnsupportedOperationException();
+ }
+ }
+
+
+ private boolean inRange(Object key)
+ {
+ if(_fromKey != null && comparator().compare(_fromKey, key) > 0)
+ {
+ return false;
+ }
+ if(_toKey != null && comparator().compare(key, _toKey) >= 0)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ private final Object _fromKey;
+ private final Object _toKey;
+ private final Map _map;
+ private final Map.Index _index;
+ private java.util.Set _entrySet;
+}
diff --git a/java/src/IceGridGUI/Application/AdapterEditor.java b/java/src/IceGridGUI/Application/AdapterEditor.java
index 86162008c8f..0463e1e5cbf 100755
--- a/java/src/IceGridGUI/Application/AdapterEditor.java
+++ b/java/src/IceGridGUI/Application/AdapterEditor.java
@@ -19,6 +19,7 @@ import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
+import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
@@ -194,8 +195,8 @@ class AdapterEditor extends CommunicatorChildEditor
descriptor.priority = _priority.getText().trim();
descriptor.registerProcess = _registerProcess.isSelected();
descriptor.serverLifetime = _serverLifetime.isSelected();
- descriptor.objects = mapToObjectDescriptorSeq(_objects.get());
- descriptor.allocatables = mapToObjectDescriptorSeq(_allocatables.get());
+ descriptor.objects = _objectList;
+ descriptor.allocatables = _allocatableList;
}
boolean isSimpleUpdate()
@@ -413,6 +414,23 @@ class AdapterEditor extends CommunicatorChildEditor
protected boolean validate()
{
+ //
+ // First validate stringified identities
+ //
+ _objectList = mapToObjectDescriptorSeq(_objects.get());
+
+ if(_objectList == null)
+ {
+ return false;
+ }
+
+ _allocatableList = mapToObjectDescriptorSeq(_allocatables.get());
+
+ if(_allocatableList == null)
+ {
+ return false;
+ }
+
return check(new String[]{
"Adapter Name", _name.getText().trim(),
"Adapter ID", getIdAsString(),
@@ -560,17 +578,39 @@ class AdapterEditor extends CommunicatorChildEditor
private java.util.LinkedList mapToObjectDescriptorSeq(java.util.Map map)
{
+ String badIdentities = "";
java.util.LinkedList result = new java.util.LinkedList();
java.util.Iterator p = map.entrySet().iterator();
+
while(p.hasNext())
{
java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- Ice.Identity id =
- Ice.Util.stringToIdentity((String)entry.getKey());
- String[] val = (String[])entry.getValue();
- result.add(new ObjectDescriptor(id, val[0]));
+ try
+ {
+ Ice.Identity id = Ice.Util.stringToIdentity((String)entry.getKey());
+ String[] val = (String[])entry.getValue();
+ result.add(new ObjectDescriptor(id, val[0]));
+ }
+ catch(Ice.IdentityParseException ex)
+ {
+ badIdentities += "- " + (String)entry.getKey() + "\n";
+ }
+ }
+
+ if(!badIdentities.equals(""))
+ {
+ JOptionPane.showMessageDialog(
+ _target.getCoordinator().getMainFrame(),
+ "The following identities could not be parsed properly:\n" + badIdentities,
+ "Validation failed",
+ JOptionPane.ERROR_MESSAGE);
+
+ return null;
+ }
+ else
+ {
+ return result;
}
- return result;
}
private String _defaultAdapterId = "";
@@ -605,7 +645,9 @@ class AdapterEditor extends CommunicatorChildEditor
private JCheckBox _serverLifetime;
private MapField _objects;
+ private java.util.LinkedList _objectList;
private MapField _allocatables;
+ private java.util.LinkedList _allocatableList;
static private final Object PUBLISH_ACTUAL = new Object()
{
diff --git a/java/src/IceGridGUI/Application/Nodes.java b/java/src/IceGridGUI/Application/Nodes.java
index 5da3acee87d..5bfeab237f4 100755
--- a/java/src/IceGridGUI/Application/Nodes.java
+++ b/java/src/IceGridGUI/Application/Nodes.java
@@ -224,8 +224,8 @@ class Nodes extends ListTreeNode
NodeDescriptor nodeDescriptor = new NodeDescriptor(update.variables,
update.serverInstances,
update.servers,
- update.loadFactor.value,
- update.description.value,
+ update.loadFactor == null ? "" : update.loadFactor.value,
+ update.description == null ? "" : update.description.value,
new java.util.HashMap());
_descriptors.put(update.name, nodeDescriptor);
node = new Node(false, this, update.name, nodeDescriptor);
diff --git a/java/src/IceGridGUI/Application/ReplicaGroupEditor.java b/java/src/IceGridGUI/Application/ReplicaGroupEditor.java
index d0762ed687a..18477b511fd 100755
--- a/java/src/IceGridGUI/Application/ReplicaGroupEditor.java
+++ b/java/src/IceGridGUI/Application/ReplicaGroupEditor.java
@@ -229,7 +229,7 @@ class ReplicaGroupEditor extends Editor
descriptor.id = _id.getText().trim();
descriptor.description = _description.getText();
- descriptor.objects = mapToObjectDescriptorSeq(_objects.get());
+ descriptor.objects = _objectList;
Object loadBalancing = _loadBalancing.getSelectedItem();
if(loadBalancing == ORDERED)
@@ -316,6 +316,16 @@ class ReplicaGroupEditor extends Editor
protected boolean validate()
{
+ //
+ // First validate stringified identities
+ //
+ _objectList = mapToObjectDescriptorSeq(_objects.get());
+
+ if(_objectList == null)
+ {
+ return false;
+ }
+
return check(new String[]{"Replica Group ID", _id.getText().trim()});
}
@@ -419,19 +429,39 @@ class ReplicaGroupEditor extends Editor
private java.util.LinkedList mapToObjectDescriptorSeq(java.util.Map map)
{
+ String badIdentities = "";
java.util.LinkedList result = new java.util.LinkedList();
java.util.Iterator p = map.entrySet().iterator();
+
while(p.hasNext())
{
java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- Ice.Identity id =
- Ice.Util.stringToIdentity((String)entry.getKey());
- String type = (String)entry.getValue();
- result.add(new ObjectDescriptor(id, type));
+ try
+ {
+ Ice.Identity id = Ice.Util.stringToIdentity((String)entry.getKey());
+ String type = (String)entry.getValue();
+ result.add(new ObjectDescriptor(id, type));
+ }
+ catch(Ice.IdentityParseException ex)
+ {
+ badIdentities += "- " + (String)entry.getKey() + "\n";
+ }
}
- return result;
- }
+ if(!badIdentities.equals(""))
+ {
+ JOptionPane.showMessageDialog(
+ _target.getCoordinator().getMainFrame(),
+ "The following identities could not be parsed properly:\n" + badIdentities,
+ "Validation failed",
+ JOptionPane.ERROR_MESSAGE);
+ return null;
+ }
+ else
+ {
+ return result;
+ }
+ }
static private String ORDERED = "Ordered";
static private String RANDOM = "Random";
@@ -451,4 +481,5 @@ class ReplicaGroupEditor extends Editor
{"1", "5", "15"});
private MapField _objects;
+ private java.util.LinkedList _objectList;
}
diff --git a/java/src/IceGridGUI/SimpleInternalFrame.java b/java/src/IceGridGUI/SimpleInternalFrame.java
index 9bd936bf37f..cdda5cc2a1c 100755
--- a/java/src/IceGridGUI/SimpleInternalFrame.java
+++ b/java/src/IceGridGUI/SimpleInternalFrame.java
@@ -57,7 +57,7 @@ import com.jgoodies.looks.LookUtils;
* be displayed as selected.
*
* @author Karsten Lentzsch
- * @version $Revision$
+ * @version $Revision: 1.2 $
*
* @see javax.swing.JInternalFrame
* @see javax.swing.JDesktopPane