summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2009-04-03 15:15:13 -0700
committerMark Spruiell <mes@zeroc.com>2009-04-03 15:15:13 -0700
commitb415955846ce0d5c2e0c283f897190ccd2c3616a (patch)
tree10daf6bb8a05edf5052a33f10ea16c73d8ae0d89 /java/src
parentBug 3465 - Remove _adapter members from test where unecessary (diff)
downloadice-b415955846ce0d5c2e0c283f897190ccd2c3616a.tar.bz2
ice-b415955846ce0d5c2e0c283f897190ccd2c3616a.tar.xz
ice-b415955846ce0d5c2e0c283f897190ccd2c3616a.zip
removing Java2 mapping
Diffstat (limited to 'java/src')
-rw-r--r--java/src/Ice/CommunicatorI.java18
-rw-r--r--java/src/Ice/ConnectionI.java161
-rw-r--r--java/src/Ice/ImplicitContextI.java8
-rw-r--r--java/src/Ice/MapHolder.java26
-rw-r--r--java/src/Ice/ObjectAdapterI.java94
-rw-r--r--java/src/Ice/PluginManagerI.java34
-rw-r--r--java/src/Ice/PropertiesI.java81
-rw-r--r--java/src/IceBox/Server.java8
-rw-r--r--java/src/IceBox/ServiceManagerI.java84
-rw-r--r--java/src/IceGridGUI/AdapterObserverI.java29
-rw-r--r--java/src/IceGridGUI/AdminRouter.java20
-rw-r--r--java/src/IceGridGUI/Application/AbstractServerEditor.java21
-rw-r--r--java/src/IceGridGUI/Application/Adapter.java89
-rw-r--r--java/src/IceGridGUI/Application/AdapterEditor.java211
-rw-r--r--java/src/IceGridGUI/Application/ApplicationEditor.java55
-rw-r--r--java/src/IceGridGUI/Application/ArrayMapField.java (renamed from java/src/IceGridGUI/Application/MapField.java)153
-rw-r--r--java/src/IceGridGUI/Application/Communicator.java373
-rw-r--r--java/src/IceGridGUI/Application/CommunicatorChildEditor.java26
-rw-r--r--java/src/IceGridGUI/Application/CommunicatorSubEditor.java80
-rw-r--r--java/src/IceGridGUI/Application/DbEnv.java61
-rw-r--r--java/src/IceGridGUI/Application/DbEnvEditor.java59
-rw-r--r--java/src/IceGridGUI/Application/DescriptorHolder.java1
-rw-r--r--java/src/IceGridGUI/Application/Editable.java23
-rw-r--r--java/src/IceGridGUI/Application/Editor.java51
-rw-r--r--java/src/IceGridGUI/Application/ListTextField.java9
-rw-r--r--java/src/IceGridGUI/Application/ListTreeNode.java28
-rw-r--r--java/src/IceGridGUI/Application/Node.java606
-rw-r--r--java/src/IceGridGUI/Application/NodeEditor.java49
-rw-r--r--java/src/IceGridGUI/Application/Nodes.java172
-rw-r--r--java/src/IceGridGUI/Application/ParameterValuesField.java85
-rw-r--r--java/src/IceGridGUI/Application/ParametersField.java85
-rw-r--r--java/src/IceGridGUI/Application/PlainServer.java150
-rw-r--r--java/src/IceGridGUI/Application/PlainServerEditor.java15
-rw-r--r--java/src/IceGridGUI/Application/PlainService.java75
-rw-r--r--java/src/IceGridGUI/Application/PlainServiceEditor.java18
-rw-r--r--java/src/IceGridGUI/Application/PropertiesField.java125
-rw-r--r--java/src/IceGridGUI/Application/PropertySet.java67
-rw-r--r--java/src/IceGridGUI/Application/PropertySetEditor.java50
-rw-r--r--java/src/IceGridGUI/Application/PropertySetParent.java1
-rw-r--r--java/src/IceGridGUI/Application/PropertySets.java96
-rw-r--r--java/src/IceGridGUI/Application/ReplicaGroup.java71
-rw-r--r--java/src/IceGridGUI/Application/ReplicaGroupEditor.java147
-rw-r--r--java/src/IceGridGUI/Application/ReplicaGroups.java82
-rw-r--r--java/src/IceGridGUI/Application/Root.java401
-rw-r--r--java/src/IceGridGUI/Application/Server.java1
-rw-r--r--java/src/IceGridGUI/Application/ServerInstance.java156
-rw-r--r--java/src/IceGridGUI/Application/ServerInstanceEditor.java72
-rw-r--r--java/src/IceGridGUI/Application/ServerInstancePropertySetEditor.java8
-rw-r--r--java/src/IceGridGUI/Application/ServerSubEditor.java140
-rw-r--r--java/src/IceGridGUI/Application/ServerTemplate.java91
-rw-r--r--java/src/IceGridGUI/Application/ServerTemplateEditor.java11
-rw-r--r--java/src/IceGridGUI/Application/ServerTemplates.java134
-rw-r--r--java/src/IceGridGUI/Application/Service.java4
-rw-r--r--java/src/IceGridGUI/Application/ServiceInstance.java104
-rw-r--r--java/src/IceGridGUI/Application/ServiceInstanceEditor.java80
-rw-r--r--java/src/IceGridGUI/Application/ServiceSubEditor.java33
-rw-r--r--java/src/IceGridGUI/Application/ServiceTemplate.java70
-rw-r--r--java/src/IceGridGUI/Application/ServiceTemplateEditor.java11
-rw-r--r--java/src/IceGridGUI/Application/ServiceTemplates.java93
-rw-r--r--java/src/IceGridGUI/Application/SimpleMapField.java184
-rw-r--r--java/src/IceGridGUI/Application/TemplateEditor.java36
-rw-r--r--java/src/IceGridGUI/Application/TemplateInstance.java3
-rw-r--r--java/src/IceGridGUI/Application/Templates.java24
-rw-r--r--java/src/IceGridGUI/Application/TreeNode.java169
-rw-r--r--java/src/IceGridGUI/Application/UpdateFailedException.java5
-rw-r--r--java/src/IceGridGUI/ApplicationActions.java104
-rw-r--r--java/src/IceGridGUI/ApplicationObserverI.java46
-rw-r--r--java/src/IceGridGUI/ApplicationPane.java72
-rw-r--r--java/src/IceGridGUI/BareBonesBrowserLaunch.java2
-rw-r--r--java/src/IceGridGUI/CellRenderer.java9
-rw-r--r--java/src/IceGridGUI/Coordinator.java534
-rw-r--r--java/src/IceGridGUI/EditorBase.java28
-rw-r--r--java/src/IceGridGUI/LiveActions.java95
-rw-r--r--java/src/IceGridGUI/LiveDeployment/Adapter.java22
-rw-r--r--java/src/IceGridGUI/LiveDeployment/AdapterEditor.java35
-rw-r--r--java/src/IceGridGUI/LiveDeployment/ApplicationDetailsDialog.java11
-rw-r--r--java/src/IceGridGUI/LiveDeployment/CommunicatorEditor.java12
-rw-r--r--java/src/IceGridGUI/LiveDeployment/DbEnv.java25
-rw-r--r--java/src/IceGridGUI/LiveDeployment/DbEnvEditor.java9
-rw-r--r--java/src/IceGridGUI/LiveDeployment/Editor.java3
-rw-r--r--java/src/IceGridGUI/LiveDeployment/ListArrayTreeNode.java35
-rw-r--r--java/src/IceGridGUI/LiveDeployment/ListTreeNode.java14
-rw-r--r--java/src/IceGridGUI/LiveDeployment/Node.java318
-rw-r--r--java/src/IceGridGUI/LiveDeployment/NodeEditor.java33
-rw-r--r--java/src/IceGridGUI/LiveDeployment/ObjectDialog.java26
-rw-r--r--java/src/IceGridGUI/LiveDeployment/RegistryEditor.java92
-rw-r--r--java/src/IceGridGUI/LiveDeployment/Root.java338
-rw-r--r--java/src/IceGridGUI/LiveDeployment/Server.java447
-rw-r--r--java/src/IceGridGUI/LiveDeployment/ServerEditor.java63
-rw-r--r--java/src/IceGridGUI/LiveDeployment/Service.java189
-rw-r--r--java/src/IceGridGUI/LiveDeployment/ServiceEditor.java21
-rw-r--r--java/src/IceGridGUI/LiveDeployment/ShowLogDialog.java101
-rw-r--r--java/src/IceGridGUI/LiveDeployment/ShowLogPrefsDialog.java27
-rw-r--r--java/src/IceGridGUI/LiveDeployment/Slave.java28
-rw-r--r--java/src/IceGridGUI/LiveDeployment/SlaveEditor.java1
-rw-r--r--java/src/IceGridGUI/LiveDeployment/TableField.java125
-rw-r--r--java/src/IceGridGUI/LiveDeployment/TreeNode.java56
-rw-r--r--java/src/IceGridGUI/LiveDeployment/WriteMessageDialog.java41
-rw-r--r--java/src/IceGridGUI/LiveDeploymentPane.java68
-rw-r--r--java/src/IceGridGUI/Logger.java6
-rw-r--r--java/src/IceGridGUI/Main.java31
-rw-r--r--java/src/IceGridGUI/MainPane.java12
-rw-r--r--java/src/IceGridGUI/NodeObserverI.java57
-rw-r--r--java/src/IceGridGUI/ObjectObserverI.java32
-rw-r--r--java/src/IceGridGUI/RegistryObserverI.java30
-rw-r--r--java/src/IceGridGUI/SessionKeeper.java277
-rw-r--r--java/src/IceGridGUI/SimpleInternalFrame.java170
-rw-r--r--java/src/IceGridGUI/StatusBar.java1
-rw-r--r--java/src/IceGridGUI/Tab.java1
-rw-r--r--java/src/IceGridGUI/TreeNodeBase.java114
-rw-r--r--java/src/IceGridGUI/Utils.java183
-rw-r--r--java/src/IceGridGUI/XMLWriter.java32
-rw-r--r--java/src/IceInternal/BasicStream.java28
-rw-r--r--java/src/IceInternal/ConnectRequestHandler.java8
-rw-r--r--java/src/IceInternal/ConnectionMonitor.java7
-rw-r--r--java/src/IceInternal/EndpointHostResolver.java5
-rw-r--r--java/src/IceInternal/Incoming.java2
-rw-r--r--java/src/IceInternal/IncomingAsync.java8
-rw-r--r--java/src/IceInternal/IncomingConnectionFactory.java6
-rw-r--r--java/src/IceInternal/Instance.java24
-rw-r--r--java/src/IceInternal/LocatorManager.java4
-rw-r--r--java/src/IceInternal/Network.java24
-rw-r--r--java/src/IceInternal/ObjectAdapterFactory.java21
-rw-r--r--java/src/IceInternal/ObjectFactoryManager.java7
-rw-r--r--java/src/IceInternal/Outgoing.java2
-rw-r--r--java/src/IceInternal/OutgoingAsync.java2
-rw-r--r--java/src/IceInternal/OutgoingConnectionFactory.java195
-rw-r--r--java/src/IceInternal/ReferenceFactory.java20
-rw-r--r--java/src/IceInternal/RetryQueue.java4
-rw-r--r--java/src/IceInternal/RoutableReference.java20
-rw-r--r--java/src/IceInternal/RouterInfo.java6
-rw-r--r--java/src/IceInternal/RouterManager.java4
-rw-r--r--java/src/IceInternal/Selector.java4
-rw-r--r--java/src/IceInternal/SelectorThread.java4
-rw-r--r--java/src/IceInternal/ServantManager.java14
-rw-r--r--java/src/IceInternal/TcpEndpointI.java10
-rw-r--r--java/src/IceInternal/ThreadPool.java9
-rw-r--r--java/src/IceInternal/TraceUtil.java8
-rw-r--r--java/src/IceInternal/UdpEndpointI.java10
-rw-r--r--java/src/IceInternal/ValueWriter.java75
-rw-r--r--java/src/IceSSL/EndpointI.java10
-rw-r--r--java/src/IceSSL/Instance.java42
-rw-r--r--java/src/IceSSL/TrustManager.java41
-rw-r--r--java/src/IceUtilInternal/Assert.java4
-rw-r--r--java/src/ant/Slice2FreezeJTask.java124
-rw-r--r--java/src/ant/Slice2JavaTask.java62
-rw-r--r--java/src/ant/SliceTask.java41
147 files changed, 4646 insertions, 5712 deletions
diff --git a/java/src/Ice/CommunicatorI.java b/java/src/Ice/CommunicatorI.java
index bf1225bc23f..2ba2770a6e3 100644
--- a/java/src/Ice/CommunicatorI.java
+++ b/java/src/Ice/CommunicatorI.java
@@ -137,24 +137,6 @@ public final class CommunicatorI implements Communicator
_instance.setDefaultLocator(locator);
}
- /**
- * @deprecated
- **/
- public java.util.Map
- getDefaultContext()
- {
- return _instance.getDefaultContext();
- }
-
- /**
- * @deprecated
- **/
- public void
- setDefaultContext(java.util.Map ctx)
- {
- _instance.setDefaultContext(ctx);
- }
-
public ImplicitContext
getImplicitContext()
{
diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java
index 840c3b7824a..269e7c4ae98 100644
--- a/java/src/Ice/ConnectionI.java
+++ b/java/src/Ice/ConnectionI.java
@@ -35,11 +35,11 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
status = validate();
}
-
+
if(status != IceInternal.SocketStatus.Finished)
{
//
- // If the initialization or validation couldn't be completed without potentially
+ // If the initialization or validation couldn't be completed without potentially
// blocking, we register the connection with the selector thread and return.
//
int timeout;
@@ -52,7 +52,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
timeout = _endpoint.timeout();
}
-
+
_sendInProgress = true;
_selectorThread._register(_socketReadyCallback, status, timeout);
@@ -72,7 +72,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
}
}
-
+
if(_state >= StateClosing)
{
assert(_exception != null);
@@ -114,7 +114,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
_acmAbsoluteTimeoutMillis = IceInternal.Time.currentMonotonicTimeMillis() + _acmTimeout * 1000;
}
-
+
setState(StateActive);
}
@@ -143,7 +143,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
setState(StateClosing, new ObjectAdapterDeactivatedException());
break;
}
-
+
case CommunicatorDestroyed:
{
setState(StateClosing, new CommunicatorDestroyedException());
@@ -151,7 +151,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
}
}
}
-
+
synchronized public void
close(boolean force)
{
@@ -178,7 +178,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
}
}
-
+
setState(StateClosing, new CloseConnectionException());
}
}
@@ -196,7 +196,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
return false;
}
-
+
assert(_state == StateClosed);
return true;
}
@@ -246,7 +246,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
}
}
-
+
//
// Now we must wait until close() has been called on the
// transceiver.
@@ -259,7 +259,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
long absoluteWaitTime = _stateTime + _endpoint.timeout();
long waitTime = absoluteWaitTime - IceInternal.Time.currentMonotonicTimeMillis();
-
+
if(waitTime > 0)
{
//
@@ -311,7 +311,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
return;
}
-
+
//
// Active connection management for idle connections.
//
@@ -322,7 +322,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
return;
}
-
+
if(now >= _acmAbsoluteTimeoutMillis)
{
setState(StateClosing, new ConnectionTimeoutException());
@@ -345,10 +345,10 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
//
throw new IceInternal.LocalExceptionWrapper(_exception, true);
}
-
+
assert(_state > StateNotValidated);
assert(_state < StateClosing);
-
+
if(response)
{
//
@@ -360,14 +360,14 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
_nextRequestId = 1;
requestId = _nextRequestId++;
}
-
+
//
// Fill in the request ID.
//
os.pos(IceInternal.Protocol.headerSize);
os.writeInt(requestId);
}
-
+
//
// Send the message. If it can't be sent without blocking the message is added
// to _sendStreams and it will be sent by the selector thread or by this thread
@@ -402,7 +402,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
int requestId = 0;
final IceInternal.BasicStream os = out.__os();
-
+
if(_exception != null)
{
//
@@ -412,10 +412,10 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
//
throw new IceInternal.LocalExceptionWrapper(_exception, true);
}
-
+
assert(_state > StateNotValidated);
assert(_state < StateClosing);
-
+
if(response)
{
//
@@ -427,14 +427,14 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
_nextRequestId = 1;
requestId = _nextRequestId++;
}
-
+
//
// Fill in the request ID.
//
os.pos(IceInternal.Protocol.headerSize);
os.writeInt(requestId);
}
-
+
boolean sent;
try
{
@@ -446,7 +446,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
assert(_exception != null);
throw _exception;
}
-
+
if(response)
{
//
@@ -527,7 +527,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
//
// Throw memory limit exception if the first message added causes us to go over
- // limit. Otherwise put aside the marshalled message that caused limit to be
+ // limit. Otherwise put aside the marshalled message that caused limit to be
// exceeded and rollback stream to the marker.
try
{
@@ -564,7 +564,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
//
_batchStream.pos(IceInternal.Protocol.headerSize);
_batchStream.writeInt(_batchRequestNum);
-
+
OutgoingMessage message = new OutgoingMessage(_batchStream, _batchRequestCompress, true);
sendMessage(message);
}
@@ -602,7 +602,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
// Increment the number of requests in the batch.
//
++_batchRequestNum;
-
+
//
// We compress the whole batch if there is at least one compressed
// message.
@@ -660,26 +660,26 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
}
}
-
+
if(_exception != null)
{
throw _exception;
}
-
+
if(_batchRequestNum == 0)
{
out.sent(false);
return true;
}
-
+
//
// Fill in the number of requests in the batch.
//
_batchStream.pos(IceInternal.Protocol.headerSize);
_batchStream.writeInt(_batchRequestNum);
-
+
_batchStream.swap(out.os());
-
+
boolean sent = false;
try
{
@@ -692,7 +692,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
assert(_exception != null);
throw _exception;
}
-
+
//
// Reset the batch stream.
//
@@ -716,7 +716,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
}
}
-
+
if(_exception != null)
{
throw _exception;
@@ -733,9 +733,9 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
//
_batchStream.pos(IceInternal.Protocol.headerSize);
_batchStream.writeInt(_batchRequestNum);
-
+
_batchStream.swap(outAsync.__os());
-
+
boolean sent;
try
{
@@ -748,7 +748,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
assert(_exception != null);
throw _exception;
}
-
+
//
// Reset the batch stream.
//
@@ -778,7 +778,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
}
sendMessage(new OutgoingMessage(os, compressFlag != 0, true));
-
+
if(_state == StateClosing && _dispatchCount == 0)
{
initiateShutdown();
@@ -805,7 +805,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
notifyAll();
}
-
+
if(_state == StateClosed)
{
assert(_exception != null);
@@ -987,27 +987,24 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
_startCallback = null;
}
- java.util.Iterator<OutgoingMessage> p = _sendStreams.iterator();
- while(p.hasNext())
+ for(OutgoingMessage p : _sendStreams)
{
- p.next().finished(_exception);
+ p.finished(_exception);
}
_sendStreams.clear();
-
- java.util.Iterator<IceInternal.Outgoing> q = _requests.values().iterator();
- while(q.hasNext())
+
+ for(IceInternal.Outgoing p : _requests.values())
{
- q.next().finished(_exception);
+ p.finished(_exception);
}
_requests.clear();
- java.util.Iterator<IceInternal.OutgoingAsync> r = _asyncRequests.values().iterator();
- while(r.hasNext())
+ for(IceInternal.OutgoingAsync p : _asyncRequests.values())
{
- r.next().__finished(_exception);
+ p.__finished(_exception);
}
_asyncRequests.clear();
-
+
//
// This must be done last as this will cause waitUntilFinished() to return (and communicator
// objects such as the timer might be destroyed too).
@@ -1080,8 +1077,8 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
//
// Operations from SocketReadyCallback
- //
- public IceInternal.SocketStatus
+ //
+ public IceInternal.SocketStatus
socketReady()
{
StartCallback callback = null;
@@ -1119,7 +1116,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
return status;
}
}
-
+
if(_state <= StateNotValidated)
{
IceInternal.SocketStatus status = validate();
@@ -1128,7 +1125,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
return status;
}
}
-
+
callback = _startCallback;
_startCallback = null;
}
@@ -1188,7 +1185,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
return _transceiver;
}
- public ConnectionI(IceInternal.Instance instance, IceInternal.Transceiver transceiver,
+ public ConnectionI(IceInternal.Instance instance, IceInternal.Transceiver transceiver,
IceInternal.EndpointI endpoint, ObjectAdapter adapter)
{
super(instance);
@@ -1251,7 +1248,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
_servantManager = null;
}
-
+
try
{
if(_adapter != null)
@@ -1434,7 +1431,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
_threadPool._register(this);
break;
}
-
+
case StateClosed:
{
if(_sendInProgress)
@@ -1443,7 +1440,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
// Unregister with both the pool and the selector thread. We unregister with
// the pool to ensure that it stops reading on the socket (otherwise, if the
// socket is closed the thread pool would spin always reading 0 from the FD).
- // The selector thread will register again the FD with the pool once it's
+ // The selector thread will register again the FD with the pool once it's
// done.
//
_selectorThread.finish(_socketReadyCallback);
@@ -1457,7 +1454,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
}
}
- //
+ //
// We only register with the connection monitor if our new state
// is StateActive. Otherwise we unregister with the connection
// monitor, but only if we were registered before, i.e., if our
@@ -1530,7 +1527,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
}
}
- private IceInternal.SocketStatus
+ private IceInternal.SocketStatus
initialize()
{
IceInternal.SocketStatus status = _transceiver.initialize();
@@ -1568,7 +1565,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
IceInternal.TraceUtil.traceSend(os, _logger, _traceLevels);
os.prepareWrite();
}
-
+
if(!_transceiver.write(os.getBuffer()))
{
return IceInternal.SocketStatus.NeedWrite;
@@ -1634,7 +1631,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
IceInternal.TraceUtil.traceRecv(is, _logger, _traceLevels);
}
}
-
+
_stream.reset();
//
@@ -1673,14 +1670,14 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
IceInternal.TraceUtil.traceSend(stream, _logger, _traceLevels);
}
-
+
}
if(!_transceiver.write(message.stream.getBuffer()))
{
return false;
}
-
+
message.sent(this, true);
if(message.outAsync instanceof Ice.AMISentCallback)
@@ -1722,7 +1719,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
assert(_state != StateClosed);
if(_sendInProgress)
- {
+ {
message.adopt();
_sendStreams.addLast(message);
return false;
@@ -1731,13 +1728,13 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
assert(!_sendInProgress);
//
- // Attempt to send the message without blocking. If the send blocks, we register
- // the connection with the selector thread or we request the caller to call
+ // Attempt to send the message without blocking. If the send blocks, we register
+ // the connection with the selector thread or we request the caller to call
// finishSendMessage() outside the synchronization.
//
assert(!message.prepared);
-
+
IceInternal.BasicStream stream = message.stream;
boolean compress = _overrideCompress ? _overrideCompressValue : message.compress;
@@ -1753,7 +1750,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
IceInternal.TraceUtil.traceSend(stream, _logger, _traceLevels);
}
-
+
if(_transceiver.write(message.stream.getBuffer()))
{
message.sent(this, false);
@@ -1770,7 +1767,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
_selectorThread._register(_socketReadyCallback, IceInternal.SocketStatus.NeedWrite, _endpoint.timeout());
return false;
}
-
+
private IceInternal.BasicStream
doCompress(IceInternal.BasicStream uncompressed, boolean compress)
{
@@ -1974,7 +1971,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
default:
{
- IceInternal.TraceUtil.trace("received unknown message\n(invalid, closing connection)",
+ IceInternal.TraceUtil.trace("received unknown message\n(invalid, closing connection)",
info.stream, _logger, _traceLevels);
throw new UnknownMessageException();
}
@@ -2010,7 +2007,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
while(invokeNum > 0)
{
-
+
//
// Prepare the invocation.
//
@@ -2019,7 +2016,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
IceInternal.BasicStream is = in.is();
stream.swap(is);
IceInternal.BasicStream os = in.os();
-
+
//
// Prepare the response if necessary.
//
@@ -2027,15 +2024,15 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
assert(invokeNum == 1); // No further invocations if a response is expected.
os.writeBlob(IceInternal.Protocol.replyHdr);
-
+
//
// Add the request ID.
//
os.writeInt(requestId);
}
-
+
in.invoke(servantManager);
-
+
//
// If there are more invocations, we need the stream back.
//
@@ -2199,7 +2196,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
this.compress = compress;
this.adopt = adopt;
}
-
+
OutgoingMessage(IceInternal.OutgoingMessageCallback out, IceInternal.BasicStream stream, boolean compress,
boolean resp)
{
@@ -2208,7 +2205,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
this.out = out;
this.response = resp;
}
-
+
OutgoingMessage(IceInternal.OutgoingAsyncMessageCallback out, IceInternal.BasicStream stream, boolean compress,
boolean resp)
{
@@ -2229,7 +2226,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
adopt = false;
}
}
-
+
public void
sent(ConnectionI connection, boolean notify)
{
@@ -2242,12 +2239,12 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
outAsync.__sent(connection);
}
}
-
+
public void
finished(Ice.LocalException ex)
{
//
- // Only notify oneway requests. The connection keeps track of twoway
+ // Only notify oneway requests. The connection keeps track of twoway
// requests in the _requests/_asyncRequests maps and will notify them
// of the connection exceptions.
//
@@ -2280,7 +2277,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
{
_connection = connection;
}
-
+
public java.nio.channels.SelectableChannel
fd()
{
@@ -2369,7 +2366,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
ConnectionI.this.flushSentCallbacks();
};
};
-
+
private int _dispatchCount;
private int _state; // The current state.
diff --git a/java/src/Ice/ImplicitContextI.java b/java/src/Ice/ImplicitContextI.java
index 6b5f4dac028..35c74ccacb4 100644
--- a/java/src/Ice/ImplicitContextI.java
+++ b/java/src/Ice/ImplicitContextI.java
@@ -40,12 +40,12 @@ public abstract class ImplicitContextI implements ImplicitContext
static class Shared extends ImplicitContextI
{
- public synchronized java.util.Map getContext()
+ public synchronized java.util.Map<String, String> getContext()
{
return new java.util.HashMap<String, String>(_context);
}
- public synchronized void setContext(java.util.Map context)
+ public synchronized void setContext(java.util.Map<String, String> context)
{
_context.clear();
if(context != null && !context.isEmpty())
@@ -148,7 +148,7 @@ public abstract class ImplicitContextI implements ImplicitContext
static class PerThread extends ImplicitContextI
{
- public java.util.Map getContext()
+ public java.util.Map<String, String> getContext()
{
//
// Note that _map is a *synchronized* map
@@ -162,7 +162,7 @@ public abstract class ImplicitContextI implements ImplicitContext
return threadContext;
}
- public void setContext(java.util.Map context)
+ public void setContext(java.util.Map<String, String> context)
{
if(context == null || context.isEmpty())
{
diff --git a/java/src/Ice/MapHolder.java b/java/src/Ice/MapHolder.java
deleted file mode 100644
index c1351a88ce4..00000000000
--- a/java/src/Ice/MapHolder.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-package Ice;
-
-public final class MapHolder
-{
- public
- MapHolder()
- {
- }
-
- public
- MapHolder(java.util.Map value)
- {
- this.value = value;
- }
-
- public java.util.Map value;
-}
diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java
index ba25b1b1173..a78323d4532 100644
--- a/java/src/Ice/ObjectAdapterI.java
+++ b/java/src/Ice/ObjectAdapterI.java
@@ -52,7 +52,7 @@ public final class ObjectAdapterI implements ObjectAdapter
IceInternal.IncomingConnectionFactory factory =
(IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i);
factory.activate();
- }
+ }
return;
}
@@ -120,7 +120,7 @@ public final class ObjectAdapterI implements ObjectAdapter
(IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i);
factory.activate();
}
- }
+ }
}
public synchronized void
@@ -149,7 +149,7 @@ public final class ObjectAdapterI implements ObjectAdapter
(IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i);
factory.waitUntilHolding();
}
- }
+ }
public void
deactivate()
@@ -170,7 +170,7 @@ public final class ObjectAdapterI implements ObjectAdapter
//
//
- // Wait for activation to complete. This is necessary to not
+ // Wait for activation to complete. This is necessary to not
// get out of order locator updates.
//
while(_waitForActivate)
@@ -267,18 +267,17 @@ public final class ObjectAdapterI implements ObjectAdapter
}
}
- incomingConnectionFactories =
- (IceInternal.IncomingConnectionFactory[])_incomingConnectionFactories.toArray(
- new IceInternal.IncomingConnectionFactory[0]);
+ incomingConnectionFactories =
+ _incomingConnectionFactories.toArray(new IceInternal.IncomingConnectionFactory[0]);
}
//
// Now we wait for until all incoming connection factories are
// finished.
//
- for(int i = 0; i < incomingConnectionFactories.length; ++i)
+ for(IceInternal.IncomingConnectionFactory f : incomingConnectionFactories)
{
- incomingConnectionFactories[i].waitUntilFinished();
+ f.waitUntilFinished();
}
}
@@ -446,7 +445,7 @@ public final class ObjectAdapterI implements ObjectAdapter
return _servantManager.removeServant(ident, facet);
}
- public synchronized java.util.Map
+ public synchronized java.util.Map<String, Ice.Object>
removeAllFacets(Identity ident)
{
checkForDeactivation();
@@ -478,7 +477,7 @@ public final class ObjectAdapterI implements ObjectAdapter
return _servantManager.findServant(ident, facet);
}
- public synchronized java.util.Map
+ public synchronized java.util.Map<String, Ice.Object>
findAllFacets(Identity ident)
{
checkForDeactivation();
@@ -600,7 +599,7 @@ public final class ObjectAdapterI implements ObjectAdapter
isLocal(ObjectPrx proxy)
{
//
- // NOTE: it's important that isLocal() doesn't perform any blocking operations as
+ // NOTE: it's important that isLocal() doesn't perform any blocking operations as
// it can be called for AMI invocations if the proxy has no delegate set yet.
//
@@ -634,26 +633,22 @@ public final class ObjectAdapterI implements ObjectAdapter
// endpoints used by this object adapter's incoming connection
// factories are considered local.
//
- for(int i = 0; i < endpoints.length; ++i)
+ for(IceInternal.EndpointI endpoint : endpoints)
{
- java.util.Iterator<IceInternal.EndpointI> p = _publishedEndpoints.iterator();
- while(p.hasNext())
+ for(IceInternal.EndpointI p : _publishedEndpoints)
{
- if(endpoints[i].equivalent(p.next()))
+ if(endpoint.equivalent(p))
{
return true;
}
}
- java.util.Iterator<IceInternal.IncomingConnectionFactory> q =
- _incomingConnectionFactories.iterator();
- while(q.hasNext())
+ for(IceInternal.IncomingConnectionFactory p : _incomingConnectionFactories)
{
- if(endpoints[i].equivalent(q.next().endpoint()))
+ if(endpoint.equivalent(p.endpoint()))
{
return true;
}
}
-
}
//
@@ -663,12 +658,11 @@ public final class ObjectAdapterI implements ObjectAdapter
//
if(_routerInfo != null && _routerInfo.getRouter().equals(proxy.ice_getRouter()))
{
- for(int i = 0; i < endpoints.length; ++i)
+ for(IceInternal.EndpointI endpoint : endpoints)
{
- java.util.Iterator<IceInternal.EndpointI> p = _routerEndpoints.iterator();
- while(p.hasNext())
+ for(IceInternal.EndpointI p : _routerEndpoints)
{
- if(endpoints[i].equivalent(p.next()))
+ if(endpoint.equivalent(p))
{
return true;
}
@@ -689,10 +683,9 @@ public final class ObjectAdapterI implements ObjectAdapter
{
f = new java.util.ArrayList<IceInternal.IncomingConnectionFactory>(_incomingConnectionFactories);
}
- java.util.Iterator<IceInternal.IncomingConnectionFactory> i = f.iterator();
- while(i.hasNext())
+ for(IceInternal.IncomingConnectionFactory p : f)
{
- i.next().flushBatchRequests();
+ p.flushBatchRequests();
}
}
@@ -742,7 +735,7 @@ public final class ObjectAdapterI implements ObjectAdapter
public IceInternal.ServantManager
getServantManager()
- {
+ {
//
// No mutex lock necessary, _servantManager is immutable.
//
@@ -753,7 +746,7 @@ public final class ObjectAdapterI implements ObjectAdapter
// Only for use by IceInternal.ObjectAdapterFactory
//
public
- ObjectAdapterI(IceInternal.Instance instance, Communicator communicator,
+ ObjectAdapterI(IceInternal.Instance instance, Communicator communicator,
IceInternal.ObjectAdapterFactory objectAdapterFactory, String name, String endpointInfo,
RouterPrx router, boolean noConfig)
{
@@ -788,10 +781,9 @@ public final class ObjectAdapterI implements ObjectAdapter
if(unknownProps.size() != 0 && properties.getPropertyAsIntWithDefault("Ice.Warn.UnknownProperties", 1) > 0)
{
String message = "found unknown properties for object adapter `" + _name + "':";
- java.util.Iterator<String> p = unknownProps.iterator();
- while(p.hasNext())
+ for(String p : unknownProps)
{
- message += "\n " + p.next();
+ message += "\n " + p;
}
_instance.initializationData().logger.warning(message);
}
@@ -861,7 +853,7 @@ public final class ObjectAdapterI implements ObjectAdapter
//
if(_routerInfo.getAdapter() != null)
{
- throw new AlreadyRegisteredException("object adapter with router",
+ throw new AlreadyRegisteredException("object adapter with router",
_instance.identityToString(router.ice_getIdentity()));
}
@@ -870,9 +862,9 @@ public final class ObjectAdapterI implements ObjectAdapter
// adapter.
//
IceInternal.EndpointI[] endpoints = _routerInfo.getServerEndpoints();
- for(int i = 0; i < endpoints.length; ++i)
+ for(IceInternal.EndpointI endpoint : endpoints)
{
- _routerEndpoints.add(endpoints[i]);
+ _routerEndpoints.add(endpoint);
}
java.util.Collections.sort(_routerEndpoints); // Must be sorted.
@@ -905,7 +897,7 @@ public final class ObjectAdapterI implements ObjectAdapter
// Also modify all existing outgoing connections to the
// router's client proxy to use this object adapter for
// callbacks.
- //
+ //
_instance.outgoingConnectionFactory().setRouterInfo(_routerInfo);
}
}
@@ -927,7 +919,7 @@ public final class ObjectAdapterI implements ObjectAdapter
for(int i = 0; i < endpoints.size(); ++i)
{
IceInternal.EndpointI endp = endpoints.get(i);
- IceInternal.IncomingConnectionFactory factory =
+ IceInternal.IncomingConnectionFactory factory =
new IceInternal.IncomingConnectionFactory(instance, endp, this, _name);
_incomingConnectionFactories.add(factory);
}
@@ -970,7 +962,7 @@ public final class ObjectAdapterI implements ObjectAdapter
{
if(!_deactivated)
{
- _instance.initializationData().logger.warning("object adapter `" + getName() +
+ _instance.initializationData().logger.warning("object adapter `" + getName() +
"' has not been deactivated");
}
else if(!_destroyed)
@@ -998,7 +990,7 @@ public final class ObjectAdapterI implements ObjectAdapter
return newDirectProxy(ident, facet);
}
else if(_replicaGroupId.length() == 0)
- {
+ {
return newIndirectProxy(ident, facet, _id);
}
else
@@ -1182,10 +1174,9 @@ public final class ObjectAdapterI implements ObjectAdapter
// include actual addresses in the published endpoints.
//
java.util.List<IceInternal.EndpointI> expandedEndpoints = new java.util.ArrayList<IceInternal.EndpointI>();
- java.util.Iterator<IceInternal.EndpointI> p = endpoints.iterator();
- while(p.hasNext())
+ for(IceInternal.EndpointI p : endpoints)
{
- expandedEndpoints.addAll(p.next().expand());
+ expandedEndpoints.addAll(p.expand());
}
return expandedEndpoints;
}
@@ -1199,7 +1190,7 @@ public final class ObjectAdapterI implements ObjectAdapter
}
//
- // Call on the locator registry outside the synchronization to
+ // Call on the locator registry outside the synchronization to
// blocking other threads that need to lock this OA.
//
LocatorRegistryPrx locatorRegistry = locatorInfo != null ? locatorInfo.getLocatorRegistry() : null;
@@ -1341,7 +1332,7 @@ public final class ObjectAdapterI implements ObjectAdapter
try
{
- locatorRegistry.setServerProcessProxy(serverId,
+ locatorRegistry.setServerProcessProxy(serverId,
ProcessPrxHelper.uncheckedCast(createDirectProxy(_processId)));
}
catch(ServerNotFoundException ex)
@@ -1384,9 +1375,9 @@ public final class ObjectAdapterI implements ObjectAdapter
_instance.initializationData().logger.trace(_instance.traceLevels().locationCat, s.toString());
}
}
- }
+ }
- static private String[] _suffixes =
+ static private String[] _suffixes =
{
"AdapterId",
"Endpoints",
@@ -1422,15 +1413,12 @@ public final class ObjectAdapterI implements ObjectAdapter
boolean noProps = true;
java.util.Map<String, String> props = _instance.initializationData().properties.getPropertiesForPrefix(prefix);
- java.util.Iterator<String> p = props.keySet().iterator();
- while(p.hasNext())
+ for(String prop : props.keySet())
{
- String prop = p.next();
-
boolean valid = false;
- for(int i = 0; i < _suffixes.length; ++i)
+ for(String suffix : _suffixes)
{
- if(prop.equals(prefix + _suffixes[i]))
+ if(prop.equals(prefix + suffix))
{
noProps = false;
valid = true;
diff --git a/java/src/Ice/PluginManagerI.java b/java/src/Ice/PluginManagerI.java
index 89f856be484..c40f75619f7 100644
--- a/java/src/Ice/PluginManagerI.java
+++ b/java/src/Ice/PluginManagerI.java
@@ -29,10 +29,8 @@ public final class PluginManagerI implements PluginManager
java.util.List<Plugin> initializedPlugins = new java.util.ArrayList<Plugin>();
try
{
- java.util.Iterator<Plugin> i = _initOrder.iterator();
- while(i.hasNext())
+ for(Plugin p : _initOrder)
{
- Plugin p = i.next();
p.initialize();
initializedPlugins.add(p);
}
@@ -106,20 +104,16 @@ public final class PluginManagerI implements PluginManager
{
if(_initialized)
{
- java.util.Iterator<java.util.Map.Entry<String, Plugin> > i = _plugins.entrySet().iterator();
- java.util.Map.Entry<String, Plugin> entry;
- while(i.hasNext())
+ for(java.util.Map.Entry<String, Plugin> p : _plugins.entrySet())
{
- entry = i.next();
try
{
- Plugin p = entry.getValue();
- p.destroy();
+ p.getValue().destroy();
}
catch(RuntimeException ex)
{
- Ice.Util.getProcessLogger().warning("unexpected exception raised by plug-in `" +
- entry.getKey() + "' destruction:\n" + ex.toString());
+ Ice.Util.getProcessLogger().warning("unexpected exception raised by plug-in `" + p.getKey() +
+ "' destruction:\n" + ex.toString());
}
}
}
@@ -156,37 +150,37 @@ public final class PluginManagerI implements PluginManager
java.util.Map<String, String> plugins = properties.getPropertiesForPrefix(prefix);
final String[] loadOrder = properties.getPropertyAsList("Ice.PluginLoadOrder");
- for(int i = 0; i < loadOrder.length; ++i)
+ for(String name : loadOrder)
{
- if(_plugins.containsKey(loadOrder[i]))
+ if(_plugins.containsKey(name))
{
PluginInitializationException ex = new PluginInitializationException();
- ex.reason = "plug-in `" + loadOrder[i] + "' already loaded";
+ ex.reason = "plug-in `" + name + "' already loaded";
throw ex;
}
- String key = "Ice.Plugin." + loadOrder[i] + ".java";
+ String key = "Ice.Plugin." + name + ".java";
boolean hasKey = plugins.containsKey(key);
if(hasKey)
{
- plugins.remove("Ice.Plugin." + loadOrder[i]);
+ plugins.remove("Ice.Plugin." + name);
}
else
{
- key = "Ice.Plugin." + loadOrder[i];
+ key = "Ice.Plugin." + name;
hasKey = plugins.containsKey(key);
}
if(hasKey)
{
- final String value = (String)plugins.get(key);
- loadPlugin(loadOrder[i], value, cmdArgs);
+ final String value = plugins.get(key);
+ loadPlugin(name, value, cmdArgs);
plugins.remove(key);
}
else
{
PluginInitializationException ex = new PluginInitializationException();
- ex.reason = "plug-in `" + loadOrder[i] + "' not defined";
+ ex.reason = "plug-in `" + name + "' not defined";
throw ex;
}
}
diff --git a/java/src/Ice/PropertiesI.java b/java/src/Ice/PropertiesI.java
index 8a3d3582ff8..b187c358865 100644
--- a/java/src/Ice/PropertiesI.java
+++ b/java/src/Ice/PropertiesI.java
@@ -114,7 +114,7 @@ public final class PropertiesI implements Properties
}
catch(NumberFormatException ex)
{
- Ice.Util.getProcessLogger().warning("numeric property " + key +
+ Ice.Util.getProcessLogger().warning("numeric property " + key +
" set to non-numeric value, defaulting to " + value);
return value;
}
@@ -155,11 +155,11 @@ public final class PropertiesI implements Properties
pv.used = true;
result = pv.value;
}
-
+
String[] arr = splitString(result, ", \t\r\n");
if(arr == null)
{
- Ice.Util.getProcessLogger().warning("mismatched quotes in property " + key
+ Ice.Util.getProcessLogger().warning("mismatched quotes in property " + key
+ "'s value, returning default value");
return value;
}
@@ -169,19 +169,16 @@ public final class PropertiesI implements Properties
}
}
-
public synchronized java.util.Map<String, String>
getPropertiesForPrefix(String prefix)
{
java.util.HashMap<String, String> result = new java.util.HashMap<String, String>();
- java.util.Iterator<java.util.Map.Entry<String, PropertyValue> > p = _properties.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, PropertyValue> p : _properties.entrySet())
{
- java.util.Map.Entry<String, PropertyValue> entry = p.next();
- String key = entry.getKey();
+ String key = p.getKey();
if(prefix.length() == 0 || key.startsWith(prefix))
{
- PropertyValue pv = entry.getValue();
+ PropertyValue pv = p.getValue();
pv.used = true;
result.put(key, pv.value);
}
@@ -281,12 +278,10 @@ public final class PropertiesI implements Properties
getCommandLineOptions()
{
String[] result = new String[_properties.size()];
- java.util.Iterator<java.util.Map.Entry<String, PropertyValue> > p = _properties.entrySet().iterator();
int i = 0;
- while(p.hasNext())
+ for(java.util.Map.Entry<String, PropertyValue> p : _properties.entrySet())
{
- java.util.Map.Entry<String, PropertyValue> entry = p.next();
- result[i++] = "--" + entry.getKey() + "=" + entry.getValue().value;
+ result[i++] = "--" + p.getKey() + "=" + p.getValue().value;
}
assert(i == result.length);
return result;
@@ -302,9 +297,8 @@ public final class PropertiesI implements Properties
pfx = "--" + pfx;
java.util.ArrayList<String> result = new java.util.ArrayList<String>();
- for(int i = 0; i < options.length; i++)
+ for(String opt : options)
{
- String opt = options[i];
if(opt.startsWith(pfx))
{
if(opt.indexOf('=') == -1)
@@ -319,7 +313,7 @@ public final class PropertiesI implements Properties
result.add(opt);
}
}
- return (String[])result.toArray(new String[0]);
+ return result.toArray(new String[0]);
}
public String[]
@@ -362,14 +356,12 @@ public final class PropertiesI implements Properties
getUnusedProperties()
{
java.util.List<String> unused = new java.util.ArrayList<String>();
- java.util.Iterator<java.util.Map.Entry<String, PropertyValue> > p = _properties.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, PropertyValue> p : _properties.entrySet())
{
- java.util.Map.Entry<String, PropertyValue> entry = p.next();
- PropertyValue pv = entry.getValue();
+ PropertyValue pv = p.getValue();
if(!pv.used)
{
- unused.add(entry.getKey());
+ unused.add(p.getKey());
}
}
return unused;
@@ -378,15 +370,13 @@ public final class PropertiesI implements Properties
PropertiesI(PropertiesI props)
{
//
- // NOTE: we can't just do a shallow copy of the map as the map values
+ // NOTE: we can't just do a shallow copy of the map as the map values
// would otherwise be shared between the two PropertiesI object.
//
//_properties = new java.util.HashMap<String, PropertyValue>(props._properties);
- java.util.Iterator<java.util.Map.Entry<String, PropertyValue> > p = props._properties.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, PropertyValue> p : props._properties.entrySet())
{
- java.util.Map.Entry<String, PropertyValue> entry = p.next();
- _properties.put(entry.getKey(), new PropertyValue(entry.getValue()));
+ _properties.put(p.getKey(), new PropertyValue(p.getValue()));
}
}
@@ -400,7 +390,7 @@ public final class PropertiesI implements Properties
{
_properties = new java.util.HashMap<String, PropertyValue>(((PropertiesI)defaults)._properties);
}
-
+
boolean loadConfigFiles = false;
for(int i = 0; i < args.value.length; i++)
@@ -468,7 +458,7 @@ public final class PropertiesI implements Properties
{
String key = "";
String value = "";
-
+
int state = ParseStateKey;
String whitespace = "";
@@ -496,7 +486,7 @@ public final class PropertiesI implements Properties
whitespace = "";
key += c;
break;
-
+
case ' ':
if(key.length() != 0)
{
@@ -518,7 +508,7 @@ public final class PropertiesI implements Properties
key += c;
}
break;
-
+
case ' ':
case '\t':
case '\r':
@@ -528,16 +518,16 @@ public final class PropertiesI implements Properties
whitespace += c;
}
break;
-
+
case '=':
whitespace = "";
state = ParseStateValue;
break;
-
+
case '#':
finished = true;
break;
-
+
default:
key += whitespace;
whitespace = "";
@@ -546,7 +536,7 @@ public final class PropertiesI implements Properties
}
break;
}
-
+
case ParseStateValue:
{
switch(c)
@@ -565,12 +555,12 @@ public final class PropertiesI implements Properties
escapedspace = "";
value += c;
break;
-
+
case ' ':
whitespace += c;
escapedspace += c;
break;
-
+
default:
value += value.length() == 0 ? escapedspace : whitespace;
whitespace = "";
@@ -586,7 +576,7 @@ public final class PropertiesI implements Properties
value += c;
}
break;
-
+
case ' ':
case '\t':
case '\r':
@@ -596,12 +586,12 @@ public final class PropertiesI implements Properties
whitespace += c;
}
break;
-
+
case '#':
value += escapedspace;
finished = true;
break;
-
+
default:
value += value.length() == 0 ? escapedspace : whitespace;
whitespace = "";
@@ -618,7 +608,7 @@ public final class PropertiesI implements Properties
}
}
value += escapedspace;
-
+
if((state == ParseStateKey && key.length() != 0) || (state == ParseStateValue && key.length() == 0))
{
Ice.Util.getProcessLogger().warning("invalid config file entry: \"" + line + "\"");
@@ -655,10 +645,9 @@ public final class PropertiesI implements Properties
if(value.length() > 0)
{
- String[] files = value.split(",");
- for(int i = 0; i < files.length; i++)
+ for(String file : value.split(","))
{
- load(files[i]);
+ load(file);
}
}
@@ -673,7 +662,7 @@ public final class PropertiesI implements Properties
java.util.List<String> l = new java.util.ArrayList<String>();
char[] arr = new char[str.length()];
int pos = 0;
-
+
while(pos < str.length())
{
int n = 0;
@@ -704,7 +693,7 @@ public final class PropertiesI implements Properties
break;
}
}
-
+
if(pos < str.length())
{
arr[n++] = str.charAt(pos++);
@@ -719,7 +708,7 @@ public final class PropertiesI implements Properties
l.add(new String(arr, 0, n));
}
}
-
+
return (String[])l.toArray(new String[0]);
}
diff --git a/java/src/IceBox/Server.java b/java/src/IceBox/Server.java
index 6438692c86b..386b0ffcc9a 100644
--- a/java/src/IceBox/Server.java
+++ b/java/src/IceBox/Server.java
@@ -35,16 +35,16 @@ public final class Server extends Ice.Application
public int
run(String[] args)
{
- for(int i = 1; i < args.length; ++i)
+ for(String arg : args)
{
- if(args[i].equals("-h") || args[i].equals("--help"))
+ if(arg.equals("-h") || arg.equals("--help"))
{
usage();
return 0;
}
- else if(!args[i].startsWith("--"))
+ else if(!arg.startsWith("--"))
{
- System.err.println("Server: unknown option `" + args[i] + "'");
+ System.err.println("Server: unknown option `" + arg + "'");
usage();
return 1;
}
diff --git a/java/src/IceBox/ServiceManagerI.java b/java/src/IceBox/ServiceManagerI.java
index 95cfac6fb1a..57c5ba9cf14 100644
--- a/java/src/IceBox/ServiceManagerI.java
+++ b/java/src/IceBox/ServiceManagerI.java
@@ -24,7 +24,7 @@ public class ServiceManagerI extends _ServiceManagerDisp
_traceServiceObserver = _communicator.getProperties().getPropertyAsInt("IceBox.Trace.ServiceObserver");
}
- public java.util.Map
+ public java.util.Map<String, String>
getSliceChecksums(Ice.Current current)
{
return SliceChecksums.checksums;
@@ -41,18 +41,16 @@ public class ServiceManagerI extends _ServiceManagerDisp
// Search would be more efficient if services were contained in
// a map, but order is required for shutdown.
//
- java.util.Iterator<ServiceInfo> p = _services.iterator();
- while(p.hasNext())
+ for(ServiceInfo p : _services)
{
- ServiceInfo in = p.next();
- if(in.name.equals(name))
+ if(p.name.equals(name))
{
- if(in.status == StatusStarted)
+ if(p.status == StatusStarted)
{
throw new AlreadyStartedException();
}
- in.status = StatusStarting;
- info = (ServiceInfo)in.clone();
+ p.status = StatusStarting;
+ info = (ServiceInfo)p.clone();
break;
}
}
@@ -75,21 +73,18 @@ public class ServiceManagerI extends _ServiceManagerDisp
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
e.printStackTrace(pw);
pw.flush();
- _logger.warning("ServiceManager: exception in start for service " + info.name + "\n" +
- sw.toString());
+ _logger.warning("ServiceManager: exception in start for service " + info.name + "\n" + sw.toString());
}
synchronized(this)
{
- java.util.Iterator<ServiceInfo> p = _services.iterator();
- while(p.hasNext())
+ for(ServiceInfo p : _services)
{
- ServiceInfo in = p.next();
- if(in.name.equals(name))
+ if(p.name.equals(name))
{
if(started)
{
- in.status = StatusStarted;
+ p.status = StatusStarted;
java.util.List<String> services = new java.util.ArrayList<String>();
services.add(name);
@@ -97,7 +92,7 @@ public class ServiceManagerI extends _ServiceManagerDisp
}
else
{
- in.status = StatusStopped;
+ p.status = StatusStopped;
}
break;
}
@@ -118,18 +113,16 @@ public class ServiceManagerI extends _ServiceManagerDisp
// Search would be more efficient if services were contained in
// a map, but order is required for shutdown.
//
- java.util.Iterator<ServiceInfo> p = _services.iterator();
- while(p.hasNext())
+ for(ServiceInfo p : _services)
{
- ServiceInfo in = p.next();
- if(in.name.equals(name))
+ if(p.name.equals(name))
{
- if(in.status == StatusStopped)
+ if(p.status == StatusStopped)
{
throw new AlreadyStoppedException();
}
- in.status = StatusStopping;
- info = (ServiceInfo)in.clone();
+ p.status = StatusStopping;
+ info = (ServiceInfo)p.clone();
break;
}
}
@@ -158,15 +151,13 @@ public class ServiceManagerI extends _ServiceManagerDisp
synchronized(this)
{
- java.util.Iterator<ServiceInfo> p = _services.iterator();
- while(p.hasNext())
+ for(ServiceInfo p : _services)
{
- ServiceInfo in = p.next();
- if(in.name.equals(name))
+ if(p.name.equals(name))
{
if(stopped)
{
- in.status = StatusStopped;
+ p.status = StatusStopped;
java.util.List<String> services = new java.util.ArrayList<String>();
services.add(name);
@@ -174,7 +165,7 @@ public class ServiceManagerI extends _ServiceManagerDisp
}
else
{
- in.status = StatusStarted;
+ p.status = StatusStarted;
}
break;
}
@@ -280,28 +271,26 @@ public class ServiceManagerI extends _ServiceManagerDisp
java.util.Map<String, String> services = properties.getPropertiesForPrefix(prefix);
String[] loadOrder = properties.getPropertyAsList("IceBox.LoadOrder");
java.util.List<StartServiceInfo> servicesInfo = new java.util.ArrayList<StartServiceInfo>();
- for(int i = 0; i < loadOrder.length; ++i)
+ for(String name : loadOrder)
{
- if(loadOrder[i].length() > 0)
+ if(name.length() > 0)
{
- String key = prefix + loadOrder[i];
+ String key = prefix + name;
String value = services.get(key);
if(value == null)
{
FailureException ex = new FailureException();
- ex.reason = "ServiceManager: no service definition for `" + loadOrder[i] + "'";
+ ex.reason = "ServiceManager: no service definition for `" + name + "'";
throw ex;
}
- servicesInfo.add(new StartServiceInfo(loadOrder[i], value, _argv));
+ servicesInfo.add(new StartServiceInfo(name, value, _argv));
services.remove(key);
}
}
- java.util.Iterator<java.util.Map.Entry<String, String> > p = services.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, String> p : services.entrySet())
{
- java.util.Map.Entry<String, String> entry = p.next();
- String name = entry.getKey().substring(prefix.length());
- String value = entry.getValue();
+ String name = p.getKey().substring(prefix.length());
+ String value = p.getValue();
servicesInfo.add(new StartServiceInfo(name, value, _argv));
}
@@ -336,10 +325,8 @@ public class ServiceManagerI extends _ServiceManagerDisp
// overriden by the service properties).
//
java.util.Map<String, String> allProps = initData.properties.getPropertiesForPrefix("");
- java.util.Iterator<String> q = allProps.keySet().iterator();
- while(q.hasNext())
+ for(String key : allProps.keySet())
{
- String key = q.next();
if(svcProperties.getProperty(key).length() == 0)
{
initData.properties.setProperty(key, "");
@@ -349,12 +336,9 @@ public class ServiceManagerI extends _ServiceManagerDisp
//
// Add the service properties to the shared communicator properties.
//
- java.util.Iterator<java.util.Map.Entry<String, String> > r =
- svcProperties.getPropertiesForPrefix("").entrySet().iterator();
- while(r.hasNext())
+ for(java.util.Map.Entry<String, String> p : svcProperties.getPropertiesForPrefix("").entrySet())
{
- java.util.Map.Entry<String, String> entry = r.next();
- initData.properties.setProperty(entry.getKey(), entry.getValue());
+ initData.properties.setProperty(p.getKey(), p.getValue());
}
//
@@ -940,11 +924,11 @@ public class ServiceManagerI extends _ServiceManagerDisp
if(serverArgs.length > 0)
{
java.util.List<String> l = new java.util.ArrayList<String>(java.util.Arrays.asList(args));
- for(int j = 0; j < serverArgs.length; j++)
+ for(String arg : serverArgs)
{
- if(serverArgs[j].startsWith("--" + service + "."))
+ if(arg.startsWith("--" + service + "."))
{
- l.add(serverArgs[j]);
+ l.add(arg);
}
}
args = l.toArray(args);
diff --git a/java/src/IceGridGUI/AdapterObserverI.java b/java/src/IceGridGUI/AdapterObserverI.java
index 697efd0fb5d..2fef82c063a 100644
--- a/java/src/IceGridGUI/AdapterObserverI.java
+++ b/java/src/IceGridGUI/AdapterObserverI.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import javax.swing.SwingUtilities;
@@ -30,18 +31,18 @@ class AdapterObserverI extends _AdapterObserverDisp
else
{
String names = "";
- for(int i = 0; i < adapters.length; ++i)
+ for(AdapterInfo info : adapters)
{
- names += " " + adapters[i].id;
+ names += " " + info.id;
}
-
+
_coordinator.traceObserver("adapterInit for adapters" + names);
}
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.adapterInit(adapters);
}
@@ -55,14 +56,14 @@ class AdapterObserverI extends _AdapterObserverDisp
_coordinator.traceObserver("adapterAdded for adapter " + info.id);
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.adapterAdded(info);
}
});
- }
+ }
public void adapterUpdated(final AdapterInfo info, Ice.Current current)
{
@@ -71,14 +72,14 @@ class AdapterObserverI extends _AdapterObserverDisp
_coordinator.traceObserver("adapterUpdated for adapter " + info.id);
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.adapterUpdated(info);
}
});
- }
+ }
public void adapterRemoved(final String id, Ice.Current current)
{
@@ -87,9 +88,9 @@ class AdapterObserverI extends _AdapterObserverDisp
_coordinator.traceObserver("adapterRemoved for adapter " + id);
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.adapterRemoved(id);
}
@@ -98,4 +99,4 @@ class AdapterObserverI extends _AdapterObserverDisp
private final Coordinator _coordinator;
private final boolean _trace;
-};
+}
diff --git a/java/src/IceGridGUI/AdminRouter.java b/java/src/IceGridGUI/AdminRouter.java
index dfafff81963..d1360fff1df 100644
--- a/java/src/IceGridGUI/AdminRouter.java
+++ b/java/src/IceGridGUI/AdminRouter.java
@@ -6,22 +6,18 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import IceGrid.*;
class AdminRouter extends Ice.Blobject
{
- public boolean ice_invoke(byte[] inParams,
- Ice.ByteSeqHolder outParams,
- Ice.Current current)
+ public boolean ice_invoke(byte[] inParams, Ice.ByteSeqHolder outParams, Ice.Current current)
{
-
if(_admin == null)
{
- throw new Ice.ObjectNotExistException(current.id,
- current.facet,
- current.operation);
+ throw new Ice.ObjectNotExistException(current.id, current.facet, current.operation);
}
else if(current.operation.equals("ice_id") ||
current.operation.equals("ice_ids") ||
@@ -29,20 +25,14 @@ class AdminRouter extends Ice.Blobject
current.operation.equals("ice_ping") ||
current.operation.equals("getDefaultApplicationDescriptor"))
{
-
- return _admin.ice_invoke(current.operation,
- current.mode,
- inParams, outParams,
- current.ctx);
+ return _admin.ice_invoke(current.operation, current.mode, inParams, outParams, current.ctx);
}
else
{
//
// Routing other operations could be a security risk
//
- throw new Ice.OperationNotExistException(current.id,
- current.facet,
- current.operation);
+ throw new Ice.OperationNotExistException(current.id, current.facet, current.operation);
}
}
diff --git a/java/src/IceGridGUI/Application/AbstractServerEditor.java b/java/src/IceGridGUI/Application/AbstractServerEditor.java
index 4fbb68864a2..adf3c8e0045 100644
--- a/java/src/IceGridGUI/Application/AbstractServerEditor.java
+++ b/java/src/IceGridGUI/Application/AbstractServerEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import javax.swing.JOptionPane;
@@ -91,12 +92,12 @@ abstract class AbstractServerEditor extends Editor
//
_target = (TreeNode)node.findChildWithDescriptor(server.getDescriptor());
root.updated();
-
+
if(refresh)
{
root.setSelectedNode(_target);
}
-
+
}
else if(isSimpleUpdate())
{
@@ -112,9 +113,9 @@ abstract class AbstractServerEditor extends Editor
Object savedDescriptor = server.saveDescriptor();
Node node = (Node)_target.getParent();
writeDescriptor();
-
+
node.removeServer(_target);
-
+
try
{
if(server instanceof PlainServer)
@@ -130,7 +131,7 @@ abstract class AbstractServerEditor extends Editor
{
//
// Restore
- //
+ //
try
{
node.insertServer(_target, true);
@@ -141,7 +142,7 @@ abstract class AbstractServerEditor extends Editor
}
server.restoreDescriptor(savedDescriptor);
root.setSelectedNode(_target);
-
+
JOptionPane.showMessageDialog(
root.getCoordinator().getMainFrame(),
e.toString(),
@@ -149,13 +150,13 @@ abstract class AbstractServerEditor extends Editor
JOptionPane.ERROR_MESSAGE);
return false;
}
-
+
//
// Success
//
- node.getEditable().removeElement(_target.getId(), server.getEditable(),
+ node.getEditable().removeElement(_target.getId(), server.getEditable(),
Server.class); // replaced by brand new Server
-
+
_target = node.findChildWithDescriptor(server.getDescriptor());
root.updated();
if(refresh)
@@ -163,7 +164,7 @@ abstract class AbstractServerEditor extends Editor
root.setSelectedNode(_target);
}
}
-
+
if(refresh)
{
root.getCoordinator().getCurrentTab().showNode(_target);
diff --git a/java/src/IceGridGUI/Application/Adapter.java b/java/src/IceGridGUI/Application/Adapter.java
index 62f4980b792..7f43e2feac1 100644
--- a/java/src/IceGridGUI/Application/Adapter.java
+++ b/java/src/IceGridGUI/Application/Adapter.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.Component;
@@ -20,7 +21,7 @@ class Adapter extends TreeNode implements DescriptorHolder
static class AdapterCopy
{
AdapterDescriptor descriptor;
- java.util.Map parentProperties;
+ java.util.Map<String, String> parentProperties;
}
static public AdapterDescriptor copyDescriptor(AdapterDescriptor d)
@@ -28,14 +29,13 @@ class Adapter extends TreeNode implements DescriptorHolder
return (AdapterDescriptor)d.clone();
}
- static public java.util.List
- copyDescriptors(java.util.List descriptors)
+ static public java.util.List<AdapterDescriptor>
+ copyDescriptors(java.util.List<AdapterDescriptor> descriptors)
{
- java.util.List copy = new java.util.LinkedList();
- java.util.Iterator p = descriptors.iterator();
- while(p.hasNext())
+ java.util.List<AdapterDescriptor> copy = new java.util.LinkedList<AdapterDescriptor>();
+ for(AdapterDescriptor p : descriptors)
{
- copy.add(copyDescriptor((AdapterDescriptor)p.next()));
+ copy.add(copyDescriptor(p));
}
return copy;
}
@@ -47,14 +47,13 @@ class Adapter extends TreeNode implements DescriptorHolder
{
boolean[] actions = new boolean[ACTION_COUNT];
actions[COPY] = !_ephemeral;
-
+
Object clipboard = getCoordinator().getClipboard();
- actions[PASTE] = clipboard != null &&
- (clipboard instanceof AdapterCopy
- || clipboard instanceof DbEnvDescriptor);
-
+ actions[PASTE] = clipboard != null && (clipboard instanceof AdapterCopy ||
+ clipboard instanceof DbEnvDescriptor);
+
actions[DELETE] = true;
-
+
if(!_ephemeral)
{
boolean[] parentActions = ((TreeNode)_parent).getAvailableActions();
@@ -80,13 +79,13 @@ class Adapter extends TreeNode implements DescriptorHolder
}
public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
@@ -94,8 +93,7 @@ class Adapter extends TreeNode implements DescriptorHolder
_cellRenderer.setLeafIcon(Utils.getIcon("/icons/16x16/adapter_inactive.png"));
}
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
public Editor getEditor()
@@ -120,7 +118,7 @@ class Adapter extends TreeNode implements DescriptorHolder
((Communicator)_parent).getAdapters().destroyChild(this);
}
-
+
Object getDescriptor()
{
return _descriptor;
@@ -134,7 +132,7 @@ class Adapter extends TreeNode implements DescriptorHolder
public void restoreDescriptor(Object savedDescriptor)
{
AdapterDescriptor ad = (AdapterDescriptor)savedDescriptor;
-
+
_descriptor.name = ad.name;
_descriptor.id = ad.id;
_descriptor.replicaGroupId = ad.replicaGroupId;
@@ -143,9 +141,9 @@ class Adapter extends TreeNode implements DescriptorHolder
_descriptor.serverLifetime = ad.serverLifetime;
_descriptor.objects = ad.objects;
}
-
- Adapter(Communicator parent, String adapterName, AdapterDescriptor descriptor,
- java.util.Map parentProperties, boolean ephemeral)
+
+ Adapter(Communicator parent, String adapterName, AdapterDescriptor descriptor,
+ java.util.Map<String, String> parentProperties, boolean ephemeral)
{
super(parent, adapterName);
_descriptor = descriptor;
@@ -153,17 +151,18 @@ class Adapter extends TreeNode implements DescriptorHolder
_parentProperties = parentProperties;
}
-
- void write(XMLWriter writer) throws java.io.IOException
+ void write(XMLWriter writer)
+ throws java.io.IOException
{
assert false;
}
- void write(XMLWriter writer, java.util.List properties) throws java.io.IOException
+ void write(XMLWriter writer, java.util.List<PropertyDescriptor> properties)
+ throws java.io.IOException
{
if(!_ephemeral)
{
- java.util.List attributes = new java.util.LinkedList();
+ java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
attributes.add(createAttribute("name", _descriptor.name));
String oaPrefix = _descriptor.name + ".";
@@ -185,8 +184,8 @@ class Adapter extends TreeNode implements DescriptorHolder
{
attributes.add(createAttribute("server-lifetime", "false"));
}
-
- if(_descriptor.description.length() == 0
+
+ if(_descriptor.description.length() == 0
&& _descriptor.objects.isEmpty()
&& _descriptor.allocatables.isEmpty())
{
@@ -211,24 +210,23 @@ class Adapter extends TreeNode implements DescriptorHolder
{
if(_parentProperties != null)
{
- return (String)_parentProperties.get(property);
+ return _parentProperties.get(property);
}
else
{
return ((Communicator)_parent).getProperty(property);
}
}
+
String lookupPropertyValue(String val)
{
if(_parentProperties != null)
{
- java.util.Iterator p = _parentProperties.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, String> p : _parentProperties.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- if(entry.getValue().equals(val))
+ if(p.getValue().equals(val))
{
- return (String)entry.getKey();
+ return p.getKey();
}
}
return "";
@@ -238,23 +236,26 @@ class Adapter extends TreeNode implements DescriptorHolder
return ((Communicator)_parent).lookupPropertyValue(val);
}
}
+
void setProperty(String property, String newValue)
{
((Communicator)_parent).setProperty(property, newValue);
}
+
void removeProperty(String property)
{
((Communicator)_parent).removeProperty(property);
}
+
String getDefaultAdapterId()
{
return getDefaultAdapterId(_id);
}
String getDefaultAdapterId(String name)
- {
- return (_parent instanceof Service ||
- _parent instanceof ServiceTemplate) ?
+ {
+ return (_parent instanceof Service ||
+ _parent instanceof ServiceTemplate) ?
"${server}.${service}." + name: "${server}." + name;
}
@@ -264,9 +265,9 @@ class Adapter extends TreeNode implements DescriptorHolder
}
private final boolean _ephemeral;
- private final java.util.Map _parentProperties; // set only when ephemeral == true;
+ private final java.util.Map<String, String> _parentProperties; // set only when ephemeral == true;
private AdapterDescriptor _descriptor;
private AdapterEditor _editor;
- static private DefaultTreeCellRenderer _cellRenderer;
+ static private DefaultTreeCellRenderer _cellRenderer;
}
diff --git a/java/src/IceGridGUI/Application/AdapterEditor.java b/java/src/IceGridGUI/Application/AdapterEditor.java
index bbf6636ad28..7e8b6834441 100644
--- a/java/src/IceGridGUI/Application/AdapterEditor.java
+++ b/java/src/IceGridGUI/Application/AdapterEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -36,20 +37,19 @@ class AdapterEditor extends CommunicatorChildEditor
{
AdapterEditor()
{
- _objects = new MapField(this, "Identity", new String[]{"Type", "Property"}, true);
- _allocatables = new MapField(this, "Identity", new String[]{"Type", "Property"}, true);
+ _objects = new ArrayMapField(this, true, "Identity", "Type", "Property");
+ _allocatables = new ArrayMapField(this, true, "Identity", "Type", "Property");
//
// Create buttons
//
-
+
//
// _replicaGroupButton
//
- Action gotoReplicaGroup = new AbstractAction(
- "", Utils.getIcon("/icons/16x16/goto.png"))
+ Action gotoReplicaGroup = new AbstractAction("", Utils.getIcon("/icons/16x16/goto.png"))
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
Object obj = _replicaGroupId.getSelectedItem();
Adapter adapter = getAdapter();
@@ -61,8 +61,7 @@ class AdapterEditor extends CommunicatorChildEditor
}
else
{
- String replicaGroupId =
- Utils.substitute(obj.toString(), adapter.getResolver());
+ String replicaGroupId = Utils.substitute(obj.toString(), adapter.getResolver());
rg = adapter.getRoot().findReplicaGroup(replicaGroupId);
}
@@ -76,10 +75,9 @@ class AdapterEditor extends CommunicatorChildEditor
}
}
};
- gotoReplicaGroup.putValue(Action.SHORT_DESCRIPTION,
- "Goto the definition of this replica group");
+ gotoReplicaGroup.putValue(Action.SHORT_DESCRIPTION, "Goto the definition of this replica group");
_replicaGroupButton = new JButton(gotoReplicaGroup);
-
+
Action checkRegisterProcess = new AbstractAction("Register Process")
{
public void actionPerformed(ActionEvent e)
@@ -96,8 +94,7 @@ class AdapterEditor extends CommunicatorChildEditor
+ "to enable clean shutdown; you should register<br>"
+ "exactly one Process object per server.</html>");
- Action checkServerLifetime =
- new AbstractAction("Server Lifetime")
+ Action checkServerLifetime = new AbstractAction("Server Lifetime")
{
public void actionPerformed(ActionEvent e)
{
@@ -107,25 +104,25 @@ class AdapterEditor extends CommunicatorChildEditor
_serverLifetime = new JCheckBox(checkServerLifetime);
_serverLifetime.setToolTipText(
"<html>Is the adapter lifetime the same as the server<br>" +
- "lifetime? The server is considered to be active<br>" +
+ "lifetime? The server is considered to be active<br>" +
"only if all the adapters with this attribute set<br>" +
"to true are active.</html>");
//
// Associate updateListener with various fields
//
_name.getDocument().addDocumentListener(
- new DocumentListener()
+ new DocumentListener()
{
public void changedUpdate(DocumentEvent e)
{
update();
}
-
+
public void insertUpdate(DocumentEvent e)
{
update();
}
-
+
public void removeUpdate(DocumentEvent e)
{
update();
@@ -142,13 +139,12 @@ class AdapterEditor extends CommunicatorChildEditor
}
});
- _name.setToolTipText(
- "Identifies this object adapter within an Ice communicator");
+ _name.setToolTipText("Identifies this object adapter within an Ice communicator");
_endpoints.getDocument().addDocumentListener(_updateListener);
_endpoints.setToolTipText(
"<html>The network interface(s) on which this object adapter receives requests;<br>"
- + "for example:<br>"
+ + "for example:<br>"
+ " tcp (listen on all local interfaces using a random port)<br>"
+ " tcp -h venus.foo.com (listen on just one interface)<br>"
+ " tcp -t 10000 (sets a timeout of 10,000 milliseconds)<br>"
@@ -156,40 +152,33 @@ class AdapterEditor extends CommunicatorChildEditor
+ "</html>");
_description.getDocument().addDocumentListener(_updateListener);
- _description.setToolTipText(
- "An optional description for this object adapter");
+ _description.setToolTipText("An optional description for this object adapter");
- JTextField idTextField = (JTextField)
- _id.getEditor().getEditorComponent();
+ JTextField idTextField = (JTextField)_id.getEditor().getEditorComponent();
idTextField.getDocument().addDocumentListener(_updateListener);
_id.setToolTipText("Identities this object adapter within an IceGrid deployment");
- JTextField replicaGroupIdTextField = (JTextField)
- _replicaGroupId.getEditor().getEditorComponent();
+ JTextField replicaGroupIdTextField = (JTextField)_replicaGroupId.getEditor().getEditorComponent();
replicaGroupIdTextField.getDocument().addDocumentListener(_updateListener);
_replicaGroupId.setToolTipText("Select a replica group");
-
+
_priority.getDocument().addDocumentListener(_updateListener);
_priority.setToolTipText("The priority of this adapter; see the Ordered load-balancing "
+ "policy in Replica Groups");
-
- JTextField publishedEndpointsTextField = (JTextField)
- _publishedEndpoints.getEditor().getEditorComponent();
+ JTextField publishedEndpointsTextField = (JTextField)_publishedEndpoints.getEditor().getEditorComponent();
publishedEndpointsTextField.getDocument().addDocumentListener(_updateListener);
_publishedEndpoints.setToolTipText(
"Endpoints registered with the IceGrid Registry during the activation of this adapter.");
}
-
-
+
//
// From CommunicatorChildEditor
//
void writeDescriptor()
{
- AdapterDescriptor descriptor =
- (AdapterDescriptor)getAdapter().getDescriptor();
+ AdapterDescriptor descriptor = (AdapterDescriptor)getAdapter().getDescriptor();
descriptor.name = _name.getText().trim();
descriptor.description = _description.getText();
descriptor.id = getIdAsString();
@@ -199,14 +188,13 @@ class AdapterEditor extends CommunicatorChildEditor
descriptor.serverLifetime = _serverLifetime.isSelected();
descriptor.objects = _objectList;
descriptor.allocatables = _allocatableList;
- }
-
+ }
+
boolean isSimpleUpdate()
{
- AdapterDescriptor descriptor =
- (AdapterDescriptor)getAdapter().getDescriptor();
+ AdapterDescriptor descriptor = (AdapterDescriptor)getAdapter().getDescriptor();
- return descriptor.name.equals(_name.getText().trim());
+ return descriptor.name.equals(_name.getText().trim());
}
Communicator.ChildList getChildList()
@@ -219,22 +207,21 @@ class AdapterEditor extends CommunicatorChildEditor
builder.append("Adapter Name" );
builder.append(_name, 3);
builder.nextLine();
-
+
builder.append("Description");
builder.nextLine();
builder.append("");
builder.nextRow(-2);
CellConstraints cc = new CellConstraints();
JScrollPane scrollPane = new JScrollPane(_description);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
builder.nextRow(2);
builder.nextLine();
builder.append("Adapter ID");
builder.append(_id, 3);
builder.nextLine();
-
+
builder.append("Replica Group", _replicaGroupId);
builder.append(_replicaGroupButton);
builder.nextLine();
@@ -265,8 +252,7 @@ class AdapterEditor extends CommunicatorChildEditor
builder.append("");
builder.nextRow(-6);
scrollPane = new JScrollPane(_objects);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
@@ -279,8 +265,7 @@ class AdapterEditor extends CommunicatorChildEditor
builder.append("");
builder.nextRow(-6);
scrollPane = new JScrollPane(_allocatables);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
}
@@ -291,7 +276,6 @@ class AdapterEditor extends CommunicatorChildEditor
_propertiesPanel.setName("Adapter Properties");
}
-
void postUpdate()
{
//
@@ -305,9 +289,9 @@ class AdapterEditor extends CommunicatorChildEditor
adapter.removeProperty(_oldName + ".PublishedEndpoints");
_oldName = name;
}
-
+
adapter.setProperty(name + ".Endpoints", _endpoints.getText().trim());
-
+
Object published = _publishedEndpoints.getSelectedItem();
if(published == PUBLISH_ACTUAL)
{
@@ -315,21 +299,17 @@ class AdapterEditor extends CommunicatorChildEditor
}
else
{
- adapter.setProperty(name + ".PublishedEndpoints",
- published.toString().trim());
-
+ adapter.setProperty(name + ".PublishedEndpoints", published.toString().trim());
}
//
// Set all objects and allocatables properties
//
- java.util.Map map = _objects.get();
- java.util.Iterator p = map.entrySet().iterator();
- while(p.hasNext())
+ java.util.Map<String, String[]> map = _objects.get();
+ for(java.util.Map.Entry<String, String[]> p : map.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- String key = (String)entry.getKey();
- String[] value = (String[]) entry.getValue();
+ String key = p.getKey();
+ String[] value = p.getValue();
if(!value[1].equals(""))
{
adapter.setProperty(value[1], key);
@@ -337,19 +317,17 @@ class AdapterEditor extends CommunicatorChildEditor
}
map = _allocatables.get();
- p = map.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, String[]> p : map.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- String key = (String)entry.getKey();
- String[] value = (String[]) entry.getValue();
+ String key = p.getKey();
+ String[] value = p.getValue();
if(!value[1].equals(""))
{
adapter.setProperty(value[1], key);
}
}
}
-
+
private void setId(String id)
{
if(id.equals(_defaultAdapterId))
@@ -365,8 +343,7 @@ class AdapterEditor extends CommunicatorChildEditor
private void refreshId()
{
Object id = _id.getSelectedItem();
- _id.setModel(new DefaultComboBoxModel(new Object[]
- {DEFAULT_ADAPTER_ID}));
+ _id.setModel(new DefaultComboBoxModel(new Object[]{DEFAULT_ADAPTER_ID}));
_id.setSelectedItem(id);
}
@@ -386,10 +363,10 @@ class AdapterEditor extends CommunicatorChildEditor
{
ReplicaGroups replicaGroups =
getAdapter().getRoot().getReplicaGroups();
-
- ReplicaGroup replicaGroup =
+
+ ReplicaGroup replicaGroup =
(ReplicaGroup)replicaGroups.findChild(replicaGroupId);
-
+
if(replicaGroup != null)
{
_replicaGroupId.setSelectedItem(replicaGroup);
@@ -397,10 +374,10 @@ class AdapterEditor extends CommunicatorChildEditor
else
{
_replicaGroupId.setSelectedItem(replicaGroupId);
- }
+ }
}
}
-
+
private String getReplicaGroupIdAsString()
{
Object obj = _replicaGroupId.getSelectedItem();
@@ -420,7 +397,7 @@ class AdapterEditor extends CommunicatorChildEditor
// First validate stringified identities
//
_objectList = mapToObjectDescriptorSeq(_objects.get());
-
+
if(_objectList == null)
{
return false;
@@ -432,7 +409,7 @@ class AdapterEditor extends CommunicatorChildEditor
{
return false;
}
-
+
return check(new String[]{
"Adapter Name", _name.getText().trim(),
"Adapter ID", getIdAsString(),
@@ -446,12 +423,11 @@ class AdapterEditor extends CommunicatorChildEditor
_target = adapter;
AdapterDescriptor descriptor = (AdapterDescriptor)adapter.getDescriptor();
-
- final Utils.Resolver resolver = adapter.getCoordinator().substitute() ?
- adapter.getResolver() : null;
+
+ final Utils.Resolver resolver = adapter.getCoordinator().substitute() ? adapter.getResolver() : null;
boolean isEditable = resolver == null;
-
+
_oldName = descriptor.name;
_name.setText(Utils.substitute(descriptor.name, resolver));
@@ -459,8 +435,7 @@ class AdapterEditor extends CommunicatorChildEditor
String oaPrefix = descriptor.name + ".";
- _description.setText(
- Utils.substitute(descriptor.description, resolver));
+ _description.setText(Utils.substitute(descriptor.description, resolver));
_description.setEditable(isEditable);
_description.setOpaque(isEditable);
@@ -468,7 +443,7 @@ class AdapterEditor extends CommunicatorChildEditor
// Need to make control editable & enabled before changing it
//
_id.setEnabled(true);
- _id.setEditable(true);
+ _id.setEditable(true);
_defaultAdapterId = adapter.getDefaultAdapterId();
refreshId();
if(descriptor.id == null)
@@ -481,10 +456,9 @@ class AdapterEditor extends CommunicatorChildEditor
_id.setEditable(isEditable);
_replicaGroupId.setEnabled(true);
- _replicaGroupId.setEditable(true);
-
- final ReplicaGroups replicaGroups =
- adapter.getRoot().getReplicaGroups();
+ _replicaGroupId.setEditable(true);
+
+ final ReplicaGroups replicaGroups = adapter.getRoot().getReplicaGroups();
_replicaGroupId.setModel(replicaGroups.createComboBoxModel(NOT_REPLICATED));
_replicaGroupId.addItemListener(new ItemListener()
@@ -499,8 +473,7 @@ class AdapterEditor extends CommunicatorChildEditor
{
if(resolver != null)
{
- String replicaGroupId =
- resolver.substitute(item.toString().trim());
+ String replicaGroupId = resolver.substitute(item.toString().trim());
enabled = (replicaGroups.findChild(replicaGroupId) != null);
}
}
@@ -516,9 +489,9 @@ class AdapterEditor extends CommunicatorChildEditor
_priority.setText(Utils.substitute(descriptor.priority, resolver));
_priority.setEditable(isEditable);
-
+
String endpoints = Utils.substitute(adapter.getProperty(oaPrefix + "Endpoints"), resolver);
-
+
if(adapter.isEphemeral() && (endpoints == null || endpoints.equals("")))
{
_endpoints.setText("default");
@@ -528,11 +501,10 @@ class AdapterEditor extends CommunicatorChildEditor
_endpoints.setText(endpoints);
}
_endpoints.setEditable(isEditable);
-
+
_publishedEndpoints.setEnabled(true);
_publishedEndpoints.setEditable(true);
- String published =
- Utils.substitute(adapter.getProperty(oaPrefix + "PublishedEndpoints"), resolver);
+ String published = Utils.substitute(adapter.getProperty(oaPrefix + "PublishedEndpoints"), resolver);
if(published == null || published.equals(""))
{
_publishedEndpoints.setSelectedItem(PUBLISH_ACTUAL);
@@ -549,15 +521,15 @@ class AdapterEditor extends CommunicatorChildEditor
//
_objects.set(objectDescriptorSeqToMap(descriptor.objects), resolver, isEditable);
_allocatables.set(objectDescriptorSeqToMap(descriptor.allocatables), resolver, isEditable);
-
+
_registerProcess.setSelected(descriptor.registerProcess);
_registerProcess.setEnabled(isEditable);
-
+
_serverLifetime.setSelected(descriptor.serverLifetime);
_serverLifetime.setEnabled(isEditable);
_applyButton.setEnabled(adapter.isEphemeral());
- _discardButton.setEnabled(adapter.isEphemeral());
+ _discardButton.setEnabled(adapter.isEphemeral());
detectUpdates(true);
if(adapter.isEphemeral())
@@ -571,38 +543,32 @@ class AdapterEditor extends CommunicatorChildEditor
return (Adapter)_target;
}
- private java.util.Map objectDescriptorSeqToMap(java.util.List objects)
+ private java.util.Map<String, String[]> objectDescriptorSeqToMap(java.util.List<ObjectDescriptor> objects)
{
- java.util.Map result = new java.util.TreeMap();
- java.util.Iterator p = objects.iterator();
- while(p.hasNext())
+ java.util.Map<String, String[]> result = new java.util.TreeMap<String, String[]>();
+ for(ObjectDescriptor p : objects)
{
- ObjectDescriptor od = (ObjectDescriptor)p.next();
- String k = Ice.Util.identityToString(od.id);
-
- result.put(k, new String[]{od.type, getAdapter().lookupPropertyValue(k)});
+ String k = Ice.Util.identityToString(p.id);
+ result.put(k, new String[]{p.type, getAdapter().lookupPropertyValue(k)});
}
return result;
}
-
- private java.util.LinkedList mapToObjectDescriptorSeq(java.util.Map map)
+
+ private java.util.LinkedList<ObjectDescriptor> mapToObjectDescriptorSeq(java.util.Map<String, String[]> map)
{
String badIdentities = "";
- java.util.LinkedList result = new java.util.LinkedList();
- java.util.Iterator p = map.entrySet().iterator();
-
- while(p.hasNext())
+ java.util.LinkedList<ObjectDescriptor> result = new java.util.LinkedList<ObjectDescriptor>();
+ for(java.util.Map.Entry<String, String[]> p : map.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
try
{
- Ice.Identity id = Ice.Util.stringToIdentity((String)entry.getKey());
- String[] val = (String[])entry.getValue();
+ Ice.Identity id = Ice.Util.stringToIdentity(p.getKey());
+ String[] val = p.getValue();
result.add(new ObjectDescriptor(id, val[0]));
}
catch(Ice.IdentityParseException ex)
{
- badIdentities += "- " + (String)entry.getKey() + "\n";
+ badIdentities += "- " + p.getKey() + "\n";
}
}
@@ -631,9 +597,9 @@ class AdapterEditor extends CommunicatorChildEditor
return _defaultAdapterId;
}
};
-
+
private String _oldName;
-
+
private JTextField _name = new JTextField(20);
private JTextArea _description = new JTextArea(3, 20);
@@ -642,10 +608,9 @@ class AdapterEditor extends CommunicatorChildEditor
private JButton _replicaGroupButton;
private JTextField _priority = new JTextField(20);
-
+
private JTextField _endpoints = new JTextField(20);
- private JComboBox _publishedEndpoints = new JComboBox(
- new Object[]{PUBLISH_ACTUAL});
+ private JComboBox _publishedEndpoints = new JComboBox(new Object[]{PUBLISH_ACTUAL});
private JTextField _currentStatus = new JTextField(20);
private JTextField _currentEndpoints = new JTextField(20);
@@ -653,10 +618,10 @@ class AdapterEditor extends CommunicatorChildEditor
private JCheckBox _registerProcess;
private JCheckBox _serverLifetime;
- private MapField _objects;
- private java.util.LinkedList _objectList;
- private MapField _allocatables;
- private java.util.LinkedList _allocatableList;
+ private ArrayMapField _objects;
+ private java.util.LinkedList<ObjectDescriptor> _objectList;
+ private ArrayMapField _allocatables;
+ private java.util.LinkedList<ObjectDescriptor> _allocatableList;
static private final Object PUBLISH_ACTUAL = new Object()
{
@@ -665,7 +630,7 @@ class AdapterEditor extends CommunicatorChildEditor
return "Actual endpoints";
}
};
-
+
static private final Object NOT_REPLICATED = new Object()
{
public String toString()
diff --git a/java/src/IceGridGUI/Application/ApplicationEditor.java b/java/src/IceGridGUI/Application/ApplicationEditor.java
index 4317eeea0e2..a63a51ac560 100644
--- a/java/src/IceGridGUI/Application/ApplicationEditor.java
+++ b/java/src/IceGridGUI/Application/ApplicationEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -68,14 +69,14 @@ class ApplicationEditor extends Editor
//
root.updated();
root.getEditable().markModified();
-
+
if(!savedDescriptor.name.equals(root.getId()))
{
mainPane.resetTitle(root);
root.getTreeModel().nodeChanged(root);
}
}
-
+
_applyButton.setEnabled(false);
_discardButton.setEnabled(false);
return true;
@@ -90,11 +91,11 @@ class ApplicationEditor extends Editor
{
_name.getDocument().addDocumentListener(_updateListener);
_description.getDocument().addDocumentListener(_updateListener);
-
+
//
// Variables
//
- _variables = new MapField(this, "Name", "Value", false);
+ _variables = new SimpleMapField(this, false, "Name", "Value");
//
// Distrib
@@ -103,10 +104,8 @@ class ApplicationEditor extends Editor
_distrib.setEditable(true);
_distrib.setToolTipText("The proxy to the IcePatch2 server holding your files");
- JTextField distribTextField = (JTextField)
- _distrib.getEditor().getEditorComponent();
- distribTextField.getDocument().addDocumentListener(
- _updateListener);
+ JTextField distribTextField = (JTextField)_distrib.getEditor().getEditorComponent();
+ distribTextField.getDocument().addDocumentListener(_updateListener);
_distribDirs.getDocument().addDocumentListener(_updateListener);
_distribDirs.setToolTipText(
@@ -114,9 +113,9 @@ class ApplicationEditor extends Editor
+ "Use whitespace as separator; use double-quotes around directories containing whitespaces</html>");
}
-
+
protected void appendProperties(DefaultFormBuilder builder)
- {
+ {
builder.append("Name");
builder.append(_name, 3);
@@ -126,8 +125,7 @@ class ApplicationEditor extends Editor
builder.nextRow(-2);
CellConstraints cc = new CellConstraints();
JScrollPane scrollPane = new JScrollPane(_description);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
builder.nextRow(2);
builder.nextLine();
@@ -140,8 +138,7 @@ class ApplicationEditor extends Editor
builder.append("");
builder.nextRow(-6);
scrollPane = new JScrollPane(_variables);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
@@ -154,7 +151,7 @@ class ApplicationEditor extends Editor
builder.append(_distribDirs, 3);
builder.nextLine();
}
-
+
protected void buildPropertiesPanel()
{
super.buildPropertiesPanel();
@@ -164,8 +161,7 @@ class ApplicationEditor extends Editor
boolean isSimpleUpdate()
{
ApplicationDescriptor descriptor = (ApplicationDescriptor)_target.getDescriptor();
- return descriptor.name.equals(_name.getText().trim())
- && _variables.get().equals(descriptor.variables);
+ return descriptor.name.equals(_name.getText().trim()) && _variables.get().equals(descriptor.variables);
}
void writeDescriptor()
@@ -184,8 +180,8 @@ class ApplicationEditor extends Editor
descriptor.distrib.icepatch = _distrib.getSelectedItem().toString().trim();
}
descriptor.distrib.directories = _distribDirs.getList();
- }
-
+ }
+
protected boolean validate()
{
return check(new String[]{"Name", _name.getText().trim()});
@@ -195,28 +191,25 @@ class ApplicationEditor extends Editor
{
detectUpdates(false);
_target = root;
-
+
Utils.Resolver resolver = getDetailResolver();
boolean isEditable = (resolver == null);
- ApplicationDescriptor descriptor =
- (ApplicationDescriptor)root.getDescriptor();
+ ApplicationDescriptor descriptor = (ApplicationDescriptor)root.getDescriptor();
_name.setText(descriptor.name);
_name.setEditable(!root.isLive() && isEditable);
- _description.setText(
- Utils.substitute(descriptor.description, resolver));
+ _description.setText(Utils.substitute(descriptor.description, resolver));
_description.setEditable(isEditable);
_description.setOpaque(isEditable);
_description.setToolTipText("An optional description for this application");
-
+
_variables.set(descriptor.variables, resolver, isEditable);
-
+
_distrib.setEnabled(true);
_distrib.setEditable(true);
- String icepatch =
- Utils.substitute(descriptor.distrib.icepatch, resolver);
+ String icepatch = Utils.substitute(descriptor.distrib.icepatch, resolver);
if(icepatch.equals(""))
{
_distrib.setSelectedItem(NO_DISTRIB);
@@ -232,10 +225,10 @@ class ApplicationEditor extends Editor
_distribDirs.setEditable(isEditable);
_applyButton.setEnabled(false);
- _discardButton.setEnabled(false);
+ _discardButton.setEnabled(false);
detectUpdates(true);
}
-
+
Utils.Resolver getDetailResolver()
{
if(_target.getCoordinator().substitute())
@@ -259,7 +252,7 @@ class ApplicationEditor extends Editor
private JTextField _name = new JTextField(20);
private JTextArea _description = new JTextArea(3, 20);
- private MapField _variables;
+ private SimpleMapField _variables;
private JComboBox _distrib;
private ListTextField _distribDirs = new ListTextField(20);
}
diff --git a/java/src/IceGridGUI/Application/MapField.java b/java/src/IceGridGUI/Application/ArrayMapField.java
index 7d695b110d9..cdb49d25613 100644
--- a/java/src/IceGridGUI/Application/MapField.java
+++ b/java/src/IceGridGUI/Application/ArrayMapField.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import IceGrid.*;
@@ -25,37 +26,36 @@ import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
//
-// A special field used to show/edit a map
+// A special field used to show/edit a map
//
-public class MapField extends JTable
+public class ArrayMapField extends JTable
{
- public MapField(Editor editor, String headKey, String[] headValues, boolean substituteKey)
+ public ArrayMapField(Editor editor, boolean substituteKey, String... columns)
{
_editor = editor;
_substituteKey = substituteKey;
- _vectorSize = headValues.length + 1;
+ _vectorSize = columns.length;
- _columnNames = new java.util.Vector(_vectorSize);
- _columnNames.add(headKey);
- for(int i = 0; i < headValues.length; ++i)
+ _columnNames = new java.util.Vector<String>(_vectorSize);
+ for(String name : columns)
{
- _columnNames.add(headValues[i]);
+ _columnNames.add(name);
}
- assert _vectorSize >= 2;
-
+ assert _vectorSize > 2;
+
Action deleteRow = new AbstractAction("Delete selected row(s)")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(_editable)
{
- if(isEditing())
+ if(isEditing())
{
getCellEditor().stopCellEditing();
}
-
+
for(;;)
{
int selectedRow = getSelectedRow();
@@ -72,58 +72,42 @@ public class MapField extends JTable
}
};
getActionMap().put("delete", deleteRow);
- getInputMap().put(
- KeyStroke.getKeyStroke("DELETE"), "delete");
+ getInputMap().put(KeyStroke.getKeyStroke("DELETE"), "delete");
}
- public MapField(Editor editor, String headKey, String headValue, boolean substituteKey)
- {
- this(editor, headKey, new String[]{headValue}, substituteKey);
- }
-
- public void set(java.util.Map map, Utils.Resolver resolver,
- boolean editable)
+ public void set(java.util.Map<String, String[]> map, Utils.Resolver resolver, boolean editable)
{
_editable = editable;
+ assert(_vectorSize > 2);
//
// Transform map into vector of vectors
//
- java.util.Vector vector = new java.util.Vector(map.size());
- java.util.Iterator p = map.entrySet().iterator();
- while(p.hasNext())
+ java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<java.util.Vector<String>>(map.size());
+ for(java.util.Map.Entry<String, String[]> p : map.entrySet())
{
- java.util.Vector row = new java.util.Vector(_vectorSize);
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
-
+ java.util.Vector<String> row = new java.util.Vector<String>(_vectorSize);
+
if(_substituteKey)
{
- row.add(Utils.substitute((String)entry.getKey(), resolver));
+ row.add(Utils.substitute(p.getKey(), resolver));
}
else
{
- row.add((String)entry.getKey());
+ row.add(p.getKey());
}
- if(_vectorSize == 2)
+ for(String val : p.getValue())
{
- row.add(Utils.substitute((String)entry.getValue(), resolver));
+ row.add(Utils.substitute(val, resolver));
}
- else
- {
- String[] val = (String[])entry.getValue();
- for(int i = 0; i < val.length; ++i)
- {
- row.add(Utils.substitute(val[i], resolver));
- }
- }
vector.add(row);
}
if(_editable)
{
- java.util.Vector newRow = new java.util.Vector(_vectorSize);
+ java.util.Vector<String> newRow = new java.util.Vector<String>(_vectorSize);
for(int i = 0; i < _vectorSize; ++i)
{
newRow.add("");
@@ -138,15 +122,14 @@ public class MapField extends JTable
return _editable;
}
};
-
+
_model.addTableModelListener(new TableModelListener()
{
public void tableChanged(TableModelEvent e)
{
if(_editable)
{
- Object lastKey = _model.getValueAt(
- _model.getRowCount() - 1 , 0);
+ Object lastKey = _model.getValueAt(_model.getRowCount() - 1 , 0);
if(lastKey != null && !lastKey.equals(""))
{
Object[] emptyRow = new Object[_vectorSize];
@@ -166,62 +149,48 @@ public class MapField extends JTable
setOpaque(_editable);
setPreferredScrollableViewportSize(getPreferredSize());
- DefaultTableCellRenderer cr = (DefaultTableCellRenderer)
- getDefaultRenderer(String.class);
- cr.setOpaque(_editable);
+ DefaultTableCellRenderer cr = (DefaultTableCellRenderer)getDefaultRenderer(String.class);
+ cr.setOpaque(_editable);
}
-
- public java.util.TreeMap get()
+ public java.util.TreeMap<String, String[]> get()
{
assert _editable;
+ assert(_vectorSize > 2);
- if(isEditing())
+ if(isEditing())
{
getCellEditor().stopCellEditing();
}
- java.util.Vector vector = _model.getDataVector();
-
- java.util.TreeMap result = new java.util.TreeMap();
+ @SuppressWarnings("unchecked")
+ java.util.Vector<java.util.Vector<String>> vector =
+ (java.util.Vector<java.util.Vector<String>>)_model.getDataVector();
+
+ java.util.TreeMap<String, String[]> result = new java.util.TreeMap<String, String[]>();
- java.util.Iterator p = vector.iterator();
- while(p.hasNext())
+ for(java.util.Vector<String> row : vector)
{
- java.util.Vector row = (java.util.Vector)p.next();
-
- //
- // Eliminate rows with null or empty keys
- //
- String key = (String)row.elementAt(0);
- if(key != null)
- {
- key = key.trim();
- if(!key.equals(""))
- {
- if(_vectorSize == 2)
- {
- String val = (String)row.elementAt(1);
- if(val == null)
- {
- val = "";
- }
- result.put(key, val);
- }
- else
- {
- String[] val = new String[_vectorSize - 1];
- for(int i = 1; i < _vectorSize; ++i)
- {
- val[i - 1] = (String)row.elementAt(i);
- if(val[i - 1] == null)
- {
- val[i - 1] = "";
- }
- }
- result.put(key, val);
- }
- }
- }
+ //
+ // Eliminate rows with null or empty keys
+ //
+ String key = row.elementAt(0);
+ if(key != null)
+ {
+ key = key.trim();
+ if(!key.equals(""))
+ {
+ String[] val = new String[_vectorSize - 1];
+ for(int i = 1; i < _vectorSize; ++i)
+ {
+ val[i - 1] = row.elementAt(i);
+ if(val[i - 1] == null)
+ {
+ val[i - 1] = "";
+ }
+ }
+ result.put(key, val);
+ }
+ }
}
return result;
}
@@ -229,12 +198,10 @@ public class MapField extends JTable
private final int _vectorSize;
private DefaultTableModel _model;
- private java.util.Vector _columnNames;
+ private java.util.Vector<String> _columnNames;
private boolean _editable = false;
private boolean _substituteKey;
private Editor _editor;
}
-
-
diff --git a/java/src/IceGridGUI/Application/Communicator.java b/java/src/IceGridGUI/Application/Communicator.java
index caf677d7123..e23f7b9a4a2 100644
--- a/java/src/IceGridGUI/Application/Communicator.java
+++ b/java/src/IceGridGUI/Application/Communicator.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.util.Enumeration;
@@ -31,7 +32,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
{
return true;
}
-
+
while(++_index < _childListArray.length)
{
_p = _childListArray[_index].iterator();
@@ -61,17 +62,17 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
}
}
}
-
+
private int _index = 0;
private java.util.Iterator _p = _childListArray[0].iterator();
};
}
-
+
public boolean getAllowsChildren()
{
return true;
}
-
+
public javax.swing.tree.TreeNode getChildAt(int childIndex)
{
if(childIndex < 0)
@@ -79,39 +80,39 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
throw new ArrayIndexOutOfBoundsException(childIndex);
}
int offset = 0;
- for(int i = 0; i < _childListArray.length; ++i)
+ for(ChildList childList : _childListArray)
{
- if(childIndex < offset + _childListArray[i].size())
+ if(childIndex < offset + childList.size())
{
- return _childListArray[i].get(childIndex - offset);
+ return childList.get(childIndex - offset);
}
else
{
- offset += _childListArray[i].size();
+ offset += childList.size();
}
}
throw new ArrayIndexOutOfBoundsException(childIndex);
}
-
+
public int getChildCount()
{
int result = 0;
- for(int i = 0; i < _childListArray.length; ++i)
+ for(ChildList childList : _childListArray)
{
- result += _childListArray[i].size();
+ result += childList.size();
}
return result;
}
-
+
public int getIndex(javax.swing.tree.TreeNode node)
{
int offset = 0;
- for(int i = 0; i < _childListArray.length; ++i)
+ for(ChildList childList : _childListArray)
{
- int index = _childListArray[i].indexOf(node);
+ int index = childList.indexOf(node);
if(index == -1)
{
- offset += _childListArray[i].size();
+ offset += childList.size();
}
else
{
@@ -123,9 +124,9 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
public boolean isLeaf()
{
- for(int i = 0; i < _childListArray.length; ++i)
+ for(ChildList childList : _childListArray)
{
- if(!_childListArray[i].isEmpty())
+ if(!childList.isEmpty())
{
return false;
}
@@ -141,14 +142,17 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
{
_adapters.newChild();
}
+
public void newDbEnv()
{
_dbEnvs.newChild();
}
+
public void newService()
{
_services.newChild();
}
+
public void newServiceFromTemplate()
{
_services.newServiceFromTemplate();
@@ -161,7 +165,8 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
if(descriptor instanceof Adapter.AdapterCopy)
{
Adapter.AdapterCopy copy = (Adapter.AdapterCopy)descriptor;
- _adapters.newAdapter(Adapter.copyDescriptor(copy.descriptor), new java.util.HashMap(copy.parentProperties));
+ _adapters.newAdapter(Adapter.copyDescriptor(copy.descriptor),
+ new java.util.HashMap<String, String>(copy.parentProperties));
}
else if(descriptor instanceof DbEnvDescriptor)
{
@@ -178,7 +183,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
((TreeNode)_parent).paste();
}
}
-
+
abstract CommunicatorDescriptor getCommunicatorDescriptor();
abstract Editable getEnclosingEditable();
@@ -186,14 +191,13 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
// When 'this' is a template, returns all instances of this template.
// Otherwise, return just 'this'
//
- java.util.List findInstances()
+ java.util.List<? extends TemplateInstance> findInstances()
{
- java.util.List result = new java.util.LinkedList();
- result.add(this);
+ java.util.List<TemplateInstance> result = new java.util.LinkedList<TemplateInstance>();
+ result.add((TemplateInstance)this);
return result;
}
-
-
+
TreeNode findChildLike(TreeNode other)
{
if(other instanceof Adapter)
@@ -224,9 +228,9 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
super(parent, id);
}
- abstract class ChildList
+ abstract class ChildList<T>
{
- abstract TreeNode createChild(Object descriptor) throws UpdateFailedException;
+ abstract TreeNode createChild(T descriptor) throws UpdateFailedException;
abstract void newChild();
protected ChildList(boolean sorted)
@@ -234,34 +238,33 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
_sorted = sorted;
}
- void write(XMLWriter writer) throws java.io.IOException
+ void write(XMLWriter writer)
+ throws java.io.IOException
{
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(TreeNode p : _children)
{
- TreeNode child = (TreeNode)p.next();
- child.write(writer);
+ p.write(writer);
}
}
//
// Some list-like methods
//
- java.util.Iterator iterator()
+ java.util.Iterator<TreeNode> iterator()
{
return _children.iterator();
}
TreeNode get(int index)
{
- return (TreeNode)_children.get(index);
+ return _children.get(index);
}
int indexOf(Object obj)
{
return _children.indexOf(obj);
}
-
+
int size()
{
return _children.size();
@@ -271,22 +274,21 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
{
return _children.isEmpty();
}
-
+
//
// Non-list methods
//
- void init(java.util.List descriptors) throws UpdateFailedException
+ void init(java.util.List<T> descriptors)
+ throws UpdateFailedException
{
assert _descriptors == null;
assert _children.isEmpty();
_descriptors = descriptors;
- java.util.Iterator p = _descriptors.iterator();
- while(p.hasNext())
+ for(T descriptor : _descriptors)
{
- Object descriptor = p.next();
TreeNode child = createChild(descriptor);
addChild(child, false);
}
@@ -303,23 +305,22 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
_children.clear();
}
- TreeNode addNewChild(Object descriptor) throws UpdateFailedException
+ TreeNode addNewChild(T descriptor)
+ throws UpdateFailedException
{
TreeNode child = createChild(descriptor);
addChild(child, true);
-
+
return child;
}
- TreeNode findChildWithDescriptor(Object descriptor)
+ TreeNode findChildWithDescriptor(T descriptor)
{
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(TreeNode p : _children)
{
- TreeNode child = (TreeNode)p.next();
- if(child.getDescriptor() == descriptor)
+ if(p.getDescriptor() == descriptor)
{
- return child;
+ return p;
}
}
return null;
@@ -327,25 +328,23 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
TreeNode findChildById(String id)
{
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(TreeNode p : _children)
{
- TreeNode child = (TreeNode)p.next();
- if(child.getId().equals(id))
+ if(p.getId().equals(id))
{
- return child;
+ return p;
}
}
return null;
}
- void addChild(TreeNode child, boolean fireEvent) throws UpdateFailedException
+ void addChild(TreeNode child, boolean fireEvent)
+ throws UpdateFailedException
{
if(_sorted)
{
- DefaultTreeModel treeModel = fireEvent ?
- getRoot().getTreeModel() : null;
-
+ DefaultTreeModel treeModel = fireEvent ? getRoot().getTreeModel() : null;
+
if(!insertSortedChild(child, _children, treeModel))
{
throw new UpdateFailedException(Communicator.this, child.getId());
@@ -367,14 +366,12 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
int removeChild(TreeNode child)
{
int index = getIndex(child);
-
+
_children.remove(child);
-
- getRoot().getTreeModel().nodesWereRemoved(Communicator.this,
- new int[]{index},
- new Object[]{child});
+
+ getRoot().getTreeModel().nodesWereRemoved(Communicator.this, new int[]{index}, new Object[]{child});
return index;
- }
+ }
void destroyChild(TreeNode child)
{
@@ -384,7 +381,8 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
}
else
{
- Object descriptor = child.getDescriptor();
+ @SuppressWarnings("unchecked")
+ T descriptor = (T)child.getDescriptor();
removeDescriptor(descriptor);
getEnclosingEditable().markModified();
getRoot().updated();
@@ -392,17 +390,17 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
}
}
- void addDescriptor(Object descriptor)
+ void addDescriptor(T descriptor)
{
_descriptors.add(descriptor);
}
- void removeDescriptor(Object descriptor)
+ void removeDescriptor(T descriptor)
{
//
// A straight remove uses equals(), which is not the desired behavior
//
- java.util.Iterator p = _descriptors.iterator();
+ java.util.Iterator<T> p = _descriptors.iterator();
while(p.hasNext())
{
if(descriptor == p.next())
@@ -412,15 +410,16 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
}
}
}
-
+
boolean canMove(TreeNode child, boolean up)
- {
+ {
int i = _children.indexOf(child);
assert i != -1;
return (up && i > 0) || (!up && i < _children.size() - 1);
}
- void tryAdd(Object descriptor) throws UpdateFailedException
+ void tryAdd(T descriptor)
+ throws UpdateFailedException
{
addDescriptor(descriptor);
try
@@ -435,14 +434,16 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
getEnclosingEditable().markModified();
}
- void tryUpdate(TreeNode child) throws UpdateFailedException
+ void tryUpdate(TreeNode child)
+ throws UpdateFailedException
{
//
// Child is an Adapter or DbEnv
//
assert _sorted;
- Object descriptor = child.getDescriptor();
+ @SuppressWarnings("unchecked")
+ T descriptor = (T)child.getDescriptor();
removeChild(child);
try
{
@@ -467,28 +468,27 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
return id;
}
- protected java.util.List _children = new java.util.LinkedList();
- protected java.util.List _descriptors;
+ protected java.util.List<TreeNode> _children = new java.util.LinkedList<TreeNode>();
+ protected java.util.List<T> _descriptors;
protected boolean _sorted;
}
- class Adapters extends ChildList
+ class Adapters extends ChildList<AdapterDescriptor>
{
Adapters()
{
super(true);
}
- void write(XMLWriter writer, java.util.List props) throws java.io.IOException
+ void write(XMLWriter writer, java.util.List<PropertyDescriptor> props)
+ throws java.io.IOException
{
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(TreeNode p : _children)
{
- Adapter child = (Adapter)p.next();
- child.write(writer, props);
+ ((Adapter)p).write(writer, props);
}
}
-
+
void newChild()
{
AdapterDescriptor descriptor = new AdapterDescriptor(
@@ -499,21 +499,28 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
"",
false,
true,
- new java.util.LinkedList(),
- new java.util.LinkedList()
- );
-
+ new java.util.LinkedList<ObjectDescriptor>(),
+ new java.util.LinkedList<ObjectDescriptor>()
+ );
+
newAdapter(descriptor, null);
}
+ /*
TreeNode createChild(Object descriptor)
{
AdapterDescriptor ad = (AdapterDescriptor)descriptor;
String name = Utils.substitute(ad.name, getResolver());
return new Adapter(Communicator.this, name, ad, null, false);
}
-
- private void newAdapter(AdapterDescriptor descriptor, java.util.Map parentProperties)
+ */
+ TreeNode createChild(AdapterDescriptor descriptor)
+ {
+ String name = Utils.substitute(descriptor.name, getResolver());
+ return new Adapter(Communicator.this, name, descriptor, null, false);
+ }
+
+ private void newAdapter(AdapterDescriptor descriptor, java.util.Map<String, String> parentProperties)
{
String newName = makeNewChildId(descriptor.name);
@@ -524,14 +531,14 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
//
String key = descriptor.name + ".Endpoints";
- String val = (String)parentProperties.remove(key);
+ String val = parentProperties.remove(key);
if(val != null)
{
parentProperties.put(newName + ".Endpoints", val);
}
key = descriptor.name + ".PublishedEndpoints";
- val = (String)parentProperties.remove(key);
+ val = parentProperties.remove(key);
if(val != null)
{
parentProperties.put(newName + ".PublishedEndpoints", val);
@@ -553,29 +560,32 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
}
}
- class DbEnvs extends ChildList
+ class DbEnvs extends ChildList<DbEnvDescriptor>
{
DbEnvs()
{
super(true);
}
-
+
void newChild()
{
DbEnvDescriptor descriptor = new DbEnvDescriptor(
"NewDbEnv",
"",
"",
- new java.util.LinkedList());
-
+ new java.util.LinkedList<PropertyDescriptor>());
+
newDbEnv(descriptor);
}
-
- TreeNode createChild(Object descriptor)
+
+ //TreeNode createChild(Object descriptor)
+ TreeNode createChild(DbEnvDescriptor descriptor)
{
- DbEnvDescriptor dd = (DbEnvDescriptor)descriptor;
- String name = Utils.substitute(dd.name, getResolver());
- return new DbEnv(Communicator.this, name, dd, false);
+ //DbEnvDescriptor dd = (DbEnvDescriptor)descriptor;
+ //String name = Utils.substitute(dd.name, getResolver());
+ //return new DbEnv(Communicator.this, name, dd, false);
+ String name = Utils.substitute(descriptor.name, getResolver());
+ return new DbEnv(Communicator.this, name, descriptor, false);
}
private void newDbEnv(DbEnvDescriptor descriptor)
@@ -592,10 +602,9 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
}
getRoot().setSelectedNode(dbEnv);
}
-
}
-
- class Services extends ChildList
+
+ class Services extends ChildList<ServiceInstanceDescriptor>
{
Services()
{
@@ -604,44 +613,50 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
void newChild()
{
- ServiceDescriptor serviceDescriptor =
- new ServiceDescriptor(new java.util.LinkedList(),
- new PropertySetDescriptor(new String[0], new java.util.LinkedList()),
- new java.util.LinkedList(),
+ ServiceDescriptor serviceDescriptor =
+ new ServiceDescriptor(new java.util.LinkedList<AdapterDescriptor>(),
+ new PropertySetDescriptor(
+ new String[0], new java.util.LinkedList<PropertyDescriptor>()),
+ new java.util.LinkedList<DbEnvDescriptor>(),
new String[0],
"",
"NewService",
"");
- ServiceInstanceDescriptor descriptor =
+ ServiceInstanceDescriptor descriptor =
new ServiceInstanceDescriptor("",
- new java.util.HashMap(),
+ new java.util.HashMap<String, String>(),
serviceDescriptor,
- new PropertySetDescriptor(new String[0], new java.util.LinkedList()));
-
+ new PropertySetDescriptor(
+ new String[0], new java.util.LinkedList<PropertyDescriptor>())
+ );
+
newService(descriptor);
}
void newServiceFromTemplate()
{
- ServiceInstanceDescriptor descriptor =
+ ServiceInstanceDescriptor descriptor =
new ServiceInstanceDescriptor("",
- new java.util.HashMap(),
+ new java.util.HashMap<String, String>(),
null,
- new PropertySetDescriptor(new String[0], new java.util.LinkedList()));
+ new PropertySetDescriptor(
+ new String[0],
+ new java.util.LinkedList<PropertyDescriptor>())
+ );
newService(descriptor);
}
-
+
void move(TreeNode child, boolean up)
{
int index = getIndex(child);
int listIndex = _children.indexOf(child);
- Object descriptor = child.getDescriptor();
+ ServiceInstanceDescriptor descriptor = (ServiceInstanceDescriptor)child.getDescriptor();
getEnclosingEditable().markModified();
getRoot().updated();
-
+
_descriptors.remove(listIndex);
if(up)
{
@@ -651,47 +666,42 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
{
_descriptors.add(listIndex + 1, descriptor);
}
-
+
_children.remove(listIndex);
- getRoot().getTreeModel().nodesWereRemoved(Communicator.this,
- new int[]{index},
- new Object[]{child});
+ getRoot().getTreeModel().nodesWereRemoved(Communicator.this, new int[]{index}, new Object[]{child});
if(up)
{
_children.add(listIndex - 1, child);
- getRoot().getTreeModel().nodesWereInserted(Communicator.this,
- new int[]{index - 1});
-
+ getRoot().getTreeModel().nodesWereInserted(Communicator.this, new int[]{index - 1});
}
else
{
_children.add(listIndex + 1, child);
- getRoot().getTreeModel().nodesWereInserted(Communicator.this,
- new int[]{index + 1});
-
+ getRoot().getTreeModel().nodesWereInserted(Communicator.this, new int[]{index + 1});
}
getRoot().setSelectedNode(child);
getCoordinator().showActions(child);
}
- TreeNode createChild(Object o) throws UpdateFailedException
+ TreeNode createChild(ServiceInstanceDescriptor descriptor)
+ throws UpdateFailedException
{
- ServiceInstanceDescriptor descriptor = (ServiceInstanceDescriptor)o;
+ //ServiceInstanceDescriptor descriptor = (ServiceInstanceDescriptor)o;
if(descriptor.descriptor == null)
- {
+ {
String serviceName = null;
String displayString = null;
Utils.Resolver serviceResolver = null;
if(Communicator.this instanceof PlainServer)
{
- TemplateDescriptor templateDescriptor
+ TemplateDescriptor templateDescriptor
= getRoot().findServiceTemplateDescriptor(descriptor.template);
-
+
assert templateDescriptor != null;
- serviceResolver = new Utils.Resolver(getResolver(),
+ serviceResolver = new Utils.Resolver(getResolver(),
descriptor.parameterValues,
templateDescriptor.parameterDefaults);
@@ -710,11 +720,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
serviceName = descriptor.template + "<>";
}
- return new ServiceInstance(Communicator.this,
- serviceName,
- displayString,
- descriptor,
- serviceResolver);
+ return new ServiceInstance(Communicator.this, serviceName, displayString, descriptor, serviceResolver);
}
else
{
@@ -733,28 +739,26 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
{
serviceName = serviceDescriptor.name;
}
-
- return new PlainService(Communicator.this,
- serviceName,
- descriptor,
- serviceResolver);
+
+ return new PlainService(Communicator.this, serviceName, descriptor, serviceResolver);
}
}
-
- void tryUpdate(TreeNode child) throws UpdateFailedException
+
+ void tryUpdate(TreeNode child)
+ throws UpdateFailedException
{
//
// Rebuilding a Service is quite different since the creation of a service can
// trigger an UpdateFailedException
//
- Object descriptor = child.getDescriptor();
+ ServiceInstanceDescriptor descriptor = (ServiceInstanceDescriptor)child.getDescriptor();
int listIndex = _children.indexOf(child);
assert listIndex != -1;
-
+
TreeNode newChild = createChild(descriptor);
_children.set(listIndex, newChild);
getRoot().getTreeModel().nodeStructureChanged(newChild);
-
+
getEnclosingEditable().markModified();
}
@@ -763,12 +767,12 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
if(descriptor.descriptor == null)
{
String name = makeNewChildId("NewService");
-
+
//
// Make sure descriptor.template points to a real template
//
ServiceTemplate t = getRoot().findServiceTemplate(descriptor.template);
-
+
if(t == null)
{
if(getRoot().getServiceTemplates().getChildCount() == 0)
@@ -784,18 +788,16 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
{
t = (ServiceTemplate)getRoot().getServiceTemplates().getChildAt(0);
descriptor.template = t.getId();
- descriptor.parameterValues = new java.util.HashMap();
+ descriptor.parameterValues = new java.util.HashMap<String, String>();
}
}
-
+
//
// Validate/update parameterValues
//
TemplateDescriptor td = (TemplateDescriptor)t.getDescriptor();
- descriptor.parameterValues = Editor.makeParameterValues(descriptor.parameterValues,
- td.parameters);
-
-
+ descriptor.parameterValues = Editor.makeParameterValues(descriptor.parameterValues, td.parameters);
+
ServiceInstance service = new ServiceInstance(Communicator.this, name, descriptor);
try
{
@@ -824,7 +826,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
}
}
}
-
+
Adapters getAdapters()
{
return _adapters;
@@ -840,18 +842,17 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
return _services;
}
- java.util.List findServiceInstances(String template)
- {
- java.util.List result = new java.util.LinkedList();
- java.util.Iterator p = _services.iterator();
+ java.util.List<ServiceInstance> findServiceInstances(String template)
+ {
+ java.util.List<ServiceInstance> result = new java.util.LinkedList<ServiceInstance>();
+ java.util.Iterator<TreeNode> p = _services.iterator();
while(p.hasNext())
{
- Object obj = p.next();
+ ServiceInstance obj = (ServiceInstance)p.next();
if(obj instanceof ServiceInstance)
{
ServiceInstance service = (ServiceInstance)obj;
- ServiceInstanceDescriptor d =
- (ServiceInstanceDescriptor)service.getDescriptor();
+ ServiceInstanceDescriptor d = (ServiceInstanceDescriptor)service.getDescriptor();
if(d.template.equals(template))
{
result.add(service);
@@ -862,18 +863,17 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
}
void removeServiceInstances(String template)
- {
+ {
boolean updated = false;
- java.util.Iterator p = _services.iterator();
+ java.util.Iterator<TreeNode> p = _services.iterator();
while(p.hasNext())
{
- Object obj = p.next();
+ TreeNode obj = p.next();
if(obj instanceof ServiceInstance)
{
ServiceInstance service = (ServiceInstance)obj;
- ServiceInstanceDescriptor d =
- (ServiceInstanceDescriptor)service.getDescriptor();
+ ServiceInstanceDescriptor d = (ServiceInstanceDescriptor)service.getDescriptor();
if(d.template.equals(template))
{
p.remove();
@@ -889,11 +889,12 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
}
}
- void removeSortedChildren(String[] childIds, java.util.List fromChildren)
+ void removeSortedChildren(String[] childIds, java.util.List<TreeNodeBase> fromChildren)
{
removeSortedChildren(childIds, fromChildren, getRoot().getTreeModel());
}
- void childrenChanged(java.util.List children)
+
+ void childrenChanged(java.util.List<TreeNodeBase> children)
{
childrenChanged(children, getRoot().getTreeModel());
}
@@ -901,13 +902,11 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
String getProperty(String key)
{
CommunicatorDescriptor descriptor = getCommunicatorDescriptor();
- java.util.Iterator p = descriptor.propertySet.properties.iterator();
- while(p.hasNext())
+ for(PropertyDescriptor p : descriptor.propertySet.properties)
{
- PropertyDescriptor pd = (PropertyDescriptor)p.next();
- if(pd.name.equals(key))
+ if(p.name.equals(key))
{
- return pd.value;
+ return p.value;
}
}
return null;
@@ -916,33 +915,31 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
String lookupPropertyValue(String val)
{
CommunicatorDescriptor descriptor = getCommunicatorDescriptor();
- java.util.Iterator p = descriptor.propertySet.properties.iterator();
- while(p.hasNext())
+ for(PropertyDescriptor p : descriptor.propertySet.properties)
{
- PropertyDescriptor pd = (PropertyDescriptor)p.next();
- if(pd.value.equals(val))
+ if(p.value.equals(val))
{
- return pd.name;
+ return p.name;
}
}
return "";
}
-
void setProperty(String key, String newValue)
{
CommunicatorDescriptor descriptor = getCommunicatorDescriptor();
removeProperty(key);
- ((java.util.LinkedList)descriptor.propertySet.properties).addFirst(new PropertyDescriptor(key, newValue));
+ ((java.util.LinkedList<PropertyDescriptor>)descriptor.propertySet.properties).addFirst(
+ new PropertyDescriptor(key, newValue));
}
void removeProperty(String key)
{
CommunicatorDescriptor descriptor = getCommunicatorDescriptor();
- java.util.Iterator p = descriptor.propertySet.properties.iterator();
+ java.util.Iterator<PropertyDescriptor> p = descriptor.propertySet.properties.iterator();
while(p.hasNext())
{
- PropertyDescriptor pd = (PropertyDescriptor)p.next();
+ PropertyDescriptor pd = p.next();
if(pd.name.equals(key))
{
p.remove();
@@ -950,20 +947,18 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
}
}
- java.util.Map propertiesMap()
+ java.util.Map<String, String> propertiesMap()
{
- java.util.Map result = new java.util.HashMap();
+ java.util.Map<String, String> result = new java.util.HashMap<String, String>();
CommunicatorDescriptor descriptor = getCommunicatorDescriptor();
- java.util.Iterator p = descriptor.propertySet.properties.iterator();
- while(p.hasNext())
+ for(PropertyDescriptor p : descriptor.propertySet.properties)
{
- PropertyDescriptor pd = (PropertyDescriptor)p.next();
- result.put(pd.name, pd.value);
+ result.put(p.name, p.value);
}
return result;
}
-
+
//
// Children
//
diff --git a/java/src/IceGridGUI/Application/CommunicatorChildEditor.java b/java/src/IceGridGUI/Application/CommunicatorChildEditor.java
index 85395d1bdfc..b889f29e02e 100644
--- a/java/src/IceGridGUI/Application/CommunicatorChildEditor.java
+++ b/java/src/IceGridGUI/Application/CommunicatorChildEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import javax.swing.JOptionPane;
@@ -14,13 +15,16 @@ import IceGrid.*;
import IceGridGUI.*;
abstract class CommunicatorChildEditor extends Editor
-{
+{
abstract void writeDescriptor();
abstract boolean isSimpleUpdate();
abstract Communicator.ChildList getChildList();
- void postUpdate() {}
-
+ void postUpdate()
+ {
+ }
+
+ @SuppressWarnings("unchecked")
protected boolean applyUpdate(boolean refresh)
{
Root root = _target.getRoot();
@@ -30,13 +34,14 @@ abstract class CommunicatorChildEditor extends Editor
if(_target.isEphemeral())
{
Communicator.ChildList childList = getChildList();
-
+
writeDescriptor();
Object descriptor = _target.getDescriptor();
_target.destroy(); // just removes the child
-
+
try
{
+ //@SuppressWarnings("unchecked")
childList.tryAdd(descriptor);
}
catch(UpdateFailedException e)
@@ -52,20 +57,21 @@ abstract class CommunicatorChildEditor extends Editor
{
assert false;
}
-
+
JOptionPane.showMessageDialog(
root.getCoordinator().getMainFrame(),
e.toString(),
"Apply failed",
JOptionPane.ERROR_MESSAGE);
-
+
root.setSelectedNode(_target);
return false;
}
-
+
//
// Success
//
+ //@SuppressWarnings("unchecked")
_target = childList.findChildWithDescriptor(descriptor);
root.updated();
if(refresh)
@@ -101,7 +107,7 @@ abstract class CommunicatorChildEditor extends Editor
JOptionPane.ERROR_MESSAGE);
return false;
}
-
+
//
// Success
//
@@ -112,7 +118,7 @@ abstract class CommunicatorChildEditor extends Editor
root.setSelectedNode(_target);
}
}
-
+
postUpdate();
if(refresh)
diff --git a/java/src/IceGridGUI/Application/CommunicatorSubEditor.java b/java/src/IceGridGUI/Application/CommunicatorSubEditor.java
index 3ea2bc86172..7331a1a6ed5 100644
--- a/java/src/IceGridGUI/Application/CommunicatorSubEditor.java
+++ b/java/src/IceGridGUI/Application/CommunicatorSubEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -28,22 +29,18 @@ class CommunicatorSubEditor
CommunicatorSubEditor(Editor mainEditor)
{
_mainEditor = mainEditor;
-
- _description.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
+
+ _description.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
_description.setToolTipText("An optional description");
- _propertySets.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
+ _propertySets.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
_propertySets.setToolTipText("Property Set References");
_properties = new PropertiesField(mainEditor);
- _logFiles = new MapField(mainEditor, "Path", "Property",
- true);
+ _logFiles = new SimpleMapField(mainEditor, true, "Path", "Property");
_logFiles.setToolTipText("Log files used by this server or service");
}
-
void appendProperties(DefaultFormBuilder builder)
{
builder.append("Description");
@@ -52,11 +49,10 @@ class CommunicatorSubEditor
builder.nextRow(-2);
CellConstraints cc = new CellConstraints();
JScrollPane scrollPane = new JScrollPane(_description);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
builder.nextRow(2);
builder.nextLine();
-
+
builder.append("Property Sets");
builder.append(_propertySets, 3);
builder.nextLine();
@@ -71,8 +67,7 @@ class CommunicatorSubEditor
builder.nextRow(-6);
scrollPane = new JScrollPane(_properties);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
@@ -83,34 +78,30 @@ class CommunicatorSubEditor
builder.append("");
builder.nextRow(-4);
scrollPane = new JScrollPane(_logFiles);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 5));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 5));
builder.nextRow(4);
builder.nextLine();
}
void writeDescriptor(CommunicatorDescriptor descriptor)
{
- descriptor.propertySet.references =
- (String[])_propertySets.getList().toArray(new String[0]);
+ descriptor.propertySet.references = _propertySets.getList().toArray(new String[0]);
descriptor.propertySet.properties = _properties.getProperties();
descriptor.description = _description.getText();
- java.util.TreeMap tm = _logFiles.get();
- java.util.Iterator p = tm.entrySet().iterator();
+ java.util.TreeMap<String, String> tm = _logFiles.get();
descriptor.logs = new String[tm.size()];
int i = 0;
- while(p.hasNext())
+ for(java.util.Map.Entry<String, String> p : tm.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- String path = (String)entry.getKey();
- String prop = ((String)entry.getValue()).trim();
+ String path = p.getKey();
+ String prop = p.getValue().trim();
descriptor.logs[i++] = path;
if(!prop.equals(""))
{
- setProperty((java.util.LinkedList)descriptor.propertySet.properties, prop, path);
+ setProperty((java.util.LinkedList<PropertyDescriptor>)descriptor.propertySet.properties, prop, path);
}
}
}
@@ -123,71 +114,64 @@ class CommunicatorSubEditor
//
// Note that we don't substitute in the lookup
//
- java.util.Map map = new java.util.TreeMap();
- for(int i = 0; i < descriptor.logs.length; ++i)
+ java.util.Map<String, String> map = new java.util.TreeMap<String, String>();
+ for(String log : descriptor.logs)
{
- String prop = lookupKey(descriptor.propertySet.properties,
- descriptor.logs[i]);
- map.put(descriptor.logs[i], prop);
+ String prop = lookupKey(descriptor.propertySet.properties, log);
+ map.put(log, prop);
}
_logFiles.set(map, detailResolver, isEditable);
- _propertySets.setList(java.util.Arrays.asList(descriptor.propertySet.references),
- detailResolver);
+ _propertySets.setList(java.util.Arrays.asList(descriptor.propertySet.references), detailResolver);
_propertySets.setEditable(isEditable);
_properties.setProperties(descriptor.propertySet.properties,
descriptor.adapters,
descriptor.logs,
detailResolver, isEditable);
- _description.setText(
- Utils.substitute(descriptor.description, detailResolver));
+ _description.setText(Utils.substitute(descriptor.description, detailResolver));
_description.setEditable(isEditable);
_description.setOpaque(isEditable);
}
-
//
// Returns first key matching this value, if there is one
//
- private String lookupKey(java.util.List props, String value)
+ private String lookupKey(java.util.List<PropertyDescriptor> props, String value)
{
- java.util.Iterator p = props.iterator();
- while(p.hasNext())
+ for(PropertyDescriptor p : props)
{
- PropertyDescriptor pd = (PropertyDescriptor)p.next();
- if(pd.value.equals(value))
+ if(p.value.equals(value))
{
- return pd.name;
+ return p.name;
}
}
return "";
}
- private void setProperty(java.util.LinkedList props, String key, String newValue)
+ private void setProperty(java.util.LinkedList<PropertyDescriptor> props, String key, String newValue)
{
removeProperty(props, key);
props.addFirst(new PropertyDescriptor(key, newValue));
}
- private void removeProperty(java.util.List props, String key)
+ private void removeProperty(java.util.List<PropertyDescriptor> props, String key)
{
- java.util.Iterator p = props.iterator();
+ java.util.Iterator<PropertyDescriptor> p = props.iterator();
while(p.hasNext())
{
- PropertyDescriptor pd = (PropertyDescriptor)p.next();
+ PropertyDescriptor pd = p.next();
if(pd.name.equals(key))
{
p.remove();
}
}
}
-
protected Editor _mainEditor;
-
+
private JTextArea _description = new JTextArea(3, 20);
- private ListTextField _propertySets = new ListTextField(20);
+ private ListTextField _propertySets = new ListTextField(20);
private PropertiesField _properties;
- private MapField _logFiles;
+ private SimpleMapField _logFiles;
}
diff --git a/java/src/IceGridGUI/Application/DbEnv.java b/java/src/IceGridGUI/Application/DbEnv.java
index 3653b6059e9..922c8ad67ab 100644
--- a/java/src/IceGridGUI/Application/DbEnv.java
+++ b/java/src/IceGridGUI/Application/DbEnv.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.Component;
@@ -22,33 +23,31 @@ class DbEnv extends TreeNode implements DescriptorHolder
return (DbEnvDescriptor)d.clone();
}
- static public java.util.List copyDescriptors(java.util.List list)
+ static public java.util.List<DbEnvDescriptor> copyDescriptors(java.util.List<DbEnvDescriptor> list)
{
- java.util.List copy = new java.util.LinkedList();
- java.util.Iterator p = list.iterator();
- while(p.hasNext())
+ java.util.List<DbEnvDescriptor> copy = new java.util.LinkedList<DbEnvDescriptor>();
+ for(DbEnvDescriptor p : list)
{
- copy.add(copyDescriptor((DbEnvDescriptor)p.next()));
+ copy.add(copyDescriptor(p));
}
return copy;
}
public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
_cellRenderer = new DefaultTreeCellRenderer();
_cellRenderer.setLeafIcon(Utils.getIcon("/icons/16x16/database.png"));
}
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
//
@@ -60,11 +59,11 @@ class DbEnv extends TreeNode implements DescriptorHolder
actions[COPY] = !_ephemeral;
Object clipboard = getCoordinator().getClipboard();
- actions[PASTE] = clipboard != null &&
+ actions[PASTE] = clipboard != null &&
(clipboard instanceof Adapter.AdapterCopy
|| clipboard instanceof DbEnvDescriptor);
actions[DELETE] = true;
-
+
if(!_ephemeral)
{
boolean[] parentActions = ((TreeNode)_parent).getAvailableActions();
@@ -134,42 +133,38 @@ class DbEnv extends TreeNode implements DescriptorHolder
return _ephemeral;
}
- DbEnv(Communicator parent, String dbEnvName, DbEnvDescriptor descriptor,
- boolean ephemeral)
+ DbEnv(Communicator parent, String dbEnvName, DbEnvDescriptor descriptor, boolean ephemeral)
{
super(parent, dbEnvName);
_descriptor = descriptor;
_ephemeral = ephemeral;
}
- static void writeDbProperties(XMLWriter writer,
- java.util.List properties)
+ static void writeDbProperties(XMLWriter writer, java.util.List<PropertyDescriptor> properties)
throws java.io.IOException
{
- java.util.Iterator p = properties.iterator();
- while(p.hasNext())
+ for(PropertyDescriptor p : properties)
{
- PropertyDescriptor pd = (PropertyDescriptor)p.next();
- java.util.List attributes = new java.util.LinkedList();
- attributes.add(createAttribute("name", pd.name));
- attributes.add(createAttribute("value", pd.value));
+ java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
+ attributes.add(createAttribute("name", p.name));
+ attributes.add(createAttribute("value", p.value));
writer.writeElement("dbproperty", attributes);
}
}
- void write(XMLWriter writer) throws java.io.IOException
+ void write(XMLWriter writer)
+ throws java.io.IOException
{
if(!_ephemeral)
{
- java.util.List attributes = new java.util.LinkedList();
+ java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
attributes.add(createAttribute("name", _descriptor.name));
if(_descriptor.dbHome.length() > 0)
{
attributes.add(createAttribute("home", _descriptor.dbHome));
}
-
- if(_descriptor.description.length() == 0 &&
- _descriptor.properties.isEmpty())
+
+ if(_descriptor.description.length() == 0 && _descriptor.properties.isEmpty())
{
writer.writeElement("dbenv", attributes);
}
@@ -187,8 +182,8 @@ class DbEnv extends TreeNode implements DescriptorHolder
}
private DbEnvDescriptor _descriptor;
- private final boolean _ephemeral;
+ private final boolean _ephemeral;
private DbEnvEditor _editor;
- static private DefaultTreeCellRenderer _cellRenderer;
+ static private DefaultTreeCellRenderer _cellRenderer;
}
diff --git a/java/src/IceGridGUI/Application/DbEnvEditor.java b/java/src/IceGridGUI/Application/DbEnvEditor.java
index 07f66df4d6c..e8cd2b2ddc3 100644
--- a/java/src/IceGridGUI/Application/DbEnvEditor.java
+++ b/java/src/IceGridGUI/Application/DbEnvEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -29,14 +30,11 @@ class DbEnvEditor extends CommunicatorChildEditor
DbEnvEditor()
{
_name.getDocument().addDocumentListener(_updateListener);
- _name.setToolTipText(
- "Identifies this Freeze database environment within an Ice communicator");
+ _name.setToolTipText("Identifies this Freeze database environment within an Ice communicator");
_description.getDocument().addDocumentListener(_updateListener);
- _description.setToolTipText(
- "An optional description for this database environment");
+ _description.setToolTipText("An optional description for this database environment");
- JTextField dbHomeTextField = (JTextField)
- _dbHome.getEditor().getEditorComponent();
+ JTextField dbHomeTextField = (JTextField)_dbHome.getEditor().getEditorComponent();
dbHomeTextField.getDocument().addDocumentListener(_updateListener);
_dbHome.setToolTipText("<html><i>node data dir</i>/servers/<i>server id</i>"
+ "/dbs/<i>db env name</i> if created by the IceGrid Node;<br>"
@@ -48,19 +46,17 @@ class DbEnvEditor extends CommunicatorChildEditor
void writeDescriptor()
{
- DbEnvDescriptor descriptor =
- (DbEnvDescriptor)getDbEnv().getDescriptor();
+ DbEnvDescriptor descriptor = (DbEnvDescriptor)getDbEnv().getDescriptor();
descriptor.name = _name.getText().trim();
descriptor.description = _description.getText();
descriptor.dbHome = getDbHomeAsString();
descriptor.properties = _properties.getProperties();
- }
-
+ }
+
boolean isSimpleUpdate()
{
- DbEnvDescriptor descriptor =
- (DbEnvDescriptor)getDbEnv().getDescriptor();
- return descriptor.name.equals(_name.getText().trim());
+ DbEnvDescriptor descriptor = (DbEnvDescriptor)getDbEnv().getDescriptor();
+ return descriptor.name.equals(_name.getText().trim());
}
Communicator.ChildList getChildList()
@@ -80,11 +76,10 @@ class DbEnvEditor extends CommunicatorChildEditor
builder.nextRow(-2);
CellConstraints cc = new CellConstraints();
JScrollPane scrollPane = new JScrollPane(_description);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
builder.nextRow(2);
builder.nextLine();
-
+
builder.append("DB Home" );
builder.append(_dbHome, 3);
builder.nextLine();
@@ -100,8 +95,7 @@ class DbEnvEditor extends CommunicatorChildEditor
builder.nextRow(-6);
scrollPane = new JScrollPane(_properties);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
}
@@ -123,34 +117,31 @@ class DbEnvEditor extends CommunicatorChildEditor
_target = dbEnv;
DbEnvDescriptor descriptor = (DbEnvDescriptor)dbEnv.getDescriptor();
-
+
Utils.Resolver resolver = null;
if(dbEnv.getCoordinator().substitute())
{
resolver = dbEnv.getResolver();
}
boolean isEditable = resolver == null;
-
- _name.setText(
- Utils.substitute(descriptor.name, resolver));
+
+ _name.setText(Utils.substitute(descriptor.name, resolver));
_name.setEditable(isEditable);
- _description.setText(
- Utils.substitute(descriptor.description, resolver));
+ _description.setText(Utils.substitute(descriptor.description, resolver));
_description.setEditable(isEditable);
_description.setOpaque(isEditable);
-
+
_dbHome.setEnabled(true);
_dbHome.setEditable(true);
setDbHome(Utils.substitute(descriptor.dbHome, resolver));
_dbHome.setEnabled(isEditable);
_dbHome.setEditable(isEditable);
-
- _properties.setProperties(descriptor.properties, null, null,
- resolver, isEditable);
-
+
+ _properties.setProperties(descriptor.properties, null, null, resolver, isEditable);
+
_applyButton.setEnabled(dbEnv.isEphemeral());
- _discardButton.setEnabled(dbEnv.isEphemeral());
+ _discardButton.setEnabled(dbEnv.isEphemeral());
detectUpdates(true);
if(dbEnv.isEphemeral())
@@ -170,12 +161,12 @@ class DbEnvEditor extends CommunicatorChildEditor
{
_dbHome.setSelectedItem(NO_DB_HOME);
}
- else
+ else
{
_dbHome.setSelectedItem(dbHome);
}
}
-
+
private String getDbHomeAsString()
{
Object obj = _dbHome.getSelectedItem();
@@ -188,13 +179,13 @@ class DbEnvEditor extends CommunicatorChildEditor
return obj.toString().trim();
}
}
-
+
private JTextField _name = new JTextField(20);
private JTextArea _description = new JTextArea(3, 20);
private JComboBox _dbHome = new JComboBox(new Object[]{NO_DB_HOME});
private PropertiesField _properties;
-
+
static private final Object NO_DB_HOME = new Object()
{
public String toString()
diff --git a/java/src/IceGridGUI/Application/DescriptorHolder.java b/java/src/IceGridGUI/Application/DescriptorHolder.java
index 60433d97e1e..4ff5f4a2090 100644
--- a/java/src/IceGridGUI/Application/DescriptorHolder.java
+++ b/java/src/IceGridGUI/Application/DescriptorHolder.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
interface DescriptorHolder
diff --git a/java/src/IceGridGUI/Application/Editable.java b/java/src/IceGridGUI/Application/Editable.java
index 3e4570cde79..71e55dd3716 100644
--- a/java/src/IceGridGUI/Application/Editable.java
+++ b/java/src/IceGridGUI/Application/Editable.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
class Editable implements Cloneable
@@ -46,10 +47,10 @@ class Editable implements Cloneable
{
if(!editable.isNew())
{
- java.util.TreeSet set = (java.util.TreeSet)_removedElements.get(forClass);
+ java.util.TreeSet<String> set = _removedElements.get(forClass);
if(set == null)
{
- set = new java.util.TreeSet();
+ set = new java.util.TreeSet<String>();
_removedElements.put(forClass, set);
}
set.add(id);
@@ -58,14 +59,14 @@ class Editable implements Cloneable
String[] removedElements(Class forClass)
{
- java.util.TreeSet set = (java.util.TreeSet)_removedElements.get(forClass);
+ java.util.TreeSet<String> set = _removedElements.get(forClass);
if(set == null)
{
return new String[0];
}
else
{
- return (String[])set.toArray(new String[0]);
+ return set.toArray(new String[0]);
}
}
@@ -74,13 +75,12 @@ class Editable implements Cloneable
try
{
Editable result = (Editable)clone();
- java.util.HashMap removedElements = new java.util.HashMap();
- java.util.Iterator p = result._removedElements.entrySet().iterator();
- while(p.hasNext())
+ java.util.HashMap<Class, java.util.TreeSet<String>> removedElements =
+ new java.util.HashMap<Class, java.util.TreeSet<String>>();
+ for(java.util.Map.Entry<Class, java.util.TreeSet<String>> p : result._removedElements.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- Object val = ((java.util.TreeSet)entry.getValue()).clone();
- removedElements.put(entry.getKey(), val);
+ java.util.TreeSet<String> val = new java.util.TreeSet<String>(p.getValue());
+ removedElements.put(p.getKey(), val);
}
result._removedElements = removedElements;
return result;
@@ -102,5 +102,6 @@ class Editable implements Cloneable
private boolean _isNew = false;
private boolean _modified = false;
- private java.util.HashMap _removedElements = new java.util.HashMap();
+ private java.util.HashMap<Class, java.util.TreeSet<String>> _removedElements =
+ new java.util.HashMap<Class, java.util.TreeSet<String>>();
}
diff --git a/java/src/IceGridGUI/Application/Editor.java b/java/src/IceGridGUI/Application/Editor.java
index 1157c46b48e..9e6f9134467 100644
--- a/java/src/IceGridGUI/Application/Editor.java
+++ b/java/src/IceGridGUI/Application/Editor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.BorderLayout;
@@ -37,22 +38,20 @@ import IceGrid.*;
import IceGridGUI.*;
public class Editor extends EditorBase
-{
- static public java.util.Map makeParameterValues(
- java.util.Map oldParameterValues,
- java.util.List newParameters)
+{
+ static public java.util.Map<String, String> makeParameterValues(
+ java.util.Map<String, String> oldParameterValues,
+ java.util.List<String> newParameters)
{
- java.util.Map result = new java.util.HashMap();
+ java.util.Map<String, String> result = new java.util.HashMap<String, String>();
- java.util.Iterator p = newParameters.iterator();
- while(p.hasNext())
+ for(String name : newParameters)
{
- Object name = p.next();
- Object value = oldParameterValues.get(name);
+ String value = oldParameterValues.get(name);
if(value != null)
{
result.put(name, value);
- }
+ }
}
return result;
}
@@ -79,7 +78,7 @@ public class Editor extends EditorBase
assert false;
return false;
}
-
+
protected void detectUpdates(boolean val)
{
_detectUpdates = val;
@@ -101,19 +100,17 @@ public class Editor extends EditorBase
}
protected void appendProperties(DefaultFormBuilder builder)
- {}
+ {
+ }
protected void buildPropertiesPanel()
{
super.buildPropertiesPanel();
- JComponent buttonBar =
- ButtonBarFactory.buildRightAlignedBar(_applyButton,
- _discardButton);
+ JComponent buttonBar = ButtonBarFactory.buildRightAlignedBar(_applyButton, _discardButton);
buttonBar.setBorder(Borders.DIALOG_BORDER);
_propertiesPanel.add(buttonBar, BorderLayout.SOUTH);
}
-
Editor()
{
//
@@ -121,7 +118,7 @@ public class Editor extends EditorBase
//
AbstractAction apply = new AbstractAction("Apply")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(validate())
{
@@ -134,13 +131,13 @@ public class Editor extends EditorBase
};
_applyButton = new JButton(apply);
_applyButton.setEnabled(false);
-
+
//
// _discardButton
//
AbstractAction discard = new AbstractAction("Discard")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
discardUpdate();
_target.getRoot().getTree().grabFocus();
@@ -148,19 +145,19 @@ public class Editor extends EditorBase
};
_discardButton = new JButton(discard);
_discardButton.setEnabled(false);
-
- _updateListener = new DocumentListener()
+
+ _updateListener = new DocumentListener()
{
public void changedUpdate(DocumentEvent e)
{
updated();
}
-
+
public void insertUpdate(DocumentEvent e)
{
updated();
}
-
+
public void removeUpdate(DocumentEvent e)
{
updated();
@@ -185,7 +182,7 @@ public class Editor extends EditorBase
{
return _target;
}
-
+
void updated()
{
if(_detectUpdates)
@@ -221,7 +218,7 @@ public class Editor extends EditorBase
emptyFields += "'" + nameValArray[i - 1] + "'";
}
}
-
+
if(errorCount > 0)
{
String message = errorCount == 1 ?
@@ -241,7 +238,7 @@ public class Editor extends EditorBase
protected JButton _applyButton;
protected JButton _discardButton;
protected DocumentListener _updateListener;
-
+
protected TreeNode _target;
- private boolean _detectUpdates = true;
+ private boolean _detectUpdates = true;
}
diff --git a/java/src/IceGridGUI/Application/ListTextField.java b/java/src/IceGridGUI/Application/ListTextField.java
index 77e381a87fe..ae7117d4320 100644
--- a/java/src/IceGridGUI/Application/ListTextField.java
+++ b/java/src/IceGridGUI/Application/ListTextField.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import IceGrid.*;
@@ -25,7 +26,7 @@ public class ListTextField extends JTextField
super(columns);
}
- public void setList(java.util.List list, final Utils.Resolver resolver)
+ public void setList(java.util.List<String> list, final Utils.Resolver resolver)
{
Utils.Stringifier stringifier = new Utils.Stringifier()
{
@@ -34,14 +35,14 @@ public class ListTextField extends JTextField
return Utils.substitute((String)obj, resolver);
}
};
-
+
setText(Utils.stringify(list, stringifier, " ", null));
}
- public java.util.LinkedList getList()
+ public java.util.LinkedList<String> getList()
{
String text = getText().trim();
- java.util.LinkedList result = new java.util.LinkedList();
+ java.util.LinkedList<String> result = new java.util.LinkedList<String>();
while(text.length() > 0)
{
diff --git a/java/src/IceGridGUI/Application/ListTreeNode.java b/java/src/IceGridGUI/Application/ListTreeNode.java
index 395a4dc9b07..28921e5d482 100644
--- a/java/src/IceGridGUI/Application/ListTreeNode.java
+++ b/java/src/IceGridGUI/Application/ListTreeNode.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import javax.swing.tree.DefaultTreeModel;
@@ -34,7 +35,7 @@ abstract class ListTreeNode extends TreeNode
return _p.next();
}
- private java.util.Iterator _p = _children.iterator();
+ private java.util.Iterator<TreeNodeBase> _p = _children.iterator();
};
}
@@ -51,7 +52,7 @@ abstract class ListTreeNode extends TreeNode
}
else if(childIndex < _children.size())
{
- return (javax.swing.tree.TreeNode)_children.get(childIndex);
+ return _children.get(childIndex);
}
else
{
@@ -95,12 +96,12 @@ abstract class ListTreeNode extends TreeNode
_editable = new Editable(brandNew);
}
- void write(XMLWriter writer) throws java.io.IOException
+ void write(XMLWriter writer)
+ throws java.io.IOException
{
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(TreeNodeBase p : _children)
{
- TreeNode node = (TreeNode)p.next();
+ TreeNode node = (TreeNode)p;
node.write(writer);
}
}
@@ -108,8 +109,7 @@ abstract class ListTreeNode extends TreeNode
void insertChild(TreeNode child, boolean fireEvent)
throws UpdateFailedException
{
- DefaultTreeModel treeModel = fireEvent ?
- getRoot().getTreeModel() : null;
+ DefaultTreeModel treeModel = fireEvent ? getRoot().getTreeModel() : null;
if(!insertSortedChild(child, _children, treeModel))
{
@@ -120,8 +120,7 @@ abstract class ListTreeNode extends TreeNode
void insertChildren(java.util.List newChildren, boolean fireEvent)
throws UpdateFailedException
{
- DefaultTreeModel treeModel = fireEvent ?
- getRoot().getTreeModel() : null;
+ DefaultTreeModel treeModel = fireEvent ? getRoot().getTreeModel() : null;
String badChildId = insertSortedChildren(newChildren, _children, treeModel);
@@ -136,9 +135,7 @@ abstract class ListTreeNode extends TreeNode
int index = getIndex(child);
_children.remove(child);
- getRoot().getTreeModel().nodesWereRemoved(this,
- new int[]{index},
- new Object[]{child});
+ getRoot().getTreeModel().nodesWereRemoved(this, new int[]{index}, new Object[]{child});
return index;
}
@@ -170,8 +167,7 @@ abstract class ListTreeNode extends TreeNode
//
// Adapts ListTreeNode to a ComboBoxModel
//
- class ComboBoxModel extends javax.swing.AbstractListModel
- implements javax.swing.ComboBoxModel
+ class ComboBoxModel extends javax.swing.AbstractListModel implements javax.swing.ComboBoxModel
{
public Object getElementAt(int index)
{
@@ -232,7 +228,7 @@ abstract class ListTreeNode extends TreeNode
private Object _selectedItem;
}
- protected final java.util.LinkedList _children = new java.util.LinkedList();
+ protected final java.util.LinkedList<TreeNodeBase> _children = new java.util.LinkedList<TreeNodeBase>();
protected Editable _editable;
static private Editor _editor;
diff --git a/java/src/IceGridGUI/Application/Node.java b/java/src/IceGridGUI/Application/Node.java
index ef9131c677f..db233d4d710 100644
--- a/java/src/IceGridGUI/Application/Node.java
+++ b/java/src/IceGridGUI/Application/Node.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.Component;
@@ -26,34 +27,29 @@ import IceGrid.*;
import IceGridGUI.*;
class Node extends TreeNode implements PropertySetParent
-{
+{
static public NodeDescriptor
copyDescriptor(NodeDescriptor nd)
{
NodeDescriptor copy = (NodeDescriptor)nd.clone();
-
+
copy.propertySets = PropertySets.copyDescriptors(copy.propertySets);
-
- copy.serverInstances = new java.util.LinkedList();
- java.util.Iterator p = nd.serverInstances.iterator();
- while(p.hasNext())
+ copy.serverInstances = new java.util.LinkedList<ServerInstanceDescriptor>();
+ for(ServerInstanceDescriptor p : nd.serverInstances)
{
- copy.serverInstances.add(ServerInstance.copyDescriptor(
- (ServerInstanceDescriptor)p.next()));
+ copy.serverInstances.add(ServerInstance.copyDescriptor(p));
}
-
- copy.servers = new java.util.LinkedList();
- p = nd.servers.iterator();
- while(p.hasNext())
+
+ copy.servers = new java.util.LinkedList<ServerDescriptor>();
+ for(ServerDescriptor p : nd.servers)
{
- copy.servers.add(PlainServer.copyDescriptor(
- (ServerDescriptor)p.next()));
+ copy.servers.add(PlainServer.copyDescriptor(p));
}
-
+
return copy;
}
-
+
public Enumeration children()
{
return new Enumeration()
@@ -77,17 +73,17 @@ class Node extends TreeNode implements PropertySetParent
{
return _p.next();
}
-
+
private java.util.Iterator _p = _propertySets.iterator();
private boolean _iteratingOverServers = false;
};
}
-
+
public boolean getAllowsChildren()
{
return true;
}
-
+
public javax.swing.tree.TreeNode getChildAt(int childIndex)
{
if(childIndex < 0)
@@ -96,24 +92,23 @@ class Node extends TreeNode implements PropertySetParent
}
else if(childIndex < _propertySets.size())
{
- return (javax.swing.tree.TreeNode)_propertySets.get(childIndex);
+ return _propertySets.get(childIndex);
}
else if(childIndex < (_propertySets.size() + _servers.size()))
{
- return (javax.swing.tree.TreeNode)_servers.get(
- childIndex - _propertySets.size());
+ return (javax.swing.tree.TreeNode)_servers.get(childIndex - _propertySets.size());
}
else
{
throw new ArrayIndexOutOfBoundsException(childIndex);
}
}
-
+
public int getChildCount()
{
return _propertySets.size() + _servers.size();
}
-
+
public int getIndex(javax.swing.tree.TreeNode node)
{
if(node instanceof PropertySet)
@@ -145,7 +140,7 @@ class Node extends TreeNode implements PropertySetParent
{
removeSortedChildren(childIds, _propertySets, getRoot().getTreeModel());
}
-
+
void childrenChanged(java.util.List children)
{
childrenChanged(children, getRoot().getTreeModel());
@@ -161,41 +156,37 @@ class Node extends TreeNode implements PropertySetParent
return (PropertySet)find(id, _propertySets);
}
- void insertPropertySets(java.util.List newChildren, boolean fireEvent)
+ void insertPropertySets(java.util.List<PropertySet> newChildren, boolean fireEvent)
throws UpdateFailedException
{
- DefaultTreeModel treeModel = fireEvent ?
- getRoot().getTreeModel() : null;
-
+ DefaultTreeModel treeModel = fireEvent ? getRoot().getTreeModel() : null;
+
String badChildId = insertSortedChildren(newChildren, _propertySets, treeModel);
-
+
if(badChildId != null)
{
throw new UpdateFailedException(this, badChildId);
}
}
-
void insertServer(TreeNode child, boolean fireEvent)
throws UpdateFailedException
{
- DefaultTreeModel treeModel = fireEvent ?
- getRoot().getTreeModel() : null;
-
+ DefaultTreeModel treeModel = fireEvent ? getRoot().getTreeModel() : null;
+
if(!insertSortedChild(child, _servers, treeModel))
{
throw new UpdateFailedException(this, child.getId());
}
}
- void insertServers(java.util.List newChildren, boolean fireEvent)
+ void insertServers(java.util.List<Server> newChildren, boolean fireEvent)
throws UpdateFailedException
{
- DefaultTreeModel treeModel = fireEvent ?
- getRoot().getTreeModel() : null;
-
+ DefaultTreeModel treeModel = fireEvent ? getRoot().getTreeModel() : null;
+
String badChildId = insertSortedChildren(newChildren, _servers, treeModel);
-
+
if(badChildId != null)
{
throw new UpdateFailedException(this, badChildId);
@@ -206,18 +197,15 @@ class Node extends TreeNode implements PropertySetParent
{
int index = getIndex(child);
_servers.remove(child);
-
- getRoot().getTreeModel().nodesWereRemoved(this,
- new int[]{index},
- new Object[]{child});
+
+ getRoot().getTreeModel().nodesWereRemoved(this, new int[]{index}, new Object[]{child});
}
public void insertPropertySet(PropertySet child, boolean fireEvent)
throws UpdateFailedException
{
- DefaultTreeModel treeModel = fireEvent ?
- getRoot().getTreeModel() : null;
-
+ DefaultTreeModel treeModel = fireEvent ? getRoot().getTreeModel() : null;
+
if(!insertSortedChild(child, _propertySets, treeModel))
{
throw new UpdateFailedException(this, child.getId());
@@ -228,10 +216,8 @@ class Node extends TreeNode implements PropertySetParent
{
int index = getIndex(child);
_propertySets.remove(child);
-
- getRoot().getTreeModel().nodesWereRemoved(this,
- new int[]{index},
- new Object[]{child});
+
+ getRoot().getTreeModel().nodesWereRemoved(this, new int[]{index}, new Object[]{child});
}
public void removeDescriptor(String id)
@@ -287,11 +273,13 @@ class Node extends TreeNode implements PropertySetParent
actions.setTarget(this);
return _popup;
}
+
public void copy()
{
getCoordinator().setClipboard(copyDescriptor(_descriptor));
getCoordinator().getActionsForMenu().get(PASTE).setEnabled(true);
}
+
public void paste()
{
Object descriptor = getCoordinator().getClipboard();
@@ -309,9 +297,9 @@ class Node extends TreeNode implements PropertySetParent
// Remove any extra parameters
//
ServerInstanceDescriptor sid = ServerInstance.copyDescriptor((ServerInstanceDescriptor)descriptor);
-
+
TemplateDescriptor td = getRoot().findServerTemplateDescriptor(sid.template);
-
+
if(td != null)
{
sid.parameterValues.keySet().retainAll(td.parameters);
@@ -329,35 +317,37 @@ class Node extends TreeNode implements PropertySetParent
return;
}
}
- newServer(sd);
+ newServer(sd);
}
}
-
+
public void newPropertySet()
{
- newPropertySet(new PropertySetDescriptor(
- new String[0], new java.util.LinkedList()));
+ newPropertySet(new PropertySetDescriptor(new String[0], new java.util.LinkedList<PropertyDescriptor>()));
}
public void newServer()
{
newServer(PlainServer.newServerDescriptor());
}
+
public void newServerIceBox()
{
newServer(PlainServer.newIceBoxDescriptor());
}
public void newServerFromTemplate()
{
- ServerInstanceDescriptor descriptor =
+ ServerInstanceDescriptor descriptor =
new ServerInstanceDescriptor("",
- new java.util.HashMap(),
- new PropertySetDescriptor(new String[0], new java.util.LinkedList()),
- new java.util.HashMap());
+ new java.util.HashMap<String, String>(),
+ new PropertySetDescriptor(
+ new String[0],
+ new java.util.LinkedList<PropertyDescriptor>()),
+ new java.util.HashMap<String, PropertySetDescriptor>());
newServer(descriptor);
}
-
+
public void destroy()
{
Nodes nodes = (Nodes)_parent;
@@ -375,13 +365,13 @@ class Node extends TreeNode implements PropertySetParent
}
public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
@@ -394,8 +384,7 @@ class Node extends TreeNode implements PropertySetParent
_cellRenderer.setClosedIcon(nodeIcon);
}
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
public Editor getEditor()
@@ -417,14 +406,12 @@ class Node extends TreeNode implements PropertySetParent
{
return _ephemeral;
}
-
Object getDescriptor()
{
return _descriptor;
}
-
NodeDescriptor saveDescriptor()
{
return (NodeDescriptor)_descriptor.clone();
@@ -437,82 +424,77 @@ class Node extends TreeNode implements PropertySetParent
_descriptor.variables = copy.variables;
}
- void write(XMLWriter writer) throws java.io.IOException
+ void write(XMLWriter writer)
+ throws java.io.IOException
{
if(!_ephemeral)
{
- java.util.List attributes = new java.util.LinkedList();
+ java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
attributes.add(createAttribute("name", _id));
if(_descriptor.loadFactor.length() > 0)
{
- attributes.add(createAttribute("load-factor",
- _descriptor.loadFactor));
+ attributes.add(createAttribute("load-factor", _descriptor.loadFactor));
}
-
+
writer.writeStartTag("node", attributes);
-
+
if(_descriptor.description.length() > 0)
{
writer.writeElement("description", _descriptor.description);
}
writeVariables(writer, _descriptor.variables);
-
- java.util.Iterator p = _propertySets.iterator();
- while(p.hasNext())
+ for(PropertySet p : _propertySets)
{
- PropertySet ps = (PropertySet)p.next();
- ps.write(writer);
+ p.write(writer);
}
- p = _servers.iterator();
- while(p.hasNext())
+ for(Server p : _servers)
{
- TreeNode server = (TreeNode)p.next();
+ TreeNode server = (TreeNode)p;
server.write(writer);
}
+
writer.writeEndTag("node");
}
}
-
static class Backup
{
Utils.Resolver resolver;
- java.util.List backupList;
- java.util.List servers;
+ java.util.List<Object> backupList;
+ java.util.List<Server> servers;
}
//
// Try to rebuild this node;
// returns a backup object if rollback is later necessary
- // We don't rebuild the property sets since they don't
+ // We don't rebuild the property sets since they don't
// depend on the variables.
//
- Backup rebuild(java.util.List editables)
+ Backup rebuild(java.util.List<Editable> editables)
throws UpdateFailedException
{
Root root = getRoot();
Backup backup = new Backup();
backup.resolver = _resolver;
- _resolver = new Utils.Resolver(new java.util.Map[]
- {_descriptor.variables, root.getVariables()});
-
+ @SuppressWarnings("unchecked")
+ Utils.Resolver resolver = new Utils.Resolver(new java.util.Map[] {_descriptor.variables, root.getVariables()});
+ _resolver = resolver;
+
_resolver.put("application", root.getId());
_resolver.put("node", _id);
- backup.backupList = new java.util.Vector();
- backup.servers = (java.util.LinkedList)_servers.clone();
+ backup.backupList = new java.util.Vector<Object>();
+ backup.servers = new java.util.LinkedList<Server>(_servers);
- java.util.Iterator p = backup.servers.iterator();
- while(p.hasNext())
+ for(Server p : backup.servers)
{
- Server server = (Server)p.next();
try
{
- backup.backupList.add(server.rebuild(editables));
+ backup.backupList.add(p.rebuild(editables));
}
catch(UpdateFailedException e)
{
@@ -530,32 +512,27 @@ class Node extends TreeNode implements PropertySetParent
_origDescription = _descriptor.description;
_origLoadFactor = _descriptor.loadFactor;
- java.util.Iterator p = _propertySets.iterator();
- while(p.hasNext())
+ for(PropertySet p : _propertySets)
{
- PropertySet ps = (PropertySet)p.next();
- ps.commit();
+ p.commit();
}
- p = _servers.iterator();
- while(p.hasNext())
+ for(Server p : _servers)
{
- Server server = (Server)p.next();
- server.getEditable().commit();
+ p.getEditable().commit();
}
}
-
+
void restore(Backup backup)
- {
+ {
for(int i = backup.backupList.size() - 1; i >= 0; --i)
{
- ((Server)backup.servers.get(i)).restore(backup.backupList.get(i));
+ backup.servers.get(i).restore(backup.backupList.get(i));
}
_resolver = backup.resolver;
}
-
- ServerInstance createServer(boolean brandNew,
- ServerInstanceDescriptor instanceDescriptor)
+
+ ServerInstance createServer(boolean brandNew, ServerInstanceDescriptor instanceDescriptor)
throws UpdateFailedException
{
Root root = getRoot();
@@ -563,36 +540,33 @@ class Node extends TreeNode implements PropertySetParent
//
// Find template
//
- TemplateDescriptor templateDescriptor =
- root.findServerTemplateDescriptor(instanceDescriptor.template);
+ TemplateDescriptor templateDescriptor = root.findServerTemplateDescriptor(instanceDescriptor.template);
assert templateDescriptor != null;
-
- ServerDescriptor serverDescriptor =
- (ServerDescriptor)templateDescriptor.descriptor;
-
+
+ ServerDescriptor serverDescriptor = (ServerDescriptor)templateDescriptor.descriptor;
+
assert serverDescriptor != null;
boolean isIceBox = serverDescriptor instanceof IceBoxDescriptor;
-
+
//
// Build resolver
//
- Utils.Resolver instanceResolver =
- new Utils.Resolver(_resolver,
+ Utils.Resolver instanceResolver =
+ new Utils.Resolver(_resolver,
instanceDescriptor.parameterValues,
templateDescriptor.parameterDefaults);
-
+
String serverId = instanceResolver.substitute(serverDescriptor.id);
instanceResolver.put("server", serverId);
-
+
//
// Create server
//
- return new ServerInstance(brandNew, this, serverId,
- instanceResolver, instanceDescriptor, isIceBox);
+ return new ServerInstance(brandNew, this, serverId, instanceResolver, instanceDescriptor, isIceBox);
}
- PlainServer createServer(boolean brandNew, ServerDescriptor serverDescriptor)
+ PlainServer createServer(boolean brandNew, ServerDescriptor serverDescriptor)
throws UpdateFailedException
{
//
@@ -601,13 +575,11 @@ class Node extends TreeNode implements PropertySetParent
Utils.Resolver instanceResolver = new Utils.Resolver(_resolver);
String serverId = instanceResolver.substitute(serverDescriptor.id);
instanceResolver.put("server", serverId);
-
+
//
// Create server
//
- return new PlainServer(brandNew, this, serverId,
- instanceResolver, serverDescriptor);
-
+ return new PlainServer(brandNew, this, serverId, instanceResolver, serverDescriptor);
}
NodeUpdateDescriptor getUpdate()
@@ -626,15 +598,13 @@ class Node extends TreeNode implements PropertySetParent
else
{
update.removePropertySets = _editable.removedElements(PropertySet.class);
- update.propertySets = new java.util.HashMap();
+ update.propertySets = new java.util.HashMap<String, PropertySetDescriptor>();
- java.util.Iterator p = _propertySets.iterator();
- while(p.hasNext())
+ for(PropertySet p : _propertySets)
{
- PropertySet ps = (PropertySet)p.next();
- if(ps.getEditable().isNew() || ps.getEditable().isModified())
+ if(p.getEditable().isNew() || p.getEditable().isModified())
{
- update.propertySets.put(ps.getId(), (PropertySetDescriptor)ps.getDescriptor());
+ update.propertySets.put(p.getId(), (PropertySetDescriptor)p.getDescriptor());
}
}
}
@@ -651,31 +621,28 @@ class Node extends TreeNode implements PropertySetParent
update.removeServers = _editable.removedElements(Server.class);
}
- update.serverInstances = new java.util.LinkedList();
- update.servers = new java.util.LinkedList();
+ update.serverInstances = new java.util.LinkedList<ServerInstanceDescriptor>();
+ update.servers = new java.util.LinkedList<ServerDescriptor>();
- java.util.Iterator p = _servers.iterator();
- while(p.hasNext())
+ for(Server p : _servers)
{
- Server server = (Server)p.next();
- if(_editable.isNew() || server.getEditable().isModified()
- || server.getEditable().isNew())
+ if(_editable.isNew() || p.getEditable().isModified() || p.getEditable().isNew())
{
- if(server instanceof PlainServer)
+ if(p instanceof PlainServer)
{
- update.servers.add((ServerDescriptor)server.getDescriptor());
+ update.servers.add((ServerDescriptor)p.getDescriptor());
}
else
{
- update.serverInstances.add((ServerInstanceDescriptor)server.getDescriptor());
+ update.serverInstances.add((ServerInstanceDescriptor)p.getDescriptor());
}
}
}
-
+
//
// Anything in this update?
//
- if(!_editable.isNew() && !_editable.isModified()
+ if(!_editable.isNew() && !_editable.isModified()
&& update.removePropertySets.length == 0
&& update.propertySets.size() == 0
&& update.removeServers.length == 0
@@ -698,7 +665,7 @@ class Node extends TreeNode implements PropertySetParent
{
update.description = new IceGrid.BoxedString(_descriptor.description);
}
-
+
if(!_descriptor.loadFactor.equals(_origLoadFactor))
{
update.loadFactor = new IceGrid.BoxedString(_descriptor.loadFactor);
@@ -707,43 +674,40 @@ class Node extends TreeNode implements PropertySetParent
//
// Diff variables (TODO: avoid duplication with same code in Root)
//
- update.variables = new java.util.TreeMap(_descriptor.variables);
- java.util.List removeVariables = new java.util.LinkedList();
+ update.variables = new java.util.TreeMap<String, String>(_descriptor.variables);
+ java.util.List<String> removeVariables = new java.util.LinkedList<String>();
- p = _origVariables.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, String> p : _origVariables.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- Object key = entry.getKey();
- Object newValue = update.variables.get(key);
+ String key = p.getKey();
+ String newValue = update.variables.get(key);
if(newValue == null)
{
removeVariables.add(key);
}
else
{
- Object value = entry.getValue();
+ String value = p.getValue();
if(newValue.equals(value))
{
update.variables.remove(key);
}
}
}
- update.removeVariables = (String[])removeVariables.toArray(new String[0]);
+ update.removeVariables = removeVariables.toArray(new String[0]);
}
return update;
}
-
- void update(NodeUpdateDescriptor update,
- java.util.Set serverTemplates, java.util.Set serviceTemplates)
+ void update(NodeUpdateDescriptor update, java.util.Set<String> serverTemplates,
+ java.util.Set<String> serviceTemplates)
throws UpdateFailedException
{
Root root = getRoot();
- java.util.Vector newServers = new java.util.Vector();
- java.util.Vector updatedServers = new java.util.Vector();
+ java.util.Vector<Server> newServers = new java.util.Vector<Server>();
+ java.util.Vector<Server> updatedServers = new java.util.Vector<Server>();
if(update != null)
{
@@ -755,7 +719,7 @@ class Node extends TreeNode implements PropertySetParent
_descriptor.description = update.description.value;
_origDescription = _descriptor.description;
}
-
+
//
// Load factor
//
@@ -764,37 +728,33 @@ class Node extends TreeNode implements PropertySetParent
_descriptor.loadFactor = update.loadFactor.value;
_origLoadFactor = _descriptor.loadFactor;
}
-
+
//
// Variables
//
- for(int i = 0; i < update.removeVariables.length; ++i)
+ for(String name : update.removeVariables)
{
- _descriptor.variables.remove(update.removeVariables[i]);
+ _descriptor.variables.remove(name);
}
_descriptor.variables.putAll(update.variables);
-
//
// Property Sets
//
removePropertySets(update.removePropertySets);
- for(int i = 0; i < update.removePropertySets.length; ++i)
+ for(String id : update.removePropertySets)
{
- _descriptor.propertySets.remove(update.removePropertySets[i]);
+ _descriptor.propertySets.remove(id);
}
-
- java.util.Vector newPropertySets = new java.util.Vector();
- java.util.Vector updatedPropertySets = new java.util.Vector();
- java.util.Iterator p = update.propertySets.entrySet().iterator();
- while(p.hasNext())
+ java.util.Vector<PropertySet> newPropertySets = new java.util.Vector<PropertySet>();
+ java.util.Vector<PropertySet> updatedPropertySets = new java.util.Vector<PropertySet>();
+
+ for(java.util.Map.Entry<String, PropertySetDescriptor> p : update.propertySets.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
-
- String id = (String)entry.getKey();
- PropertySetDescriptor psd = (PropertySetDescriptor)entry.getValue();
-
+ String id = p.getKey();
+ PropertySetDescriptor psd = p.getValue();
+
//
// Lookup named property set
//
@@ -812,56 +772,47 @@ class Node extends TreeNode implements PropertySetParent
}
}
childrenChanged(updatedPropertySets);
- insertPropertySets(newPropertySets, true);
+ insertPropertySets(newPropertySets, true);
-
//
// Update _descriptor
//
- for(int i = 0; i < update.removeServers.length; ++i)
+ for(String id : update.removeServers)
{
- Server server = findServer(update.removeServers[i]);
+ Server server = findServer(id);
removeDescriptor(server);
- }
+ }
//
// One big set of removes
//
removeServers(update.removeServers);
-
+
//
// One big set of updates, followed by inserts
//
- p = update.serverInstances.iterator();
- while(p.hasNext())
+ for(ServerInstanceDescriptor p : update.serverInstances)
{
- ServerInstanceDescriptor instanceDescriptor =
- (ServerInstanceDescriptor)p.next();
-
//
// Find template
//
- TemplateDescriptor templateDescriptor =
- root.findServerTemplateDescriptor(instanceDescriptor.template);
-
+ TemplateDescriptor templateDescriptor = root.findServerTemplateDescriptor(p.template);
+
assert templateDescriptor != null;
-
- ServerDescriptor serverDescriptor =
- (ServerDescriptor)templateDescriptor.descriptor;
-
+
+ ServerDescriptor serverDescriptor = (ServerDescriptor)templateDescriptor.descriptor;
+
assert serverDescriptor != null;
-
+
//
// Build resolver
//
- Utils.Resolver instanceResolver =
- new Utils.Resolver(_resolver,
- instanceDescriptor.parameterValues,
- templateDescriptor.parameterDefaults);
-
+ Utils.Resolver instanceResolver =
+ new Utils.Resolver(_resolver, p.parameterValues, templateDescriptor.parameterDefaults);
+
String serverId = instanceResolver.substitute(serverDescriptor.id);
instanceResolver.put("server", serverId);
-
+
//
// Lookup servers
//
@@ -869,75 +820,65 @@ class Node extends TreeNode implements PropertySetParent
if(server != null)
{
removeDescriptor(server);
- server.rebuild(instanceResolver, instanceDescriptor,
- serverDescriptor instanceof IceBoxDescriptor);
+ server.rebuild(instanceResolver, p, serverDescriptor instanceof IceBoxDescriptor);
updatedServers.add(server);
- _descriptor.serverInstances.add(instanceDescriptor);
+ _descriptor.serverInstances.add(p);
}
else
{
- server = new ServerInstance(false, this, serverId, instanceResolver,
- instanceDescriptor,
+ server = new ServerInstance(false, this, serverId, instanceResolver, p,
serverDescriptor instanceof IceBoxDescriptor);
newServers.add(server);
- _descriptor.serverInstances.add(instanceDescriptor);
+ _descriptor.serverInstances.add(p);
}
}
-
+
//
// Plain servers
//
- p = update.servers.iterator();
- while(p.hasNext())
+ for(ServerDescriptor p : update.servers)
{
- ServerDescriptor serverDescriptor = (ServerDescriptor)p.next();
-
//
// Build resolver
//
Utils.Resolver instanceResolver = new Utils.Resolver(_resolver);
- String serverId = instanceResolver.substitute(serverDescriptor.id);
+ String serverId = instanceResolver.substitute(p.id);
instanceResolver.put("server", serverId);
-
+
//
// Lookup server
//
PlainServer server = (PlainServer)findServer(serverId);
-
+
if(server != null)
{
removeDescriptor(server);
- server.rebuild(instanceResolver, serverDescriptor);
+ server.rebuild(instanceResolver, p);
updatedServers.add(server);
- _descriptor.servers.add(serverDescriptor);
+ _descriptor.servers.add(p);
}
else
{
- server = new PlainServer(false, this, serverId, instanceResolver,
- serverDescriptor);
+ server = new PlainServer(false, this, serverId, instanceResolver, p);
newServers.add(server);
- _descriptor.servers.add(serverDescriptor);
+ _descriptor.servers.add(p);
}
}
}
-
- //
+
+ //
// Find servers affected by template updates
//
- java.util.Set serverSet = new java.util.HashSet();
+ java.util.Set<Server> serverSet = new java.util.HashSet<Server>();
- java.util.Iterator p = serverTemplates.iterator();
- while(p.hasNext())
+ for(String p : serverTemplates)
{
- String template = (String)p.next();
- java.util.List serverInstances = findServerInstances(template);
- java.util.Iterator q = serverInstances.iterator();
- while(q.hasNext())
+ java.util.List<ServerInstance> serverInstances = findServerInstances(p);
+ for(ServerInstance q : serverInstances)
{
- ServerInstance server = (ServerInstance)q.next();
- if(!updatedServers.contains(server) && !newServers.contains(server))
+ if(!updatedServers.contains(q) && !newServers.contains(q))
{
- serverSet.add(server);
+ serverSet.add(q);
}
}
}
@@ -945,16 +886,12 @@ class Node extends TreeNode implements PropertySetParent
//
// Servers affected by service-template updates
//
- p = serviceTemplates.iterator();
- while(p.hasNext())
+ for(String p : serviceTemplates)
{
- java.util.List serviceInstances =
- findServiceInstances((String)p.next());
- java.util.Iterator q = serviceInstances.iterator();
- while(q.hasNext())
+ java.util.List<ServiceInstance> serviceInstances = findServiceInstances(p);
+ for(ServiceInstance q : serviceInstances)
{
- ServiceInstance service = (ServiceInstance)q.next();
- Server server = (Server)service.getParent().getParent();
+ Server server = (Server)q.getParent().getParent();
if(!updatedServers.contains(server) && !newServers.contains(server))
{
serverSet.add(server);
@@ -965,50 +902,45 @@ class Node extends TreeNode implements PropertySetParent
//
// Rebuild these servers
//
- p = serverSet.iterator();
- while(p.hasNext())
+ for(Server p : serverSet)
{
- Server server = (Server)p.next();
-
- if(server instanceof PlainServer)
+ if(p instanceof PlainServer)
{
- PlainServer ps = (PlainServer)server;
+ PlainServer ps = (PlainServer)p;
ServerDescriptor serverDescriptor = (ServerDescriptor)ps.getDescriptor();
Utils.Resolver instanceResolver = new Utils.Resolver(_resolver);
-
+
String serverId = instanceResolver.substitute(serverDescriptor.id);
assert serverId.equals(ps.getId());
-
+
ps.rebuild(instanceResolver, serverDescriptor);
}
else
{
- ServerInstance si = (ServerInstance)server;
+ ServerInstance si = (ServerInstance)p;
ServerInstanceDescriptor instanceDescriptor = (ServerInstanceDescriptor)si.getDescriptor();
- TemplateDescriptor templateDescriptor =
- root.findServerTemplateDescriptor(instanceDescriptor.template);
+ TemplateDescriptor templateDescriptor = root.findServerTemplateDescriptor(instanceDescriptor.template);
assert templateDescriptor != null;
-
+
ServerDescriptor serverDescriptor = (ServerDescriptor)templateDescriptor.descriptor;
assert serverDescriptor != null;
- Utils.Resolver instanceResolver =
- new Utils.Resolver(_resolver,
+ Utils.Resolver instanceResolver =
+ new Utils.Resolver(_resolver,
instanceDescriptor.parameterValues,
templateDescriptor.parameterDefaults);
-
+
String serverId = instanceResolver.substitute(serverDescriptor.id);
assert serverId.equals(si.getId());
- si.rebuild(instanceResolver, instanceDescriptor,
- serverDescriptor instanceof IceBoxDescriptor);
+ si.rebuild(instanceResolver, instanceDescriptor, serverDescriptor instanceof IceBoxDescriptor);
}
- updatedServers.add(server);
+ updatedServers.add(p);
}
-
+
childrenChanged(updatedServers);
- insertServers(newServers, true);
+ insertServers(newServers, true);
}
Node(boolean brandNew, TreeNode parent, String nodeName, NodeDescriptor descriptor)
@@ -1024,49 +956,40 @@ class Node extends TreeNode implements PropertySetParent
_origDescription = _descriptor.description;
_origLoadFactor = _descriptor.loadFactor;
- _resolver = new Utils.Resolver(new java.util.Map[]
- {_descriptor.variables, getRoot().getVariables()});
-
+ @SuppressWarnings("unchecked")
+ Utils.Resolver resolver =
+ new Utils.Resolver(new java.util.Map[] {_descriptor.variables, getRoot().getVariables()});
+ _resolver = resolver;
+
_resolver.put("application", getRoot().getId());
_resolver.put("node", _id);
-
+
//
// Property Sets
//
- java.util.Iterator p = _descriptor.propertySets.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, PropertySetDescriptor> p : _descriptor.propertySets.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- String id = (String)entry.getKey();
- insertPropertySet(new PropertySet(false, this,
- id, id,
- (PropertySetDescriptor)entry.getValue()),
- false);
+ String id = p.getKey();
+ insertPropertySet(new PropertySet(false, this, id, id, p.getValue()), false);
}
//
// Template instances
//
- p = _descriptor.serverInstances.iterator();
- while(p.hasNext())
+ for(ServerInstanceDescriptor p : _descriptor.serverInstances)
{
- ServerInstanceDescriptor instanceDescriptor =
- (ServerInstanceDescriptor)p.next();
-
- insertServer(createServer(false, instanceDescriptor), false);
+ insertServer(createServer(false, p), false);
}
//
// Plain servers
//
- p = _descriptor.servers.iterator();
- while(p.hasNext())
+ for(ServerDescriptor p : _descriptor.servers)
{
- ServerDescriptor serverDescriptor = (ServerDescriptor)p.next();
- insertServer(createServer(false, serverDescriptor), false);
+ insertServer(createServer(false, p), false);
}
- }
-
+ }
+
Node(TreeNode parent, String nodeName, NodeDescriptor descriptor)
{
super(parent, nodeName);
@@ -1075,42 +998,33 @@ class Node extends TreeNode implements PropertySetParent
_descriptor = descriptor;
}
- java.util.List findServerInstances(String template)
+ java.util.List<ServerInstance> findServerInstances(String template)
{
- java.util.List result = new java.util.LinkedList();
- java.util.Iterator p = _servers.iterator();
- while(p.hasNext())
+ java.util.List<ServerInstance> result = new java.util.LinkedList<ServerInstance>();
+ for(Server p : _servers)
{
- Server server = (Server)p.next();
-
- if(server instanceof ServerInstance)
+ if(p instanceof ServerInstance)
{
- ServerInstanceDescriptor instanceDescriptor
- = (ServerInstanceDescriptor)server.getDescriptor();
+ ServerInstanceDescriptor instanceDescriptor = (ServerInstanceDescriptor)p.getDescriptor();
if(instanceDescriptor.template.equals(template))
{
- result.add(server);
+ result.add((ServerInstance)p);
}
}
}
return result;
}
-
void removeServerInstances(String template)
{
- java.util.List toRemove = new java.util.LinkedList();
+ java.util.List<String> toRemove = new java.util.LinkedList<String>();
- java.util.Iterator p = _servers.iterator();
- while(p.hasNext())
+ for(Server p : _servers)
{
- Server server = (Server)p.next();
-
- if(server instanceof ServerInstance)
+ if(p instanceof ServerInstance)
{
- ServerInstanceDescriptor instanceDescriptor
- = (ServerInstanceDescriptor)server.getDescriptor();
+ ServerInstanceDescriptor instanceDescriptor = (ServerInstanceDescriptor)p.getDescriptor();
if(instanceDescriptor.template.equals(template))
{
@@ -1118,8 +1032,8 @@ class Node extends TreeNode implements PropertySetParent
// Remove instance
//
removeDescriptor(instanceDescriptor);
- String id = ((TreeNode)server).getId();
- _editable.removeElement(id, server.getEditable(), Server.class);
+ String id = ((TreeNode)p).getId();
+ _editable.removeElement(id, p.getEditable(), Server.class);
toRemove.add(id);
}
}
@@ -1127,34 +1041,30 @@ class Node extends TreeNode implements PropertySetParent
if(toRemove.size() > 0)
{
- removeServers((String[])toRemove.toArray(new String[0]));
+ removeServers(toRemove.toArray(new String[0]));
}
}
-
- java.util.List findServiceInstances(String template)
+
+ java.util.List<ServiceInstance> findServiceInstances(String template)
{
- java.util.List result = new java.util.LinkedList();
- java.util.Iterator p = _servers.iterator();
- while(p.hasNext())
+ java.util.List<ServiceInstance> result = new java.util.LinkedList<ServiceInstance>();
+ for(Server p : _servers)
{
- Object o = p.next();
- if(o instanceof PlainServer)
+ if(p instanceof PlainServer)
{
- result.addAll(((PlainServer)o).findServiceInstances(template));
+ result.addAll(((PlainServer)p).findServiceInstances(template));
}
}
return result;
}
void removeServiceInstances(String template)
- {
- java.util.Iterator p = _servers.iterator();
- while(p.hasNext())
+ {
+ for(Server p : _servers)
{
- Object o = p.next();
- if(o instanceof PlainServer)
+ if(p instanceof PlainServer)
{
- ((PlainServer)o).removeServiceInstances(template);
+ ((PlainServer)p).removeServiceInstances(template);
}
}
}
@@ -1164,12 +1074,10 @@ class Node extends TreeNode implements PropertySetParent
return _resolver;
}
-
- public void tryAdd(String id, PropertySetDescriptor descriptor)
+ public void tryAdd(String id, PropertySetDescriptor descriptor)
throws UpdateFailedException
{
- insertPropertySet(new PropertySet(true, this, id, id, descriptor),
- true);
+ insertPropertySet(new PropertySet(true, this, id, id, descriptor), true);
_descriptor.propertySets.put(id, descriptor);
}
@@ -1183,9 +1091,7 @@ class Node extends TreeNode implements PropertySetParent
try
{
- insertPropertySet(
- new PropertySet(true, this, newId, newId, descriptor),
- true);
+ insertPropertySet(new PropertySet(true, this, newId, newId, descriptor), true);
}
catch(UpdateFailedException ex)
{
@@ -1205,19 +1111,19 @@ class Node extends TreeNode implements PropertySetParent
_descriptor.propertySets.put(newId, descriptor);
}
- void tryAdd(ServerInstanceDescriptor instanceDescriptor,
- boolean addDescriptor) throws UpdateFailedException
+ void tryAdd(ServerInstanceDescriptor instanceDescriptor, boolean addDescriptor)
+ throws UpdateFailedException
{
insertServer(createServer(true, instanceDescriptor), true);
if(addDescriptor)
{
- _descriptor.serverInstances.add(instanceDescriptor);
+ _descriptor.serverInstances.add(instanceDescriptor);
}
}
- void tryAdd(ServerDescriptor serverDescriptor,
- boolean addDescriptor) throws UpdateFailedException
+ void tryAdd(ServerDescriptor serverDescriptor, boolean addDescriptor)
+ throws UpdateFailedException
{
insertServer(createServer(true, serverDescriptor), true);
@@ -1244,7 +1150,7 @@ class Node extends TreeNode implements PropertySetParent
//
// A straight remove uses equals(), which is not the desired behavior
//
- java.util.Iterator p = _descriptor.servers.iterator();
+ java.util.Iterator<ServerDescriptor> p = _descriptor.servers.iterator();
while(p.hasNext())
{
if(sd == p.next())
@@ -1260,7 +1166,7 @@ class Node extends TreeNode implements PropertySetParent
//
// A straight remove uses equals(), which is not the desired behavior
//
- java.util.Iterator p = _descriptor.serverInstances.iterator();
+ java.util.Iterator<ServerInstanceDescriptor> p = _descriptor.serverInstances.iterator();
while(p.hasNext())
{
if(sd == p.next())
@@ -1274,7 +1180,7 @@ class Node extends TreeNode implements PropertySetParent
private void newPropertySet(PropertySetDescriptor descriptor)
{
String id = makeNewChildId("PropertySet");
-
+
PropertySet ps = new PropertySet(this, id, descriptor);
try
{
@@ -1290,7 +1196,7 @@ class Node extends TreeNode implements PropertySetParent
private void newServer(ServerDescriptor descriptor)
{
descriptor.id = makeNewChildId(descriptor.id);
-
+
PlainServer server = new PlainServer(this, descriptor.id, descriptor);
try
{
@@ -1312,7 +1218,7 @@ class Node extends TreeNode implements PropertySetParent
// Make sure descriptor.template points to a real template
//
ServerTemplate t = root.findServerTemplate(descriptor.template);
-
+
if(t == null)
{
if(root.getServerTemplates().getChildCount() == 0)
@@ -1324,10 +1230,10 @@ class Node extends TreeNode implements PropertySetParent
JOptionPane.INFORMATION_MESSAGE);
return;
}
-
+
t = (ServerTemplate)root.getServerTemplates().getChildAt(0);
descriptor.template = t.getId();
- descriptor.parameterValues = new java.util.HashMap();
+ descriptor.parameterValues = new java.util.HashMap<String, String>();
}
ServerInstance server = new ServerInstance(this, id, descriptor);
@@ -1345,18 +1251,18 @@ class Node extends TreeNode implements PropertySetParent
private NodeDescriptor _descriptor;
private Utils.Resolver _resolver;
- private java.util.Map _origVariables;
+ private java.util.Map<String, String> _origVariables;
private String _origDescription;
private String _origLoadFactor;
private final boolean _ephemeral;
private NodeEditor _editor;
- private java.util.LinkedList _propertySets = new java.util.LinkedList();
- private java.util.LinkedList _servers = new java.util.LinkedList();
-
+ private java.util.LinkedList<PropertySet> _propertySets = new java.util.LinkedList<PropertySet>();
+ private java.util.LinkedList<Server> _servers = new java.util.LinkedList<Server>();
+
private Editable _editable;
- static private DefaultTreeCellRenderer _cellRenderer;
+ static private DefaultTreeCellRenderer _cellRenderer;
static private JPopupMenu _popup;
}
diff --git a/java/src/IceGridGUI/Application/NodeEditor.java b/java/src/IceGridGUI/Application/NodeEditor.java
index 925fdaf3bcc..0a69121a9ff 100644
--- a/java/src/IceGridGUI/Application/NodeEditor.java
+++ b/java/src/IceGridGUI/Application/NodeEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -75,7 +76,7 @@ class NodeEditor extends Editor
JOptionPane.ERROR_MESSAGE);
return false;
}
-
+
//
// Success
//
@@ -99,13 +100,13 @@ class NodeEditor extends Editor
//
NodeDescriptor savedDescriptor = ((Node)_target).saveDescriptor();
writeDescriptor();
-
+
//
// Rebuild node; don't need the backup
// since it's just one node
//
- java.util.List editables = new java.util.LinkedList();
-
+ java.util.List<Editable> editables = new java.util.LinkedList<Editable>();
+
try
{
((Node)_target).rebuild(editables);
@@ -120,12 +121,10 @@ class NodeEditor extends Editor
JOptionPane.ERROR_MESSAGE);
return false;
}
-
- java.util.Iterator p = editables.iterator();
- while(p.hasNext())
+
+ for(Editable p : editables)
{
- Editable editable = (Editable)p.next();
- editable.markModified();
+ p.markModified();
}
((Node)_target).getEditable().markModified();
@@ -143,7 +142,7 @@ class NodeEditor extends Editor
finally
{
root.enableSelectionListener();
- }
+ }
}
Utils.Resolver getDetailResolver()
@@ -164,11 +163,11 @@ class NodeEditor extends Editor
_name.setToolTipText("Must match the IceGrid.Node.Name property of the desired icegridnode process");
_description.getDocument().addDocumentListener(_updateListener);
_description.setToolTipText("An optional description for this node");
-
+
//
// Variables
//
- _variables = new MapField(this, "Name", "Value", false);
+ _variables = new SimpleMapField(this, false, "Name", "Value");
_loadFactor.getDocument().addDocumentListener(_updateListener);
_loadFactor.setToolTipText("<html>A floating point value.<br>"
@@ -177,7 +176,7 @@ class NodeEditor extends Editor
}
protected void appendProperties(DefaultFormBuilder builder)
- {
+ {
builder.append("Name");
builder.append(_name, 3);
builder.nextLine();
@@ -188,8 +187,7 @@ class NodeEditor extends Editor
builder.nextRow(-2);
CellConstraints cc = new CellConstraints();
JScrollPane scrollPane = new JScrollPane(_description);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
builder.nextRow(2);
builder.nextLine();
@@ -202,8 +200,7 @@ class NodeEditor extends Editor
builder.append("");
builder.nextRow(-6);
scrollPane = new JScrollPane(_variables);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
@@ -211,7 +208,7 @@ class NodeEditor extends Editor
builder.append(_loadFactor, 3);
builder.nextLine();
}
-
+
boolean isSimpleUpdate()
{
NodeDescriptor descriptor = (NodeDescriptor)_target.getDescriptor();
@@ -224,8 +221,8 @@ class NodeEditor extends Editor
descriptor.description = _description.getText();
descriptor.variables = _variables.get();
descriptor.loadFactor = _loadFactor.getText().trim();
- }
-
+ }
+
protected boolean validate()
{
return check(new String[]{"Name", _name.getText().trim()});
@@ -235,24 +232,22 @@ class NodeEditor extends Editor
{
detectUpdates(false);
_target = node;
-
+
Utils.Resolver resolver = getDetailResolver();
boolean isEditable = (resolver == null);
_name.setText(_target.getId());
_name.setEditable(_target.isEphemeral());
-
+
NodeDescriptor descriptor = (NodeDescriptor)_target.getDescriptor();
- _description.setText(
- Utils.substitute(descriptor.description, resolver));
+ _description.setText(Utils.substitute(descriptor.description, resolver));
_description.setEditable(isEditable);
_description.setOpaque(isEditable);
_variables.set(descriptor.variables, resolver, isEditable);
- _loadFactor.setText(
- Utils.substitute(descriptor.loadFactor, resolver));
+ _loadFactor.setText(Utils.substitute(descriptor.loadFactor, resolver));
_loadFactor.setEditable(isEditable);
_applyButton.setEnabled(node.isEphemeral());
@@ -266,6 +261,6 @@ class NodeEditor extends Editor
private JTextField _name = new JTextField(20);
private JTextArea _description = new JTextArea(3, 20);
- private MapField _variables;
+ private SimpleMapField _variables;
private JTextField _loadFactor = new JTextField(20);
}
diff --git a/java/src/IceGridGUI/Application/Nodes.java b/java/src/IceGridGUI/Application/Nodes.java
index 70e491a8a2c..f0c1302e72e 100644
--- a/java/src/IceGridGUI/Application/Nodes.java
+++ b/java/src/IceGridGUI/Application/Nodes.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.Component;
@@ -20,18 +21,13 @@ import IceGridGUI.*;
class Nodes extends ListTreeNode
{
- static public java.util.Map
- copyDescriptors(java.util.Map descriptors)
+ static public java.util.Map<String, NodeDescriptor>
+ copyDescriptors(java.util.Map<String, NodeDescriptor> descriptors)
{
- java.util.Map copy = new java.util.HashMap();
- java.util.Iterator p = descriptors.entrySet().iterator();
- while(p.hasNext())
+ java.util.Map<String, NodeDescriptor> copy = new java.util.HashMap<String, NodeDescriptor>();
+ for(java.util.Map.Entry<String, NodeDescriptor> p : descriptors.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
-
- copy.put(entry.getKey(),
- Node.copyDescriptor(
- (NodeDescriptor)entry.getValue()));
+ copy.put(p.getKey(), Node.copyDescriptor(p.getValue()));
}
return copy;
}
@@ -65,38 +61,34 @@ class Nodes extends ListTreeNode
{
Object descriptor = getCoordinator().getClipboard();
NodeDescriptor nd = Node.copyDescriptor((NodeDescriptor)descriptor);
-
+
//
// Verify / fix all template instances
//
-
- java.util.Iterator p = nd.serverInstances.iterator();
- while(p.hasNext())
+
+ for(ServerInstanceDescriptor p : nd.serverInstances)
{
- ServerInstanceDescriptor sid = (ServerInstanceDescriptor)p.next();
- TemplateDescriptor td = getRoot().findServerTemplateDescriptor(sid.template);
+ TemplateDescriptor td = getRoot().findServerTemplateDescriptor(p.template);
if(td == null)
{
JOptionPane.showMessageDialog(
getCoordinator().getMainFrame(),
- "Descriptor refers to undefined server template '" + sid.template + "'",
+ "Descriptor refers to undefined server template '" + p.template + "'",
"Cannot paste",
JOptionPane.ERROR_MESSAGE);
return;
}
else
{
- sid.parameterValues.keySet().retainAll(td.parameters);
+ p.parameterValues.keySet().retainAll(td.parameters);
}
}
- p = nd.servers.iterator();
- while(p.hasNext())
+ for(ServerDescriptor p : nd.servers)
{
- ServerDescriptor sd = (ServerDescriptor)p.next();
- if(sd instanceof IceBoxDescriptor)
+ if(p instanceof IceBoxDescriptor)
{
- if(!getRoot().pasteIceBox((IceBoxDescriptor)sd))
+ if(!getRoot().pasteIceBox((IceBoxDescriptor)p))
{
return;
}
@@ -105,31 +97,29 @@ class Nodes extends ListTreeNode
newNode(nd);
}
-
+
public void newNode()
{
newNode(new NodeDescriptor(
- new java.util.TreeMap(),
- new java.util.LinkedList(),
- new java.util.LinkedList(),
+ new java.util.TreeMap<String, String>(),
+ new java.util.LinkedList<ServerInstanceDescriptor>(),
+ new java.util.LinkedList<ServerDescriptor>(),
"",
"",
- new java.util.HashMap()));
+ new java.util.HashMap<String, PropertySetDescriptor>()));
}
-
- Nodes(TreeNode parent, java.util.Map descriptors)
+
+ Nodes(TreeNode parent, java.util.Map<String, NodeDescriptor> descriptors)
throws UpdateFailedException
{
super(false, parent, "Nodes");
_descriptors = descriptors;
- java.util.Iterator p = _descriptors.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, NodeDescriptor> p : _descriptors.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- String nodeName = (String)entry.getKey();
- NodeDescriptor nodeDescriptor = (NodeDescriptor)entry.getValue();
- insertChild(new Node(false, this, nodeName, nodeDescriptor), false);
+ String nodeName = p.getKey();
+ NodeDescriptor nodeDescriptor = p.getValue();
+ insertChild(new Node(false, this, nodeName, nodeDescriptor), false);
}
}
@@ -137,15 +127,15 @@ class Nodes extends ListTreeNode
// Try to rebuild all my children
// No-op if it fails
//
- void rebuild() throws UpdateFailedException
+ void rebuild()
+ throws UpdateFailedException
{
- java.util.List backupList = new java.util.Vector();
- java.util.List editables = new java.util.LinkedList();
+ java.util.List<Node.Backup> backupList = new java.util.ArrayList<Node.Backup>();
+ java.util.List<Editable> editables = new java.util.LinkedList<Editable>();
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(TreeNodeBase p : _children)
{
- Node node = (Node)p.next();
+ Node node = (Node)p;
try
{
backupList.add(node.rebuild(editables));
@@ -154,7 +144,7 @@ class Nodes extends ListTreeNode
{
for(int i = backupList.size() - 1; i >= 0; --i)
{
- ((Node)_children.get(i)).restore((Node.Backup)backupList.get(i));
+ ((Node)_children.get(i)).restore(backupList.get(i));
}
throw e;
}
@@ -163,32 +153,28 @@ class Nodes extends ListTreeNode
//
// Success
//
- p = editables.iterator();
- while(p.hasNext())
+ for(Editable p : editables)
{
- Editable editable = (Editable)p.next();
- editable.markModified();
+ p.markModified();
}
}
void commit()
{
_editable.commit();
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(TreeNodeBase p : _children)
{
- Node node = (Node)p.next();
+ Node node = (Node)p;
node.commit();
}
}
- java.util.LinkedList getUpdates()
+ java.util.LinkedList<NodeUpdateDescriptor> getUpdates()
{
- java.util.LinkedList updates = new java.util.LinkedList();
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ java.util.LinkedList<NodeUpdateDescriptor> updates = new java.util.LinkedList<NodeUpdateDescriptor>();
+ for(TreeNodeBase p : _children)
{
- Node node = (Node)p.next();
+ Node node = (Node)p;
NodeUpdateDescriptor d = node.getUpdate();
if(d != null)
{
@@ -200,39 +186,35 @@ class Nodes extends ListTreeNode
void removeServerInstances(String templateId)
{
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(TreeNodeBase p : _children)
{
- Node node = (Node)p.next();
+ Node node = (Node)p;
node.removeServerInstances(templateId);
}
}
- java.util.List findServiceInstances(String template)
+ java.util.List<ServiceInstance> findServiceInstances(String template)
{
- java.util.List result = new java.util.LinkedList();
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ java.util.List<ServiceInstance> result = new java.util.LinkedList<ServiceInstance>();
+ for(TreeNodeBase p : _children)
{
- Node node = (Node)p.next();
+ Node node = (Node)p;
result.addAll(node.findServiceInstances(template));
}
return result;
}
-
void removeServiceInstances(String templateId)
{
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(TreeNodeBase p : _children)
{
- Node node = (Node)p.next();
+ Node node = (Node)p;
node.removeServiceInstances(templateId);
}
}
- void update(java.util.List updates, String[] removeNodes,
- java.util.Set serverTemplates, java.util.Set serviceTemplates)
+ void update(java.util.List<NodeUpdateDescriptor> updates, String[] removeNodes,
+ java.util.Set<String> serverTemplates, java.util.Set<String> serviceTemplates)
throws UpdateFailedException
{
Root root = getRoot();
@@ -246,27 +228,26 @@ class Nodes extends ListTreeNode
// One big set of removes
//
removeChildren(removeNodes);
-
+
//
// One big set of updates, followed by inserts
//
- java.util.Vector newChildren = new java.util.Vector();
- java.util.Set updatedNodes = new java.util.HashSet();
-
- java.util.Iterator p = updates.iterator();
- while(p.hasNext())
+ java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<TreeNodeBase>();
+ java.util.Set<Node> updatedNodes = new java.util.HashSet<Node>();
+
+ for(NodeUpdateDescriptor update : updates)
{
- NodeUpdateDescriptor update = (NodeUpdateDescriptor)p.next();
Node node = findNode(update.name);
if(node == null)
{
- NodeDescriptor nodeDescriptor = new NodeDescriptor(update.variables,
- update.serverInstances,
- update.servers,
- update.loadFactor == null ? "" : update.loadFactor.value,
- update.description == null ? "" : update.description.value,
- new java.util.HashMap());
+ NodeDescriptor nodeDescriptor =
+ new NodeDescriptor(update.variables,
+ update.serverInstances,
+ update.servers,
+ update.loadFactor == null ? "" : update.loadFactor.value,
+ update.description == null ? "" : update.description.value,
+ new java.util.HashMap<String, PropertySetDescriptor>());
_descriptors.put(update.name, nodeDescriptor);
node = new Node(false, this, update.name, nodeDescriptor);
newChildren.add(node);
@@ -281,33 +262,29 @@ class Nodes extends ListTreeNode
//
// Some nodes are only affected by template updates
//
- p = _children.iterator();
- while(p.hasNext())
+ for(TreeNodeBase p : _children)
{
- Node node = (Node)p.next();
+ Node node = (Node)p;
if(!updatedNodes.contains(node))
{
node.update(null, serverTemplates, serviceTemplates);
}
}
-
+
insertChildren(newChildren, true);
}
-
-
Node findNode(String nodeName)
{
return (Node)findChild(nodeName);
}
- java.util.List findServerInstances(String template)
+ java.util.List<ServerInstance> findServerInstances(String template)
{
- java.util.List result = new java.util.LinkedList();
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ java.util.List<ServerInstance> result = new java.util.LinkedList<ServerInstance>();
+ for(TreeNodeBase p : _children)
{
- Node node = (Node)p.next();
+ Node node = (Node)p;
result.addAll(node.findServerInstances(template));
}
return result;
@@ -317,6 +294,7 @@ class Nodes extends ListTreeNode
{
_descriptors.put(nodeName, descriptor);
}
+
void removeDescriptor(String nodeName)
{
_descriptors.remove(nodeName);
@@ -334,11 +312,11 @@ class Nodes extends ListTreeNode
insertChild(node, true);
_descriptors.put(nodeName, descriptor);
}
-
+
private void newNode(NodeDescriptor descriptor)
{
String name = makeNewChildId("NewNode");
-
+
Node node = new Node(this, name, descriptor);
try
{
@@ -351,8 +329,6 @@ class Nodes extends ListTreeNode
getRoot().setSelectedNode(node);
}
-
-
- private java.util.Map _descriptors;
+ private java.util.Map<String, NodeDescriptor> _descriptors;
static private JPopupMenu _popup;
}
diff --git a/java/src/IceGridGUI/Application/ParameterValuesField.java b/java/src/IceGridGUI/Application/ParameterValuesField.java
index 37c6e06ebff..d4f6d6f376e 100644
--- a/java/src/IceGridGUI/Application/ParameterValuesField.java
+++ b/java/src/IceGridGUI/Application/ParameterValuesField.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import IceGrid.*;
@@ -37,7 +38,7 @@ public class ParameterValuesField extends JTable
{
_editor = editor;
- _columnNames = new java.util.Vector(2);
+ _columnNames = new java.util.Vector<String>(2);
_columnNames.add("Name");
_columnNames.add("Value");
@@ -45,29 +46,28 @@ public class ParameterValuesField extends JTable
_notSetCombo.setEditable(true);
}
- public void set(java.util.List names,
- java.util.Map values,
- java.util.Map defaultValues,
+ public void set(java.util.List<String> names,
+ java.util.Map<String, String> values,
+ java.util.Map<String, String> defaultValues,
final Utils.Resolver resolver)
{
//
// Transform map into vector of vectors
//
- java.util.Vector vector = new java.util.Vector(names.size());
- java.util.Iterator p = names.iterator();
+ java.util.Vector<java.util.Vector<String>> vector =
+ new java.util.Vector<java.util.Vector<String>>(names.size());
_hasDefault = new boolean[names.size()];
int i = 0;
- while(p.hasNext())
+ for(String name : names)
{
- java.util.Vector row = new java.util.Vector(2);
- String name = (String)p.next();
+ java.util.Vector<String> row = new java.util.Vector<String>(2);
row.add(name);
_hasDefault[i] = (defaultValues.get(name) != null);
-
- Object val = values.get(name);
+
+ String val = values.get(name);
if(val == null)
{
row.add(_hasDefault[i] ? _useDefault : _notSet);
@@ -94,7 +94,7 @@ public class ParameterValuesField extends JTable
}
}
};
-
+
_model.addTableModelListener(new TableModelListener()
{
public void tableChanged(TableModelEvent e)
@@ -108,35 +108,32 @@ public class ParameterValuesField extends JTable
setOpaque(resolver == null);
setPreferredScrollableViewportSize(getPreferredSize());
- DefaultTableCellRenderer cr = (DefaultTableCellRenderer)
- getDefaultRenderer(String.class);
- cr.setOpaque(resolver == null);
+ DefaultTableCellRenderer cr = (DefaultTableCellRenderer)getDefaultRenderer(String.class);
+ cr.setOpaque(resolver == null);
}
-
- public java.util.Map getValues()
+ public java.util.Map<String, String> getValues()
{
- java.util.Map values = new java.util.HashMap();
+ java.util.Map<String, String> values = new java.util.HashMap<String, String>();
- if(isEditing())
+ if(isEditing())
{
getCellEditor().stopCellEditing();
}
- java.util.Vector vector = _model.getDataVector();
-
- java.util.Iterator p = vector.iterator();
- while(p.hasNext())
+ @SuppressWarnings("unchecked")
+ java.util.Vector<java.util.Vector<String>> vector =
+ (java.util.Vector<java.util.Vector<String>>)_model.getDataVector();
+
+ for(java.util.Vector<String> row : vector)
{
- java.util.Vector row = (java.util.Vector)p.next();
-
//
// Eliminate rows with null or empty names
//
- String name = (String)row.elementAt(0);
+ String name = row.elementAt(0);
assert name != null;
-
- Object val = row.elementAt(1);
-
+
+ String val = row.elementAt(1);
+
//
// Eliminate entries with default or not set value
//
@@ -149,8 +146,7 @@ public class ParameterValuesField extends JTable
return values;
}
- public TableCellEditor getCellEditor(int row,
- int column)
+ public TableCellEditor getCellEditor(int row, int column)
{
if(column == 1)
{
@@ -162,37 +158,20 @@ public class ParameterValuesField extends JTable
}
}
+ private static final String _useDefault = "Use default";
- private static final Object _useDefault = new Object()
- {
- public String toString()
- {
- return "Use default";
- }
- };
+ private static final String _notSet = "Not set";
- private static final Object _notSet = new Object()
- {
- public String toString()
- {
- return "Not set";
- }
- };
+ private JComboBox _useDefaultCombo = new JComboBox(new Object[]{_useDefault});
- private JComboBox _useDefaultCombo = new JComboBox(
- new Object[]{_useDefault});
-
- private JComboBox _notSetCombo = new JComboBox(
- new Object[]{_notSet});
+ private JComboBox _notSetCombo = new JComboBox(new Object[]{_notSet});
private TableCellEditor _useDefaultEditor = new DefaultCellEditor(_useDefaultCombo);
private TableCellEditor _notSetEditor = new DefaultCellEditor(_notSetCombo);
private DefaultTableModel _model;
- private java.util.Vector _columnNames;
+ private java.util.Vector<String> _columnNames;
private Editor _editor;
private boolean[] _hasDefault;
}
-
-
diff --git a/java/src/IceGridGUI/Application/ParametersField.java b/java/src/IceGridGUI/Application/ParametersField.java
index 732d46a20e2..0b53744b88c 100644
--- a/java/src/IceGridGUI/Application/ParametersField.java
+++ b/java/src/IceGridGUI/Application/ParametersField.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import IceGrid.*;
@@ -37,24 +38,23 @@ public class ParametersField extends JTable
{
_editor = editor;
- _columnNames = new java.util.Vector(2);
+ _columnNames = new java.util.Vector<String>(2);
_columnNames.add("Name");
_columnNames.add("Default value");
- JComboBox comboBox = new JComboBox(
- new Object[]{_noDefault});
+ JComboBox comboBox = new JComboBox(new Object[]{_noDefault});
comboBox.setEditable(true);
_cellEditor = new DefaultCellEditor(comboBox);
Action deleteRow = new AbstractAction("Delete selected row(s)")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
- if(isEditing())
+ if(isEditing())
{
getCellEditor().stopCellEditing();
}
-
+
for(;;)
{
int selectedRow = getSelectedRow();
@@ -70,26 +70,23 @@ public class ParametersField extends JTable
}
};
getActionMap().put("delete", deleteRow);
- getInputMap().put(
- KeyStroke.getKeyStroke("DELETE"), "delete");
-
+ getInputMap().put(KeyStroke.getKeyStroke("DELETE"), "delete");
}
- public void set(java.util.List names, java.util.Map values)
+ public void set(java.util.List<String> names, java.util.Map<String, String> values)
{
//
// Transform map into vector of vectors
//
- java.util.Vector vector = new java.util.Vector(names.size());
- java.util.Iterator p = names.iterator();
- while(p.hasNext())
+ java.util.Vector<java.util.Vector<String>> vector =
+ new java.util.Vector<java.util.Vector<String>>(names.size());
+ for(String name : names)
{
- java.util.Vector row = new java.util.Vector(2);
- String name = (String)p.next();
-
+ java.util.Vector<String> row = new java.util.Vector<String>(2);
+
row.add(name);
-
- Object val = values.get(name);
+
+ String val = values.get(name);
if(val == null)
{
row.add(_noDefault);
@@ -101,25 +98,23 @@ public class ParametersField extends JTable
vector.add(row);
}
-
- java.util.Vector newRow = new java.util.Vector(2);
+ java.util.Vector<String> newRow = new java.util.Vector<String>(2);
newRow.add("");
newRow.add(_noDefault);
vector.add(newRow);
_model = new DefaultTableModel(vector, _columnNames);
-
+
_model.addTableModelListener(new TableModelListener()
{
public void tableChanged(TableModelEvent e)
{
- Object lastKey = _model.getValueAt(
- _model.getRowCount() - 1 , 0);
+ Object lastKey = _model.getValueAt(_model.getRowCount() - 1 , 0);
if(lastKey != null && !lastKey.equals(""))
{
_model.addRow(new Object[]{"", _noDefault});
}
-
+
_editor.updated();
}
});
@@ -128,41 +123,39 @@ public class ParametersField extends JTable
TableColumn valColumn = getColumnModel().getColumn(1);
valColumn.setCellEditor(_cellEditor);
- setPreferredScrollableViewportSize(getPreferredSize());
+ setPreferredScrollableViewportSize(getPreferredSize());
}
-
- public java.util.Map get(java.util.List names)
+ public java.util.Map<String, String> get(java.util.List<String> names)
{
assert names != null;
- java.util.Map values = new java.util.HashMap();
+ java.util.Map<String, String> values = new java.util.HashMap<String, String>();
- if(isEditing())
+ if(isEditing())
{
getCellEditor().stopCellEditing();
}
- java.util.Vector vector = _model.getDataVector();
-
- java.util.Iterator p = vector.iterator();
- while(p.hasNext())
+ @SuppressWarnings("unchecked")
+ java.util.Vector<java.util.Vector<String>> vector =
+ (java.util.Vector<java.util.Vector<String>>)_model.getDataVector();
+
+ for(java.util.Vector<String> row : vector)
{
- java.util.Vector row = (java.util.Vector)p.next();
-
//
// Eliminate rows with null or empty names
//
- String name = (String)row.elementAt(0);
+ String name = row.elementAt(0);
if(name != null)
{
name = name.trim();
-
+
if(!name.equals(""))
{
names.add(name);
-
- Object val = row.elementAt(1);
-
+
+ String val = row.elementAt(1);
+
//
// Eliminate entries with "default" value
//
@@ -177,18 +170,10 @@ public class ParametersField extends JTable
return values;
}
- private final Object _noDefault = new Object()
- {
- public String toString()
- {
- return "No default";
- }
- };
+ private final String _noDefault = "No default";
private DefaultTableModel _model;
- private java.util.Vector _columnNames;
+ private java.util.Vector<String> _columnNames;
private Editor _editor;
private TableCellEditor _cellEditor;
}
-
-
diff --git a/java/src/IceGridGUI/Application/PlainServer.java b/java/src/IceGridGUI/Application/PlainServer.java
index d8f733c3955..36c609e4996 100644
--- a/java/src/IceGridGUI/Application/PlainServer.java
+++ b/java/src/IceGridGUI/Application/PlainServer.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.Component;
@@ -21,7 +22,7 @@ import IceGrid.*;
import IceGridGUI.*;
class PlainServer extends Communicator implements Server
-{
+{
static public ServerDescriptor
copyDescriptor(ServerDescriptor sd)
{
@@ -31,7 +32,7 @@ class PlainServer extends Communicator implements Server
copy.dbEnvs = DbEnv.copyDescriptors(copy.dbEnvs);
copy.propertySet = PropertySet.copyDescriptor(copy.propertySet);
-
+
copy.distrib = (DistributionDescriptor)copy.distrib.clone();
if(copy instanceof IceBoxDescriptor)
@@ -41,11 +42,11 @@ class PlainServer extends Communicator implements Server
}
return copy;
}
-
+
static public void shallowRestore(ServerDescriptor from, ServerDescriptor into)
{
//
- // When editing a server or server template, if we update properties,
+ // When editing a server or server template, if we update properties,
// we replace the entire field
//
into.propertySet = from.propertySet;
@@ -65,22 +66,22 @@ class PlainServer extends Communicator implements Server
static public ServerDescriptor newServerDescriptor()
{
return new ServerDescriptor(
- new java.util.LinkedList(),
- new PropertySetDescriptor(new String[0], new java.util.LinkedList()),
- new java.util.LinkedList(),
+ new java.util.LinkedList<AdapterDescriptor>(),
+ new PropertySetDescriptor(new String[0], new java.util.LinkedList<PropertyDescriptor>()),
+ new java.util.LinkedList<DbEnvDescriptor>(),
new String[0],
"",
"NewServer",
"",
"",
"",
- new java.util.LinkedList(),
- new java.util.LinkedList(),
+ new java.util.LinkedList<String>(),
+ new java.util.LinkedList<String>(),
"manual",
"",
"",
true,
- new DistributionDescriptor("", new java.util.LinkedList()),
+ new DistributionDescriptor("", new java.util.LinkedList<String>()),
false, // Allocatable
"");
}
@@ -88,39 +89,39 @@ class PlainServer extends Communicator implements Server
static public IceBoxDescriptor newIceBoxDescriptor()
{
return new IceBoxDescriptor(
- new java.util.LinkedList(),
- new PropertySetDescriptor(new String[0], new java.util.LinkedList()),
- new java.util.LinkedList(),
+ new java.util.LinkedList<AdapterDescriptor>(),
+ new PropertySetDescriptor(new String[0], new java.util.LinkedList<PropertyDescriptor>()),
+ new java.util.LinkedList<DbEnvDescriptor>(),
new String[0],
"",
"NewIceBox",
"",
"",
"",
- new java.util.LinkedList(),
- new java.util.LinkedList(),
+ new java.util.LinkedList<String>(),
+ new java.util.LinkedList<String>(),
"manual",
"",
"",
true,
- new DistributionDescriptor("", new java.util.LinkedList()),
+ new DistributionDescriptor("", new java.util.LinkedList<String>()),
false, // Allocatable
"",
- new java.util.LinkedList()
+ new java.util.LinkedList<ServiceInstanceDescriptor>()
);
}
-
+
//
// Actions
//
public boolean[] getAvailableActions()
{
boolean[] actions = new boolean[ACTION_COUNT];
-
+
Object clipboard = getCoordinator().getClipboard();
- if(clipboard != null &&
+ if(clipboard != null &&
(clipboard instanceof ServerDescriptor
- || clipboard instanceof ServerInstanceDescriptor
+ || clipboard instanceof ServerInstanceDescriptor
|| (isIceBox() && (clipboard instanceof ServiceInstanceDescriptor))
|| (!isIceBox() && (clipboard instanceof Adapter.AdapterCopy
|| clipboard instanceof DbEnvDescriptor))))
@@ -142,6 +143,7 @@ class PlainServer extends Communicator implements Server
}
return actions;
}
+
public JPopupMenu getPopupMenu()
{
ApplicationActions actions = getCoordinator().getActionsForPopup();
@@ -156,12 +158,13 @@ class PlainServer extends Communicator implements Server
actions.setTarget(this);
return _popup;
}
+
public void copy()
{
getCoordinator().setClipboard(copyDescriptor(_descriptor));
getCoordinator().getActionsForMenu().get(PASTE).setEnabled(true);
}
-
+
public Editor getEditor()
{
if(_editor == null)
@@ -176,15 +179,15 @@ class PlainServer extends Communicator implements Server
{
return new PlainServerEditor();
}
-
+
public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
@@ -196,23 +199,22 @@ class PlainServer extends Communicator implements Server
_serverIcon = Utils.getIcon("/icons/16x16/server_inactive.png");
_iceboxServerIcon = Utils.getIcon("/icons/16x16/icebox_server_inactive.png");
}
-
+
if(expanded)
- {
+ {
_cellRenderer.setOpenIcon(isIceBox() ? _iceboxServerIcon : _serverIcon);
}
else
{
_cellRenderer.setClosedIcon(isIceBox() ? _iceboxServerIcon : _serverIcon);
- }
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ }
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
public void destroy()
{
Node node = (Node)_parent;
-
+
if(_ephemeral)
{
node.removeServer(this);
@@ -246,8 +248,8 @@ class PlainServer extends Communicator implements Server
//
// Builds the server and all its sub-tree
//
- PlainServer(boolean brandNew, TreeNode parent, String serverId,
- Utils.Resolver resolver, ServerDescriptor serverDescriptor)
+ PlainServer(boolean brandNew, TreeNode parent, String serverId, Utils.Resolver resolver,
+ ServerDescriptor serverDescriptor)
throws UpdateFailedException
{
super(parent, serverId);
@@ -271,28 +273,25 @@ class PlainServer extends Communicator implements Server
}
}
- static java.util.List createAttributes(ServerDescriptor descriptor)
+ static java.util.List<String[]> createAttributes(ServerDescriptor descriptor)
{
- java.util.List attributes = new java.util.LinkedList();
+ java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
attributes.add(createAttribute("id", descriptor.id));
if(descriptor.activation.length() > 0)
{
- attributes.add(createAttribute("activation",
- descriptor.activation));
+ attributes.add(createAttribute("activation", descriptor.activation));
}
if(descriptor.activationTimeout.length() > 0)
{
- attributes.add(createAttribute("activation-timeout",
- descriptor.activationTimeout));
+ attributes.add(createAttribute("activation-timeout", descriptor.activationTimeout));
}
if(!descriptor.applicationDistrib)
{
- attributes.add(createAttribute("application-distrib", "false"));
+ attributes.add(createAttribute("application-distrib", "false"));
}
if(descriptor.deactivationTimeout.length() > 0)
{
- attributes.add(createAttribute("deactivation-timeout",
- descriptor.deactivationTimeout));
+ attributes.add(createAttribute("deactivation-timeout", descriptor.deactivationTimeout));
}
if(descriptor.exe.length() > 0)
{
@@ -309,35 +308,33 @@ class PlainServer extends Communicator implements Server
return attributes;
}
-
- static void writeOptions(XMLWriter writer, java.util.List options)
+
+ static void writeOptions(XMLWriter writer, java.util.List<String> options)
throws java.io.IOException
{
- java.util.Iterator p = options.iterator();
- while(p.hasNext())
+ for(String p : options)
{
- writer.writeElement("option", (String)p.next());
+ writer.writeElement("option", p);
}
}
-
- static void writeEnvs(XMLWriter writer, java.util.List envs)
+
+ static void writeEnvs(XMLWriter writer, java.util.List<String> envs)
throws java.io.IOException
{
- java.util.Iterator p = envs.iterator();
- while(p.hasNext())
+ for(String p : envs)
{
- writer.writeElement("env", (String)p.next());
+ writer.writeElement("env", p);
}
}
- void write(XMLWriter writer) throws java.io.IOException
+ void write(XMLWriter writer)
+ throws java.io.IOException
{
if(!_ephemeral)
{
if(isIceBox())
{
- writer.writeStartTag("icebox",
- createAttributes(_descriptor));
+ writer.writeStartTag("icebox", createAttributes(_descriptor));
if(_descriptor.description.length() > 0)
{
@@ -345,9 +342,8 @@ class PlainServer extends Communicator implements Server
}
writeOptions(writer, _descriptor.options);
writeEnvs(writer, _descriptor.envs);
-
- writePropertySet(writer, "", "", _descriptor.propertySet,
- _descriptor.adapters, _descriptor.logs);
+
+ writePropertySet(writer, "", "", _descriptor.propertySet, _descriptor.adapters, _descriptor.logs);
writeLogs(writer, _descriptor.logs, _descriptor.propertySet.properties);
writeDistribution(writer, _descriptor.distrib);
@@ -363,10 +359,10 @@ class PlainServer extends Communicator implements Server
{
writer.writeElement("description", _descriptor.description);
}
-
+
writeOptions(writer, _descriptor.options);
writeEnvs(writer, _descriptor.envs);
-
+
writePropertySet(writer, _descriptor.propertySet, _descriptor.adapters, _descriptor.logs);
writeLogs(writer, _descriptor.logs, _descriptor.propertySet.properties);
writeDistribution(writer, _descriptor.distrib);
@@ -378,13 +374,13 @@ class PlainServer extends Communicator implements Server
}
}
-
boolean isIceBox()
{
return _descriptor instanceof IceBoxDescriptor;
}
- public Object rebuild(java.util.List editables) throws UpdateFailedException
+ public Object rebuild(java.util.List<Editable> editables)
+ throws UpdateFailedException
{
Node node = (Node)_parent;
PlainServer newServer = node.createServer(false, _descriptor);
@@ -394,7 +390,7 @@ class PlainServer extends Communicator implements Server
if(_id.equals(newServer.getId()))
{
//
- // A simple update. We can't simply rebuild server because
+ // A simple update. We can't simply rebuild server because
// we need to keep a backup
//
if(_editable.isModified())
@@ -402,7 +398,7 @@ class PlainServer extends Communicator implements Server
newServer.getEditable().markModified();
}
- node.removeServer(this);
+ node.removeServer(this);
try
{
node.insertServer(newServer, true);
@@ -422,7 +418,7 @@ class PlainServer extends Communicator implements Server
node.removeServer(this);
backup = node.getEditable().save();
node.getEditable().removeElement(_id, _editable, Server.class);
-
+
try
{
node.insertServer(newServer, true);
@@ -433,7 +429,7 @@ class PlainServer extends Communicator implements Server
throw e;
}
}
-
+
return backup;
}
@@ -471,8 +467,8 @@ class PlainServer extends Communicator implements Server
//
// Update the server and all its subtree
//
- void rebuild(Utils.Resolver resolver,
- ServerDescriptor serverDescriptor) throws UpdateFailedException
+ void rebuild(Utils.Resolver resolver, ServerDescriptor serverDescriptor)
+ throws UpdateFailedException
{
assert serverDescriptor != null;
_resolver = resolver;
@@ -489,7 +485,7 @@ class PlainServer extends Communicator implements Server
{
IceBoxDescriptor iceBoxDescriptor = (IceBoxDescriptor)_descriptor;
_services.init(iceBoxDescriptor.services);
-
+
//
// IceBox has not dbEnv
//
@@ -511,7 +507,7 @@ class PlainServer extends Communicator implements Server
{
return _resolver;
}
-
+
public Editable getEditable()
{
return _editable;
@@ -534,10 +530,10 @@ class PlainServer extends Communicator implements Server
private Utils.Resolver _resolver;
private Editable _editable;
-
+
static private DefaultTreeCellRenderer _cellRenderer;
static private Icon _serverIcon;
static private Icon _iceboxServerIcon;
-
+
static private JPopupMenu _popup;
}
diff --git a/java/src/IceGridGUI/Application/PlainServerEditor.java b/java/src/IceGridGUI/Application/PlainServerEditor.java
index 8cdec9eeba3..c382d5adfe7 100644
--- a/java/src/IceGridGUI/Application/PlainServerEditor.java
+++ b/java/src/IceGridGUI/Application/PlainServerEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import com.jgoodies.forms.builder.DefaultFormBuilder;
@@ -18,18 +19,18 @@ class PlainServerEditor extends AbstractServerEditor
protected void writeDescriptor()
{
_subEditor.writeDescriptor();
- }
-
+ }
+
protected boolean isSimpleUpdate()
{
- return _subEditor.isSimpleUpdate();
+ return _subEditor.isSimpleUpdate();
}
PlainServerEditor()
{
_subEditor = new ServerSubEditor(this);
}
-
+
//
// From Editor:
//
@@ -46,10 +47,10 @@ class PlainServerEditor extends AbstractServerEditor
}
protected void appendProperties(DefaultFormBuilder builder)
- {
+ {
_subEditor.appendProperties(builder);
}
-
+
Object getSubDescriptor()
{
return _target.getDescriptor();
@@ -68,7 +69,7 @@ class PlainServerEditor extends AbstractServerEditor
_subEditor.show(true);
_applyButton.setEnabled(server.isEphemeral());
- _discardButton.setEnabled(server.isEphemeral());
+ _discardButton.setEnabled(server.isEphemeral());
detectUpdates(true);
if(server.isEphemeral())
{
diff --git a/java/src/IceGridGUI/Application/PlainService.java b/java/src/IceGridGUI/Application/PlainService.java
index 83196b28184..1218cf8ad5a 100644
--- a/java/src/IceGridGUI/Application/PlainService.java
+++ b/java/src/IceGridGUI/Application/PlainService.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.Component;
@@ -17,7 +18,7 @@ import IceGrid.*;
import IceGridGUI.*;
class PlainService extends Communicator implements Service, Cloneable
-{
+{
static public ServiceDescriptor
copyDescriptor(ServiceDescriptor sd)
{
@@ -27,28 +28,25 @@ class PlainService extends Communicator implements Service, Cloneable
copy.propertySet = PropertySet.copyDescriptor(copy.propertySet);
return copy;
}
-
+
public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
_cellRenderer = new DefaultTreeCellRenderer();
- _cellRenderer.setOpenIcon(
- Utils.getIcon("/icons/16x16/service.png"));
+ _cellRenderer.setOpenIcon(Utils.getIcon("/icons/16x16/service.png"));
- _cellRenderer.setClosedIcon(
- Utils.getIcon("/icons/16x16/service.png"));
+ _cellRenderer.setClosedIcon(Utils.getIcon("/icons/16x16/service.png"));
}
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
//
@@ -58,10 +56,10 @@ class PlainService extends Communicator implements Service, Cloneable
{
boolean[] actions = new boolean[ACTION_COUNT];
actions[COPY] = !_ephemeral;
-
+
Object clipboard = getCoordinator().getClipboard();
- if(clipboard != null &&
- (clipboard instanceof ServiceInstanceDescriptor
+ if(clipboard != null &&
+ (clipboard instanceof ServiceInstanceDescriptor
|| clipboard instanceof Adapter.AdapterCopy
|| clipboard instanceof DbEnvDescriptor))
{
@@ -71,17 +69,18 @@ class PlainService extends Communicator implements Service, Cloneable
actions[DELETE] = true;
actions[NEW_ADAPTER] = !_ephemeral;
actions[NEW_DBENV] = !_ephemeral;
-
+
if(_parent instanceof Server && !_ephemeral)
{
actions[SHOW_VARS] = true;
actions[SUBSTITUTE_VARS] = true;
}
-
+
actions[MOVE_UP] = canMove(true);
actions[MOVE_DOWN] = canMove(false);
return actions;
}
+
public JPopupMenu getPopupMenu()
{
ApplicationActions actions = getCoordinator().getActionsForPopup();
@@ -97,21 +96,23 @@ class PlainService extends Communicator implements Service, Cloneable
actions.setTarget(this);
return _popup;
}
+
public void copy()
{
getCoordinator().setClipboard(ServiceInstance.copyDescriptor(_descriptor));
getCoordinator().getActionsForMenu().get(PASTE).setEnabled(true);
}
-
+
public void moveUp()
{
move(true);
}
+
public void moveDown()
{
move(false);
}
-
+
public Object getDescriptor()
{
return _descriptor;
@@ -151,7 +152,7 @@ class PlainService extends Communicator implements Service, Cloneable
{
return new PlainServiceEditor();
}
-
+
Editable getEnclosingEditable()
{
return ((Communicator)_parent).getEnclosingEditable();
@@ -174,8 +175,8 @@ class PlainService extends Communicator implements Service, Cloneable
assert canMove(up);
((Communicator)_parent).getServices().move(this, up);
}
-
- public Object rebuild(java.util.List editables)
+
+ public Object rebuild(java.util.List<Editable> editables)
throws UpdateFailedException
{
Communicator communicator = (Communicator)_parent;
@@ -183,7 +184,7 @@ class PlainService extends Communicator implements Service, Cloneable
PlainService newService = null;
newService = (PlainService)services.createChild(_descriptor);
-
+
Object backup = null;
try
@@ -215,15 +216,12 @@ class PlainService extends Communicator implements Service, Cloneable
_dbEnvs = from._dbEnvs;
_services = from._services;
_childListArray = from._childListArray;
-
+
_descriptor = from._descriptor;
_resolver = from._resolver;
}
- PlainService(Communicator parent,
- String name,
- ServiceInstanceDescriptor descriptor,
- Utils.Resolver resolver)
+ PlainService(Communicator parent, String name, ServiceInstanceDescriptor descriptor, Utils.Resolver resolver)
throws UpdateFailedException
{
super(parent, name);
@@ -245,25 +243,26 @@ class PlainService extends Communicator implements Service, Cloneable
_ephemeral = true;
}
- static java.util.List createAttributes(ServiceDescriptor descriptor)
+ static java.util.List<String[]> createAttributes(ServiceDescriptor descriptor)
{
- java.util.List attributes = new java.util.LinkedList();
+ java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
attributes.add(createAttribute("name", descriptor.name));
attributes.add(createAttribute("entry", descriptor.entry));
return attributes;
}
- void write(XMLWriter writer) throws java.io.IOException
+ void write(XMLWriter writer)
+ throws java.io.IOException
{
if(!_ephemeral)
{
writer.writeStartTag("service", createAttributes(_descriptor.descriptor));
-
+
if(_descriptor.descriptor.description.length() > 0)
{
writer.writeElement("description", _descriptor.descriptor.description);
}
-
+
writePropertySet(writer, _descriptor.descriptor.propertySet,
_descriptor.descriptor.adapters, _descriptor.descriptor.logs);
writeLogs(writer, _descriptor.descriptor.logs, _descriptor.descriptor.propertySet.properties);
@@ -273,7 +272,7 @@ class PlainService extends Communicator implements Service, Cloneable
writer.writeEndTag("service");
}
}
-
+
CommunicatorDescriptor getCommunicatorDescriptor()
{
return _descriptor.descriptor;
@@ -296,6 +295,6 @@ class PlainService extends Communicator implements Service, Cloneable
private Utils.Resolver _resolver;
private PlainServiceEditor _editor;
- static private DefaultTreeCellRenderer _cellRenderer;
+ static private DefaultTreeCellRenderer _cellRenderer;
static private JPopupMenu _popup;
}
diff --git a/java/src/IceGridGUI/Application/PlainServiceEditor.java b/java/src/IceGridGUI/Application/PlainServiceEditor.java
index fdaf20205cf..6fe9e73da65 100644
--- a/java/src/IceGridGUI/Application/PlainServiceEditor.java
+++ b/java/src/IceGridGUI/Application/PlainServiceEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import com.jgoodies.forms.builder.DefaultFormBuilder;
@@ -19,7 +20,7 @@ class PlainServiceEditor extends CommunicatorChildEditor
{
_subEditor = new ServiceSubEditor(this);
}
-
+
//
// From Editor:
//
@@ -37,10 +38,10 @@ class PlainServiceEditor extends CommunicatorChildEditor
}
protected void appendProperties(DefaultFormBuilder builder)
- {
+ {
_subEditor.appendProperties(builder);
}
-
+
protected void buildPropertiesPanel()
{
super.buildPropertiesPanel();
@@ -52,17 +53,16 @@ class PlainServiceEditor extends CommunicatorChildEditor
return _subEditor.validate();
}
-
void writeDescriptor()
{
_subEditor.writeDescriptor();
- }
-
+ }
+
boolean isSimpleUpdate()
{
- return _subEditor.isSimpleUpdate();
+ return _subEditor.isSimpleUpdate();
}
-
+
Communicator.ChildList getChildList()
{
return ((Communicator)_target.getParent()).getServices();
@@ -82,7 +82,7 @@ class PlainServiceEditor extends CommunicatorChildEditor
_subEditor.show(true);
_applyButton.setEnabled(service.isEphemeral());
- _discardButton.setEnabled(service.isEphemeral());
+ _discardButton.setEnabled(service.isEphemeral());
detectUpdates(true);
if(service.isEphemeral())
{
diff --git a/java/src/IceGridGUI/Application/PropertiesField.java b/java/src/IceGridGUI/Application/PropertiesField.java
index 73e0bf387f6..aa4a2f88889 100644
--- a/java/src/IceGridGUI/Application/PropertiesField.java
+++ b/java/src/IceGridGUI/Application/PropertiesField.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import IceGrid.*;
@@ -24,7 +25,6 @@ import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
-
//
// A special field used to show/edit properties
//
@@ -33,7 +33,7 @@ public class PropertiesField extends JTable
{
public PropertiesField(Editor editor)
{
- _columnNames = new java.util.Vector(2);
+ _columnNames = new java.util.Vector<String>(2);
_columnNames.add("Name");
_columnNames.add("Value");
@@ -41,15 +41,15 @@ public class PropertiesField extends JTable
Action deleteRow = new AbstractAction("Delete selected row(s)")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(_editable)
{
- if(isEditing())
+ if(isEditing())
{
getCellEditor().stopCellEditing();
}
-
+
for(;;)
{
int selectedRow = getSelectedRow();
@@ -66,32 +66,25 @@ public class PropertiesField extends JTable
}
};
getActionMap().put("delete", deleteRow);
- getInputMap().put(
- KeyStroke.getKeyStroke("DELETE"), "delete");
-
-
-
-
+ getInputMap().put(KeyStroke.getKeyStroke("DELETE"), "delete");
}
-
- public void setProperties(java.util.List properties,
- java.util.List adapters,
- String[] logs,
- Utils.Resolver resolver, boolean editable)
+ public void setProperties(java.util.List<PropertyDescriptor> properties,
+ java.util.List<AdapterDescriptor> adapters, String[] logs, Utils.Resolver resolver,
+ boolean editable)
{
_editable = editable;
//
// We don't show the .Endpoint and .PublishedEndpoints of adapters,
- // since they already appear in the Adapter pages
+ // since they already appear in the Adapter pages
//
- java.util.Set hiddenPropertyNames = new java.util.HashSet();
+ java.util.Set<String> hiddenPropertyNames = new java.util.HashSet<String>();
//
// We also hide properties whose value match an object or allocatable
//
- java.util.Set hiddenPropertyValues = new java.util.HashSet();
+ java.util.Set<String> hiddenPropertyValues = new java.util.HashSet<String>();
_hiddenProperties.clear();
@@ -101,86 +94,79 @@ public class PropertiesField extends JTable
// Note that we don't substitute *on purpose*, i.e. the names or values
// must match before substitution.
//
- java.util.Iterator p = adapters.iterator();
- while(p.hasNext())
+ for(AdapterDescriptor p : adapters)
{
- AdapterDescriptor ad = (AdapterDescriptor)p.next();
- hiddenPropertyNames.add(ad.name + ".Endpoints");
- hiddenPropertyNames.add(ad.name + ".PublishedEndpoints");
+ hiddenPropertyNames.add(p.name + ".Endpoints");
+ hiddenPropertyNames.add(p.name + ".PublishedEndpoints");
- java.util.Iterator q = ad.objects.iterator();
- while(q.hasNext())
+ for(ObjectDescriptor q : p.objects)
{
- ObjectDescriptor od = (ObjectDescriptor)q.next();
- hiddenPropertyValues.add(Ice.Util.identityToString(od.id));
+ hiddenPropertyValues.add(Ice.Util.identityToString(q.id));
}
- q = ad.allocatables.iterator();
- while(q.hasNext())
+ for(ObjectDescriptor q : p.allocatables)
{
- ObjectDescriptor od = (ObjectDescriptor)q.next();
- hiddenPropertyValues.add(Ice.Util.identityToString(od.id));
+ hiddenPropertyValues.add(Ice.Util.identityToString(q.id));
}
}
}
if(logs != null)
{
- for(int i = 0; i < logs.length; ++i)
+ for(String log : logs)
{
- hiddenPropertyValues.add(logs[i]);
+ hiddenPropertyValues.add(log);
}
}
-
+
//
// Transform list into vector of vectors
//
- java.util.Vector vector = new java.util.Vector(properties.size());
- java.util.Iterator p = properties.iterator();
- while(p.hasNext())
+ java.util.Vector<java.util.Vector<String>> vector =
+ new java.util.Vector<java.util.Vector<String>>(properties.size());
+ for(PropertyDescriptor p : properties)
{
- PropertyDescriptor pd = (PropertyDescriptor)p.next();
- if(hiddenPropertyNames.contains(pd.name))
+ if(hiddenPropertyNames.contains(p.name))
{
//
// We keep them at the top of the list
//
if(_editable)
{
- _hiddenProperties.add(pd);
+ _hiddenProperties.add(p);
}
//
// We hide only the first occurence
//
- hiddenPropertyNames.remove(pd.name);
+ hiddenPropertyNames.remove(p.name);
}
- else if(hiddenPropertyValues.contains(pd.value))
+ else if(hiddenPropertyValues.contains(p.value))
{
//
// We keep them at the top of the list
//
if(_editable)
{
- _hiddenProperties.add(pd);
+ _hiddenProperties.add(p);
}
//
// We hide only the first occurence
//
- hiddenPropertyValues.remove(pd.value);
+ hiddenPropertyValues.remove(p.value);
}
else
{
- java.util.Vector row = new java.util.Vector(2);
- row.add(Utils.substitute(pd.name, resolver));
- row.add(Utils.substitute(pd.value, resolver));
+ java.util.Vector<String> row = new java.util.Vector<String>(2);
+ row.add(Utils.substitute(p.name, resolver));
+ row.add(Utils.substitute(p.value, resolver));
vector.add(row);
}
}
if(_editable)
{
- java.util.Vector newRow = new java.util.Vector(2);
+ java.util.Vector<String> newRow = new java.util.Vector<String>(2);
newRow.add("");
newRow.add("");
vector.add(newRow);
@@ -193,15 +179,14 @@ public class PropertiesField extends JTable
return _editable;
}
};
-
+
_model.addTableModelListener(new TableModelListener()
{
public void tableChanged(TableModelEvent e)
{
if(_editable)
{
- Object lastKey = _model.getValueAt(
- _model.getRowCount() - 1 , 0);
+ Object lastKey = _model.getValueAt(_model.getRowCount() - 1 , 0);
if(lastKey != null && !lastKey.equals(""))
{
_model.addRow(new Object[]{"", ""});
@@ -216,38 +201,37 @@ public class PropertiesField extends JTable
setOpaque(_editable);
setPreferredScrollableViewportSize(getPreferredSize());
- DefaultTableCellRenderer cr = (DefaultTableCellRenderer)
- getDefaultRenderer(String.class);
- cr.setOpaque(_editable);
+ DefaultTableCellRenderer cr = (DefaultTableCellRenderer)getDefaultRenderer(String.class);
+ cr.setOpaque(_editable);
}
- public java.util.LinkedList getProperties()
+ public java.util.LinkedList<PropertyDescriptor> getProperties()
{
assert _editable;
- if(isEditing())
+ if(isEditing())
{
getCellEditor().stopCellEditing();
}
- java.util.Vector vector = _model.getDataVector();
-
- java.util.LinkedList result = new java.util.LinkedList(_hiddenProperties);
+ @SuppressWarnings("unchecked")
+ java.util.Vector<java.util.Vector<String>> vector =
+ (java.util.Vector<java.util.Vector<String>>)_model.getDataVector();
- java.util.Iterator p = vector.iterator();
- while(p.hasNext())
- {
- java.util.Vector row = (java.util.Vector)p.next();
+ java.util.LinkedList<PropertyDescriptor> result =
+ new java.util.LinkedList<PropertyDescriptor>(_hiddenProperties);
+ for(java.util.Vector<String> row : vector)
+ {
//
// Eliminate rows with null or empty keys
//
- String key = (String)row.elementAt(0);
+ String key = row.elementAt(0);
if(key != null)
{
- key = key.trim();
+ key = key.trim();
if(!key.equals(""))
{
- String val = (String) row.elementAt(1);
+ String val = row.elementAt(1);
if(val == null)
{
val = "";
@@ -261,12 +245,11 @@ public class PropertiesField extends JTable
}
private DefaultTableModel _model;
- private java.util.Vector _columnNames;
+ private java.util.Vector<String> _columnNames;
private boolean _editable = false;
- private java.util.LinkedList _hiddenProperties = new java.util.LinkedList();
+ private java.util.LinkedList<PropertyDescriptor> _hiddenProperties =
+ new java.util.LinkedList<PropertyDescriptor>();
private Editor _editor;
}
-
-
diff --git a/java/src/IceGridGUI/Application/PropertySet.java b/java/src/IceGridGUI/Application/PropertySet.java
index 4a147160405..7de05cc4759 100644
--- a/java/src/IceGridGUI/Application/PropertySet.java
+++ b/java/src/IceGridGUI/Application/PropertySet.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.Component;
@@ -17,34 +18,32 @@ import IceGridGUI.*;
class PropertySet extends TreeNode
{
- static public PropertySetDescriptor
+ static public PropertySetDescriptor
copyDescriptor(PropertySetDescriptor d)
{
PropertySetDescriptor psd = (PropertySetDescriptor)d.clone();
- psd.properties = new java.util.LinkedList(psd.properties);
+ psd.properties = new java.util.LinkedList<PropertyDescriptor>(psd.properties);
return psd;
}
public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
_cellRenderer = new DefaultTreeCellRenderer();
- _cellRenderer.setLeafIcon(
- Utils.getIcon("/icons/16x16/property_set.png"));
+ _cellRenderer.setLeafIcon(Utils.getIcon("/icons/16x16/property_set.png"));
}
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
-
+
//
// Actions
//
@@ -52,7 +51,7 @@ class PropertySet extends TreeNode
{
boolean[] actions = new boolean[ACTION_COUNT];
actions[COPY] = !_ephemeral;
-
+
if(((TreeNode)_parent).getAvailableActions()[PASTE])
{
actions[PASTE] = true;
@@ -73,6 +72,7 @@ class PropertySet extends TreeNode
getCoordinator().getActionsForMenu().get(PASTE).setEnabled(true);
}
+
public void paste()
{
((TreeNode)_parent).paste();
@@ -104,13 +104,11 @@ class PropertySet extends TreeNode
{
if(_inServerInstance)
{
- _editor = (PropertySetEditor)getRoot().
- getEditor(ServerInstancePropertySetEditor.class, this);
+ _editor = (PropertySetEditor)getRoot().getEditor(ServerInstancePropertySetEditor.class, this);
}
else
{
- _editor = (PropertySetEditor)getRoot().
- getEditor(PropertySetEditor.class, this);
+ _editor = (PropertySetEditor)getRoot().getEditor(PropertySetEditor.class, this);
}
}
_editor.show(_unsubstitutedId, this);
@@ -143,11 +141,12 @@ class PropertySet extends TreeNode
{
return _descriptor;
}
-
+
Object saveDescriptor()
{
return _descriptor.clone();
}
+
void restoreDescriptor(Object savedDescriptor)
{
PropertySetDescriptor clone = (PropertySetDescriptor)savedDescriptor;
@@ -162,7 +161,7 @@ class PropertySet extends TreeNode
_editable.commit();
}
}
-
+
Editable getEditable()
{
if(_editable != null)
@@ -174,12 +173,8 @@ class PropertySet extends TreeNode
return ((PropertySetParent)_parent).getEditable();
}
}
-
- PropertySet(boolean brandNew,
- TreeNode parent,
- String id,
- String unsubstitutedId,
- PropertySetDescriptor descriptor)
+
+ PropertySet(boolean brandNew, TreeNode parent, String id, String unsubstitutedId, PropertySetDescriptor descriptor)
{
super(parent, id);
_unsubstitutedId = unsubstitutedId;
@@ -189,10 +184,7 @@ class PropertySet extends TreeNode
rebuild(descriptor);
}
- PropertySet(TreeNode parent,
- String id,
- String unsubstitutedId,
- PropertySetDescriptor descriptor)
+ PropertySet(TreeNode parent, String id, String unsubstitutedId, PropertySetDescriptor descriptor)
{
super(parent, id);
_unsubstitutedId = unsubstitutedId;
@@ -202,7 +194,7 @@ class PropertySet extends TreeNode
rebuild(descriptor);
}
-
+
PropertySet(TreeNode parent, String id, PropertySetDescriptor descriptor)
{
super(parent, id);
@@ -212,14 +204,13 @@ class PropertySet extends TreeNode
_editable = null;
rebuild(descriptor);
}
-
- void write(XMLWriter writer) throws java.io.IOException
+
+ void write(XMLWriter writer)
+ throws java.io.IOException
{
if(!_ephemeral)
{
- writePropertySet(writer, _unsubstitutedId,
- _inServerInstance ? "service" : "id",
- _descriptor, null, null);
+ writePropertySet(writer, _unsubstitutedId, _inServerInstance ? "service" : "id", _descriptor, null, null);
}
}
@@ -235,5 +226,5 @@ class PropertySet extends TreeNode
private final boolean _inServerInstance;
private PropertySetEditor _editor;
- static private DefaultTreeCellRenderer _cellRenderer;
+ static private DefaultTreeCellRenderer _cellRenderer;
}
diff --git a/java/src/IceGridGUI/Application/PropertySetEditor.java b/java/src/IceGridGUI/Application/PropertySetEditor.java
index f950c8d9b6e..f225e63d3ad 100644
--- a/java/src/IceGridGUI/Application/PropertySetEditor.java
+++ b/java/src/IceGridGUI/Application/PropertySetEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -44,10 +45,9 @@ class PropertySetEditor extends Editor
if(nps.isEphemeral())
{
writeDescriptor();
- PropertySetDescriptor descriptor =
- (PropertySetDescriptor)nps.getDescriptor();
+ PropertySetDescriptor descriptor = (PropertySetDescriptor)nps.getDescriptor();
nps.destroy(); // just removes the child
-
+
try
{
parent.tryAdd(getIdText(), descriptor);
@@ -66,7 +66,7 @@ class PropertySetEditor extends Editor
assert false;
}
root.setSelectedNode(_target);
-
+
JOptionPane.showMessageDialog(
root.getCoordinator().getMainFrame(),
e.toString(),
@@ -87,8 +87,7 @@ class PropertySetEditor extends Editor
}
else if(!isSimpleUpdate())
{
- PropertySetDescriptor descriptor =
- (PropertySetDescriptor)nps.getDescriptor();
+ PropertySetDescriptor descriptor = (PropertySetDescriptor)nps.getDescriptor();
try
{
@@ -121,7 +120,7 @@ class PropertySetEditor extends Editor
root.updated();
nps.getEditable().markModified();
}
-
+
if(refresh)
{
root.getCoordinator().getCurrentTab().showNode(_target);
@@ -165,17 +164,15 @@ class PropertySetEditor extends Editor
_propertySets.setToolTipText("Property Set References");
_properties = new PropertiesField(this);
}
-
+
void writeDescriptor()
{
- PropertySetDescriptor descriptor =
- (PropertySetDescriptor)getPropertySet().getDescriptor();
+ PropertySetDescriptor descriptor = (PropertySetDescriptor)getPropertySet().getDescriptor();
- descriptor.references =
- (String[])_propertySets.getList().toArray(new String[0]);
+ descriptor.references = (String[])_propertySets.getList().toArray(new String[0]);
descriptor.properties = _properties.getProperties();
- }
-
+ }
+
boolean isSimpleUpdate()
{
return getIdText().equals(_oldId);
@@ -186,7 +183,7 @@ class PropertySetEditor extends Editor
builder.append(_idLabel);
builder.append(getIdComponent(), 3);
builder.nextLine();
-
+
builder.append("Property Sets");
builder.append(_propertySets, 3);
builder.nextLine();
@@ -202,8 +199,7 @@ class PropertySetEditor extends Editor
builder.nextRow(-6);
JScrollPane scrollPane = new JScrollPane(_properties);
CellConstraints cc = new CellConstraints();
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
}
@@ -213,7 +209,7 @@ class PropertySetEditor extends Editor
super.buildPropertiesPanel();
_propertiesPanel.setName("Named Property Set");
}
-
+
protected boolean validate()
{
return check(new String[]{_idLabel.getText(), getIdText()});
@@ -226,22 +222,19 @@ class PropertySetEditor extends Editor
Utils.Resolver resolver = getDetailResolver();
boolean isEditable = (resolver == null);
-
- PropertySetDescriptor descriptor =
- (PropertySetDescriptor)nps.getDescriptor();
-
+
+ PropertySetDescriptor descriptor = (PropertySetDescriptor)nps.getDescriptor();
+
showId(unsubstitutedId, resolver);
_oldId = unsubstitutedId;
- _propertySets.setList(java.util.Arrays.asList(descriptor.references),
- resolver);
+ _propertySets.setList(java.util.Arrays.asList(descriptor.references), resolver);
_propertySets.setEditable(isEditable);
- _properties.setProperties(descriptor.properties, null, null,
- getDetailResolver(), isEditable);
+ _properties.setProperties(descriptor.properties, null, null, getDetailResolver(), isEditable);
_applyButton.setEnabled(nps.isEphemeral());
- _discardButton.setEnabled(nps.isEphemeral());
+ _discardButton.setEnabled(nps.isEphemeral());
detectUpdates(true);
if(nps.isEphemeral())
{
@@ -268,7 +261,6 @@ class PropertySetEditor extends Editor
_id.setEditable(resolver == null);
}
-
private PropertySet getPropertySet()
{
return (PropertySet)_target;
@@ -280,5 +272,5 @@ class PropertySetEditor extends Editor
private final JLabel _idLabel;
private ListTextField _propertySets = new ListTextField(20);
- private PropertiesField _properties;
+ private PropertiesField _properties;
}
diff --git a/java/src/IceGridGUI/Application/PropertySetParent.java b/java/src/IceGridGUI/Application/PropertySetParent.java
index 3ca7756ffdf..22cda4e61c6 100644
--- a/java/src/IceGridGUI/Application/PropertySetParent.java
+++ b/java/src/IceGridGUI/Application/PropertySetParent.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import IceGrid.*;
diff --git a/java/src/IceGridGUI/Application/PropertySets.java b/java/src/IceGridGUI/Application/PropertySets.java
index aa7251f4dd9..626a7336acd 100644
--- a/java/src/IceGridGUI/Application/PropertySets.java
+++ b/java/src/IceGridGUI/Application/PropertySets.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import javax.swing.AbstractListModel;
@@ -17,18 +18,13 @@ import IceGridGUI.*;
class PropertySets extends ListTreeNode implements PropertySetParent
{
- static public java.util.Map
- copyDescriptors(java.util.Map descriptors)
+ static public java.util.Map<String, PropertySetDescriptor>
+ copyDescriptors(java.util.Map<String, PropertySetDescriptor> descriptors)
{
- java.util.Map copy = new java.util.HashMap();
- java.util.Iterator p = descriptors.entrySet().iterator();
- while(p.hasNext())
+ java.util.Map<String, PropertySetDescriptor> copy = new java.util.HashMap<String, PropertySetDescriptor>();
+ for(java.util.Map.Entry<String, PropertySetDescriptor> p : descriptors.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
-
- copy.put(entry.getKey(),
- PropertySet.copyDescriptor(
- (PropertySetDescriptor)entry.getValue()));
+ copy.put(p.getKey(), PropertySet.copyDescriptor(p.getValue()));
}
return copy;
}
@@ -61,45 +57,36 @@ class PropertySets extends ListTreeNode implements PropertySetParent
actions.setTarget(this);
return _popup;
}
-
+
public void newPropertySet()
{
- PropertySetDescriptor descriptor = new
- PropertySetDescriptor(new String[0],
- new java.util.LinkedList());
-
+ PropertySetDescriptor descriptor =
+ new PropertySetDescriptor(new String[0], new java.util.LinkedList<PropertyDescriptor>());
newPropertySet(descriptor);
}
public void paste()
{
Object descriptor = getCoordinator().getClipboard();
-
- PropertySetDescriptor d = PropertySet.copyDescriptor(
- (PropertySetDescriptor)descriptor);
+
+ PropertySetDescriptor d = PropertySet.copyDescriptor((PropertySetDescriptor)descriptor);
newPropertySet(d);
}
-
- PropertySets(TreeNode parent, java.util.Map desc)
+ PropertySets(TreeNode parent, java.util.Map<String, PropertySetDescriptor> desc)
throws UpdateFailedException
{
super(false, parent, "Property Sets");
_descriptors = desc;
-
- java.util.Iterator p = _descriptors.entrySet().iterator();
- while(p.hasNext())
- {
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
-
- String id = (String)entry.getKey();
- insertChild(new PropertySet(false, this, id, id,
- (PropertySetDescriptor)entry.getValue()), false);
+ for(java.util.Map.Entry<String, PropertySetDescriptor> p : _descriptors.entrySet())
+ {
+ String id = p.getKey();
+ insertChild(new PropertySet(false, this, id, id, p.getValue()), false);
}
}
- void update(java.util.Map updates, String[] removePropertySets)
+ void update(java.util.Map<String, PropertySetDescriptor> updates, String[] removePropertySets)
throws UpdateFailedException
{
//
@@ -114,19 +101,16 @@ class PropertySets extends ListTreeNode implements PropertySetParent
//
// One big set of updates, followed by inserts
//
- java.util.Vector newChildren = new java.util.Vector();
-
- java.util.Iterator p = updates.entrySet().iterator();
- while(p.hasNext())
+ java.util.List<PropertySet> newChildren = new java.util.ArrayList<PropertySet>();
+
+ for(java.util.Map.Entry<String, PropertySetDescriptor> p : updates.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- String id = (String)entry.getKey();
- PropertySetDescriptor psd = (PropertySetDescriptor)entry.getValue();
+ String id = p.getKey();
+ PropertySetDescriptor psd = p.getValue();
PropertySet child = (PropertySet)findChild(id);
if(child == null)
{
- newChildren.add(
- new PropertySet(false, this, id, id, psd));
+ newChildren.add(new PropertySet(false, this, id, id, psd));
}
else
{
@@ -136,16 +120,15 @@ class PropertySets extends ListTreeNode implements PropertySetParent
insertChildren(newChildren, true);
}
- java.util.Map getUpdates()
+ java.util.Map<String, PropertySetDescriptor> getUpdates()
{
- java.util.Map updates = new java.util.HashMap();
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ java.util.Map<String, PropertySetDescriptor> updates = new java.util.HashMap<String, PropertySetDescriptor>();
+ for(TreeNodeBase p : _children)
{
- PropertySet ps = (PropertySet)p.next();
+ PropertySet ps = (PropertySet)p;
if(ps.getEditable().isNew() || ps.getEditable().isModified())
{
- updates.put(ps.getId(), ps.getDescriptor());
+ updates.put(ps.getId(), (PropertySetDescriptor)ps.getDescriptor());
}
}
return updates;
@@ -154,10 +137,9 @@ class PropertySets extends ListTreeNode implements PropertySetParent
void commit()
{
_editable.commit();
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(TreeNodeBase p : _children)
{
- PropertySet ps = (PropertySet)p.next();
+ PropertySet ps = (PropertySet)p;
ps.commit();
}
}
@@ -166,13 +148,11 @@ class PropertySets extends ListTreeNode implements PropertySetParent
{
return _descriptors;
}
-
+
public void tryAdd(String id, PropertySetDescriptor descriptor)
throws UpdateFailedException
{
- insertChild(
- new PropertySet(true, this, id, id, descriptor),
- true);
+ insertChild(new PropertySet(true, this, id, id, descriptor), true);
_descriptors.put(id, descriptor);
}
@@ -187,9 +167,7 @@ class PropertySets extends ListTreeNode implements PropertySetParent
try
{
- insertChild(
- new PropertySet(true, this, newId, newId, descriptor),
- true);
+ insertChild(new PropertySet(true, this, newId, newId, descriptor), true);
}
catch(UpdateFailedException ex)
{
@@ -203,13 +181,12 @@ class PropertySets extends ListTreeNode implements PropertySetParent
}
throw ex;
}
-
+
_editable.removeElement(oldId, oldChild.getEditable(), PropertySet.class);
_descriptors.remove(oldId);
_descriptors.put(newId, descriptor);
}
-
public void insertPropertySet(PropertySet nps, boolean fireEvent)
throws UpdateFailedException
{
@@ -235,8 +212,7 @@ class PropertySets extends ListTreeNode implements PropertySetParent
{
String id = makeNewChildId("PropertySet");
- PropertySet propertySet =
- new PropertySet(this, id, descriptor);
+ PropertySet propertySet = new PropertySet(this, id, descriptor);
try
{
@@ -249,6 +225,6 @@ class PropertySets extends ListTreeNode implements PropertySetParent
getRoot().setSelectedNode(propertySet);
}
- private java.util.Map _descriptors;
+ private java.util.Map<String, PropertySetDescriptor> _descriptors;
static private JPopupMenu _popup;
}
diff --git a/java/src/IceGridGUI/Application/ReplicaGroup.java b/java/src/IceGridGUI/Application/ReplicaGroup.java
index 1a055528fde..703d82271c7 100644
--- a/java/src/IceGridGUI/Application/ReplicaGroup.java
+++ b/java/src/IceGridGUI/Application/ReplicaGroup.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.Component;
@@ -17,32 +18,30 @@ import IceGridGUI.*;
class ReplicaGroup extends TreeNode
{
- static public ReplicaGroupDescriptor
+ static public ReplicaGroupDescriptor
copyDescriptor(ReplicaGroupDescriptor d)
{
return (ReplicaGroupDescriptor)d.clone();
}
public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
_cellRenderer = new DefaultTreeCellRenderer();
- _cellRenderer.setLeafIcon(
- Utils.getIcon("/icons/16x16/replica_group.png"));
+ _cellRenderer.setLeafIcon(Utils.getIcon("/icons/16x16/replica_group.png"));
}
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
-
+
//
// Actions
//
@@ -50,7 +49,7 @@ class ReplicaGroup extends TreeNode
{
boolean[] actions = new boolean[ACTION_COUNT];
actions[COPY] = !_ephemeral;
-
+
if(((TreeNode)_parent).getAvailableActions()[PASTE])
{
actions[PASTE] = true;
@@ -84,8 +83,7 @@ class ReplicaGroup extends TreeNode
if(!_ephemeral)
{
replicaGroups.removeDescriptor(_descriptor);
- replicaGroups.getEditable().
- removeElement(_id, _editable, ReplicaGroup.class);
+ replicaGroups.getEditable().removeElement(_id, _editable, ReplicaGroup.class);
getRoot().updated();
}
}
@@ -114,11 +112,12 @@ class ReplicaGroup extends TreeNode
{
return _descriptor;
}
-
+
Object saveDescriptor()
{
return _descriptor.clone();
}
+
void restoreDescriptor(Object savedDescriptor)
{
ReplicaGroupDescriptor clone = (ReplicaGroupDescriptor)savedDescriptor;
@@ -132,22 +131,20 @@ class ReplicaGroup extends TreeNode
{
_editable.commit();
}
-
+
Editable getEditable()
{
return _editable;
}
-
- ReplicaGroup(boolean brandNew,
- TreeNode parent,
- ReplicaGroupDescriptor descriptor)
+
+ ReplicaGroup(boolean brandNew, TreeNode parent, ReplicaGroupDescriptor descriptor)
{
super(parent, descriptor.id);
_ephemeral = false;
_editable = new Editable(brandNew);
rebuild(descriptor);
}
-
+
ReplicaGroup(TreeNode parent, ReplicaGroupDescriptor descriptor)
{
super(parent, descriptor.id);
@@ -155,15 +152,16 @@ class ReplicaGroup extends TreeNode
_editable = null;
rebuild(descriptor);
}
-
- void write(XMLWriter writer) throws java.io.IOException
+
+ void write(XMLWriter writer)
+ throws java.io.IOException
{
if(!_ephemeral)
{
- java.util.List attributes = new java.util.LinkedList();
+ java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
attributes.add(createAttribute("id", _descriptor.id));
-
- if(_descriptor.loadBalancing == null &&
+
+ if(_descriptor.loadBalancing == null &&
_descriptor.description.length() == 0 && _descriptor.objects.isEmpty())
{
writer.writeElement("replica-group", attributes);
@@ -181,34 +179,31 @@ class ReplicaGroup extends TreeNode
attributes.clear();
if(_descriptor.loadBalancing instanceof RandomLoadBalancingPolicy)
{
- attributes.add(createAttribute("type", "random"));
+ attributes.add(createAttribute("type", "random"));
}
else if(_descriptor.loadBalancing instanceof OrderedLoadBalancingPolicy)
{
- attributes.add(createAttribute("type", "ordered"));
+ attributes.add(createAttribute("type", "ordered"));
}
else if(_descriptor.loadBalancing instanceof RoundRobinLoadBalancingPolicy)
{
- attributes.add(createAttribute("type", "round-robin"));
+ attributes.add(createAttribute("type", "round-robin"));
}
else if(_descriptor.loadBalancing instanceof AdaptiveLoadBalancingPolicy)
{
attributes.add(createAttribute("type", "adaptive"));
- AdaptiveLoadBalancingPolicy policy =
- (AdaptiveLoadBalancingPolicy)_descriptor.loadBalancing;
+ AdaptiveLoadBalancingPolicy policy = (AdaptiveLoadBalancingPolicy)_descriptor.loadBalancing;
attributes.add(createAttribute("load-sample", policy.loadSample));
}
- attributes.add(createAttribute("n-replicas",
- _descriptor.loadBalancing.nReplicas));
+ attributes.add(createAttribute("n-replicas", _descriptor.loadBalancing.nReplicas));
writer.writeElement("load-balancing", attributes);
-
+
writeObjects("object", writer, _descriptor.objects, null);
writer.writeEndTag("replica-group");
}
}
}
-
void rebuild(ReplicaGroupDescriptor descriptor)
{
_descriptor = descriptor;
@@ -222,5 +217,5 @@ class ReplicaGroup extends TreeNode
private final Editable _editable;
private ReplicaGroupEditor _editor;
- static private DefaultTreeCellRenderer _cellRenderer;
+ static private DefaultTreeCellRenderer _cellRenderer;
}
diff --git a/java/src/IceGridGUI/Application/ReplicaGroupEditor.java b/java/src/IceGridGUI/Application/ReplicaGroupEditor.java
index 2a21bb37ad1..f3b2f301fff 100644
--- a/java/src/IceGridGUI/Application/ReplicaGroupEditor.java
+++ b/java/src/IceGridGUI/Application/ReplicaGroupEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -44,10 +45,9 @@ class ReplicaGroupEditor extends Editor
{
ReplicaGroups replicaGroups = (ReplicaGroups)replicaGroup.getParent();
writeDescriptor();
- ReplicaGroupDescriptor descriptor =
- (ReplicaGroupDescriptor)replicaGroup.getDescriptor();
+ ReplicaGroupDescriptor descriptor = (ReplicaGroupDescriptor)replicaGroup.getDescriptor();
replicaGroup.destroy(); // just removes the child
-
+
try
{
replicaGroups.tryAdd(descriptor, true);
@@ -66,7 +66,7 @@ class ReplicaGroupEditor extends Editor
assert false;
}
root.setSelectedNode(replicaGroup);
-
+
JOptionPane.showMessageDialog(
root.getCoordinator().getMainFrame(),
e.toString(),
@@ -95,10 +95,9 @@ class ReplicaGroupEditor extends Editor
Object savedDescriptor = replicaGroup.saveDescriptor();
ReplicaGroups replicaGroups = (ReplicaGroups)replicaGroup.getParent();
writeDescriptor();
- ReplicaGroupDescriptor descriptor =
- (ReplicaGroupDescriptor)replicaGroup.getDescriptor();
-
- replicaGroups.removeChild(replicaGroup);
+ ReplicaGroupDescriptor descriptor = (ReplicaGroupDescriptor)replicaGroup.getDescriptor();
+
+ replicaGroups.removeChild(replicaGroup);
try
{
replicaGroups.tryAdd(descriptor, false);
@@ -126,15 +125,14 @@ class ReplicaGroupEditor extends Editor
JOptionPane.ERROR_MESSAGE);
return false;
}
-
+
//
// Success
//
// replaced by brand new ReplicaGroup
replicaGroups.getEditable().
- removeElement(replicaGroup.getId(),
- replicaGroup.getEditable(), ReplicaGroup.class);
+ removeElement(replicaGroup.getId(), replicaGroup.getEditable(), ReplicaGroup.class);
_target = replicaGroups.findChildWithDescriptor(descriptor);
root.updated();
@@ -144,7 +142,7 @@ class ReplicaGroupEditor extends Editor
root.setSelectedNode(_target);
}
}
-
+
if(refresh)
{
root.getCoordinator().getCurrentTab().showNode(_target);
@@ -175,8 +173,8 @@ class ReplicaGroupEditor extends Editor
ReplicaGroupEditor()
{
- _objects = new MapField(this, "Identity", "Type", true);
-
+ _objects = new SimpleMapField(this, true, "Identity", "Type");
+
//
// load balancing
//
@@ -188,7 +186,7 @@ class ReplicaGroupEditor extends Editor
{
updated();
- Object item = e.getItem();
+ Object item = e.getItem();
_loadSampleLabel.setVisible(item == ADAPTIVE);
_loadSample.setVisible(item == ADAPTIVE);
}
@@ -205,8 +203,7 @@ class ReplicaGroupEditor extends Editor
_id.setToolTipText("Must be unique within this IceGrid deployment");
_description.getDocument().addDocumentListener(_updateListener);
- _description.setToolTipText(
- "An optional description for this replica group");
+ _description.setToolTipText("An optional description for this replica group");
_nReplicas.getDocument().addDocumentListener(_updateListener);
_nReplicas.setToolTipText("<html>IceGrid returns the endpoints of "
@@ -215,54 +212,46 @@ class ReplicaGroupEditor extends Editor
+ "Enter 0 to returns the endpoints of all adapters.</html>");
_loadSample.setEditable(true);
- JTextField loadSampleTextField = (JTextField)
- _loadSample.getEditor().getEditorComponent();
+ 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?");
+ _loadSample.setToolTipText("Use the load average or CPU usage over the last 1, 5 or 15 minutes?");
}
-
+
void writeDescriptor()
{
- ReplicaGroupDescriptor descriptor =
- (ReplicaGroupDescriptor)getReplicaGroup().getDescriptor();
+ ReplicaGroupDescriptor descriptor = (ReplicaGroupDescriptor)getReplicaGroup().getDescriptor();
descriptor.id = _id.getText().trim();
descriptor.description = _description.getText();
descriptor.objects = _objectList;
-
+
Object loadBalancing = _loadBalancing.getSelectedItem();
if(loadBalancing == ORDERED)
{
- descriptor.loadBalancing = new OrderedLoadBalancingPolicy(
- _nReplicas.getText().trim());
+ descriptor.loadBalancing = new OrderedLoadBalancingPolicy(_nReplicas.getText().trim());
}
else if(loadBalancing == RANDOM)
{
- descriptor.loadBalancing = new RandomLoadBalancingPolicy(
- _nReplicas.getText().trim());
+ descriptor.loadBalancing = new RandomLoadBalancingPolicy(_nReplicas.getText().trim());
}
else if(loadBalancing == ROUND_ROBIN)
{
- descriptor.loadBalancing = new RoundRobinLoadBalancingPolicy(
- _nReplicas.getText().trim());
+ descriptor.loadBalancing = new RoundRobinLoadBalancingPolicy(_nReplicas.getText().trim());
}
else if(loadBalancing == ADAPTIVE)
{
descriptor.loadBalancing = new AdaptiveLoadBalancingPolicy(
- _nReplicas.getText().trim(),
- _loadSample.getSelectedItem().toString().trim());
+ _nReplicas.getText().trim(), _loadSample.getSelectedItem().toString().trim());
}
else
{
assert false;
}
- }
-
+ }
+
boolean isSimpleUpdate()
{
- ReplicaGroupDescriptor descriptor =
- (ReplicaGroupDescriptor)getReplicaGroup().getDescriptor();
+ ReplicaGroupDescriptor descriptor = (ReplicaGroupDescriptor)getReplicaGroup().getDescriptor();
return descriptor.id.equals(_id.getText().trim());
}
@@ -271,15 +260,14 @@ class ReplicaGroupEditor extends Editor
builder.append("Replica Group ID");
builder.append(_id, 3);
builder.nextLine();
-
+
builder.append("Description");
builder.nextLine();
builder.append("");
builder.nextRow(-2);
CellConstraints cc = new CellConstraints();
JScrollPane scrollPane = new JScrollPane(_description);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
builder.nextRow(2);
builder.nextLine();
@@ -292,8 +280,7 @@ class ReplicaGroupEditor extends Editor
builder.append("");
builder.nextRow(-6);
scrollPane = new JScrollPane(_objects);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
@@ -320,7 +307,7 @@ class ReplicaGroupEditor extends Editor
// First validate stringified identities
//
_objectList = mapToObjectDescriptorSeq(_objects.get());
-
+
if(_objectList == null)
{
return false;
@@ -329,7 +316,6 @@ class ReplicaGroupEditor extends Editor
return check(new String[]{"Replica Group ID", _id.getText().trim()});
}
-
void show(ReplicaGroup replicaGroup)
{
//
@@ -342,15 +328,13 @@ class ReplicaGroupEditor extends Editor
Utils.Resolver resolver = getDetailResolver();
boolean isEditable = (resolver == null);
-
- ReplicaGroupDescriptor descriptor =
- (ReplicaGroupDescriptor)replicaGroup.getDescriptor();
-
+
+ ReplicaGroupDescriptor descriptor = (ReplicaGroupDescriptor)replicaGroup.getDescriptor();
+
_id.setText(descriptor.id);
_id.setEditable(isEditable);
-
- _description.setText(
- Utils.substitute(descriptor.description, resolver));
+
+ _description.setText(Utils.substitute(descriptor.description, resolver));
_description.setEditable(isEditable);
_description.setOpaque(isEditable);
@@ -367,34 +351,28 @@ class ReplicaGroupEditor extends Editor
else if(descriptor.loadBalancing instanceof RandomLoadBalancingPolicy)
{
_loadBalancing.setSelectedItem(RANDOM);
- _nReplicas.setText(
- Utils.substitute(descriptor.loadBalancing.nReplicas, resolver));
+ _nReplicas.setText(Utils.substitute(descriptor.loadBalancing.nReplicas, resolver));
_loadSample.setSelectedItem("1");
}
else if(descriptor.loadBalancing instanceof OrderedLoadBalancingPolicy)
{
_loadBalancing.setSelectedItem(ORDERED);
- _nReplicas.setText(
- Utils.substitute(descriptor.loadBalancing.nReplicas, resolver));
+ _nReplicas.setText(Utils.substitute(descriptor.loadBalancing.nReplicas, resolver));
_loadSample.setSelectedItem("1");
}
else if(descriptor.loadBalancing instanceof RoundRobinLoadBalancingPolicy)
{
_loadBalancing.setSelectedItem(ROUND_ROBIN);
- _nReplicas.setText(
- Utils.substitute(descriptor.loadBalancing.nReplicas, resolver));
+ _nReplicas.setText(Utils.substitute(descriptor.loadBalancing.nReplicas, resolver));
_loadSample.setSelectedItem("1");
}
else if(descriptor.loadBalancing instanceof AdaptiveLoadBalancingPolicy)
{
_loadBalancing.setSelectedItem(ADAPTIVE);
- _nReplicas.setText(
- Utils.substitute(descriptor.loadBalancing.nReplicas, resolver));
+ _nReplicas.setText(Utils.substitute(descriptor.loadBalancing.nReplicas, resolver));
_loadSample.setSelectedItem(
- Utils.substitute(
- ((AdaptiveLoadBalancingPolicy)descriptor.loadBalancing).loadSample,
- resolver));
+ Utils.substitute(((AdaptiveLoadBalancingPolicy)descriptor.loadBalancing).loadSample, resolver));
}
else
{
@@ -405,7 +383,7 @@ class ReplicaGroupEditor extends Editor
_loadBalancing.setEnabled(isEditable);
_applyButton.setEnabled(replicaGroup.isEphemeral());
- _discardButton.setEnabled(replicaGroup.isEphemeral());
+ _discardButton.setEnabled(replicaGroup.isEphemeral());
detectUpdates(true);
if(replicaGroup.isEphemeral())
{
@@ -418,37 +396,32 @@ class ReplicaGroupEditor extends Editor
return (ReplicaGroup)_target;
}
- private java.util.Map objectDescriptorSeqToMap(java.util.List objects)
+ private java.util.Map<String, String> objectDescriptorSeqToMap(java.util.List<ObjectDescriptor> objects)
{
- java.util.Map result = new java.util.TreeMap();
- java.util.Iterator p = objects.iterator();
- while(p.hasNext())
+ java.util.Map<String, String> result = new java.util.TreeMap<String, String>();
+ for(ObjectDescriptor p : objects)
{
- ObjectDescriptor od = (ObjectDescriptor)p.next();
- result.put(Ice.Util.identityToString(od.id),
- od.type);
+ result.put(Ice.Util.identityToString(p.id), p.type);
}
return result;
}
-
- private java.util.LinkedList mapToObjectDescriptorSeq(java.util.Map map)
+
+ private java.util.LinkedList<ObjectDescriptor> mapToObjectDescriptorSeq(java.util.Map<String, String> map)
{
String badIdentities = "";
- java.util.LinkedList result = new java.util.LinkedList();
- java.util.Iterator p = map.entrySet().iterator();
-
- while(p.hasNext())
+ java.util.LinkedList<ObjectDescriptor> result = new java.util.LinkedList<ObjectDescriptor>();
+
+ for(java.util.Map.Entry<String, String> p : map.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
try
{
- Ice.Identity id = Ice.Util.stringToIdentity((String)entry.getKey());
- String type = (String)entry.getValue();
+ Ice.Identity id = Ice.Util.stringToIdentity(p.getKey());
+ String type = p.getValue();
result.add(new ObjectDescriptor(id, type));
}
catch(Ice.IdentityParseException ex)
{
- badIdentities += "- " + (String)entry.getKey() + "\n";
+ badIdentities += "- " + p.getKey() + "\n";
}
}
if(!badIdentities.equals(""))
@@ -475,15 +448,13 @@ class ReplicaGroupEditor extends Editor
private JTextField _id = new JTextField(20);
private JTextArea _description = new JTextArea(3, 20);
- private JComboBox _loadBalancing = new JComboBox(new Object[]
- {ADAPTIVE, ORDERED, RANDOM, ROUND_ROBIN});
-
+ private JComboBox _loadBalancing = new JComboBox(new Object[] {ADAPTIVE, ORDERED, RANDOM, ROUND_ROBIN});
+
private JTextField _nReplicas = new JTextField(20);
private JLabel _loadSampleLabel;
- private JComboBox _loadSample = new JComboBox(new Object[]
- {"1", "5", "15"});
-
- private MapField _objects;
- private java.util.LinkedList _objectList;
+ private JComboBox _loadSample = new JComboBox(new Object[] {"1", "5", "15"});
+
+ private SimpleMapField _objects;
+ private java.util.LinkedList<ObjectDescriptor> _objectList;
}
diff --git a/java/src/IceGridGUI/Application/ReplicaGroups.java b/java/src/IceGridGUI/Application/ReplicaGroups.java
index a1d51ea6d6c..99602cb4026 100644
--- a/java/src/IceGridGUI/Application/ReplicaGroups.java
+++ b/java/src/IceGridGUI/Application/ReplicaGroups.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import javax.swing.AbstractListModel;
@@ -17,15 +18,13 @@ import IceGridGUI.*;
class ReplicaGroups extends ListTreeNode
{
- static public java.util.List
- copyDescriptors(java.util.List descriptors)
+ static public java.util.List<ReplicaGroupDescriptor>
+ copyDescriptors(java.util.List<ReplicaGroupDescriptor> descriptors)
{
- java.util.List copy = new java.util.LinkedList();
- java.util.Iterator p = descriptors.iterator();
- while(p.hasNext())
+ java.util.List<ReplicaGroupDescriptor> copy = new java.util.LinkedList<ReplicaGroupDescriptor>();
+ for(ReplicaGroupDescriptor p : descriptors)
{
- copy.add(ReplicaGroup.copyDescriptor(
- (ReplicaGroupDescriptor)p.next()));
+ copy.add(ReplicaGroup.copyDescriptor(p));
}
return copy;
}
@@ -58,14 +57,14 @@ class ReplicaGroups extends ListTreeNode
actions.setTarget(this);
return _popup;
}
-
+
public void newReplicaGroup()
{
ReplicaGroupDescriptor descriptor = new
ReplicaGroupDescriptor(
makeNewChildId("NewReplicaGroup"),
null,
- new java.util.LinkedList(),
+ new java.util.LinkedList<ObjectDescriptor>(),
"");
newReplicaGroup(descriptor);
@@ -74,39 +73,33 @@ class ReplicaGroups extends ListTreeNode
public void paste()
{
Object descriptor = getCoordinator().getClipboard();
-
- ReplicaGroupDescriptor d = ReplicaGroup.copyDescriptor(
- (ReplicaGroupDescriptor)descriptor);
+
+ ReplicaGroupDescriptor d = ReplicaGroup.copyDescriptor((ReplicaGroupDescriptor)descriptor);
d.id = makeNewChildId(d.id);
newReplicaGroup(d);
}
-
- ReplicaGroups(TreeNode parent, java.util.List desc) throws UpdateFailedException
+ ReplicaGroups(TreeNode parent, java.util.List<ReplicaGroupDescriptor> desc)
+ throws UpdateFailedException
{
super(false, parent, "Replica Groups");
_descriptors = desc;
-
- java.util.Iterator p = _descriptors.iterator();
- while(p.hasNext())
+
+ for(ReplicaGroupDescriptor p : _descriptors)
{
- ReplicaGroupDescriptor descriptor
- = (ReplicaGroupDescriptor)p.next();
-
- insertChild(new ReplicaGroup(false, this, descriptor), false);
+ insertChild(new ReplicaGroup(false, this, p), false);
}
}
- java.util.LinkedList getUpdates()
+ java.util.LinkedList<ReplicaGroupDescriptor> getUpdates()
{
- java.util.LinkedList updates = new java.util.LinkedList();
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ java.util.LinkedList<ReplicaGroupDescriptor> updates = new java.util.LinkedList<ReplicaGroupDescriptor>();
+ for(TreeNodeBase p : _children)
{
- ReplicaGroup ra = (ReplicaGroup)p.next();
+ ReplicaGroup ra = (ReplicaGroup)p;
if(ra.getEditable().isNew() || ra.getEditable().isModified())
{
- updates.add(ra.getDescriptor());
+ updates.add((ReplicaGroupDescriptor)ra.getDescriptor());
}
}
return updates;
@@ -115,15 +108,14 @@ class ReplicaGroups extends ListTreeNode
void commit()
{
_editable.commit();
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(TreeNodeBase p : _children)
{
- ReplicaGroup rg = (ReplicaGroup)p.next();
+ ReplicaGroup rg = (ReplicaGroup)p;
rg.commit();
}
}
- void update(java.util.List descriptors, String[] removeReplicaGroups)
+ void update(java.util.List<ReplicaGroupDescriptor> descriptors, String[] removeReplicaGroups)
{
_descriptors = descriptors;
@@ -135,23 +127,16 @@ class ReplicaGroups extends ListTreeNode
//
// Updates and inserts
//
- java.util.List updatedChildren = new java.util.LinkedList();
- java.util.Iterator p = descriptors.iterator();
- while(p.hasNext())
+ java.util.List<TreeNodeBase> updatedChildren = new java.util.ArrayList<TreeNodeBase>();
+ for(ReplicaGroupDescriptor p : descriptors)
{
- ReplicaGroupDescriptor descriptor =
- (ReplicaGroupDescriptor)p.next();
-
- ReplicaGroup child
- = (ReplicaGroup)findChild(descriptor.id);
+ ReplicaGroup child = (ReplicaGroup)findChild(p.id);
if(child == null)
{
try
{
- insertChild(
- new ReplicaGroup(false, this, descriptor),
- true);
+ insertChild(new ReplicaGroup(false, this, p), true);
}
catch(UpdateFailedException e)
{
@@ -160,7 +145,7 @@ class ReplicaGroups extends ListTreeNode
}
else
{
- child.rebuild(descriptor);
+ child.rebuild(p);
updatedChildren.add(child);
}
}
@@ -189,7 +174,7 @@ class ReplicaGroups extends ListTreeNode
//
// A straight remove uses equals(), which is not the desired behavior
//
- java.util.Iterator p = _descriptors.iterator();
+ java.util.Iterator<ReplicaGroupDescriptor> p = _descriptors.iterator();
while(p.hasNext())
{
if(descriptor == p.next())
@@ -203,9 +188,7 @@ class ReplicaGroups extends ListTreeNode
void tryAdd(ReplicaGroupDescriptor descriptor, boolean addDescriptor)
throws UpdateFailedException
{
- insertChild(
- new ReplicaGroup(true, this, descriptor),
- true);
+ insertChild(new ReplicaGroup(true, this, descriptor), true);
if(addDescriptor)
{
@@ -215,8 +198,7 @@ class ReplicaGroups extends ListTreeNode
private void newReplicaGroup(ReplicaGroupDescriptor descriptor)
{
- ReplicaGroup replicaGroup =
- new ReplicaGroup(this, descriptor);
+ ReplicaGroup replicaGroup = new ReplicaGroup(this, descriptor);
try
{
@@ -229,6 +211,6 @@ class ReplicaGroups extends ListTreeNode
getRoot().setSelectedNode(replicaGroup);
}
- private java.util.List _descriptors;
+ private java.util.List<ReplicaGroupDescriptor> _descriptors;
static private JPopupMenu _popup;
}
diff --git a/java/src/IceGridGUI/Application/Root.java b/java/src/IceGridGUI/Application/Root.java
index 10b6d14ab0d..fb6ad5007d7 100644
--- a/java/src/IceGridGUI/Application/Root.java
+++ b/java/src/IceGridGUI/Application/Root.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.Component;
@@ -31,8 +32,8 @@ public class Root extends ListTreeNode
//
// Construct a normal, existing Application
//
- public Root(Coordinator coordinator, ApplicationDescriptor desc,
- boolean live, File file) throws UpdateFailedException
+ public Root(Coordinator coordinator, ApplicationDescriptor desc, boolean live, File file)
+ throws UpdateFailedException
{
super(false, null, desc.name);
_coordinator = coordinator;
@@ -46,7 +47,7 @@ public class Root extends ListTreeNode
init();
}
-
+
//
// Construct a new Application
//
@@ -59,7 +60,7 @@ public class Root extends ListTreeNode
_file = null;
_live = false;
-
+
try
{
init();
@@ -73,8 +74,8 @@ public class Root extends ListTreeNode
}
}
-
- private void init() throws UpdateFailedException
+ private void init()
+ throws UpdateFailedException
{
_resolver = new Utils.Resolver(_descriptor.variables);
_resolver.put("application", _descriptor.name);
@@ -84,7 +85,7 @@ public class Root extends ListTreeNode
_origDistrib = (DistributionDescriptor)_descriptor.distrib.clone();
_propertySets = new PropertySets(this, _descriptor.propertySets);
- _replicaGroups = new ReplicaGroups(this, _descriptor.replicaGroups);
+ _replicaGroups = new ReplicaGroups(this, _descriptor.replicaGroups);
_serviceTemplates = new ServiceTemplates(this, _descriptor.serviceTemplates);
_serverTemplates = new ServerTemplates(this, _descriptor.serverTemplates);
_nodes = new Nodes(this, _descriptor.nodes);
@@ -106,23 +107,19 @@ public class Root extends ListTreeNode
am.put("paste", _coordinator.getActionsForMenu().get(PASTE));
}
-
static public ApplicationDescriptor
copyDescriptor(ApplicationDescriptor ad)
{
ApplicationDescriptor copy = (ApplicationDescriptor)ad.clone();
-
+
copy.propertySets = PropertySets.copyDescriptors(copy.propertySets);
- copy.replicaGroups =
- ReplicaGroups.copyDescriptors(copy.replicaGroups);
-
- copy.serverTemplates =
- ServerTemplates.copyDescriptors(copy.serverTemplates);
-
- copy.serviceTemplates =
- ServiceTemplates.copyDescriptors(copy.serviceTemplates);
-
+ copy.replicaGroups = ReplicaGroups.copyDescriptors(copy.replicaGroups);
+
+ copy.serverTemplates = ServerTemplates.copyDescriptors(copy.serverTemplates);
+
+ copy.serviceTemplates = ServiceTemplates.copyDescriptors(copy.serviceTemplates);
+
copy.nodes = Nodes.copyDescriptors(copy.nodes);
copy.distrib = (DistributionDescriptor)copy.distrib.clone();
@@ -133,8 +130,7 @@ public class Root extends ListTreeNode
{
if(_editor == null)
{
- _editor = (ApplicationEditor)
- getEditor(ApplicationEditor.class, this);
+ _editor = (ApplicationEditor)getEditor(ApplicationEditor.class, this);
}
_editor.show(this);
return _editor;
@@ -156,7 +152,7 @@ public class Root extends ListTreeNode
for(int i = 0; i < path.getPathCount(); ++i)
{
TreeNode node = (TreeNode)path.getPathComponent(i);
-
+
if(result == null)
{
if(node.getId().equals(_id))
@@ -191,7 +187,7 @@ public class Root extends ListTreeNode
return result;
}
-
+
//
// Check that this node is attached to the tree
//
@@ -250,25 +246,22 @@ public class Root extends ListTreeNode
}
public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
_cellRenderer = new DefaultTreeCellRenderer();
- _cellRenderer.setOpenIcon(
- Utils.getIcon("/icons/16x16/application_open.png"));
- _cellRenderer.setClosedIcon(
- Utils.getIcon("/icons/16x16/application_closed.png"));
+ _cellRenderer.setOpenIcon(Utils.getIcon("/icons/16x16/application_open.png"));
+ _cellRenderer.setClosedIcon(Utils.getIcon("/icons/16x16/application_closed.png"));
}
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
public boolean[] getAvailableActions()
@@ -285,7 +278,7 @@ public class Root extends ListTreeNode
}
actions[SHOW_VARS] = true;
- actions[SUBSTITUTE_VARS] = true;
+ actions[SUBSTITUTE_VARS] = true;
actions[NEW_NODE] = true;
actions[NEW_PROPERTY_SET] = true;
actions[NEW_REPLICA_GROUP] = true;
@@ -320,35 +313,42 @@ public class Root extends ListTreeNode
_coordinator.setClipboard(copyDescriptor(_descriptor));
_coordinator.getActionsForMenu().get(PASTE).setEnabled(true);
}
+
public void paste()
{
_coordinator.pasteApplication();
}
+
public void newNode()
{
_nodes.newNode();
}
+
public void newPropertySet()
{
_propertySets.newPropertySet();
}
+
public void newReplicaGroup()
{
_replicaGroups.newReplicaGroup();
}
+
public void newTemplateServer()
{
_serverTemplates.newTemplateServer();
}
+
public void newTemplateServerIceBox()
{
_serverTemplates.newTemplateServerIceBox();
}
+
public void newTemplateService()
{
_serviceTemplates.newTemplateService();
}
-
+
public void save()
{
if(_live)
@@ -391,7 +391,8 @@ public class Root extends ListTreeNode
if(isSelected())
{
- _coordinator.getSaveAction().setEnabled(isLive() && _coordinator.connectedToMaster() || hasFile());
+ _coordinator.getSaveAction().setEnabled(isLive() && _coordinator.connectedToMaster() ||
+ hasFile());
_coordinator.getSaveToRegistryAction().setEnabled(true);
_coordinator.getDiscardUpdatesAction().setEnabled(true);
}
@@ -404,13 +405,12 @@ public class Root extends ListTreeNode
title,
JOptionPane.ERROR_MESSAGE);
}
-
public void run()
{
_coordinator.getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
boolean asyncRelease = false;
-
+
try
{
if(_live && _canUseUpdateDescriptor)
@@ -420,19 +420,20 @@ public class Root extends ListTreeNode
{
final String prefix = "Updating application '" + _id + "'...";
_coordinator.getStatusBar().setText(prefix);
-
+
AMI_Admin_updateApplication cb = new AMI_Admin_updateApplication()
{
public void ice_response()
{
if(_traceSaveToRegistry)
{
- _coordinator.traceSaveToRegistry("updateApplication for application " + _id + ": success");
+ _coordinator.traceSaveToRegistry("updateApplication for application " +
+ _id + ": success");
}
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
{
commit();
release();
@@ -440,39 +441,41 @@ public class Root extends ListTreeNode
}
});
}
-
+
public void ice_exception(final Ice.UserException e)
{
if(_traceSaveToRegistry)
{
- _coordinator.traceSaveToRegistry("updateApplication for application " + _id + ": failed");
+ _coordinator.traceSaveToRegistry("updateApplication for application " +
+ _id + ": failed");
}
-
- SwingUtilities.invokeLater(new Runnable()
+
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_skipUpdates--;
- handleFailure(prefix, "Update failed",
+ handleFailure(prefix, "Update failed",
"IceGrid exception: " + e.toString());
}
-
+
});
}
-
+
public void ice_exception(final Ice.LocalException e)
{
if(_traceSaveToRegistry)
{
- _coordinator.traceSaveToRegistry("updateApplication for application " + _id + ": failed");
+ _coordinator.traceSaveToRegistry("updateApplication for application " +
+ _id + ": failed");
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_skipUpdates--;
- handleFailure(prefix, "Update failed",
+ handleFailure(prefix, "Update failed",
"Communication exception: " + e.toString());
}
});
@@ -482,7 +485,8 @@ public class Root extends ListTreeNode
if(_traceSaveToRegistry)
{
- _coordinator.traceSaveToRegistry("sending updateApplication for application " + _id);
+ _coordinator.traceSaveToRegistry("sending updateApplication for application " +
+ _id);
}
_coordinator.getAdmin().updateApplication_async(cb, updateDescriptor);
@@ -510,22 +514,22 @@ public class Root extends ListTreeNode
{
assert _live == false;
-
final String prefix = "Adding application '" + _id + "'...";
_coordinator.getStatusBar().setText(prefix);
-
+
AMI_Admin_addApplication cb = new AMI_Admin_addApplication()
{
public void ice_response()
{
if(_traceSaveToRegistry)
{
- _coordinator.traceSaveToRegistry("addApplication for application " + _id + ": success");
+ _coordinator.traceSaveToRegistry("addApplication for application " +
+ _id + ": success");
}
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
{
commit();
liveReset();
@@ -535,37 +539,39 @@ public class Root extends ListTreeNode
}
});
}
-
+
public void ice_exception(final Ice.UserException e)
{
if(_traceSaveToRegistry)
{
- _coordinator.traceSaveToRegistry("addApplication for application " + _id + ": failed");
+ _coordinator.traceSaveToRegistry("addApplication for application " +
+ _id + ": failed");
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
- handleFailure(prefix, "Add failed",
+ handleFailure(prefix, "Add failed",
"IceGrid exception: " + e.toString());
}
-
+
});
}
-
+
public void ice_exception(final Ice.LocalException e)
{
if(_traceSaveToRegistry)
{
- _coordinator.traceSaveToRegistry("addApplication for application " + _id + ": failed");
+ _coordinator.traceSaveToRegistry("addApplication for application " +
+ _id + ": failed");
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
- handleFailure(prefix, "Add failed",
+ handleFailure(prefix, "Add failed",
"Communication exception: " + e.toString());
}
});
@@ -592,18 +598,20 @@ public class Root extends ListTreeNode
{
if(_traceSaveToRegistry)
{
- _coordinator.traceSaveToRegistry("syncApplication for application " + _id + ": failed");
+ _coordinator.traceSaveToRegistry("syncApplication for application " +
+ _id + ": failed");
}
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
{
commit();
if(!_live)
{
//
- // Make this tab live or close it if there is one already open
+ // Make this tab live or close it if there is one already
+ // open
//
ApplicationPane app = _coordinator.getLiveApplication(_id);
if(app == null)
@@ -617,7 +625,8 @@ public class Root extends ListTreeNode
_coordinator.getMainPane().removeApplication(Root.this);
if(selected)
{
- _coordinator.getMainPane().setSelectedComponent(app);
+ _coordinator.getMainPane()
+ .setSelectedComponent(app);
}
}
}
@@ -627,47 +636,49 @@ public class Root extends ListTreeNode
}
});
}
-
+
public void ice_exception(final Ice.UserException e)
{
if(_traceSaveToRegistry)
{
- _coordinator.traceSaveToRegistry("syncApplication for application " + _id + ": failed");
+ _coordinator.traceSaveToRegistry("syncApplication for application " +
+ _id + ": failed");
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
if(_live)
{
_skipUpdates--;
}
- handleFailure(prefix, "Sync failed",
+ handleFailure(prefix, "Sync failed",
"IceGrid exception: " + e.toString());
}
-
+
});
}
-
+
public void ice_exception(final Ice.LocalException e)
{
if(_traceSaveToRegistry)
{
- _coordinator.traceSaveToRegistry("syncApplication for application " + _id + ": failed");
+ _coordinator.traceSaveToRegistry("syncApplication for application " +
+ _id + ": failed");
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
if(_live)
{
_skipUpdates--;
}
- handleFailure(prefix, "Sync failed",
+ handleFailure(prefix, "Sync failed",
"Communication exception: " + e.toString());
}
});
@@ -699,8 +710,9 @@ public class Root extends ListTreeNode
{
if(_traceSaveToRegistry)
{
- _coordinator.traceSaveToRegistry("Ice communications exception while saving application " + _id);
- }
+ _coordinator.traceSaveToRegistry("Ice communications exception while saving application " +
+ _id);
+ }
JOptionPane.showMessageDialog(
_coordinator.getMainFrame(),
@@ -718,7 +730,7 @@ public class Root extends ListTreeNode
}
}
};
-
+
try
{
_coordinator.acquireExclusiveWriteAccess(runnable);
@@ -797,7 +809,7 @@ public class Root extends ListTreeNode
ApplicationPane app = _coordinator.getMainPane().findApplication(this);
assert app != null;
app.setRoot(newRoot);
-
+
TreeNode node = newRoot.findNodeLike(_tree.getSelectionPath(), false);
if(node == null)
{
@@ -818,7 +830,6 @@ public class Root extends ListTreeNode
_coordinator.getMainPane().resetIcon(this);
}
-
private ApplicationUpdateDescriptor createUpdateDescriptor()
{
ApplicationUpdateDescriptor update = new ApplicationUpdateDescriptor();
@@ -830,88 +841,78 @@ public class Root extends ListTreeNode
//
if(!_descriptor.description.equals(_origDescription))
{
- update.description =
- new IceGrid.BoxedString(_descriptor.description);
+ update.description = new IceGrid.BoxedString(_descriptor.description);
}
//
// Diff variables
//
- update.variables = new java.util.TreeMap(_descriptor.variables);
- java.util.List removeVariables = new java.util.LinkedList();
+ update.variables = new java.util.TreeMap<String, String>(_descriptor.variables);
+ java.util.List<String> removeVariables = new java.util.LinkedList<String>();
- java.util.Iterator p = _origVariables.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, String> p : _origVariables.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- Object key = entry.getKey();
- Object newValue = update.variables.get(key);
+ String key = p.getKey();
+ String newValue = update.variables.get(key);
if(newValue == null)
{
removeVariables.add(key);
}
else
{
- Object value = entry.getValue();
+ String value = p.getValue();
if(newValue.equals(value))
{
update.variables.remove(key);
}
}
}
- update.removeVariables = (String[])removeVariables.toArray(new String[0]);
+ update.removeVariables = removeVariables.toArray(new String[0]);
//
// Diff distribution
//
if(!_descriptor.distrib.equals(_origDistrib))
{
- update.distrib = new IceGrid.BoxedDistributionDescriptor(
- _descriptor.distrib);
+ update.distrib = new IceGrid.BoxedDistributionDescriptor(_descriptor.distrib);
}
}
else
{
- update.variables = new java.util.TreeMap();
+ update.variables = new java.util.TreeMap<String, String>();
update.removeVariables = new String[0];
}
//
// Property sets
//
- update.removePropertySets = _propertySets.getEditable().
- removedElements(PropertySet.class);
+ update.removePropertySets = _propertySets.getEditable().removedElements(PropertySet.class);
update.propertySets = _propertySets.getUpdates();
//
// Replica Groups
//
- update.removeReplicaGroups = _replicaGroups.getEditable().
- removedElements(ReplicaGroup.class);
+ update.removeReplicaGroups = _replicaGroups.getEditable().removedElements(ReplicaGroup.class);
update.replicaGroups = _replicaGroups.getUpdates();
-
+
//
// Server Templates
//
- update.removeServerTemplates = _serverTemplates.getEditable().
- removedElements(ServerTemplate.class);
+ update.removeServerTemplates = _serverTemplates.getEditable().removedElements(ServerTemplate.class);
update.serverTemplates = _serverTemplates.getUpdates();
//
// Service Templates
//
- update.removeServiceTemplates = _serviceTemplates.getEditable().
- removedElements(ServiceTemplate.class);
+ update.removeServiceTemplates = _serviceTemplates.getEditable().removedElements(ServiceTemplate.class);
update.serviceTemplates =_serviceTemplates.getUpdates();
//
// Nodes
//
- update.removeNodes = _nodes.getEditable().
- removedElements(Node.class);
+ update.removeNodes = _nodes.getEditable().removedElements(Node.class);
update.nodes = _nodes.getUpdates();
-
//
// Return null if nothing changed
//
@@ -947,7 +948,7 @@ public class Root extends ListTreeNode
_origVariables = _descriptor.variables;
_origDescription = _descriptor.description;
_origDistrib = (DistributionDescriptor)_descriptor.distrib.clone();
-
+
_nodes.commit();
_propertySets.commit();
_replicaGroups.commit();
@@ -971,7 +972,7 @@ public class Root extends ListTreeNode
int confirm = JOptionPane.showConfirmDialog(
_coordinator.getMainFrame(),
"You are about to remove application '" + _id + "' from the IceGrid registry. "
- + "Do you want to proceed?",
+ + "Do you want to proceed?",
"Remove Confirmation",
JOptionPane.YES_NO_OPTION);
@@ -988,7 +989,7 @@ public class Root extends ListTreeNode
int confirm = JOptionPane.showConfirmDialog(
_coordinator.getMainFrame(),
"You are about to remove application '" + _id + "' and its associated file. "
- + "Do you want to proceed?",
+ + "Do you want to proceed?",
"Remove Confirmation",
JOptionPane.YES_NO_OPTION);
@@ -1005,7 +1006,7 @@ public class Root extends ListTreeNode
public boolean update(ApplicationUpdateDescriptor desc)
{
assert _live == true;
-
+
if(_skipUpdates > 0)
{
_skipUpdates--;
@@ -1035,16 +1036,16 @@ public class Root extends ListTreeNode
_descriptor.description = desc.description.value;
_origDescription = _descriptor.description;
}
-
+
//
// Variables
//
- for(int i = 0; i < desc.removeVariables.length; ++i)
+ for(String name : desc.removeVariables)
{
- _descriptor.variables.remove(desc.removeVariables[i]);
+ _descriptor.variables.remove(name);
}
_descriptor.variables.putAll(desc.variables);
-
+
//
// Distrib
//
@@ -1053,69 +1054,59 @@ public class Root extends ListTreeNode
_descriptor.distrib = desc.distrib.value;
_origDistrib = (DistributionDescriptor)_descriptor.distrib.clone();
}
-
+
//
// Property Sets
//
- for(int i = 0; i < desc.removePropertySets.length; ++i)
+ for(String id : desc.removePropertySets)
{
- _descriptor.propertySets.remove(desc.removePropertySets[i]);
+ _descriptor.propertySets.remove(id);
}
_descriptor.propertySets.putAll(desc.propertySets);
- _propertySets.update(desc.propertySets,
- desc.removePropertySets);
+ _propertySets.update(desc.propertySets, desc.removePropertySets);
//
// Replica groups
//
- for(int i = 0; i < desc.removeReplicaGroups.length; ++i)
+ for(String id : desc.removeReplicaGroups)
{
- _descriptor.replicaGroups.remove(desc.
- removeReplicaGroups[i]);
+ _descriptor.replicaGroups.remove(id);
}
_descriptor.replicaGroups.addAll(desc.replicaGroups);
- _replicaGroups.update(desc.replicaGroups,
- desc.removeReplicaGroups);
-
-
+ _replicaGroups.update(desc.replicaGroups, desc.removeReplicaGroups);
+
//
// Service templates
//
- for(int i = 0; i < desc.removeServiceTemplates.length; ++i)
+ for(String id : desc.removeServiceTemplates)
{
- _descriptor.serviceTemplates.remove(desc.
- removeServiceTemplates[i]);
+ _descriptor.serviceTemplates.remove(id);
}
_descriptor.serviceTemplates.putAll(desc.serviceTemplates);
- _serviceTemplates.update(desc.serviceTemplates,
- desc.removeServiceTemplates);
-
+ _serviceTemplates.update(desc.serviceTemplates, desc.removeServiceTemplates);
+
//
// Server templates
//
- for(int i = 0; i < desc.removeServerTemplates.length; ++i)
+ for(String id : desc.removeServerTemplates)
{
- _descriptor.serverTemplates.remove(desc.removeServerTemplates[i]);
+ _descriptor.serverTemplates.remove(id);
}
_descriptor.serverTemplates.putAll(desc.serverTemplates);
- _serverTemplates.update(desc.serverTemplates,
- desc.removeServerTemplates,
- desc.serviceTemplates.keySet());
-
+ _serverTemplates.update(desc.serverTemplates, desc.removeServerTemplates, desc.serviceTemplates.keySet());
+
//
// Nodes
//
- for(int i = 0; i < desc.removeNodes.length; ++i)
+ for(String id : desc.removeNodes)
{
- _descriptor.nodes.remove(desc.removeNodes[i]);
+ _descriptor.nodes.remove(id);
}
-
+
//
// Updates also _descriptor.nodes
//
- _nodes.update(desc.nodes, desc.removeNodes,
- desc.serverTemplates.keySet(),
- desc.serviceTemplates.keySet());
+ _nodes.update(desc.nodes, desc.removeNodes, desc.serverTemplates.keySet(), desc.serviceTemplates.keySet());
}
catch(UpdateFailedException e)
{
@@ -1167,11 +1158,9 @@ public class Root extends ListTreeNode
//
// Apply now any delayed concurrent update
//
- java.util.Iterator p = _concurrentUpdates.iterator();
- while(p.hasNext())
+ for(ApplicationUpdateDescriptor p : _concurrentUpdates)
{
- ApplicationUpdateDescriptor d = (ApplicationUpdateDescriptor)p.next();
- boolean ok = update(d);
+ boolean ok = update(p);
assert ok;
}
if(!_concurrentUpdates.isEmpty())
@@ -1182,8 +1171,7 @@ public class Root extends ListTreeNode
_coordinator.getSaveAction().setEnabled(false);
_coordinator.getDiscardUpdatesAction().setEnabled(false);
- _coordinator.getSaveToRegistryAction().setEnabled(hasFile()
- && _coordinator.connectedToMaster());
+ _coordinator.getSaveToRegistryAction().setEnabled(hasFile() && _coordinator.connectedToMaster());
}
}
@@ -1198,8 +1186,7 @@ public class Root extends ListTreeNode
else
{
_coordinator.getMainPane().resetIcon(this);
- _coordinator.getCurrentTab().selected(); // only needed when 'this'
- // corresponds to the current tab
+ _coordinator.getCurrentTab().selected(); // only needed when 'this' corresponds to the current tab
return false;
}
}
@@ -1229,10 +1216,9 @@ public class Root extends ListTreeNode
return _applicationPane;
}
-
Editor getEditor(Class c, TreeNode node)
{
- Editor result = (Editor)_editorMap.get(c);
+ Editor result = _editorMap.get(c);
if(result == null)
{
result = node.createEditor();
@@ -1262,11 +1248,12 @@ public class Root extends ListTreeNode
_descriptor.description = clone.description;
}
- public void write(XMLWriter writer) throws java.io.IOException
+ public void write(XMLWriter writer)
+ throws java.io.IOException
{
writer.writeStartTag("icegrid");
- java.util.List attributes = new java.util.LinkedList();
+ java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
attributes.add(createAttribute("name", _id));
writer.writeStartTag("application", attributes);
@@ -1283,7 +1270,7 @@ public class Root extends ListTreeNode
_replicaGroups.write(writer);
_propertySets.write(writer);
_nodes.write(writer);
-
+
writer.writeEndTag("application");
writer.writeEndTag("icegrid");
}
@@ -1306,11 +1293,12 @@ public class Root extends ListTreeNode
{
_updated = true;
disableRegistryUpdates(); // can be still enabled when updated() is called by destroy()
-
+
_concurrentUpdates.clear();
}
-
- void rebuild() throws UpdateFailedException
+
+ void rebuild()
+ throws UpdateFailedException
{
Utils.Resolver oldResolver = _resolver;
String oldId = _id;
@@ -1329,7 +1317,7 @@ public class Root extends ListTreeNode
throw e;
}
}
-
+
//
// Called when a server-template is deleted, to remove all
// corresponding instances.
@@ -1349,7 +1337,6 @@ public class Root extends ListTreeNode
_serverTemplates.removeServiceInstances(templateId);
}
-
ServerTemplate findServerTemplate(String id)
{
return (ServerTemplate)_serverTemplates.findChild(id);
@@ -1370,35 +1357,33 @@ public class Root extends ListTreeNode
return (Node)_nodes.findChild(id);
}
- java.util.List findServerInstances(String template)
+ java.util.List<ServerInstance> findServerInstances(String template)
{
return _nodes.findServerInstances(template);
}
- java.util.List findServiceInstances(String template)
+ java.util.List<ServiceInstance> findServiceInstances(String template)
{
- java.util.List result = _serverTemplates.findServiceInstances(template);
+ java.util.List<ServiceInstance> result = _serverTemplates.findServiceInstances(template);
result.addAll(_nodes.findServiceInstances(template));
return result;
}
TemplateDescriptor findServerTemplateDescriptor(String templateName)
{
- return (TemplateDescriptor)
- _descriptor.serverTemplates.get(templateName);
+ return (TemplateDescriptor)_descriptor.serverTemplates.get(templateName);
}
TemplateDescriptor findServiceTemplateDescriptor(String templateName)
{
- return (TemplateDescriptor)
- _descriptor.serviceTemplates.get(templateName);
+ return (TemplateDescriptor)_descriptor.serviceTemplates.get(templateName);
}
-
+
ServerTemplates getServerTemplates()
{
return _serverTemplates;
}
-
+
ServiceTemplates getServiceTemplates()
{
return _serviceTemplates;
@@ -1415,25 +1400,23 @@ public class Root extends ListTreeNode
// During paste, check that all service instances refer to existing services,
// and remove any extra template parameters
//
- java.util.Iterator p = ibd.services.iterator();
- while(p.hasNext())
+ for(ServiceInstanceDescriptor p : ibd.services)
{
- ServiceInstanceDescriptor sid = (ServiceInstanceDescriptor)p.next();
- if(sid.template.length() > 0)
+ if(p.template.length() > 0)
{
- TemplateDescriptor td = findServiceTemplateDescriptor(sid.template);
+ TemplateDescriptor td = findServiceTemplateDescriptor(p.template);
if(td == null)
{
JOptionPane.showMessageDialog(
_coordinator.getMainFrame(),
- "Descriptor refers to undefined service template '" + sid.template + "'",
+ "Descriptor refers to undefined service template '" + p.template + "'",
"Cannot paste",
JOptionPane.ERROR_MESSAGE);
return false;
}
- sid.parameterValues.keySet().retainAll(td.parameters);
+ p.parameterValues.keySet().retainAll(td.parameters);
}
}
return true;
@@ -1443,7 +1426,7 @@ public class Root extends ListTreeNode
{
return this;
}
-
+
Utils.Resolver getResolver()
{
return _resolver;
@@ -1452,7 +1435,7 @@ public class Root extends ListTreeNode
//
// Should only be used for reading
//
- java.util.Map getVariables()
+ java.util.Map<String, String> getVariables()
{
return _descriptor.variables;
}
@@ -1482,17 +1465,17 @@ public class Root extends ListTreeNode
private boolean _live;
//
- // null when this application is not tied to a file
+ // null when this application is not tied to a file
//
private File _file;
-
+
private ApplicationDescriptor _descriptor;
//
- // Keeps original version (as shallow copies) to be able to build
+ // Keeps original version (as shallow copies) to be able to build
// ApplicationUpdateDescriptor. Only used when _live == true
//
- private java.util.Map _origVariables;
+ private java.util.Map<String, String> _origVariables;
private String _origDescription;
private DistributionDescriptor _origDistrib;
@@ -1506,16 +1489,17 @@ public class Root extends ListTreeNode
private boolean _discardMe = false;
//
- // True when any update was applied to this application
+ // True when any update was applied to this application
// (including children)
//
private boolean _updated = false;
-
+
//
- // Updates saved when _updated == false and
+ // Updates saved when _updated == false and
// _registryUpdatesEnabled == false
//
- private java.util.List _concurrentUpdates = new java.util.LinkedList();
+ private java.util.List<ApplicationUpdateDescriptor> _concurrentUpdates =
+ new java.util.LinkedList<ApplicationUpdateDescriptor>();
//
// When _live is true and _canUseUpdateDescriptor is true, we can
@@ -1525,8 +1509,7 @@ public class Root extends ListTreeNode
//
// Updates to skip (because already applied locally)
//
- private int _skipUpdates = 0;
-
+ private int _skipUpdates = 0;
private Nodes _nodes;
private PropertySets _propertySets;
@@ -1541,10 +1524,10 @@ public class Root extends ListTreeNode
//
// Map editor-class to Editor object
//
- private java.util.Map _editorMap = new java.util.HashMap();
+ private java.util.Map<Class, Editor> _editorMap = new java.util.HashMap<Class, Editor>();
private ApplicationPane _applicationPane;
- static private DefaultTreeCellRenderer _cellRenderer;
+ static private DefaultTreeCellRenderer _cellRenderer;
static private JPopupMenu _popup;
}
diff --git a/java/src/IceGridGUI/Application/Server.java b/java/src/IceGridGUI/Application/Server.java
index eeb03a47ce9..24c4398bc3e 100644
--- a/java/src/IceGridGUI/Application/Server.java
+++ b/java/src/IceGridGUI/Application/Server.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
interface Server extends TemplateInstance
diff --git a/java/src/IceGridGUI/Application/ServerInstance.java b/java/src/IceGridGUI/Application/ServerInstance.java
index 9c0661a511e..b042aa8338b 100644
--- a/java/src/IceGridGUI/Application/ServerInstance.java
+++ b/java/src/IceGridGUI/Application/ServerInstance.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.Component;
@@ -21,7 +22,7 @@ import IceGrid.*;
import IceGridGUI.*;
class ServerInstance extends ListTreeNode implements Server, PropertySetParent
-{
+{
static public ServerInstanceDescriptor
copyDescriptor(ServerInstanceDescriptor sid)
{
@@ -29,7 +30,7 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
copy.propertySet = PropertySet.copyDescriptor(copy.propertySet);
return copy;
}
-
+
//
// Overrides ListTreeNode
//
@@ -45,9 +46,9 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
{
boolean[] actions = new boolean[ACTION_COUNT];
actions[COPY] = !_ephemeral;
-
+
Object clipboard = getCoordinator().getClipboard();
- if(clipboard != null &&
+ if(clipboard != null &&
(clipboard instanceof ServerDescriptor
|| clipboard instanceof ServerInstanceDescriptor
|| (_isIceBox && clipboard instanceof PropertySetDescriptor)))
@@ -60,16 +61,16 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
{
actions[SHOW_VARS] = true;
actions[SUBSTITUTE_VARS] = true;
-
+
if(_isIceBox)
{
actions[NEW_PROPERTY_SET] = true;
}
}
-
+
return actions;
}
-
+
public void copy()
{
getCoordinator().setClipboard(copyDescriptor(_descriptor));
@@ -90,14 +91,12 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
((TreeNode)_parent).paste();
}
-
+
public void newPropertySet()
{
- newPropertySet(new PropertySetDescriptor(
- new String[0], new java.util.LinkedList()));
+ newPropertySet(new PropertySetDescriptor(new String[0], new java.util.LinkedList<PropertyDescriptor>()));
}
-
public JPopupMenu getPopupMenu()
{
if(_isIceBox)
@@ -121,8 +120,7 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
{
if(_editor == null)
{
- _editor = (ServerInstanceEditor)
- getRoot().getEditor(ServerInstanceEditor.class, this);
+ _editor = (ServerInstanceEditor)getRoot().getEditor(ServerInstanceEditor.class, this);
}
_editor.show(this);
return _editor;
@@ -132,15 +130,15 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
{
return new ServerInstanceEditor();
}
-
+
public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
@@ -151,20 +149,19 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
_serverIcon = Utils.getIcon("/icons/16x16/server_inactive.png");
_iceboxServerIcon = Utils.getIcon("/icons/16x16/icebox_server_inactive.png");
-
+
_cellRenderer.setLeafIcon(_serverIcon);
_cellRenderer.setOpenIcon(_iceboxServerIcon);
_cellRenderer.setClosedIcon(_iceboxServerIcon);
}
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
public void destroy()
{
Node node = (Node)_parent;
-
+
if(_ephemeral)
{
node.removeServer(this);
@@ -178,7 +175,6 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
}
}
-
public Object getDescriptor()
{
return _descriptor;
@@ -201,10 +197,8 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
//
// Builds the server and all its sub-tree
//
- ServerInstance(boolean brandNew, TreeNode parent, String serverId,
- Utils.Resolver resolver,
- ServerInstanceDescriptor instanceDescriptor,
- boolean isIceBox)
+ ServerInstance(boolean brandNew, TreeNode parent, String serverId, Utils.Resolver resolver,
+ ServerInstanceDescriptor instanceDescriptor, boolean isIceBox)
throws UpdateFailedException
{
super(brandNew, parent, serverId);
@@ -212,8 +206,7 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
rebuild(resolver, instanceDescriptor, isIceBox);
}
- ServerInstance(TreeNode parent, String serverId,
- ServerInstanceDescriptor instanceDescriptor)
+ ServerInstance(TreeNode parent, String serverId, ServerInstanceDescriptor instanceDescriptor)
{
super(false, parent, serverId);
_ephemeral = true;
@@ -227,19 +220,18 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
}
}
- void write(XMLWriter writer) throws java.io.IOException
+ void write(XMLWriter writer)
+ throws java.io.IOException
{
if(!_ephemeral)
{
- TemplateDescriptor templateDescriptor
- = getRoot().findServerTemplateDescriptor(_descriptor.template);
-
- java.util.LinkedList attributes = parameterValuesToAttributes(
+ TemplateDescriptor templateDescriptor = getRoot().findServerTemplateDescriptor(_descriptor.template);
+
+ java.util.LinkedList<String[]> attributes = parameterValuesToAttributes(
_descriptor.parameterValues, templateDescriptor.parameters);
attributes.addFirst(createAttribute("template", _descriptor.template));
-
- if(_descriptor.propertySet.references.length == 0 &&
- _descriptor.propertySet.properties.size() == 0 &&
+
+ if(_descriptor.propertySet.references.length == 0 && _descriptor.propertySet.properties.size() == 0 &&
_children.size() == 0)
{
writer.writeElement("server-instance", attributes);
@@ -248,11 +240,10 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
{
writer.writeStartTag("server-instance", attributes);
writePropertySet(writer, _descriptor.propertySet, null, null);
-
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+
+ for(TreeNodeBase p : _children)
{
- PropertySet ps = (PropertySet)p.next();
+ PropertySet ps = (PropertySet)p;
ps.write(writer);
}
@@ -261,7 +252,6 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
}
}
-
boolean isIceBox()
{
return _isIceBox;
@@ -276,7 +266,7 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
getRoot().getTreeModel().nodeStructureChanged(this);
}
}
-
+
static private class Backup
{
Backup(Editable ne)
@@ -285,18 +275,18 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
}
Editable nodeEditable;
- java.util.Map parameterValues;
+ java.util.Map<String, String> parameterValues;
}
- public Object rebuild(java.util.List editables) throws UpdateFailedException
+ public Object rebuild(java.util.List<Editable> editables)
+ throws UpdateFailedException
{
Node node = (Node)_parent;
Backup backup = new Backup(node.getEditable().save());
- TemplateDescriptor templateDescriptor
- = getRoot().findServerTemplateDescriptor(_descriptor.template);
+ TemplateDescriptor templateDescriptor = getRoot().findServerTemplateDescriptor(_descriptor.template);
- java.util.Set parameters = new java.util.HashSet(templateDescriptor.parameters);
+ java.util.Set<String> parameters = new java.util.HashSet<String>(templateDescriptor.parameters);
if(!parameters.equals(_descriptor.parameterValues.keySet()))
{
backup.parameterValues = _descriptor.parameterValues;
@@ -304,12 +294,11 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
_descriptor.parameterValues, templateDescriptor.parameters);
}
ServerInstance newServer = node.createServer(false, _descriptor);
-
if(_id.equals(newServer.getId()))
{
//
- // A simple update. We can't simply rebuild server because
+ // A simple update. We can't simply rebuild server because
// we need to keep a backup
//
if(_editable.isModified())
@@ -317,7 +306,7 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
newServer.getEditable().markModified();
}
- node.removeServer(this);
+ node.removeServer(this);
try
{
node.insertServer(newServer, true);
@@ -348,7 +337,7 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
throw e;
}
}
-
+
return backup;
}
@@ -356,7 +345,7 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
{
Backup backup = (Backup)backupObj;
Node node = (Node)_parent;
-
+
node.getEditable().restore(backup.nodeEditable);
if(backup.parameterValues != null)
@@ -381,21 +370,19 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
}
}
-
public void tryAdd(String unsubstitutedId, PropertySetDescriptor descriptor)
throws UpdateFailedException
{
insertPropertySet(new PropertySet(this,
Utils.substitute(unsubstitutedId, _resolver),
unsubstitutedId,
- descriptor),
+ descriptor),
true);
_descriptor.servicePropertySets.put(unsubstitutedId, descriptor);
_editable.markModified();
}
- public void tryRename(String oldId, String oldUnresolvedId,
- String newUnsubstitutedId)
+ public void tryRename(String oldId, String oldUnresolvedId, String newUnsubstitutedId)
throws UpdateFailedException
{
PropertySet oldChild = (PropertySet)findChild(oldId);
@@ -406,8 +393,8 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
try
{
insertPropertySet(
- new PropertySet(this,
- Utils.substitute(newUnsubstitutedId, _resolver),
+ new PropertySet(this,
+ Utils.substitute(newUnsubstitutedId, _resolver),
newUnsubstitutedId, descriptor),
true);
}
@@ -423,12 +410,11 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
}
throw ex;
}
-
+
_editable.markModified();
_descriptor.servicePropertySets.remove(oldUnresolvedId);
_descriptor.servicePropertySets.put(newUnsubstitutedId, descriptor);
}
-
public void insertPropertySet(PropertySet nps, boolean fireEvent)
throws UpdateFailedException
@@ -450,7 +436,7 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
{
return _editable;
}
-
+
Object[] getServiceNames()
{
assert _isIceBox;
@@ -458,13 +444,12 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
//
// Retrieve the list of service instances
//
-
- Communicator.ChildList services = getRoot().
- findServerTemplate(_descriptor.template).getServices();
-
+
+ Communicator.ChildList services = getRoot().findServerTemplate(_descriptor.template).getServices();
+
Object[] result = new Object[services.size()];
int i = 0;
-
+
java.util.Iterator p = services.iterator();
while(p.hasNext())
{
@@ -473,13 +458,13 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
if(d.template.length() > 0)
{
- TemplateDescriptor templateDescriptor
- = (TemplateDescriptor)getRoot().findServiceTemplateDescriptor(d.template);
+ TemplateDescriptor templateDescriptor =
+ (TemplateDescriptor)getRoot().findServiceTemplateDescriptor(d.template);
assert templateDescriptor != null;
- Utils.Resolver serviceResolver = new Utils.Resolver(_resolver,
+ Utils.Resolver serviceResolver = new Utils.Resolver(_resolver,
d.parameterValues,
templateDescriptor.parameterDefaults);
-
+
ServiceDescriptor serviceDescriptor = (ServiceDescriptor)templateDescriptor.descriptor;
result[i++] = serviceResolver.substitute(serviceDescriptor.name);
@@ -495,26 +480,22 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
//
// Update the server and its children
//
- void rebuild(Utils.Resolver resolver,
- ServerInstanceDescriptor instanceDescriptor,
- boolean isIceBox) throws UpdateFailedException
+ void rebuild(Utils.Resolver resolver, ServerInstanceDescriptor instanceDescriptor, boolean isIceBox)
+ throws UpdateFailedException
{
_resolver = resolver;
_isIceBox = isIceBox;
_descriptor = instanceDescriptor;
-
+
_children.clear();
- java.util.Iterator p = _descriptor.servicePropertySets.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, PropertySetDescriptor> p : _descriptor.servicePropertySets.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- String unsubstitutedId = (String)entry.getKey();
-
- insertPropertySet(new PropertySet(this,
+ String unsubstitutedId = p.getKey();
+ insertPropertySet(new PropertySet(this,
Utils.substitute(unsubstitutedId, _resolver),
unsubstitutedId,
- (PropertySetDescriptor)entry.getValue()),
+ p.getValue()),
false);
}
}
@@ -522,7 +503,7 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
private void newPropertySet(PropertySetDescriptor descriptor)
{
String id = makeNewChildId("Service");
-
+
PropertySet ps = new PropertySet(this, id, descriptor);
try
{
@@ -535,7 +516,6 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
getRoot().setSelectedNode(ps);
}
-
Utils.Resolver getResolver()
{
return _resolver;
@@ -565,7 +545,7 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
private ServerInstanceEditor _editor;
private Utils.Resolver _resolver;
-
+
static private DefaultTreeCellRenderer _cellRenderer;
static private Icon _serverIcon;
static private Icon _iceboxServerIcon;
diff --git a/java/src/IceGridGUI/Application/ServerInstanceEditor.java b/java/src/IceGridGUI/Application/ServerInstanceEditor.java
index eb2fefe6db6..96480fb5980 100644
--- a/java/src/IceGridGUI/Application/ServerInstanceEditor.java
+++ b/java/src/IceGridGUI/Application/ServerInstanceEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -32,38 +33,36 @@ class ServerInstanceEditor extends AbstractServerEditor
{
ServerInstanceDescriptor descriptor = getDescriptor();
ServerTemplate t = (ServerTemplate)_template.getSelectedItem();
-
+
descriptor.template = t.getId();
descriptor.parameterValues = _parameters.getValues();
- descriptor.propertySet.references =
- (String[])_propertySets.getList().toArray(new String[0]);
+ descriptor.propertySet.references = (String[])_propertySets.getList().toArray(new String[0]);
descriptor.propertySet.properties = _properties.getProperties();
((ServerInstance)_target).isIceBox(
((TemplateDescriptor)t.getDescriptor()).descriptor instanceof IceBoxDescriptor);
}
-
+
protected boolean isSimpleUpdate()
{
ServerInstanceDescriptor descriptor = getDescriptor();
ServerTemplate t = (ServerTemplate)_template.getSelectedItem();
- return descriptor.template.equals(t.getId())
- && descriptor.parameterValues.equals(_parameters.getValues());
+ return descriptor.template.equals(t.getId()) && descriptor.parameterValues.equals(_parameters.getValues());
}
ServerInstanceEditor()
- {
+ {
_template.setToolTipText("Server template");
-
+
//
// Template
//
Action gotoTemplate = new AbstractAction(
"", Utils.getIcon("/icons/16x16/goto.png"))
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
TreeNode t = (TreeNode)_template.getSelectedItem();
if(t != null)
@@ -72,15 +71,14 @@ class ServerInstanceEditor extends AbstractServerEditor
}
}
};
- gotoTemplate.putValue(Action.SHORT_DESCRIPTION,
- "Goto this server template");
+ gotoTemplate.putValue(Action.SHORT_DESCRIPTION, "Goto this server template");
_templateButton = new JButton(gotoTemplate);
_parameters = new ParameterValuesField(this);
_propertySets.getDocument().addDocumentListener(_updateListener);
_propertySets.setToolTipText("Property Set References");
-
+
_properties = new PropertiesField(this);
}
@@ -106,11 +104,11 @@ class ServerInstanceEditor extends AbstractServerEditor
}
protected void appendProperties(DefaultFormBuilder builder)
- {
+ {
builder.append("Template", _template);
builder.append(_templateButton);
builder.nextLine();
-
+
builder.append("Parameters");
builder.nextLine();
builder.append("");
@@ -123,11 +121,10 @@ class ServerInstanceEditor extends AbstractServerEditor
builder.nextRow(-6);
JScrollPane scrollPane = new JScrollPane(_parameters);
CellConstraints cc = new CellConstraints();
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
-
+
builder.append("Property Sets");
builder.append(_propertySets, 3);
builder.nextLine();
@@ -143,8 +140,7 @@ class ServerInstanceEditor extends AbstractServerEditor
builder.nextRow(-6);
scrollPane = new JScrollPane(_properties);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
}
@@ -158,8 +154,7 @@ class ServerInstanceEditor extends AbstractServerEditor
Root root = server.getRoot();
boolean isEditable = server.isEphemeral() || !root.getCoordinator().substitute();
- Utils.Resolver resolver = isEditable ? null :
- ((Node)_target.getParent()).getResolver();
+ Utils.Resolver resolver = isEditable ? null : ((Node)_target.getParent()).getResolver();
//
// Need to make control enabled before changing it
@@ -169,22 +164,20 @@ class ServerInstanceEditor extends AbstractServerEditor
ServerTemplates serverTemplates = root.getServerTemplates();
_template.setModel(serverTemplates.createComboBoxModel());
- ServerTemplate t = (ServerTemplate)
- serverTemplates.findChild(descriptor.template);
+ ServerTemplate t = (ServerTemplate)serverTemplates.findChild(descriptor.template);
assert t != null;
_template.setSelectedItem(t);
-
+
ListDataListener templateListener = new ListDataListener()
{
public void contentsChanged(ListDataEvent e)
{
updated();
-
- ServerTemplate t =
- (ServerTemplate)_template.getModel().getSelectedItem();
-
+
+ ServerTemplate t = (ServerTemplate)_template.getModel().getSelectedItem();
+
TemplateDescriptor td = (TemplateDescriptor)t.getDescriptor();
-
+
//
// Replace parameters but keep existing values
//
@@ -194,28 +187,27 @@ class ServerInstanceEditor extends AbstractServerEditor
}
public void intervalAdded(ListDataEvent e)
- {}
-
+ {
+ }
+
public void intervalRemoved(ListDataEvent e)
- {}
+ {
+ }
};
_template.getModel().addListDataListener(templateListener);
_template.setEnabled(isEditable);
-
+
TemplateDescriptor td = (TemplateDescriptor)t.getDescriptor();
- _parameters.set(td.parameters, descriptor.parameterValues,
- td.parameterDefaults, resolver);
+ _parameters.set(td.parameters, descriptor.parameterValues, td.parameterDefaults, resolver);
- _propertySets.setList(java.util.Arrays.asList(descriptor.propertySet.references),
- getDetailResolver());
+ _propertySets.setList(java.util.Arrays.asList(descriptor.propertySet.references), getDetailResolver());
_propertySets.setEditable(isEditable);
- _properties.setProperties(descriptor.propertySet.properties, null, null,
- getDetailResolver(), isEditable);
+ _properties.setProperties(descriptor.propertySet.properties, null, null, getDetailResolver(), isEditable);
_applyButton.setEnabled(server.isEphemeral());
- _discardButton.setEnabled(server.isEphemeral());
+ _discardButton.setEnabled(server.isEphemeral());
detectUpdates(true);
if(server.isEphemeral())
{
diff --git a/java/src/IceGridGUI/Application/ServerInstancePropertySetEditor.java b/java/src/IceGridGUI/Application/ServerInstancePropertySetEditor.java
index 4821708ea54..b37f50f096e 100644
--- a/java/src/IceGridGUI/Application/ServerInstancePropertySetEditor.java
+++ b/java/src/IceGridGUI/Application/ServerInstancePropertySetEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import javax.swing.DefaultComboBoxModel;
@@ -23,8 +24,7 @@ class ServerInstancePropertySetEditor extends PropertySetEditor
super("Service Name");
_id.setToolTipText("The name of the service");
- JTextField idTextField = (JTextField)
- _id.getEditor().getEditorComponent();
+ JTextField idTextField = (JTextField)_id.getEditor().getEditorComponent();
idTextField.getDocument().addDocumentListener(_updateListener);
}
@@ -54,7 +54,7 @@ class ServerInstancePropertySetEditor extends PropertySetEditor
protected void showId(String unsubstitutedId, Utils.Resolver resolver)
{
ServerInstance s = (ServerInstance)_target.getParent();
-
+
_id.setEnabled(true);
_id.setEditable(true);
_id.setModel(new DefaultComboBoxModel(s.getServiceNames()));
@@ -64,4 +64,4 @@ class ServerInstancePropertySetEditor extends PropertySetEditor
}
private JComboBox _id = new JComboBox();
-} \ No newline at end of file
+}
diff --git a/java/src/IceGridGUI/Application/ServerSubEditor.java b/java/src/IceGridGUI/Application/ServerSubEditor.java
index eac339ae784..f4b50f5bb73 100644
--- a/java/src/IceGridGUI/Application/ServerSubEditor.java
+++ b/java/src/IceGridGUI/Application/ServerSubEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -31,44 +32,38 @@ class ServerSubEditor extends CommunicatorSubEditor
{
super(mainEditor);
- _id.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
+ _id.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
_id.setToolTipText("Must be unique within this IceGrid deployment");
- _exe.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
+ _exe.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
_exe.setToolTipText("<html>Path to this server's executable, e.g.:<br>"
+ "icebox<br>"
+ "java<br>"
+ "myHelloServer<br>"
+ "C:\\testbed\\hello\\server</html>");
- _iceVersion.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
+ _iceVersion.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
_iceVersion.setToolTipText("<html>The Ice version used by this server;<br>"
+ "blank means 'same version as the IceGrid registry'.</html>");
- _pwd.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
+ _pwd.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
_pwd.setToolTipText(
"<html>If not set, the server will start in "
+ "<i>node data dir</i>/servers/<i>server-id</i>;<br>"
+ "relative directories are relative to the current directory"
+ " of the icegridnode process.</html>");
- _options.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
+ _options.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
_options.setToolTipText(
"<html>Command-line arguments for this server.<br>"
+ "Use whitespace as separator; use double-quotes around arguments containing whitespaces</html>");
-
- _user.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
+
+ _user.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
_user.setToolTipText(
"<html>Run the server using this user account.<br>"
+ "This feature is only available on Unix/Linux, when the IceGrid node runs as root.</html>");
- _envs = new MapField(mainEditor, "Name", "Value", true);
+ _envs = new SimpleMapField(mainEditor, true, "Name", "Value");
_activation = new JComboBox(new Object[]{ALWAYS, MANUAL, ON_DEMAND, SESSION});
_activation.setToolTipText("<html>always: IceGrid starts and keeps the server up all the time<br>"
@@ -76,22 +71,18 @@ class ServerSubEditor extends CommunicatorSubEditor
+ "on-demand: IceGrid starts the server when a client needs it<br>"
+ "session: IceGrid starts and shuts down the server for each session</html>");
- JTextField activationTextField = (JTextField)
- _activation.getEditor().getEditorComponent();
- activationTextField.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
+ JTextField activationTextField = (JTextField)_activation.getEditor().getEditorComponent();
+ activationTextField.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
- _activationTimeout.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
- _activationTimeout.setToolTipText("<html>Number of seconds; if not set or set to 0, "
+ _activationTimeout.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
+ _activationTimeout.setToolTipText("<html>Number of seconds; if not set or set to 0, "
+ "the IceGrid Node<br> uses the value of its "
+ "IceGrid.Node.WaitTime property</html>");
- _deactivationTimeout.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
- _deactivationTimeout.setToolTipText("<html>Number of seconds; if not set or set to 0, "
+ _deactivationTimeout.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
+ _deactivationTimeout.setToolTipText("<html>Number of seconds; if not set or set to 0, "
+ "the IceGrid Node<br> uses the value of its "
+ "IceGrid.Node.WaitTime property</html>");
-
+
Action allocatable = new AbstractAction("Allocatable")
{
public void actionPerformed(ActionEvent e)
@@ -103,7 +94,7 @@ class ServerSubEditor extends CommunicatorSubEditor
"<html>Check this box to ensure that the well-known objects<br>"
+ "of this server can only be allocated by one session at a time.</html>");
_allocatable = new JCheckBox(allocatable);
-
+
Action appDistrib = new AbstractAction("Depends on the application distribution")
{
@@ -119,34 +110,28 @@ class ServerSubEditor extends CommunicatorSubEditor
_applicationDistrib = new JCheckBox(appDistrib);
_distrib = new JComboBox(new Object[]{NO_DISTRIB, DEFAULT_DISTRIB});
- _distrib.setToolTipText(
- "The proxy to the IcePatch2 server holding your files");
+ _distrib.setToolTipText("The proxy to the IcePatch2 server holding your files");
- JTextField distribTextField = (JTextField)
- _distrib.getEditor().getEditorComponent();
- distribTextField.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
+ JTextField distribTextField = (JTextField)_distrib.getEditor().getEditorComponent();
+ distribTextField.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
- _distribDirs.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
+ _distribDirs.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
_distribDirs.setToolTipText(
"<html>Include only these directories when patching.<br>"
+ "Use whitespace as separator; use double-quotes around directories containing whitespaces</html>");
-
}
-
+
ServerDescriptor getServerDescriptor()
{
- return (ServerDescriptor)
- _mainEditor.getSubDescriptor();
+ return (ServerDescriptor)_mainEditor.getSubDescriptor();
}
-
+
void appendProperties(DefaultFormBuilder builder)
- {
+ {
builder.append("Server ID");
builder.append(_id, 3);
builder.nextLine();
-
+
//
// Add Communicator fields
//
@@ -178,11 +163,10 @@ class ServerSubEditor extends CommunicatorSubEditor
builder.nextRow(-6);
CellConstraints cc = new CellConstraints();
JScrollPane scrollPane = new JScrollPane(_envs);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
-
+
builder.append("Activation Mode");
builder.append(_activation, 3);
builder.nextLine();
@@ -194,7 +178,7 @@ class ServerSubEditor extends CommunicatorSubEditor
builder.nextLine();
builder.append("", _allocatable);
builder.nextLine();
-
+
JComponent c = builder.appendSeparator("Distribution");
c.setToolTipText("Files specific to this server");
@@ -207,7 +191,7 @@ class ServerSubEditor extends CommunicatorSubEditor
builder.append(_distribDirs, 3);
builder.nextLine();
}
-
+
void writeDescriptor()
{
ServerDescriptor descriptor = getServerDescriptor();
@@ -219,15 +203,12 @@ class ServerSubEditor extends CommunicatorSubEditor
descriptor.options = _options.getList();
descriptor.user = _user.getText().trim();
- descriptor.envs = new java.util.LinkedList();
- java.util.Iterator p = _envs.get().entrySet().iterator();
- while(p.hasNext())
+ descriptor.envs = new java.util.LinkedList<String>();
+ for(java.util.Map.Entry<String, String> p : _envs.get().entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- descriptor.envs.add(entry.getKey().toString()
- + "=" + entry.getValue().toString());
+ descriptor.envs.add(p.getKey() + "=" + p.getValue());
}
-
+
descriptor.activation = _activation.getSelectedItem().toString().trim();
descriptor.activationTimeout = _activationTimeout.getText().trim();
descriptor.deactivationTimeout = _deactivationTimeout.getText().trim();
@@ -247,11 +228,11 @@ class ServerSubEditor extends CommunicatorSubEditor
descriptor.distrib.directories = _distribDirs.getList();
super.writeDescriptor(descriptor);
- }
-
+ }
+
boolean isSimpleUpdate()
{
- return getServerDescriptor().id.equals(_id.getText().trim());
+ return getServerDescriptor().id.equals(_id.getText().trim());
}
boolean validate()
@@ -265,7 +246,7 @@ class ServerSubEditor extends CommunicatorSubEditor
{
ServerDescriptor descriptor = getServerDescriptor();
Utils.Resolver detailResolver = _mainEditor.getDetailResolver();
-
+
isEditable = isEditable && (detailResolver == null);
if(detailResolver != null)
@@ -277,46 +258,38 @@ class ServerSubEditor extends CommunicatorSubEditor
_id.setText(descriptor.id);
}
_id.setEditable(isEditable);
-
- _exe.setText(
- Utils.substitute(descriptor.exe, detailResolver));
+
+ _exe.setText(Utils.substitute(descriptor.exe, detailResolver));
_exe.setEditable(isEditable);
- _iceVersion.setText(
- Utils.substitute(descriptor.iceVersion, detailResolver));
+ _iceVersion.setText(Utils.substitute(descriptor.iceVersion, detailResolver));
_iceVersion.setEditable(isEditable);
- _pwd.setText(
- Utils.substitute(descriptor.pwd, detailResolver));
+ _pwd.setText(Utils.substitute(descriptor.pwd, detailResolver));
_pwd.setEditable(isEditable);
_options.setList(descriptor.options, detailResolver);
_options.setEditable(isEditable);
- _user.setText(
- Utils.substitute(descriptor.user, detailResolver));
+ _user.setText(Utils.substitute(descriptor.user, detailResolver));
_user.setEditable(isEditable);
- java.util.Map envMap = new java.util.TreeMap();
- java.util.Iterator p = descriptor.envs.iterator();
- while(p.hasNext())
+ java.util.Map<String, String> envMap = new java.util.TreeMap<String, String>();
+ for(String p : descriptor.envs)
{
- String env = (String)p.next();
- int equal = env.indexOf('=');
- if(equal == -1 || equal == env.length() - 1)
+ int equal = p.indexOf('=');
+ if(equal == -1 || equal == p.length() - 1)
{
- envMap.put(env, "");
+ envMap.put(p, "");
}
else
{
- envMap.put(env.substring(0, equal),
- env.substring(equal + 1));
+ envMap.put(p.substring(0, equal), p.substring(equal + 1));
}
}
_envs.set(envMap, detailResolver, isEditable);
- String activation = Utils.substitute(descriptor.activation,
- detailResolver);
-
+ String activation = Utils.substitute(descriptor.activation, detailResolver);
+
_activation.setEnabled(true);
_activation.setEditable(true);
if(activation.equals(ALWAYS))
@@ -342,12 +315,10 @@ class ServerSubEditor extends CommunicatorSubEditor
_activation.setEnabled(isEditable);
_activation.setEditable(isEditable);
- _activationTimeout.setText(
- Utils.substitute(descriptor.activationTimeout, detailResolver));
+ _activationTimeout.setText(Utils.substitute(descriptor.activationTimeout, detailResolver));
_activationTimeout.setEditable(isEditable);
- _deactivationTimeout.setText(
- Utils.substitute(descriptor.deactivationTimeout, detailResolver));
+ _deactivationTimeout.setText(Utils.substitute(descriptor.deactivationTimeout, detailResolver));
_deactivationTimeout.setEditable(isEditable);
_allocatable.setSelected(descriptor.allocatable);
@@ -358,8 +329,7 @@ class ServerSubEditor extends CommunicatorSubEditor
_distrib.setEnabled(true);
_distrib.setEditable(true);
- String icepatch = Utils.substitute(descriptor.distrib.icepatch,
- detailResolver);
+ String icepatch = Utils.substitute(descriptor.distrib.icepatch, detailResolver);
if(icepatch.equals(""))
{
_distrib.setSelectedItem(NO_DISTRIB);
@@ -398,7 +368,7 @@ class ServerSubEditor extends CommunicatorSubEditor
private JTextField _pwd = new JTextField(20);
private ListTextField _options = new ListTextField(20);
private JTextField _user = new JTextField(20);
- private MapField _envs;
+ private SimpleMapField _envs;
private JComboBox _activation;
private JTextField _activationTimeout = new JTextField(20);
diff --git a/java/src/IceGridGUI/Application/ServerTemplate.java b/java/src/IceGridGUI/Application/ServerTemplate.java
index 681a86e704d..03b4b6ab892 100644
--- a/java/src/IceGridGUI/Application/ServerTemplate.java
+++ b/java/src/IceGridGUI/Application/ServerTemplate.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.Component;
@@ -25,36 +26,31 @@ import javax.swing.tree.DefaultTreeCellRenderer;
import IceGrid.*;
import IceGridGUI.*;
-
class ServerTemplate extends Communicator
{
static public TemplateDescriptor
copyDescriptor(TemplateDescriptor templateDescriptor)
{
- TemplateDescriptor copy = (TemplateDescriptor)
- templateDescriptor.clone();
+ TemplateDescriptor copy = (TemplateDescriptor)templateDescriptor.clone();
- copy.descriptor = PlainServer.copyDescriptor(
- (ServerDescriptor)copy.descriptor);
+ copy.descriptor = PlainServer.copyDescriptor((ServerDescriptor)copy.descriptor);
return copy;
}
-
+
public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
_cellRenderer = new DefaultTreeCellRenderer();
- _plainIcon =
- Utils.getIcon("/icons/16x16/server_template.png");
- _iceboxIcon =
- Utils.getIcon("/icons/16x16/icebox_server_template.png");
+ _plainIcon = Utils.getIcon("/icons/16x16/server_template.png");
+ _iceboxIcon = Utils.getIcon("/icons/16x16/icebox_server_template.png");
}
if(_templateDescriptor.descriptor instanceof IceBoxDescriptor)
@@ -80,11 +76,9 @@ class ServerTemplate extends Communicator
}
}
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
-
//
// Actions
//
@@ -100,7 +94,7 @@ class ServerTemplate extends Communicator
else
{
Object clipboard = getCoordinator().getClipboard();
- actions[PASTE] = clipboard != null &&
+ actions[PASTE] = clipboard != null &&
((isIceBox() && (clipboard instanceof ServiceInstanceDescriptor))
|| (!isIceBox() && (clipboard instanceof Adapter.AdapterCopy
|| clipboard instanceof DbEnvDescriptor)));
@@ -118,13 +112,13 @@ class ServerTemplate extends Communicator
return actions;
}
+
public void copy()
{
getCoordinator().setClipboard(copyDescriptor(_templateDescriptor));
getCoordinator().getActionsForMenu().get(PASTE).setEnabled(true);
}
-
-
+
public JPopupMenu getPopupMenu()
{
ApplicationActions actions = getCoordinator().getActionsForPopup();
@@ -144,8 +138,7 @@ class ServerTemplate extends Communicator
{
if(_editor == null)
{
- _editor = (ServerTemplateEditor)getRoot().
- getEditor(ServerTemplateEditor.class, this);
+ _editor = (ServerTemplateEditor)getRoot().getEditor(ServerTemplateEditor.class, this);
}
_editor.show(this);
return _editor;
@@ -155,7 +148,7 @@ class ServerTemplate extends Communicator
{
return new ServerTemplateEditor();
}
-
+
public void destroy()
{
ServerTemplates serverTemplates = (ServerTemplates)_parent;
@@ -169,8 +162,7 @@ class ServerTemplate extends Communicator
serverTemplates.removeDescriptor(_id);
getRoot().removeServerInstances(_id);
serverTemplates.removeChild(this);
- serverTemplates.getEditable().
- removeElement(_id, _editable, ServerTemplate.class);
+ serverTemplates.getEditable().removeElement(_id, _editable, ServerTemplate.class);
getRoot().updated();
}
}
@@ -190,7 +182,6 @@ class ServerTemplate extends Communicator
return _templateDescriptor.descriptor;
}
-
public Object saveDescriptor()
{
//
@@ -200,7 +191,7 @@ class ServerTemplate extends Communicator
clone.descriptor = (ServerDescriptor)_templateDescriptor.descriptor.clone();
return clone;
}
-
+
public void restoreDescriptor(Object savedDescriptor)
{
TemplateDescriptor clone = (TemplateDescriptor)savedDescriptor;
@@ -238,23 +229,22 @@ class ServerTemplate extends Communicator
assert false;
}
}
-
- void write(XMLWriter writer) throws java.io.IOException
+
+ void write(XMLWriter writer)
+ throws java.io.IOException
{
if(!_ephemeral)
{
- java.util.List attributes = new java.util.LinkedList();
+ java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
attributes.add(createAttribute("id", _id));
writer.writeStartTag("server-template", attributes);
- writeParameters(writer, _templateDescriptor.parameters,
- _templateDescriptor.parameterDefaults);
-
+ writeParameters(writer, _templateDescriptor.parameters, _templateDescriptor.parameterDefaults);
+
if(_templateDescriptor.descriptor instanceof IceBoxDescriptor)
{
IceBoxDescriptor descriptor = (IceBoxDescriptor)_templateDescriptor.descriptor;
- writer.writeStartTag("icebox",
- PlainServer.createAttributes(descriptor));
+ writer.writeStartTag("icebox", PlainServer.createAttributes(descriptor));
if(descriptor.description.length() > 0)
{
@@ -262,7 +252,7 @@ class ServerTemplate extends Communicator
}
PlainServer.writeOptions(writer, descriptor.options);
PlainServer.writeEnvs(writer, descriptor.envs);
-
+
writePropertySet(writer, "", "", descriptor.propertySet, descriptor.adapters, descriptor.logs);
writeLogs(writer, descriptor.logs, descriptor.propertySet.properties);
writeDistribution(writer, descriptor.distrib);
@@ -275,8 +265,7 @@ class ServerTemplate extends Communicator
{
ServerDescriptor descriptor = (ServerDescriptor)_templateDescriptor.descriptor;
- writer.writeStartTag("server",
- PlainServer.createAttributes(descriptor));
+ writer.writeStartTag("server", PlainServer.createAttributes(descriptor));
if(descriptor.description.length() > 0)
{
@@ -284,7 +273,7 @@ class ServerTemplate extends Communicator
}
PlainServer.writeOptions(writer, descriptor.options);
PlainServer.writeEnvs(writer, descriptor.envs);
-
+
writePropertySet(writer, descriptor.propertySet, descriptor.adapters, descriptor.logs);
writeLogs(writer, descriptor.logs, descriptor.propertySet.properties);
writeDistribution(writer, descriptor.distrib);
@@ -292,11 +281,10 @@ class ServerTemplate extends Communicator
_adapters.write(writer, descriptor.propertySet.properties);
_dbEnvs.write(writer);
writer.writeEndTag("server");
- }
+ }
writer.writeEndTag("server-template");
}
}
-
boolean isIceBox()
{
@@ -314,14 +302,13 @@ class ServerTemplate extends Communicator
if(!_ephemeral)
{
_adapters.init(_templateDescriptor.descriptor.adapters);
-
+
if(isIceBox())
{
- IceBoxDescriptor iceBoxDescriptor =
- (IceBoxDescriptor)_templateDescriptor.descriptor;
-
+ IceBoxDescriptor iceBoxDescriptor = (IceBoxDescriptor)_templateDescriptor.descriptor;
+
_services.init(iceBoxDescriptor.services);
-
+
assert _templateDescriptor.descriptor.dbEnvs.size() == 0;
}
else
@@ -340,7 +327,7 @@ class ServerTemplate extends Communicator
{
_editable.commit();
}
-
+
Editable getEditable()
{
return _editable;
@@ -351,7 +338,7 @@ class ServerTemplate extends Communicator
return _editable;
}
- java.util.List findInstances()
+ java.util.List<? extends TemplateInstance> findInstances()
{
return getRoot().findServerInstances(_id);
}
@@ -364,6 +351,6 @@ class ServerTemplate extends Communicator
static private DefaultTreeCellRenderer _cellRenderer;
static private Icon _plainIcon;
static private Icon _iceboxIcon;
-
+
static private JPopupMenu _popup;
}
diff --git a/java/src/IceGridGUI/Application/ServerTemplateEditor.java b/java/src/IceGridGUI/Application/ServerTemplateEditor.java
index 74d27d3c01e..1cfdac8b1c9 100644
--- a/java/src/IceGridGUI/Application/ServerTemplateEditor.java
+++ b/java/src/IceGridGUI/Application/ServerTemplateEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import com.jgoodies.forms.builder.DefaultFormBuilder;
@@ -16,12 +17,12 @@ class ServerTemplateEditor extends TemplateEditor
{
_subEditor = new ServerSubEditor(this);
}
-
+
void writeDescriptor()
{
super.writeDescriptor();
_subEditor.writeDescriptor();
- }
+ }
boolean isSimpleUpdate()
{
@@ -29,7 +30,7 @@ class ServerTemplateEditor extends TemplateEditor
}
protected void appendProperties(DefaultFormBuilder builder)
- {
+ {
super.appendProperties(builder);
builder.appendSeparator();
builder.nextLine();
@@ -51,12 +52,12 @@ class ServerTemplateEditor extends TemplateEditor
{
detectUpdates(false);
_target = t;
-
+
super.show();
_subEditor.show(true);
_applyButton.setEnabled(t.isEphemeral());
- _discardButton.setEnabled(t.isEphemeral());
+ _discardButton.setEnabled(t.isEphemeral());
detectUpdates(true);
if(t.isEphemeral())
{
diff --git a/java/src/IceGridGUI/Application/ServerTemplates.java b/java/src/IceGridGUI/Application/ServerTemplates.java
index d6945686a69..a704eb6d482 100644
--- a/java/src/IceGridGUI/Application/ServerTemplates.java
+++ b/java/src/IceGridGUI/Application/ServerTemplates.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import javax.swing.JMenuItem;
@@ -16,18 +17,13 @@ import IceGridGUI.*;
class ServerTemplates extends Templates
{
- static public java.util.Map
- copyDescriptors(java.util.Map descriptors)
+ static public java.util.Map<String, TemplateDescriptor>
+ copyDescriptors(java.util.Map<String, TemplateDescriptor> descriptors)
{
- java.util.Map copy = new java.util.HashMap();
- java.util.Iterator p = descriptors.entrySet().iterator();
- while(p.hasNext())
+ java.util.Map<String, TemplateDescriptor> copy = new java.util.HashMap<String, TemplateDescriptor>();
+ for(java.util.Map.Entry<String, TemplateDescriptor> p : descriptors.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
-
- copy.put(entry.getKey(),
- ServerTemplate.copyDescriptor(
- (TemplateDescriptor)entry.getValue()));
+ copy.put(p.getKey(), ServerTemplate.copyDescriptor(p.getValue()));
}
return copy;
}
@@ -40,7 +36,7 @@ class ServerTemplates extends Templates
boolean[] actions = new boolean[ACTION_COUNT];
actions[NEW_TEMPLATE_SERVER] = true;
actions[NEW_TEMPLATE_SERVER_ICEBOX] = true;
-
+
Object clipboard = getCoordinator().getClipboard();
if(clipboard != null && clipboard instanceof TemplateDescriptor)
{
@@ -49,6 +45,7 @@ class ServerTemplates extends Templates
}
return actions;
}
+
public JPopupMenu getPopupMenu()
{
ApplicationActions actions = getCoordinator().getActionsForPopup();
@@ -65,17 +62,19 @@ class ServerTemplates extends Templates
public void newTemplateServer()
{
newServerTemplate(new TemplateDescriptor(
- PlainServer.newServerDescriptor(),
- new java.util.LinkedList(),
- new java.util.TreeMap()));
+ PlainServer.newServerDescriptor(),
+ new java.util.LinkedList<String>(),
+ new java.util.TreeMap<String, String>()));
}
+
public void newTemplateServerIceBox()
{
newServerTemplate(new TemplateDescriptor(
- PlainServer.newIceBoxDescriptor(),
- new java.util.LinkedList(),
- new java.util.TreeMap()));
+ PlainServer.newIceBoxDescriptor(),
+ new java.util.LinkedList<String>(),
+ new java.util.TreeMap<String, String>()));
}
+
public void paste()
{
Object descriptor = getCoordinator().getClipboard();
@@ -88,27 +87,20 @@ class ServerTemplates extends Templates
return;
}
}
-
+
newServerTemplate(td);
}
-
- ServerTemplates(Root parent, java.util.Map descriptors)
+ ServerTemplates(Root parent, java.util.Map<String, TemplateDescriptor> descriptors)
throws UpdateFailedException
{
super(parent, "Server templates");
_descriptors = descriptors;
- java.util.Iterator p = _descriptors.entrySet().iterator();
-
- while(p.hasNext())
+ for(java.util.Map.Entry<String, TemplateDescriptor> p : _descriptors.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- insertChild(new ServerTemplate(false, this,
- (String)entry.getKey(),
- (TemplateDescriptor)entry.getValue()),
- false);
+ insertChild(new ServerTemplate(false, this, p.getKey(), p.getValue()), false);
}
}
@@ -120,16 +112,15 @@ class ServerTemplates extends Templates
return null;
}
- java.util.Map getUpdates()
+ java.util.Map<String, TemplateDescriptor> getUpdates()
{
- java.util.Map updates = new java.util.HashMap();
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ java.util.Map<String, TemplateDescriptor> updates = new java.util.HashMap<String, TemplateDescriptor>();
+ for(TreeNodeBase p : _children)
{
- ServerTemplate t = (ServerTemplate)p.next();
+ ServerTemplate t = (ServerTemplate)p;
if(t.getEditable().isNew() || t.getEditable().isModified())
{
- updates.put(t.getId(), t.getDescriptor());
+ updates.put(t.getId(), (TemplateDescriptor)t.getDescriptor());
}
}
return updates;
@@ -138,21 +129,19 @@ class ServerTemplates extends Templates
void commit()
{
_editable.commit();
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(TreeNodeBase p : _children)
{
- ServerTemplate st = (ServerTemplate)p.next();
+ ServerTemplate st = (ServerTemplate)p;
st.commit();
}
}
- java.util.List findServiceInstances(String template)
+ java.util.List<ServiceInstance> findServiceInstances(String template)
{
- java.util.List result = new java.util.LinkedList();
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ java.util.List<ServiceInstance> result = new java.util.LinkedList<ServiceInstance>();
+ for(TreeNodeBase p : _children)
{
- ServerTemplate t = (ServerTemplate)p.next();
+ ServerTemplate t = (ServerTemplate)p;
result.addAll(t.findServiceInstances(template));
}
return result;
@@ -160,14 +149,13 @@ class ServerTemplates extends Templates
void removeServiceInstances(String template)
{
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(TreeNodeBase p : _children)
{
- ServerTemplate t = (ServerTemplate)p.next();
+ ServerTemplate t = (ServerTemplate)p;
t.removeServiceInstances(template);
}
}
-
+
void newServerTemplate(TemplateDescriptor descriptor)
{
String id;
@@ -179,7 +167,7 @@ class ServerTemplates extends Templates
{
id = makeNewChildId("NewServerTemplate");
}
-
+
ServerTemplate t = new ServerTemplate(this, id, descriptor);
try
{
@@ -195,19 +183,18 @@ class ServerTemplates extends Templates
void tryAdd(String newId, TemplateDescriptor descriptor)
throws UpdateFailedException
{
- insertChild(new ServerTemplate(true, this, newId, descriptor),
- true);
+ insertChild(new ServerTemplate(true, this, newId, descriptor), true);
_descriptors.put(newId, descriptor);
}
- void update(java.util.Map updates, String[] removeTemplates,
- java.util.Set serviceTemplates)
+ void update(java.util.Map<String, TemplateDescriptor> updates, String[] removeTemplates,
+ java.util.Set<String> serviceTemplates)
throws UpdateFailedException
{
//
// Note: _descriptors is updated by Root
//
-
+
Root root = getRoot();
//
@@ -218,16 +205,13 @@ class ServerTemplates extends Templates
//
// One big set of updates, followed by inserts
//
- java.util.Vector newChildren = new java.util.Vector();
- java.util.Vector updatedChildren = new java.util.Vector();
-
- java.util.Iterator p = updates.entrySet().iterator();
- while(p.hasNext())
+ java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<TreeNodeBase>();
+ java.util.List<TreeNodeBase> updatedChildren = new java.util.LinkedList<TreeNodeBase>();
+
+ for(java.util.Map.Entry<String, TemplateDescriptor> p : updates.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- String name = (String)entry.getKey();
- TemplateDescriptor templateDescriptor
- = (TemplateDescriptor)entry.getValue();
+ String name = p.getKey();
+ TemplateDescriptor templateDescriptor = p.getValue();
ServerTemplate child = (ServerTemplate)findChild(name);
if(child == null)
{
@@ -239,45 +223,39 @@ class ServerTemplates extends Templates
updatedChildren.add(child);
}
}
-
+
//
// Rebuild template affected by service template updates
//
- p = serviceTemplates.iterator();
- while(p.hasNext())
+ for(String p : serviceTemplates)
{
- java.util.List serviceInstances =
- findServiceInstances((String)p.next());
- java.util.Iterator q = serviceInstances.iterator();
- while(q.hasNext())
+ java.util.List<ServiceInstance> serviceInstances = findServiceInstances(p);
+ for(ServiceInstance q : serviceInstances)
{
- ServiceInstance service = (ServiceInstance)q.next();
- ServerTemplate serverTemplate =
- (ServerTemplate)service.getParent();
-
- if(!updatedChildren.contains(serverTemplate) &&
- !newChildren.contains(serverTemplate))
+ ServerTemplate serverTemplate = (ServerTemplate)q.getParent();
+
+ if(!updatedChildren.contains(serverTemplate) && !newChildren.contains(serverTemplate))
{
serverTemplate.rebuild();
updatedChildren.add(serverTemplate);
}
}
}
-
+
childrenChanged(updatedChildren);
insertChildren(newChildren, true);
}
-
+
void removeDescriptor(String id)
{
_descriptors.remove(id);
}
-
+
Object getDescriptor()
{
return _descriptors;
}
- private java.util.Map _descriptors;
+ private java.util.Map<String, TemplateDescriptor> _descriptors;
static private JPopupMenu _popup;
}
diff --git a/java/src/IceGridGUI/Application/Service.java b/java/src/IceGridGUI/Application/Service.java
index 72d9511416a..27bd1b3fb99 100644
--- a/java/src/IceGridGUI/Application/Service.java
+++ b/java/src/IceGridGUI/Application/Service.java
@@ -6,7 +6,9 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
interface Service extends TemplateInstance, DescriptorHolder
-{}
+{
+}
diff --git a/java/src/IceGridGUI/Application/ServiceInstance.java b/java/src/IceGridGUI/Application/ServiceInstance.java
index 2578a8f637e..49f4c2b0904 100644
--- a/java/src/IceGridGUI/Application/ServiceInstance.java
+++ b/java/src/IceGridGUI/Application/ServiceInstance.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.Component;
@@ -21,49 +22,44 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
static public ServiceInstanceDescriptor
copyDescriptor(ServiceInstanceDescriptor instanceDescriptor)
{
- ServiceInstanceDescriptor copy = (ServiceInstanceDescriptor)
- instanceDescriptor.clone();
+ ServiceInstanceDescriptor copy = (ServiceInstanceDescriptor)instanceDescriptor.clone();
copy.propertySet = PropertySet.copyDescriptor(copy.propertySet);
-
+
if(copy.descriptor != null)
{
copy.descriptor = PlainService.copyDescriptor((ServiceDescriptor)copy.descriptor);
}
return copy;
}
-
- static public java.util.List
- copyDescriptors(java.util.List descriptors)
+
+ static public java.util.List<ServiceInstanceDescriptor>
+ copyDescriptors(java.util.List<ServiceInstanceDescriptor> descriptors)
{
- java.util.List copy = new java.util.LinkedList();
- java.util.Iterator p = descriptors.iterator();
- while(p.hasNext())
+ java.util.List<ServiceInstanceDescriptor> copy = new java.util.LinkedList<ServiceInstanceDescriptor>();
+ for(ServiceInstanceDescriptor p : descriptors)
{
- copy.add(copyDescriptor(
- (ServiceInstanceDescriptor)p.next()));
+ copy.add(copyDescriptor(p));
}
return copy;
}
public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
_cellRenderer = new DefaultTreeCellRenderer();
- _cellRenderer.setLeafIcon(
- Utils.getIcon("/icons/16x16/service.png"));
+ _cellRenderer.setLeafIcon(Utils.getIcon("/icons/16x16/service.png"));
}
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
//
@@ -73,7 +69,7 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
{
boolean[] actions = new boolean[ACTION_COUNT];
actions[COPY] = !_ephemeral;
-
+
if(((TreeNode)_parent).getAvailableActions()[PASTE])
{
actions[PASTE] = true;
@@ -86,11 +82,12 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
actions[SHOW_VARS] = true;
actions[SUBSTITUTE_VARS] = true;
}
-
+
actions[MOVE_UP] = canMove(true);
actions[MOVE_DOWN] = canMove(false);
return actions;
}
+
public JPopupMenu getPopupMenu()
{
ApplicationActions actions = getCoordinator().getActionsForPopup();
@@ -103,6 +100,7 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
actions.setTarget(this);
return _popup;
}
+
public void copy()
{
getCoordinator().setClipboard(copyDescriptor(_descriptor));
@@ -113,16 +111,17 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
{
((TreeNode)_parent).paste();
}
-
+
public void moveUp()
{
move(true);
}
+
public void moveDown()
{
move(false);
}
-
+
public Object getDescriptor()
{
return _descriptor;
@@ -133,10 +132,7 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
//
// Must be a shallow copy
//
- ServiceInstanceDescriptor saved =
- (ServiceInstanceDescriptor)_descriptor.clone();
-
-
+ ServiceInstanceDescriptor saved = (ServiceInstanceDescriptor)_descriptor.clone();
assert saved.descriptor == null;
return saved;
}
@@ -158,8 +154,7 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
{
if(_editor == null)
{
- _editor = (ServiceInstanceEditor)getRoot().
- getEditor(ServiceInstanceEditor.class, this);
+ _editor = (ServiceInstanceEditor)getRoot().getEditor(ServiceInstanceEditor.class, this);
}
_editor.show(this);
return _editor;
@@ -181,7 +176,7 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
return super.toString();
}
}
-
+
private boolean canMove(boolean up)
{
if(_ephemeral)
@@ -199,7 +194,7 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
assert canMove(up);
((Communicator)_parent).getServices().move(this, up);
}
-
+
Editable getEnclosingEditable()
{
return ((Communicator)_parent).getEnclosingEditable();
@@ -207,11 +202,11 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
static private class Backup
{
- java.util.Map parameterValues;
+ java.util.Map<String, String> parameterValues;
ServiceInstance clone;
}
- public Object rebuild(java.util.List editables)
+ public Object rebuild(java.util.List<Editable> editables)
throws UpdateFailedException
{
Backup backup = new Backup();
@@ -221,10 +216,9 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
//
if(_descriptor.template.length() > 0)
{
- TemplateDescriptor templateDescriptor
- = getRoot().findServiceTemplateDescriptor(_descriptor.template);
+ TemplateDescriptor templateDescriptor = getRoot().findServiceTemplateDescriptor(_descriptor.template);
- java.util.Set parameters = new java.util.HashSet(templateDescriptor.parameters);
+ java.util.Set<String> parameters = new java.util.HashSet<String>(templateDescriptor.parameters);
if(!parameters.equals(_descriptor.parameterValues.keySet()))
{
backup.parameterValues = _descriptor.parameterValues;
@@ -278,23 +272,23 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
{
_descriptor.parameterValues = backup.parameterValues;
}
-
+
reset(backup.clone);
getRoot().getTreeModel().nodeChanged(this);
}
private void reset(ServiceInstance from)
{
- _id = from._id;
+ _id = from._id;
_displayString = from._displayString;
_resolver = from._resolver;
}
ServiceInstance(Communicator parent,
- String name,
- String displayString,
- ServiceInstanceDescriptor instanceDescriptor,
- Utils.Resolver resolver)
+ String name,
+ String displayString,
+ ServiceInstanceDescriptor instanceDescriptor,
+ Utils.Resolver resolver)
throws UpdateFailedException
{
super(parent, name);
@@ -307,27 +301,25 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
//
// New temporary object
//
- ServiceInstance(Communicator parent, String name,
- ServiceInstanceDescriptor instanceDescriptor)
+ ServiceInstance(Communicator parent, String name, ServiceInstanceDescriptor instanceDescriptor)
{
super(parent, name);
_descriptor = instanceDescriptor;
_ephemeral = true;
}
- void write(XMLWriter writer) throws java.io.IOException
+ void write(XMLWriter writer)
+ throws java.io.IOException
{
if(!_ephemeral)
{
- TemplateDescriptor templateDescriptor
- = getRoot().findServiceTemplateDescriptor(_descriptor.template);
+ TemplateDescriptor templateDescriptor = getRoot().findServiceTemplateDescriptor(_descriptor.template);
- java.util.LinkedList attributes = parameterValuesToAttributes(
- _descriptor.parameterValues, templateDescriptor.parameters);
+ java.util.LinkedList<String[]> attributes =
+ parameterValuesToAttributes(_descriptor.parameterValues, templateDescriptor.parameters);
attributes.addFirst(createAttribute("template", _descriptor.template));
-
- if(_descriptor.propertySet.references.length == 0 &&
- _descriptor.propertySet.properties.size() == 0)
+
+ if(_descriptor.propertySet.references.length == 0 && _descriptor.propertySet.properties.size() == 0)
{
writer.writeElement("service-instance", attributes);
}
@@ -358,6 +350,6 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
private Utils.Resolver _resolver;
private ServiceInstanceEditor _editor;
- static private DefaultTreeCellRenderer _cellRenderer;
+ static private DefaultTreeCellRenderer _cellRenderer;
static private JPopupMenu _popup;
}
diff --git a/java/src/IceGridGUI/Application/ServiceInstanceEditor.java b/java/src/IceGridGUI/Application/ServiceInstanceEditor.java
index b9d13ce41f4..84cad7157ba 100644
--- a/java/src/IceGridGUI/Application/ServiceInstanceEditor.java
+++ b/java/src/IceGridGUI/Application/ServiceInstanceEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -36,7 +37,7 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
Action gotoTemplate = new AbstractAction(
"", Utils.getIcon("/icons/16x16/goto.png"))
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
TreeNode t = (TreeNode)_template.getSelectedItem();
if(t != null)
@@ -45,8 +46,7 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
}
}
};
- gotoTemplate.putValue(Action.SHORT_DESCRIPTION,
- "Goto this service template");
+ gotoTemplate.putValue(Action.SHORT_DESCRIPTION, "Goto this service template");
_templateButton = new JButton(gotoTemplate);
_parameters = new ParameterValuesField(this);
@@ -83,18 +83,16 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
descriptor.template = ((ServiceTemplate)_template.getSelectedItem()).getId();
descriptor.parameterValues = _parameters.getValues();
- descriptor.propertySet.references =
- (String[])_propertySets.getList().toArray(new String[0]);
+ descriptor.propertySet.references = (String[])_propertySets.getList().toArray(new String[0]);
descriptor.propertySet.properties = _properties.getProperties();
- }
-
+ }
+
boolean isSimpleUpdate()
{
ServiceInstanceDescriptor descriptor = getDescriptor();
ServiceTemplate t = (ServiceTemplate)_template.getSelectedItem();
-
- return descriptor.template.equals(t.getId())
- && descriptor.parameterValues.equals(_parameters.getValues());
+
+ return descriptor.template.equals(t.getId()) && descriptor.parameterValues.equals(_parameters.getValues());
}
Communicator.ChildList getChildList()
@@ -103,11 +101,11 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
}
protected void appendProperties(DefaultFormBuilder builder)
- {
+ {
builder.append("Template", _template);
builder.append(_templateButton);
builder.nextLine();
-
+
builder.append("Parameters");
builder.nextLine();
builder.append("");
@@ -120,11 +118,10 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
builder.nextRow(-6);
JScrollPane scrollPane = new JScrollPane(_parameters);
CellConstraints cc = new CellConstraints();
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
-
+
builder.append("Property Sets");
builder.append(_propertySets, 3);
builder.nextLine();
@@ -140,8 +137,7 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
builder.nextRow(-6);
scrollPane = new JScrollPane(_properties);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
}
@@ -156,46 +152,41 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
{
detectUpdates(false);
_target = service;
-
+
//
// If it's not a template instance, it's shown using
// ServiceEditor.show()
//
assert getDescriptor().template.length() > 0;
- ServiceInstanceDescriptor descriptor =
- (ServiceInstanceDescriptor)service.getDescriptor();
+ ServiceInstanceDescriptor descriptor = (ServiceInstanceDescriptor)service.getDescriptor();
Coordinator coordinator = service.getCoordinator();
boolean isEditable = service.isEphemeral() || !coordinator.substitute();
- Utils.Resolver resolver = isEditable ? null :
- ((TreeNode)service.getParent()).getResolver();
-
+ Utils.Resolver resolver = isEditable ? null : ((TreeNode)service.getParent()).getResolver();
+
//
// Need to make control enabled before changing it
//
_template.setEnabled(true);
- ServiceTemplates serviceTemplates =
- service.getRoot().getServiceTemplates();
+ ServiceTemplates serviceTemplates = service.getRoot().getServiceTemplates();
_template.setModel(serviceTemplates.createComboBoxModel());
- ServiceTemplate t = (ServiceTemplate)
- serviceTemplates.findChild(descriptor.template);
+ ServiceTemplate t = (ServiceTemplate)serviceTemplates.findChild(descriptor.template);
assert t != null;
_template.setSelectedItem(t);
-
+
ListDataListener templateListener = new ListDataListener()
{
public void contentsChanged(ListDataEvent e)
{
updated();
-
- ServiceTemplate t =
- (ServiceTemplate)_template.getModel().getSelectedItem();
-
+
+ ServiceTemplate t = (ServiceTemplate)_template.getModel().getSelectedItem();
+
TemplateDescriptor td = (TemplateDescriptor)t.getDescriptor();
-
+
//
// Replace parameters but keep existing values
//
@@ -205,28 +196,27 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
}
public void intervalAdded(ListDataEvent e)
- {}
-
+ {
+ }
+
public void intervalRemoved(ListDataEvent e)
- {}
+ {
+ }
};
_template.getModel().addListDataListener(templateListener);
_template.setEnabled(isEditable);
-
+
TemplateDescriptor td = (TemplateDescriptor)t.getDescriptor();
- _parameters.set(td.parameters, descriptor.parameterValues,
- td.parameterDefaults, resolver);
-
- _propertySets.setList(java.util.Arrays.asList(descriptor.propertySet.references),
- getDetailResolver());
+ _parameters.set(td.parameters, descriptor.parameterValues, td.parameterDefaults, resolver);
+
+ _propertySets.setList(java.util.Arrays.asList(descriptor.propertySet.references), getDetailResolver());
_propertySets.setEditable(isEditable);
- _properties.setProperties(descriptor.propertySet.properties, null, null,
- getDetailResolver(), isEditable);
+ _properties.setProperties(descriptor.propertySet.properties, null, null, getDetailResolver(), isEditable);
_applyButton.setEnabled(service.isEphemeral());
- _discardButton.setEnabled(service.isEphemeral());
+ _discardButton.setEnabled(service.isEphemeral());
detectUpdates(true);
if(service.isEphemeral())
{
diff --git a/java/src/IceGridGUI/Application/ServiceSubEditor.java b/java/src/IceGridGUI/Application/ServiceSubEditor.java
index fea50d57f8e..edec775d54d 100644
--- a/java/src/IceGridGUI/Application/ServiceSubEditor.java
+++ b/java/src/IceGridGUI/Application/ServiceSubEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -25,12 +26,10 @@ class ServiceSubEditor extends CommunicatorSubEditor
{
super(mainEditor);
- _name.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
+ _name.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
_name.setToolTipText("Identifies this service within an IceBox server");
- _entry.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
+ _entry.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
_entry.setToolTipText(
"<html>The service entry point and optional arguments.<br>"
+ "C++: <i>shared object:function-name arg1 arg2 ...</i><br>"
@@ -38,19 +37,18 @@ class ServiceSubEditor extends CommunicatorSubEditor
+ "C#, Visual Basic: <i>assembly:class-name arg1 arg2 ...</i>"
+ "</html>");
}
-
+
ServiceDescriptor getServiceDescriptor()
{
- return (ServiceDescriptor)
- _mainEditor.getSubDescriptor();
+ return (ServiceDescriptor)_mainEditor.getSubDescriptor();
}
-
+
void appendProperties(DefaultFormBuilder builder)
- {
+ {
builder.append("Service Name");
builder.append(_name, 3);
builder.nextLine();
-
+
//
// Add Communicator fields
//
@@ -60,18 +58,18 @@ class ServiceSubEditor extends CommunicatorSubEditor
builder.append(_entry, 3);
builder.nextLine();
}
-
+
void writeDescriptor()
{
ServiceDescriptor descriptor = getServiceDescriptor();
descriptor.name = _name.getText().trim();
descriptor.entry = _entry.getText().trim();
super.writeDescriptor(descriptor);
- }
-
+ }
+
boolean isSimpleUpdate()
{
- return getServiceDescriptor().name.equals(_name.getText().trim());
+ return getServiceDescriptor().name.equals(_name.getText().trim());
}
boolean validate()
@@ -85,7 +83,7 @@ class ServiceSubEditor extends CommunicatorSubEditor
{
ServiceDescriptor descriptor = getServiceDescriptor();
Utils.Resolver detailResolver = _mainEditor.getDetailResolver();
-
+
isEditable = isEditable && (detailResolver == null);
if(detailResolver != null)
@@ -97,9 +95,8 @@ class ServiceSubEditor extends CommunicatorSubEditor
_name.setText(descriptor.name);
}
_name.setEditable(isEditable);
-
- _entry.setText(
- Utils.substitute(descriptor.entry, detailResolver));
+
+ _entry.setText(Utils.substitute(descriptor.entry, detailResolver));
_entry.setEditable(isEditable);
show(descriptor, isEditable);
diff --git a/java/src/IceGridGUI/Application/ServiceTemplate.java b/java/src/IceGridGUI/Application/ServiceTemplate.java
index 1d67a203a70..872b1617c16 100644
--- a/java/src/IceGridGUI/Application/ServiceTemplate.java
+++ b/java/src/IceGridGUI/Application/ServiceTemplate.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.Component;
@@ -22,38 +23,30 @@ class ServiceTemplate extends Communicator
static public TemplateDescriptor
copyDescriptor(TemplateDescriptor templateDescriptor)
{
- TemplateDescriptor copy = (TemplateDescriptor)
- templateDescriptor.clone();
-
- copy.descriptor = PlainService.copyDescriptor(
- (ServiceDescriptor)copy.descriptor);
-
+ TemplateDescriptor copy = (TemplateDescriptor)templateDescriptor.clone();
+ copy.descriptor = PlainService.copyDescriptor((ServiceDescriptor)copy.descriptor);
return copy;
}
-
+
public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
_cellRenderer = new DefaultTreeCellRenderer();
- _cellRenderer.setOpenIcon(
- Utils.getIcon("/icons/16x16/service_template.png"));
- _cellRenderer.setClosedIcon(
- Utils.getIcon("/icons/16x16/service_template.png"));
+ _cellRenderer.setOpenIcon(Utils.getIcon("/icons/16x16/service_template.png"));
+ _cellRenderer.setClosedIcon(Utils.getIcon("/icons/16x16/service_template.png"));
}
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
-
//
// Actions
//
@@ -68,7 +61,7 @@ class ServiceTemplate extends Communicator
else
{
Object clipboard = getCoordinator().getClipboard();
- actions[PASTE] = clipboard != null &&
+ actions[PASTE] = clipboard != null &&
(clipboard instanceof Adapter.AdapterCopy
|| clipboard instanceof DbEnvDescriptor);
}
@@ -76,20 +69,21 @@ class ServiceTemplate extends Communicator
actions[DELETE] = true;
if(!_ephemeral)
- {
+ {
actions[COPY] = true;
actions[NEW_ADAPTER] = true;
actions[NEW_DBENV] = true;
}
-
+
return actions;
}
+
public void copy()
{
getCoordinator().setClipboard(copyDescriptor(_templateDescriptor));
getCoordinator().getActionsForMenu().get(PASTE).setEnabled(true);
}
-
+
public JPopupMenu getPopupMenu()
{
ApplicationActions actions = getCoordinator().getActionsForPopup();
@@ -118,8 +112,7 @@ class ServiceTemplate extends Communicator
return new ServiceTemplateEditor();
}
- ServiceTemplate(boolean brandNew, ServiceTemplates parent,
- String name, TemplateDescriptor descriptor)
+ ServiceTemplate(boolean brandNew, ServiceTemplates parent, String name, TemplateDescriptor descriptor)
throws UpdateFailedException
{
super(parent, name);
@@ -127,7 +120,7 @@ class ServiceTemplate extends Communicator
_ephemeral = false;
rebuild(descriptor);
}
-
+
ServiceTemplate(ServiceTemplates parent, String name, TemplateDescriptor descriptor)
{
super(parent, name);
@@ -136,16 +129,16 @@ class ServiceTemplate extends Communicator
_templateDescriptor = descriptor;
}
- void write(XMLWriter writer) throws java.io.IOException
+ void write(XMLWriter writer)
+ throws java.io.IOException
{
if(!_ephemeral)
{
- java.util.List attributes = new java.util.LinkedList();
+ java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
attributes.add(createAttribute("id", _id));
writer.writeStartTag("service-template", attributes);
- writeParameters(writer, _templateDescriptor.parameters,
- _templateDescriptor.parameterDefaults);
-
+ writeParameters(writer, _templateDescriptor.parameters, _templateDescriptor.parameterDefaults);
+
ServiceDescriptor descriptor = (ServiceDescriptor)_templateDescriptor.descriptor;
writer.writeStartTag("service", PlainService.createAttributes(descriptor));
@@ -154,7 +147,7 @@ class ServiceTemplate extends Communicator
{
writer.writeElement("description", descriptor.description);
}
-
+
writePropertySet(writer, descriptor.propertySet, descriptor.adapters, descriptor.logs);
writeLogs(writer, descriptor.logs, descriptor.propertySet.properties);
_adapters.write(writer, descriptor.propertySet.properties);
@@ -198,7 +191,7 @@ class ServiceTemplate extends Communicator
{
return _ephemeral;
}
-
+
public void destroy()
{
ServiceTemplates serviceTemplates = (ServiceTemplates)_parent;
@@ -212,13 +205,12 @@ class ServiceTemplate extends Communicator
serviceTemplates.removeDescriptor(_id);
getRoot().removeServiceInstances(_id);
serviceTemplates.removeChild(this);
- serviceTemplates.getEditable().
- removeElement(_id, _editable, ServiceTemplate.class);
+ serviceTemplates.getEditable().removeElement(_id, _editable, ServiceTemplate.class);
getRoot().updated();
}
}
- java.util.List findInstances()
+ java.util.List<? extends TemplateInstance> findInstances()
{
return getRoot().findServiceInstances(_id);
}
@@ -242,7 +234,7 @@ class ServiceTemplate extends Communicator
clone.descriptor = (ServiceDescriptor)_templateDescriptor.descriptor.clone();
return clone;
}
-
+
public void restoreDescriptor(Object savedDescriptor)
{
TemplateDescriptor clone = (TemplateDescriptor)savedDescriptor;
diff --git a/java/src/IceGridGUI/Application/ServiceTemplateEditor.java b/java/src/IceGridGUI/Application/ServiceTemplateEditor.java
index 58f3013f808..aff94b7c5d3 100644
--- a/java/src/IceGridGUI/Application/ServiceTemplateEditor.java
+++ b/java/src/IceGridGUI/Application/ServiceTemplateEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import com.jgoodies.forms.builder.DefaultFormBuilder;
@@ -16,12 +17,12 @@ class ServiceTemplateEditor extends TemplateEditor
{
_subEditor = new ServiceSubEditor(this);
}
-
+
void writeDescriptor()
{
super.writeDescriptor();
_subEditor.writeDescriptor();
- }
+ }
boolean isSimpleUpdate()
{
@@ -29,7 +30,7 @@ class ServiceTemplateEditor extends TemplateEditor
}
protected void appendProperties(DefaultFormBuilder builder)
- {
+ {
super.appendProperties(builder);
builder.appendSeparator();
builder.nextLine();
@@ -51,12 +52,12 @@ class ServiceTemplateEditor extends TemplateEditor
{
detectUpdates(false);
_target = t;
-
+
super.show();
_subEditor.show(true);
_applyButton.setEnabled(t.isEphemeral());
- _discardButton.setEnabled(t.isEphemeral());
+ _discardButton.setEnabled(t.isEphemeral());
detectUpdates(true);
if(t.isEphemeral())
{
diff --git a/java/src/IceGridGUI/Application/ServiceTemplates.java b/java/src/IceGridGUI/Application/ServiceTemplates.java
index a14ef5d04a4..9a102b874e5 100644
--- a/java/src/IceGridGUI/Application/ServiceTemplates.java
+++ b/java/src/IceGridGUI/Application/ServiceTemplates.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -20,22 +21,16 @@ import IceGridGUI.*;
class ServiceTemplates extends Templates
{
- static public java.util.Map
- copyDescriptors(java.util.Map descriptors)
+ static public java.util.Map<String, TemplateDescriptor>
+ copyDescriptors(java.util.Map<String, TemplateDescriptor> descriptors)
{
- java.util.Map copy = new java.util.HashMap();
- java.util.Iterator p = descriptors.entrySet().iterator();
- while(p.hasNext())
+ java.util.Map<String, TemplateDescriptor> copy = new java.util.HashMap<String, TemplateDescriptor>();
+ for(java.util.Map.Entry<String, TemplateDescriptor> p : descriptors.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
-
- copy.put(entry.getKey(),
- ServiceTemplate.copyDescriptor(
- (TemplateDescriptor)entry.getValue()));
+ copy.put(p.getKey(), ServiceTemplate.copyDescriptor(p.getValue()));
}
return copy;
}
-
//
// Actions
@@ -44,7 +39,7 @@ class ServiceTemplates extends Templates
{
boolean[] actions = new boolean[ACTION_COUNT];
actions[NEW_TEMPLATE_SERVICE] = true;
-
+
Object clipboard = getCoordinator().getClipboard();
if(clipboard != null && clipboard instanceof TemplateDescriptor)
{
@@ -53,6 +48,7 @@ class ServiceTemplates extends Templates
}
return actions;
}
+
public JPopupMenu getPopupMenu()
{
ApplicationActions actions = getCoordinator().getActionsForPopup();
@@ -64,20 +60,22 @@ class ServiceTemplates extends Templates
actions.setTarget(this);
return _popup;
}
+
public void newTemplateService()
{
ServiceDescriptor sd = new ServiceDescriptor(
- new java.util.LinkedList(),
- new PropertySetDescriptor(new String[0], new java.util.LinkedList()),
- new java.util.LinkedList(),
+ new java.util.LinkedList<AdapterDescriptor>(),
+ new PropertySetDescriptor(new String[0], new java.util.LinkedList<PropertyDescriptor>()),
+ new java.util.LinkedList<DbEnvDescriptor>(),
new String[0],
"",
"",
"");
-
- newServiceTemplate(new TemplateDescriptor(sd, new java.util.LinkedList(), new java.util.TreeMap()));
+ newServiceTemplate(new TemplateDescriptor(sd, new java.util.LinkedList<String>(),
+ new java.util.TreeMap<String, String>()));
}
+
public void paste()
{
Object descriptor = getCoordinator().getClipboard();
@@ -85,23 +83,16 @@ class ServiceTemplates extends Templates
newServiceTemplate(td);
}
-
- ServiceTemplates(Root parent, java.util.Map descriptors)
+ ServiceTemplates(Root parent, java.util.Map<String, TemplateDescriptor> descriptors)
throws UpdateFailedException
{
super(parent, "Service templates");
_descriptors = descriptors;
- java.util.Iterator p = _descriptors.entrySet().iterator();
-
- while(p.hasNext())
+ for(java.util.Map.Entry<String, TemplateDescriptor> p : _descriptors.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- insertChild(new ServiceTemplate(false, this,
- (String)entry.getKey(),
- (TemplateDescriptor)entry.getValue()),
- false);
+ insertChild(new ServiceTemplate(false, this, p.getKey(), p.getValue()), false);
}
}
@@ -116,7 +107,7 @@ class ServiceTemplates extends Templates
void newServiceTemplate(TemplateDescriptor descriptor)
{
String id = makeNewChildId("NewServiceTemplate");
-
+
ServiceTemplate t = new ServiceTemplate(this, id, descriptor);
try
{
@@ -132,21 +123,19 @@ class ServiceTemplates extends Templates
void tryAdd(String newId, TemplateDescriptor descriptor)
throws UpdateFailedException
{
- insertChild(new ServiceTemplate(true, this, newId, descriptor),
- true);
+ insertChild(new ServiceTemplate(true, this, newId, descriptor), true);
_descriptors.put(newId, descriptor);
}
- java.util.Map getUpdates()
+ java.util.Map<String, TemplateDescriptor> getUpdates()
{
- java.util.Map updates = new java.util.HashMap();
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ java.util.Map<String, TemplateDescriptor> updates = new java.util.HashMap<String, TemplateDescriptor>();
+ for(TreeNodeBase p : _children)
{
- ServiceTemplate t = (ServiceTemplate)p.next();
+ ServiceTemplate t = (ServiceTemplate)p;
if(t.getEditable().isNew() || t.getEditable().isModified())
{
- updates.put(t.getId(), t.getDescriptor());
+ updates.put(t.getId(), (TemplateDescriptor)t.getDescriptor());
}
}
return updates;
@@ -155,22 +144,20 @@ class ServiceTemplates extends Templates
void commit()
{
_editable.commit();
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(TreeNodeBase p : _children)
{
- ServiceTemplate st = (ServiceTemplate)p.next();
+ ServiceTemplate st = (ServiceTemplate)p;
st.commit();
}
}
-
- void update(java.util.Map descriptors, String[] removeTemplates)
+ void update(java.util.Map<String, TemplateDescriptor> descriptors, String[] removeTemplates)
throws UpdateFailedException
{
//
// Note: _descriptors is updated by Application
//
-
+
//
// One big set of removes
//
@@ -179,21 +166,17 @@ class ServiceTemplates extends Templates
//
// One big set of updates, followed by inserts
//
- java.util.Vector newChildren = new java.util.Vector();
- java.util.Vector updatedChildren = new java.util.Vector();
-
- java.util.Iterator p = descriptors.entrySet().iterator();
- while(p.hasNext())
+ java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<TreeNodeBase>();
+ java.util.List<TreeNodeBase> updatedChildren = new java.util.LinkedList<TreeNodeBase>();
+
+ for(java.util.Map.Entry<String, TemplateDescriptor> p : descriptors.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- String name = (String)entry.getKey();
- TemplateDescriptor templateDescriptor
- = (TemplateDescriptor)entry.getValue();
+ String name = p.getKey();
+ TemplateDescriptor templateDescriptor = p.getValue();
ServiceTemplate child = (ServiceTemplate)findChild(name);
if(child == null)
{
- newChildren.add(new ServiceTemplate(false, this, name,
- templateDescriptor));
+ newChildren.add(new ServiceTemplate(false, this, name, templateDescriptor));
}
else
{
@@ -201,7 +184,7 @@ class ServiceTemplates extends Templates
updatedChildren.add(child);
}
}
-
+
childrenChanged(updatedChildren);
insertChildren(newChildren, true);
}
@@ -216,7 +199,7 @@ class ServiceTemplates extends Templates
return _descriptors;
}
- private java.util.Map _descriptors;
+ private java.util.Map<String, TemplateDescriptor> _descriptors;
static private JPopupMenu _popup;
}
diff --git a/java/src/IceGridGUI/Application/SimpleMapField.java b/java/src/IceGridGUI/Application/SimpleMapField.java
new file mode 100644
index 00000000000..fafd61d9cad
--- /dev/null
+++ b/java/src/IceGridGUI/Application/SimpleMapField.java
@@ -0,0 +1,184 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package IceGridGUI.Application;
+
+import IceGrid.*;
+import IceGridGUI.*;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.DefaultCellEditor;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.KeyStroke;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.DefaultTableModel;
+
+//
+// A special field used to show/edit a map
+//
+
+public class SimpleMapField extends JTable
+{
+ public SimpleMapField(Editor editor, boolean substituteKey, String headKey, String headValue)
+ {
+ _editor = editor;
+ _substituteKey = substituteKey;
+
+ _columnNames = new java.util.Vector<String>(2);
+ _columnNames.add(headKey);
+ _columnNames.add(headValue);
+
+ Action deleteRow = new AbstractAction("Delete selected row(s)")
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ if(_editable)
+ {
+ if(isEditing())
+ {
+ getCellEditor().stopCellEditing();
+ }
+
+ for(;;)
+ {
+ int selectedRow = getSelectedRow();
+ if(selectedRow == -1)
+ {
+ break;
+ }
+ else
+ {
+ _model.removeRow(selectedRow);
+ }
+ }
+ }
+ }
+ };
+ getActionMap().put("delete", deleteRow);
+ getInputMap().put(KeyStroke.getKeyStroke("DELETE"), "delete");
+ }
+
+ public void set(java.util.Map<String, String> map, Utils.Resolver resolver, boolean editable)
+ {
+ _editable = editable;
+
+ //
+ // Transform map into vector of vectors
+ //
+ java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<java.util.Vector<String>>(map.size());
+ for(java.util.Map.Entry<String, String> p : map.entrySet())
+ {
+ java.util.Vector<String> row = new java.util.Vector<String>(2);
+
+ if(_substituteKey)
+ {
+ row.add(Utils.substitute(p.getKey(), resolver));
+ }
+ else
+ {
+ row.add(p.getKey());
+ }
+
+ row.add(Utils.substitute(p.getValue(), resolver));
+ vector.add(row);
+ }
+
+ if(_editable)
+ {
+ java.util.Vector<String> newRow = new java.util.Vector<String>(2);
+ newRow.add("");
+ newRow.add("");
+ vector.add(newRow);
+ }
+
+ _model = new DefaultTableModel(vector, _columnNames)
+ {
+ public boolean isCellEditable(int row, int column)
+ {
+ return _editable;
+ }
+ };
+
+ _model.addTableModelListener(new TableModelListener()
+ {
+ public void tableChanged(TableModelEvent e)
+ {
+ if(_editable)
+ {
+ Object lastKey = _model.getValueAt(_model.getRowCount() - 1 , 0);
+ if(lastKey != null && !lastKey.equals(""))
+ {
+ Object[] emptyRow = new Object[]{"", ""};
+ _model.addRow(emptyRow);
+ }
+ _editor.updated();
+ }
+ }
+ });
+ setModel(_model);
+
+ setCellSelectionEnabled(_editable);
+ setOpaque(_editable);
+ setPreferredScrollableViewportSize(getPreferredSize());
+
+ DefaultTableCellRenderer cr = (DefaultTableCellRenderer)getDefaultRenderer(String.class);
+ cr.setOpaque(_editable);
+ }
+
+ public java.util.TreeMap<String, String> get()
+ {
+ assert _editable;
+
+ if(isEditing())
+ {
+ getCellEditor().stopCellEditing();
+ }
+ @SuppressWarnings("unchecked")
+ java.util.Vector<java.util.Vector<String>> vector =
+ (java.util.Vector<java.util.Vector<String>>)_model.getDataVector();
+
+ java.util.TreeMap<String, String> result = new java.util.TreeMap<String, String>();
+
+ for(java.util.Vector<String> row : vector)
+ {
+ //
+ // Eliminate rows with null or empty keys
+ //
+ String key = row.elementAt(0);
+ if(key != null)
+ {
+ key = key.trim();
+ if(!key.equals(""))
+ {
+ String val = row.elementAt(1);
+ if(val == null)
+ {
+ val = "";
+ }
+ result.put(key, val);
+ }
+ }
+ }
+ return result;
+ }
+
+ private DefaultTableModel _model;
+ private java.util.Vector<String> _columnNames;
+ private boolean _editable = false;
+
+ private boolean _substituteKey;
+
+ private Editor _editor;
+}
diff --git a/java/src/IceGridGUI/Application/TemplateEditor.java b/java/src/IceGridGUI/Application/TemplateEditor.java
index 9c768980189..f507c2b910e 100644
--- a/java/src/IceGridGUI/Application/TemplateEditor.java
+++ b/java/src/IceGridGUI/Application/TemplateEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -37,7 +38,7 @@ class TemplateEditor extends Editor
{
return (TemplateDescriptor)_target.getDescriptor();
}
-
+
Object getSubDescriptor()
{
return getDescriptor().descriptor;
@@ -46,27 +47,26 @@ class TemplateEditor extends Editor
void writeDescriptor()
{
TemplateDescriptor descriptor = getDescriptor();
- java.util.LinkedList parameters = new java.util.LinkedList();
+ java.util.LinkedList<String> parameters = new java.util.LinkedList<String>();
descriptor.parameterDefaults = _parameters.get(parameters);
descriptor.parameters = parameters;
- }
-
+ }
+
boolean isSimpleUpdate()
{
TemplateDescriptor descriptor = getDescriptor();
- java.util.List parameters = new java.util.LinkedList();
- java.util.Map defaultValues = _parameters.get(parameters);
+ java.util.List<String> parameters = new java.util.LinkedList<String>();
+ java.util.Map<String, String> defaultValues = _parameters.get(parameters);
- return descriptor.parameters.equals(parameters)
- && descriptor.parameterDefaults.equals(defaultValues);
+ return descriptor.parameters.equals(parameters) && descriptor.parameterDefaults.equals(defaultValues);
}
protected void appendProperties(DefaultFormBuilder builder)
- {
+ {
builder.append("Template ID");
builder.append(_template, 3);
builder.nextLine();
-
+
builder.append("Parameters");
builder.nextLine();
builder.append("");
@@ -78,8 +78,7 @@ class TemplateEditor extends Editor
builder.nextRow(-6);
JScrollPane scrollPane = new JScrollPane(_parameters);
CellConstraints cc = new CellConstraints();
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
}
@@ -136,9 +135,9 @@ class TemplateEditor extends Editor
e.toString(),
"Apply failed",
JOptionPane.ERROR_MESSAGE);
- return false;
+ return false;
}
-
+
//
// Success
//
@@ -155,7 +154,6 @@ class TemplateEditor extends Editor
writeDescriptor();
((Communicator)_target).getEnclosingEditable().markModified();
root.updated();
-
}
else
{
@@ -165,7 +163,7 @@ class TemplateEditor extends Editor
Object savedDescriptor = ((Communicator)_target).saveDescriptor();
Templates parent = (Templates)_target.getParent();
writeDescriptor();
-
+
try
{
parent.tryUpdate((Communicator)_target);
@@ -173,7 +171,7 @@ class TemplateEditor extends Editor
catch(UpdateFailedException e)
{
((Communicator)_target).restoreDescriptor(savedDescriptor);
-
+
JOptionPane.showMessageDialog(
_target.getCoordinator().getMainFrame(),
e.toString(),
@@ -184,7 +182,7 @@ class TemplateEditor extends Editor
//
return false;
}
-
+
//
// Success
//
@@ -211,7 +209,7 @@ class TemplateEditor extends Editor
root.enableSelectionListener();
}
}
-
+
private JTextField _template = new JTextField(20);
private ParametersField _parameters;
}
diff --git a/java/src/IceGridGUI/Application/TemplateInstance.java b/java/src/IceGridGUI/Application/TemplateInstance.java
index e9a11209632..545b02d1b1f 100644
--- a/java/src/IceGridGUI/Application/TemplateInstance.java
+++ b/java/src/IceGridGUI/Application/TemplateInstance.java
@@ -6,11 +6,12 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
interface TemplateInstance
{
- Object rebuild(java.util.List editables) throws UpdateFailedException;
+ Object rebuild(java.util.List<Editable> editables) throws UpdateFailedException;
void restore(Object backupObj);
}
diff --git a/java/src/IceGridGUI/Application/Templates.java b/java/src/IceGridGUI/Application/Templates.java
index 0639616500b..d2bf76a40cf 100644
--- a/java/src/IceGridGUI/Application/Templates.java
+++ b/java/src/IceGridGUI/Application/Templates.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import javax.swing.JOptionPane;
@@ -26,36 +27,31 @@ abstract class Templates extends ListTreeNode
void tryUpdate(Communicator child)
throws UpdateFailedException
{
- java.util.List instanceList = child.findInstances();
- java.util.List backupList = new java.util.Vector();
+ java.util.List<? extends TemplateInstance> instanceList = child.findInstances();
+ java.util.List<Object> backupList = new java.util.Vector<Object>();
- java.util.List editables = new java.util.LinkedList();
+ java.util.List<Editable> editables = new java.util.LinkedList<Editable>();
- java.util.Iterator p = instanceList.iterator();
- while(p.hasNext())
+ for(TemplateInstance p : instanceList)
{
- TemplateInstance instance = (TemplateInstance)p.next();
-
try
{
- backupList.add(instance.rebuild(editables));
+ backupList.add(p.rebuild(editables));
}
catch(UpdateFailedException e)
{
for(int i = backupList.size() - 1; i >= 0; --i)
{
- instance = (TemplateInstance)instanceList.get(i);
+ TemplateInstance instance = instanceList.get(i);
instance.restore(backupList.get(i));
}
throw e;
}
}
-
- p = editables.iterator();
- while(p.hasNext())
+
+ for(Editable p : editables)
{
- Editable editable = (Editable)p.next();
- editable.markModified();
+ p.markModified();
}
}
}
diff --git a/java/src/IceGridGUI/Application/TreeNode.java b/java/src/IceGridGUI/Application/TreeNode.java
index c1128a1ee37..16493aafa6e 100644
--- a/java/src/IceGridGUI/Application/TreeNode.java
+++ b/java/src/IceGridGUI/Application/TreeNode.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import javax.swing.JOptionPane;
@@ -20,11 +21,11 @@ import IceGridGUI.*;
public abstract class TreeNode extends TreeNodeBase
{
abstract public Editor getEditor();
- abstract protected Editor createEditor();
+ abstract protected Editor createEditor();
abstract Object getDescriptor();
-
+
abstract void write(XMLWriter writer) throws java.io.IOException;
-
+
//
// Ephemeral objects are destroyed when discard their changes
//
@@ -40,7 +41,7 @@ public abstract class TreeNode extends TreeNodeBase
{
assert false;
}
-
+
TreeNode(TreeNode parent, String id)
{
super(parent, id);
@@ -97,33 +98,29 @@ public abstract class TreeNode extends TreeNodeBase
return new String[]{name, value};
}
- static void writeVariables(XMLWriter writer,
- java.util.Map variables)
+ static void writeVariables(XMLWriter writer, java.util.Map<String, String> variables)
throws java.io.IOException
{
- java.util.Iterator p = variables.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, String> p : variables.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
-
- java.util.List attributes = new java.util.LinkedList();
- attributes.add(createAttribute("name", entry.getKey().toString()));
- attributes.add(createAttribute("value", entry.getValue().toString()));
+ java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
+ attributes.add(createAttribute("name", p.getKey()));
+ attributes.add(createAttribute("value", p.getValue()));
writer.writeElement("variable", attributes);
}
}
- static void writePropertySet(XMLWriter writer, PropertySetDescriptor psd,
- java.util.List adapters, String[] logs)
+ static void writePropertySet(XMLWriter writer, PropertySetDescriptor psd,
+ java.util.List<AdapterDescriptor> adapters, String[] logs)
throws java.io.IOException
{
writePropertySet(writer, "", "", psd, adapters, logs);
}
static void writePropertySet(XMLWriter writer, String id, String idAttrName,
- PropertySetDescriptor psd,
- java.util.List adapters, String[] logs)
+ PropertySetDescriptor psd,
+ java.util.List<AdapterDescriptor> adapters, String[] logs)
throws java.io.IOException
{
if(id.length() == 0 && psd.references.length == 0 && psd.properties.size() == 0)
@@ -135,41 +132,35 @@ public abstract class TreeNode extends TreeNodeBase
// We don't show the .Endpoint of adapters,
// since they already appear in the Adapter descriptors
//
- java.util.Set hiddenPropertyNames = new java.util.HashSet();
- java.util.Set hiddenPropertyValues = new java.util.HashSet();
+ java.util.Set<String> hiddenPropertyNames = new java.util.HashSet<String>();
+ java.util.Set<String> hiddenPropertyValues = new java.util.HashSet<String>();
if(adapters != null)
{
- java.util.Iterator p = adapters.iterator();
- while(p.hasNext())
+ for(AdapterDescriptor p : adapters)
{
- AdapterDescriptor ad = (AdapterDescriptor)p.next();
- hiddenPropertyNames.add(ad.name + ".Endpoints");
+ hiddenPropertyNames.add(p.name + ".Endpoints");
- java.util.Iterator q = ad.objects.iterator();
- while(q.hasNext())
+ for(ObjectDescriptor q : p.objects)
{
- ObjectDescriptor od = (ObjectDescriptor)q.next();
- hiddenPropertyValues.add(Ice.Util.identityToString(od.id));
+ hiddenPropertyValues.add(Ice.Util.identityToString(q.id));
}
- q = ad.allocatables.iterator();
- while(q.hasNext())
+ for(ObjectDescriptor q : p.allocatables)
{
- ObjectDescriptor od = (ObjectDescriptor)q.next();
- hiddenPropertyValues.add(Ice.Util.identityToString(od.id));
+ hiddenPropertyValues.add(Ice.Util.identityToString(q.id));
}
}
}
if(logs != null)
{
- for(int i = 0; i < logs.length; ++i)
+ for(String log : logs)
{
- hiddenPropertyValues.add(logs[i]);
+ hiddenPropertyValues.add(log);
}
}
- java.util.List attributes = new java.util.LinkedList();
+ java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
if(id.length() > 0)
{
attributes.add(createAttribute(idAttrName, id));
@@ -181,34 +172,32 @@ public abstract class TreeNode extends TreeNodeBase
else
{
writer.writeStartTag("properties", attributes);
-
- for(int i = 0; i < psd.references.length; ++i)
+
+ for(String ref : psd.references)
{
attributes.clear();
- attributes.add(createAttribute("refid", psd.references[i]));
+ attributes.add(createAttribute("refid", ref));
writer.writeElement("properties", attributes);
}
-
- java.util.Iterator p = psd.properties.iterator();
- while(p.hasNext())
+
+ for(PropertyDescriptor p : psd.properties)
{
- PropertyDescriptor pd = (PropertyDescriptor)p.next();
- if(hiddenPropertyNames.contains(pd.name))
+ if(hiddenPropertyNames.contains(p.name))
{
//
// We hide only the first occurence
//
- hiddenPropertyNames.remove(pd.name);
+ hiddenPropertyNames.remove(p.name);
}
- else if(hiddenPropertyValues.contains(pd.value))
+ else if(hiddenPropertyValues.contains(p.value))
{
- hiddenPropertyValues.remove(pd.value);
+ hiddenPropertyValues.remove(p.value);
}
else
{
attributes.clear();
- attributes.add(createAttribute("name", pd.name));
- attributes.add(createAttribute("value", pd.value));
+ attributes.add(createAttribute("name", p.name));
+ attributes.add(createAttribute("value", p.value));
writer.writeElement("property", attributes);
}
}
@@ -216,14 +205,14 @@ public abstract class TreeNode extends TreeNodeBase
}
}
- static void writeLogs(XMLWriter writer, String[] logs, java.util.List properties)
+ static void writeLogs(XMLWriter writer, String[] logs, java.util.List<PropertyDescriptor> properties)
throws java.io.IOException
{
- for(int i = 0; i < logs.length; ++i)
+ for(String log : logs)
{
- java.util.List attributes = new java.util.LinkedList();
- attributes.add(createAttribute("path", logs[i]));
- String prop = lookupName(logs[i], properties);
+ java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
+ attributes.add(createAttribute("path", log));
+ String prop = lookupName(log, properties);
if(prop != null)
{
attributes.add(createAttribute("property", prop));
@@ -232,30 +221,26 @@ public abstract class TreeNode extends TreeNodeBase
}
}
- static String lookupName(String val, java.util.List properties)
+ static String lookupName(String val, java.util.List<PropertyDescriptor> properties)
{
- java.util.Iterator p = properties.iterator();
- while(p.hasNext())
+ for(PropertyDescriptor p : properties)
{
- PropertyDescriptor pd = (PropertyDescriptor)p.next();
- if(pd.value.equals(val))
+ if(p.value.equals(val))
{
- return pd.name;
+ return p.name;
}
}
return null;
}
-
- static void writeDistribution(XMLWriter writer,
- DistributionDescriptor descriptor)
+ static void writeDistribution(XMLWriter writer, DistributionDescriptor descriptor)
throws java.io.IOException
{
if(descriptor.icepatch.length() > 0)
{
- java.util.List attributes = new java.util.LinkedList();
+ java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
attributes.add(createAttribute("icepatch", descriptor.icepatch));
-
+
if(descriptor.directories.isEmpty())
{
writer.writeElement("distrib", attributes);
@@ -263,30 +248,27 @@ public abstract class TreeNode extends TreeNodeBase
else
{
writer.writeStartTag("distrib", attributes);
- java.util.Iterator p = descriptor.directories.iterator();
- while(p.hasNext())
+ for(String p : descriptor.directories)
{
- writer.writeElement("directory", p.next().toString());
+ writer.writeElement("directory", p);
}
writer.writeEndTag("distrib");
}
}
}
-
- static void writeObjects(String elt, XMLWriter writer, java.util.List objects,
- java.util.List properties)
+
+ static void writeObjects(String elt, XMLWriter writer, java.util.List<ObjectDescriptor> objects,
+ java.util.List<PropertyDescriptor> properties)
throws java.io.IOException
{
- java.util.Iterator p = objects.iterator();
- while(p.hasNext())
+ for(ObjectDescriptor p : objects)
{
- ObjectDescriptor od = (ObjectDescriptor)p.next();
- java.util.List attributes = new java.util.LinkedList();
- String strId = Ice.Util.identityToString(od.id);
+ java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
+ String strId = Ice.Util.identityToString(p.id);
attributes.add(createAttribute("identity", strId));
- if(od.type.length() > 0)
+ if(p.type.length() > 0)
{
- attributes.add(createAttribute("type", od.type));
+ attributes.add(createAttribute("type", p.type));
}
if(properties != null)
{
@@ -296,22 +278,20 @@ public abstract class TreeNode extends TreeNodeBase
attributes.add(createAttribute("property", prop));
}
}
-
+
writer.writeElement(elt, attributes);
}
- }
+ }
- static void writeParameters(XMLWriter writer, java.util.List parameters,
- java.util.Map defaultValues)
+ static void writeParameters(XMLWriter writer, java.util.List<String> parameters,
+ java.util.Map<String, String> defaultValues)
throws java.io.IOException
{
- java.util.Iterator p = new java.util.LinkedHashSet(parameters).iterator();
- while(p.hasNext())
+ for(String p : new java.util.LinkedHashSet<String>(parameters))
{
- String parameter = (String)p.next();
- String val = (String)defaultValues.get(parameter);
- java.util.List attributes = new java.util.LinkedList();
- attributes.add(createAttribute("name", parameter));
+ String val = defaultValues.get(p);
+ java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
+ attributes.add(createAttribute("name", p));
if(val != null)
{
attributes.add(createAttribute("default", val));
@@ -320,23 +300,20 @@ public abstract class TreeNode extends TreeNodeBase
}
}
- static java.util.LinkedList
- parameterValuesToAttributes(java.util.Map parameterValues,
- java.util.List parameters)
+ static java.util.LinkedList<String[]>
+ parameterValuesToAttributes(java.util.Map<String, String> parameterValues, java.util.List<String> parameters)
{
- java.util.LinkedList result = new java.util.LinkedList();
+ java.util.LinkedList<String[]> result = new java.util.LinkedList<String[]>();
//
// We use a LinkedHashSet to maintain order while eliminating duplicates
//
- java.util.Iterator p = new java.util.LinkedHashSet(parameters).iterator();
- while(p.hasNext())
+ for(String p : new java.util.LinkedHashSet<String>(parameters))
{
- String param = (String)p.next();
- String val = (String)parameterValues.get(param);
+ String val = parameterValues.get(p);
if(val != null)
{
- result.add(createAttribute(param, val));
+ result.add(createAttribute(p, val));
}
}
return result;
@@ -358,7 +335,7 @@ public abstract class TreeNode extends TreeNodeBase
public static final int NEW_TEMPLATE_SERVER = 10;
public static final int NEW_TEMPLATE_SERVER_ICEBOX = 11;
public static final int NEW_TEMPLATE_SERVICE = 12;
-
+
public static final int COPY = 13;
public static final int PASTE = 14;
public static final int DELETE = 15;
diff --git a/java/src/IceGridGUI/Application/UpdateFailedException.java b/java/src/IceGridGUI/Application/UpdateFailedException.java
index b5de23be3c8..a1b2243b0c6 100644
--- a/java/src/IceGridGUI/Application/UpdateFailedException.java
+++ b/java/src/IceGridGUI/Application/UpdateFailedException.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
public class UpdateFailedException extends Exception
@@ -15,12 +16,12 @@ public class UpdateFailedException extends Exception
_parent = parent;
_id = id;
}
-
+
public String toString()
{
return _parent.getFullId().toString() + " has already a child with '" + _id + "' as ID.";
}
-
+
private TreeNode _parent;
private String _id;
}
diff --git a/java/src/IceGridGUI/ApplicationActions.java b/java/src/IceGridGUI/ApplicationActions.java
index eba5fedc70a..50ea44664f1 100644
--- a/java/src/IceGridGUI/ApplicationActions.java
+++ b/java/src/IceGridGUI/ApplicationActions.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import java.awt.Toolkit;
@@ -28,7 +29,7 @@ public class ApplicationActions
{
return _array[index];
}
-
+
public boolean[] setTarget(TreeNode target)
{
_target = target;
@@ -39,7 +40,7 @@ public class ApplicationActions
availableActions = new boolean[TreeNode.ACTION_COUNT];
}
else
- {
+ {
availableActions = _target.getAvailableActions();
}
@@ -55,10 +56,9 @@ public class ApplicationActions
{
final int MENU_MASK = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
- _array[TreeNode.NEW_ADAPTER] = new AbstractAction(
- popup ? "New Adapter" : "Adapter")
+ _array[TreeNode.NEW_ADAPTER] = new AbstractAction(popup ? "New Adapter" : "Adapter")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(apply(_target))
{
@@ -67,10 +67,9 @@ public class ApplicationActions
}
};
- _array[TreeNode.NEW_DBENV] = new AbstractAction(
- popup ? "New Database Environment" : "Database Environment")
+ _array[TreeNode.NEW_DBENV] = new AbstractAction(popup ? "New Database Environment" : "Database Environment")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(apply(_target))
{
@@ -78,11 +77,10 @@ public class ApplicationActions
}
}
};
-
- _array[TreeNode.NEW_NODE] = new AbstractAction(
- popup ? "New Node" : "Node")
+
+ _array[TreeNode.NEW_NODE] = new AbstractAction(popup ? "New Node" : "Node")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(apply(_target))
{
@@ -91,10 +89,9 @@ public class ApplicationActions
}
};
- _array[TreeNode.NEW_PROPERTY_SET] = new AbstractAction(
- popup ? "New Property Set" : "Property Set")
+ _array[TreeNode.NEW_PROPERTY_SET] = new AbstractAction(popup ? "New Property Set" : "Property Set")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(apply(_target))
{
@@ -103,10 +100,9 @@ public class ApplicationActions
}
};
- _array[TreeNode.NEW_REPLICA_GROUP] = new AbstractAction(
- popup ? "New Replica Group" : "Replica Group" )
+ _array[TreeNode.NEW_REPLICA_GROUP] = new AbstractAction(popup ? "New Replica Group" : "Replica Group" )
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(apply(_target))
{
@@ -115,10 +111,9 @@ public class ApplicationActions
}
};
- _array[TreeNode.NEW_SERVER] = new AbstractAction(
- popup ? "New Server" : "Server")
+ _array[TreeNode.NEW_SERVER] = new AbstractAction(popup ? "New Server" : "Server")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(apply(_target))
{
@@ -127,10 +122,9 @@ public class ApplicationActions
}
};
- _array[TreeNode.NEW_SERVER_ICEBOX] = new AbstractAction(
- popup ? "New IceBox Server" : "IceBox Server")
+ _array[TreeNode.NEW_SERVER_ICEBOX] = new AbstractAction(popup ? "New IceBox Server" : "IceBox Server")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(apply(_target))
{
@@ -142,7 +136,7 @@ public class ApplicationActions
_array[TreeNode.NEW_SERVER_FROM_TEMPLATE] = new AbstractAction(
popup ? "New Server from Template" : "Server from Template")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(apply(_target))
{
@@ -152,10 +146,9 @@ public class ApplicationActions
};
- _array[TreeNode.NEW_SERVICE] = new AbstractAction(
- popup ? "New Service" : "Service")
+ _array[TreeNode.NEW_SERVICE] = new AbstractAction(popup ? "New Service" : "Service")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(apply(_target))
{
@@ -167,7 +160,7 @@ public class ApplicationActions
_array[TreeNode.NEW_SERVICE_FROM_TEMPLATE] = new AbstractAction(
popup ? "New Service from Template" : "Service from Template")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(apply(_target))
{
@@ -176,10 +169,9 @@ public class ApplicationActions
}
};
- _array[TreeNode.NEW_TEMPLATE_SERVER] = new AbstractAction(
- popup ? "New Server Template" : "Server Template")
+ _array[TreeNode.NEW_TEMPLATE_SERVER] = new AbstractAction(popup ? "New Server Template" : "Server Template")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(apply(_target))
{
@@ -187,11 +179,11 @@ public class ApplicationActions
}
}
};
-
+
_array[TreeNode.NEW_TEMPLATE_SERVER_ICEBOX] = new AbstractAction(
popup ? "New IceBox Server Template" : "IceBox Server Template")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(apply(_target))
{
@@ -201,10 +193,9 @@ public class ApplicationActions
};
- _array[TreeNode.NEW_TEMPLATE_SERVICE] = new AbstractAction(
- popup ? "New Service Template" : "Service Template")
+ _array[TreeNode.NEW_TEMPLATE_SERVICE] = new AbstractAction(popup ? "New Service Template" : "Service Template")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(apply(_target))
{
@@ -212,18 +203,18 @@ public class ApplicationActions
}
}
};
-
+
_array[TreeNode.COPY] = new AbstractAction("Copy")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.copy();
}
};
-
+
_array[TreeNode.PASTE] = new AbstractAction("Paste")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(apply(_target))
{
@@ -231,45 +222,43 @@ public class ApplicationActions
}
}
};
-
+
_array[TreeNode.DELETE] = new AbstractAction("Delete")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.delete();
}
};
- _array[TreeNode.SHOW_VARS] = new
- AbstractAction("Show Variables")
+ _array[TreeNode.SHOW_VARS] = new AbstractAction("Show Variables")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.getCoordinator().showVars();
}
};
+
_array[TreeNode.SHOW_VARS].putValue(
- Action.SHORT_DESCRIPTION,
+ Action.SHORT_DESCRIPTION,
"Show variables and parameters in the Properties pane");
-
- _array[TreeNode.SUBSTITUTE_VARS] = new
+ _array[TreeNode.SUBSTITUTE_VARS] = new
AbstractAction("Substitute Variables")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.getCoordinator().substituteVars();
}
};
-
+
_array[TreeNode.SUBSTITUTE_VARS].putValue(
- Action.SHORT_DESCRIPTION,
+ Action.SHORT_DESCRIPTION,
"Substitute variables and parameters with their values in the Properties pane");
-
_array[TreeNode.MOVE_UP] = new AbstractAction("Move Up")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(apply(_target))
{
@@ -277,10 +266,10 @@ public class ApplicationActions
}
}
};
-
+
_array[TreeNode.MOVE_DOWN] = new AbstractAction("Move Down")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(apply(_target))
{
@@ -293,8 +282,7 @@ public class ApplicationActions
static private boolean apply(TreeNode target)
{
return target.getRoot().getPane().applyUpdates(false);
- }
-
+ }
private TreeNode _target;
private Action[] _array = new Action[TreeNode.ACTION_COUNT];
diff --git a/java/src/IceGridGUI/ApplicationObserverI.java b/java/src/IceGridGUI/ApplicationObserverI.java
index d282745e6fe..7d5c1e93dd2 100644
--- a/java/src/IceGridGUI/ApplicationObserverI.java
+++ b/java/src/IceGridGUI/ApplicationObserverI.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import javax.swing.SwingUtilities;
@@ -13,7 +14,6 @@ import IceGrid.*;
class ApplicationObserverI extends _ApplicationObserverDisp
{
-
ApplicationObserverI(String instanceName, Coordinator coordinator)
{
_instanceName = instanceName;
@@ -39,7 +39,7 @@ class ApplicationObserverI extends _ApplicationObserverDisp
}
catch(InterruptedException e)
{
- }
+ }
}
if(_initialized)
@@ -52,24 +52,23 @@ class ApplicationObserverI extends _ApplicationObserverDisp
}
}
- public synchronized void applicationInit(int serial, java.util.List applications, Ice.Current current)
+ public synchronized void applicationInit(int serial, java.util.List<ApplicationInfo> applications,
+ Ice.Current current)
{
if(_trace)
{
if(applications.size() == 0)
{
- _coordinator.traceObserver("applicationInit (no application);"
- + "serial is " + serial);
+ _coordinator.traceObserver("applicationInit (no application);" + "serial is " + serial);
}
else
{
String names = "";
- java.util.Iterator p = applications.iterator();
- while(p.hasNext())
+ for(ApplicationInfo p : applications)
{
- names += " " + ((ApplicationInfo)p.next()).descriptor.name;
+ names += " " + p.descriptor.name;
}
-
+
_coordinator.traceObserver("applicationInit for application"
+ (applications.size() == 1 ? "" : "s")
+ names
@@ -85,8 +84,7 @@ class ApplicationObserverI extends _ApplicationObserverDisp
notify();
}
- public void applicationAdded(final int serial, final ApplicationInfo info,
- Ice.Current current)
+ public void applicationAdded(final int serial, final ApplicationInfo info, Ice.Current current)
{
if(_trace)
{
@@ -95,17 +93,16 @@ class ApplicationObserverI extends _ApplicationObserverDisp
+ "; serial is " + serial);
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.applicationAdded(serial, info);
}
});
}
- public void applicationRemoved(final int serial, final String name,
- final Ice.Current current)
+ public void applicationRemoved(final int serial, final String name, final Ice.Current current)
{
if(_trace)
{
@@ -114,17 +111,16 @@ class ApplicationObserverI extends _ApplicationObserverDisp
+ "; serial is " + serial);
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.applicationRemoved(serial, name);
}
});
}
- public void applicationUpdated(final int serial, final ApplicationUpdateInfo info,
- Ice.Current current)
+ public void applicationUpdated(final int serial, final ApplicationUpdateInfo info, Ice.Current current)
{
if(_trace)
{
@@ -133,9 +129,9 @@ class ApplicationObserverI extends _ApplicationObserverDisp
+ "; serial is " + serial);
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.applicationUpdated(serial, info);
}
@@ -144,13 +140,13 @@ class ApplicationObserverI extends _ApplicationObserverDisp
private final Coordinator _coordinator;
private final boolean _trace;
-
+
private boolean _initialized = false;
-
+
//
// Values given to init
//
private final String _instanceName;
private int _serial;
- private java.util.List _applications;
-};
+ private java.util.List<ApplicationInfo> _applications;
+}
diff --git a/java/src/IceGridGUI/ApplicationPane.java b/java/src/IceGridGUI/ApplicationPane.java
index 4a01b91efd7..f2d987d7349 100644
--- a/java/src/IceGridGUI/ApplicationPane.java
+++ b/java/src/IceGridGUI/ApplicationPane.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import java.awt.*;
@@ -43,14 +44,15 @@ public class ApplicationPane extends JSplitPane implements Tab
super.updateUI();
setEmptyDividerBorder();
}
-
+
public void selected()
{
Coordinator c = _root.getCoordinator();
c.getCloseApplicationAction().setEnabled(true);
- c.getSaveAction().setEnabled(_root.needsSaving() && (_root.isLive() && c.connectedToMaster() || _root.hasFile()));
+ c.getSaveAction().setEnabled(_root.needsSaving() && (_root.isLive() && c.connectedToMaster() ||
+ _root.hasFile()));
c.getDiscardUpdatesAction().setEnabled(_root.needsSaving() && (_root.isLive() || _root.hasFile()));
if(_root.isLive())
@@ -63,7 +65,6 @@ public class ApplicationPane extends JSplitPane implements Tab
}
c.getSaveToFileAction().setEnabled(true);
-
c.getBackAction().setEnabled(_previousNodes.size() > 0);
c.getForwardAction().setEnabled(_nextNodes.size() > 0);
c.showActions(_currentNode);
@@ -87,11 +88,10 @@ public class ApplicationPane extends JSplitPane implements Tab
public void showNode(TreeNodeBase node)
{
TreeNode newNode = (TreeNode)node;
-
+
if(newNode != _currentNode)
{
- if(_currentNode != null
- && _currentNode.isEphemeral() && _root.hasNode(_currentNode))
+ if(_currentNode != null && _currentNode.isEphemeral() && _root.hasNode(_currentNode))
{
_currentNode.destroy();
_currentNode = null;
@@ -112,7 +112,7 @@ public class ApplicationPane extends JSplitPane implements Tab
_previousNodes.removeFirst();
}
_root.getCoordinator().getBackAction().setEnabled(true);
- }
+ }
_nextNodes.clear();
_root.getCoordinator().getForwardAction().setEnabled(false);
_currentNode = newNode;
@@ -145,10 +145,9 @@ public class ApplicationPane extends JSplitPane implements Tab
TreeNode previousNode = null;
do
{
- previousNode = (TreeNode)_previousNodes.removeLast();
- } while(_previousNodes.size() > 0
- && (previousNode == _currentNode || !_root.hasNode(previousNode)));
-
+ previousNode = _previousNodes.removeLast();
+ } while(_previousNodes.size() > 0 && (previousNode == _currentNode || !_root.hasNode(previousNode)));
+
if(_previousNodes.size() == 0)
{
_root.getCoordinator().getBackAction().setEnabled(false);
@@ -161,7 +160,7 @@ public class ApplicationPane extends JSplitPane implements Tab
_nextNodes.addFirst(_currentNode);
_root.getCoordinator().getForwardAction().setEnabled(true);
}
-
+
_currentNode = previousNode;
_root.disableSelectionListener();
_root.setSelectedNode(_currentNode);
@@ -180,10 +179,9 @@ public class ApplicationPane extends JSplitPane implements Tab
TreeNode nextNode = null;
do
{
- nextNode = (TreeNode)_nextNodes.removeFirst();
- } while(_nextNodes.size() > 0
- && (nextNode == _currentNode || !_root.hasNode(nextNode)));
-
+ nextNode = _nextNodes.removeFirst();
+ } while(_nextNodes.size() > 0 && (nextNode == _currentNode || !_root.hasNode(nextNode)));
+
if(_nextNodes.size() == 0)
{
_root.getCoordinator().getForwardAction().setEnabled(false);
@@ -196,7 +194,7 @@ public class ApplicationPane extends JSplitPane implements Tab
_previousNodes.add(_currentNode);
_root.getCoordinator().getBackAction().setEnabled(true);
}
-
+
_currentNode = nextNode;
_root.disableSelectionListener();
_root.setSelectedNode(_currentNode);
@@ -227,7 +225,7 @@ public class ApplicationPane extends JSplitPane implements Tab
_root = newRoot;
_root.setPane(this);
-
+
//
// Tree display
//
@@ -241,16 +239,15 @@ public class ApplicationPane extends JSplitPane implements Tab
ToolTipManager.sharedInstance().registerComponent(tree);
tree.addMouseListener(popupListener);
- tree.getSelectionModel().setSelectionMode
- (TreeSelectionModel.SINGLE_TREE_SELECTION);
+ tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.addTreeSelectionListener(new SelectionListener());
tree.setRootVisible(true);
- JScrollPane leftScroll =
+ JScrollPane leftScroll =
new JScrollPane(tree,
- JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
leftScroll.setBorder(Borders.EMPTY_BORDER);
@@ -271,6 +268,7 @@ public class ApplicationPane extends JSplitPane implements Tab
_root.save();
}
}
+
public void saveToRegistry()
{
if(_currentEditor == null || _currentEditor.save(true))
@@ -278,6 +276,7 @@ public class ApplicationPane extends JSplitPane implements Tab
_root.saveToRegistry();
}
}
+
public void saveToFile()
{
if(_currentEditor == null || _currentEditor.save(true))
@@ -285,10 +284,12 @@ public class ApplicationPane extends JSplitPane implements Tab
_root.saveToFile();
}
}
+
public void discardUpdates()
{
_root.discardUpdates();
}
+
public boolean close()
{
_root.getCoordinator().getMainPane().remove(this);
@@ -318,19 +319,18 @@ public class ApplicationPane extends JSplitPane implements Tab
am.put((String)action.getValue(Action.NAME), action);
}
-
ApplicationPane(Root root)
{
super(JSplitPane.HORIZONTAL_SPLIT, true);
setBorder(new EmptyBorder(10, 10, 10, 10));
-
+
_leftPane = new SimpleInternalFrame("Descriptors");
_leftPane.setPreferredSize(new Dimension(280, 350));
Coordinator c = root.getCoordinator();
registerAction(c, TreeNode.COPY);
registerAction(c, TreeNode.PASTE);
registerAction(c, TreeNode.DELETE);
-
+
//
// Right pane
//
@@ -340,7 +340,7 @@ public class ApplicationPane extends JSplitPane implements Tab
setRightComponent(_propertiesFrame);
setRoot(root);
- }
+ }
private void showCurrentNode()
{
@@ -369,11 +369,10 @@ public class ApplicationPane extends JSplitPane implements Tab
_propertiesFrame.repaint();
}
-
private void setEmptyDividerBorder()
{
SplitPaneUI splitPaneUI = getUI();
- if(splitPaneUI instanceof BasicSplitPaneUI)
+ if(splitPaneUI instanceof BasicSplitPaneUI)
{
BasicSplitPaneUI basicUI = (BasicSplitPaneUI)splitPaneUI;
basicUI.getDivider().setBorder(BorderFactory.createEmptyBorder());
@@ -382,24 +381,24 @@ public class ApplicationPane extends JSplitPane implements Tab
private class PopupListener extends MouseAdapter
{
- public void mousePressed(MouseEvent e)
+ public void mousePressed(MouseEvent e)
{
maybeShowPopup(e);
}
- public void mouseReleased(MouseEvent e)
+ public void mouseReleased(MouseEvent e)
{
maybeShowPopup(e);
}
- private void maybeShowPopup(MouseEvent e)
+ private void maybeShowPopup(MouseEvent e)
{
- if (e.isPopupTrigger())
+ if (e.isPopupTrigger())
{
JTree tree = (JTree)e.getComponent();
TreePath path = tree.getPathForLocation(e.getX(), e.getY());
-
+
if(path != null)
{
TreeNode node = (TreeNode)path.getLastPathComponent();
@@ -413,7 +412,6 @@ public class ApplicationPane extends JSplitPane implements Tab
}
}
-
private class SelectionListener implements TreeSelectionListener
{
public void valueChanged(TreeSelectionEvent e)
@@ -437,7 +435,7 @@ public class ApplicationPane extends JSplitPane implements Tab
if(e.isAddedPath())
{
TreePath path = e.getPath();
-
+
if(path == null)
{
showNode(null);
@@ -477,8 +475,8 @@ public class ApplicationPane extends JSplitPane implements Tab
//
// back/forward navigation
//
- private java.util.LinkedList _previousNodes = new java.util.LinkedList();
- private java.util.LinkedList _nextNodes = new java.util.LinkedList();
+ private java.util.LinkedList<TreeNode> _previousNodes = new java.util.LinkedList<TreeNode>();
+ private java.util.LinkedList<TreeNode> _nextNodes = new java.util.LinkedList<TreeNode>();
private TreeNode _currentNode;
private Editor _currentEditor;
diff --git a/java/src/IceGridGUI/BareBonesBrowserLaunch.java b/java/src/IceGridGUI/BareBonesBrowserLaunch.java
index f2679e4d5f8..6cfe3732c72 100644
--- a/java/src/IceGridGUI/BareBonesBrowserLaunch.java
+++ b/java/src/IceGridGUI/BareBonesBrowserLaunch.java
@@ -50,5 +50,5 @@ public class BareBonesBrowserLaunch {
catch (Exception e) {
JOptionPane.showMessageDialog(null, errMsg + ":\n" + e.getLocalizedMessage());
}
- }
+ }
}
diff --git a/java/src/IceGridGUI/CellRenderer.java b/java/src/IceGridGUI/CellRenderer.java
index 8e7fa5b9dbf..dc64e48cebd 100644
--- a/java/src/IceGridGUI/CellRenderer.java
+++ b/java/src/IceGridGUI/CellRenderer.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import java.awt.Component;
@@ -22,16 +23,14 @@ class CellRenderer implements TreeCellRenderer
boolean expanded,
boolean leaf,
int row,
- boolean hasFocus)
+ boolean hasFocus)
{
TreeCellRenderer node = (TreeCellRenderer)value;
- Component result = node.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ Component result = node.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
if(result == null)
{
- result = _defaultRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ result = _defaultRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
return result;
}
diff --git a/java/src/IceGridGUI/Coordinator.java b/java/src/IceGridGUI/Coordinator.java
index 010a755984f..c38c134b8e7 100644
--- a/java/src/IceGridGUI/Coordinator.java
+++ b/java/src/IceGridGUI/Coordinator.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import java.util.prefs.Preferences;
@@ -117,7 +118,7 @@ public class Coordinator
setEnabled(false);
}
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(_target != null)
{
@@ -131,10 +132,9 @@ public class Coordinator
// The only property we're interested in is isEnabled
//
- java.beans.PropertyChangeListener[] l = getPropertyChangeListeners();
- for(int i = 0; i < l.length; ++i)
+ for(java.beans.PropertyChangeListener l : getPropertyChangeListeners())
{
- l[i].propertyChange(e);
+ l.propertyChange(e);
}
}
@@ -174,14 +174,14 @@ public class Coordinator
super(name);
}
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(_target != null)
{
Action a = _target.getActionMap().get("delete-next");
if(a != null)
{
- a.actionPerformed(new ActionEvent(_target, ActionEvent.ACTION_PERFORMED, null));
+ a.actionPerformed(new ActionEvent(_target, ActionEvent.ACTION_PERFORMED, null));
}
}
}
@@ -192,12 +192,11 @@ public class Coordinator
}
private JTextComponent _target;
-
}
- private class FocusListener implements java.beans.PropertyChangeListener
- {
- public void propertyChange(java.beans.PropertyChangeEvent e)
+ private class FocusListener implements java.beans.PropertyChangeListener
+ {
+ public void propertyChange(java.beans.PropertyChangeEvent e)
{
Object o = e.getNewValue();
if(o == null)
@@ -250,7 +249,7 @@ public class Coordinator
private void enableTextEditActions(JTextComponent target)
{
boolean editable = target.isEditable() && target.isEnabled();
-
+
_cutText.setEnabled(editable);
_copyText.setEnabled(true);
_pasteText.setEnabled(editable);
@@ -282,7 +281,6 @@ public class Coordinator
}
}
-
private class MenuBar extends JMenuBar
{
private MenuBar()
@@ -292,7 +290,7 @@ public class Coordinator
//
// File menu
- //
+ //
JMenu fileMenu = new JMenu("File");
fileMenu.setMnemonic(java.awt.event.KeyEvent.VK_F);
add(fileMenu);
@@ -311,7 +309,6 @@ public class Coordinator
_newMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_NODE));
_newMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_PROPERTY_SET));
_newMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_REPLICA_GROUP));
-
//
// Open sub-menu
@@ -319,7 +316,6 @@ public class Coordinator
JMenu openMenu = new JMenu("Open");
openMenu.add(_openApplicationFromFile);
openMenu.add(_openApplicationFromRegistry);
-
//
// New server sub-sub-menu
@@ -330,7 +326,6 @@ public class Coordinator
_newServerMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_SERVER));
_newServerMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_SERVER_ICEBOX));
_newServerMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_SERVER_FROM_TEMPLATE));
-
//
// New service sub-sub-menu
@@ -350,7 +345,7 @@ public class Coordinator
_newTemplateMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER));
_newTemplateMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER_ICEBOX));
_newTemplateMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVICE));
-
+
fileMenu.addSeparator();
fileMenu.add(_login);
fileMenu.add(_logout);
@@ -370,7 +365,7 @@ public class Coordinator
fileMenu.addSeparator();
fileMenu.add(_exit);
}
-
+
//
// Edit menu
//
@@ -404,7 +399,7 @@ public class Coordinator
JMenu toolsMenu = new JMenu("Tools");
toolsMenu.setMnemonic(java.awt.event.KeyEvent.VK_T);
add(toolsMenu);
-
+
//
// Application sub-menu
//
@@ -416,7 +411,7 @@ public class Coordinator
_appMenu.addSeparator();
_appMenu.add(_removeApplicationFromRegistry);
_appMenu.setEnabled(false);
-
+
//
// Node sub-menu
//
@@ -427,7 +422,7 @@ public class Coordinator
_nodeMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDERR));
_nodeMenu.addSeparator();
_nodeMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_NODE));
-
+
//
// Registry sub-menu
//
@@ -453,17 +448,12 @@ public class Coordinator
_serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.ENABLE));
_serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.DISABLE));
_serverMenu.addSeparator();
- _serverMenu.add(_liveActionsForMenu.get(
- IceGridGUI.LiveDeployment.TreeNode.PATCH_SERVER));
+ _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.PATCH_SERVER));
_serverMenu.addSeparator();
- _serverMenu.add(_liveActionsForMenu.get(
- IceGridGUI.LiveDeployment.TreeNode.WRITE_MESSAGE));
- _serverMenu.add(_liveActionsForMenu.get(
- IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDOUT));
- _serverMenu.add(_liveActionsForMenu.get(
- IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDERR));
- _serverMenu.add(_liveActionsForMenu.get(
- IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG));
+ _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.WRITE_MESSAGE));
+ _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDOUT));
+ _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDERR));
+ _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG));
_serverMenu.addSeparator();
_signalMenu = new JMenu("Send Signal");
_serverMenu.add(_signalMenu);
@@ -475,9 +465,8 @@ public class Coordinator
_signalMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SIGUSR2));
_signalMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SIGTERM));
_serverMenu.addSeparator();
- _serverMenu.add(_liveActionsForMenu.get(
- IceGridGUI.LiveDeployment.TreeNode.OPEN_DEFINITION));
-
+ _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.OPEN_DEFINITION));
+
//
// Service sub-menu
//
@@ -497,12 +486,12 @@ public class Coordinator
add(helpMenu);
helpMenu.add(_helpContents);
-
+
helpMenu.addSeparator();
helpMenu.add(_about);
}
}
-
+
private class ToolBar extends JToolBar
{
private ToolBar()
@@ -522,7 +511,7 @@ public class Coordinator
add(button);
addSeparator();
-
+
button = new JButton(_back);
button.setText(null);
button.setIcon(Utils.getIcon("/icons/24x24/back.png"));
@@ -533,7 +522,7 @@ public class Coordinator
add(button);
addSeparator();
-
+
button = new JButton(_openApplicationFromRegistry);
button.setText(null);
button.setIcon(Utils.getIcon("/icons/24x24/open_from_registry.png"));
@@ -583,7 +572,7 @@ public class Coordinator
add(_substituteTool);
}
}
-
+
static private class ReuseConnectionRouter extends Ice._RouterDisp
{
public
@@ -617,13 +606,13 @@ public class Coordinator
}
private final Ice.ObjectPrx _clientProxy;
- };
+ }
public Ice.Communicator getCommunicator()
{
if(_communicator == null)
{
- _communicator = Ice.Util.initialize(_initData);
+ _communicator = Ice.Util.initialize(_initData);
}
return _communicator;
}
@@ -637,7 +626,7 @@ public class Coordinator
{
return (Tab)_mainPane.getSelectedComponent();
}
-
+
public Action getBackAction()
{
return _back;
@@ -672,17 +661,16 @@ public class Coordinator
{
return _discardUpdates;
}
-
+
//
// Open live application and select application tab
//
public ApplicationPane openLiveApplication(String applicationName)
{
- ApplicationPane app = (ApplicationPane)_liveApplications.get(applicationName);
+ ApplicationPane app = _liveApplications.get(applicationName);
if(app == null)
{
- ApplicationDescriptor desc =
- _liveDeploymentRoot.getApplicationDescriptor(applicationName);
+ ApplicationDescriptor desc = _liveDeploymentRoot.getApplicationDescriptor(applicationName);
if(desc == null)
{
JOptionPane.showMessageDialog(
@@ -710,7 +698,7 @@ public class Coordinator
JOptionPane.ERROR_MESSAGE);
return null;
}
-
+
app = new ApplicationPane(root);
_mainPane.addApplication(app);
_liveApplications.put(applicationName, app);
@@ -718,12 +706,12 @@ public class Coordinator
_mainPane.setSelectedComponent(app);
return app;
}
-
+
public void removeLiveApplication(String name)
{
_liveApplications.remove(name);
}
-
+
public void addLiveApplication(IceGridGUI.Application.Root root)
{
ApplicationPane app = _mainPane.findApplication(root);
@@ -733,20 +721,18 @@ public class Coordinator
public ApplicationPane getLiveApplication(String name)
{
- return (ApplicationPane)_liveApplications.get(name);
+ return _liveApplications.get(name);
}
-
//
// From the Application observer:
//
- void applicationInit(String instanceName, int serial, java.util.List applications)
- {
+ void applicationInit(String instanceName, int serial, java.util.List<ApplicationInfo> applications)
+ {
assert _latestSerial == -1;
_latestSerial = serial;
- _liveDeploymentRoot.applicationInit(instanceName,
- _sessionKeeper.getReplicaName(), applications);
+ _liveDeploymentRoot.applicationInit(instanceName, _sessionKeeper.getReplicaName(), applications);
//
// When we get this init, we can't have any live Application yet.
//
@@ -756,8 +742,7 @@ public class Coordinator
{
_liveDeploymentRoot.applicationAdded(info);
_liveDeploymentPane.refresh();
- _statusBar.setText(
- "Last update: new application '" + info.descriptor.name + "'");
+ _statusBar.setText("Last update: new application '" + info.descriptor.name + "'");
updateSerial(serial);
}
@@ -765,12 +750,10 @@ public class Coordinator
{
_liveDeploymentRoot.applicationRemoved(name);
_liveDeploymentPane.refresh();
- _statusBar.setText(
- "Last update: application '" + name + "' was removed");
+ _statusBar.setText("Last update: application '" + name + "' was removed");
+
+ ApplicationPane app = _liveApplications.get(name);
- ApplicationPane app =
- (ApplicationPane)_liveApplications.get(name);
-
if(app != null)
{
if(app.getRoot().kill())
@@ -788,9 +771,8 @@ public class Coordinator
_liveDeploymentPane.refresh();
_statusBar.setText("Last update: application '" + update.descriptor.name + "' was updated");
-
- ApplicationPane app =
- (ApplicationPane)_liveApplications.get(update.descriptor.name);
+
+ ApplicationPane app = _liveApplications.get(update.descriptor.name);
if(app != null)
{
@@ -815,20 +797,20 @@ public class Coordinator
{
_liveDeploymentRoot.adapterAdded(info);
_liveDeploymentPane.refresh();
- }
+ }
void adapterUpdated(AdapterInfo info)
{
_liveDeploymentRoot.adapterUpdated(info);
_liveDeploymentPane.refresh();
- }
+ }
void adapterRemoved(String id)
{
_liveDeploymentRoot.adapterRemoved(id);
_liveDeploymentPane.refresh();
- }
-
+ }
+
//
// From the Object observer:
//
@@ -842,25 +824,25 @@ public class Coordinator
{
_liveDeploymentRoot.objectAdded(info);
_liveDeploymentPane.refresh();
- }
+ }
void objectUpdated(ObjectInfo info)
{
_liveDeploymentRoot.objectUpdated(info);
_liveDeploymentPane.refresh();
- }
+ }
void objectRemoved(Ice.Identity id)
{
_liveDeploymentRoot.objectRemoved(id);
_liveDeploymentPane.refresh();
- }
-
+ }
+
public void accessDenied(AccessDeniedException e)
{
JOptionPane.showMessageDialog(
_mainFrame,
- "Another session (username = " + e.lockUserId
+ "Another session (username = " + e.lockUserId
+ ") has exclusive write access to the registry",
"Access Denied",
JOptionPane.ERROR_MESSAGE);
@@ -869,8 +851,7 @@ public class Coordinator
public void pasteApplication()
{
Object descriptor = getClipboard();
- ApplicationDescriptor desc =
- IceGridGUI.Application.Root.copyDescriptor((ApplicationDescriptor)descriptor);
+ ApplicationDescriptor desc = IceGridGUI.Application.Root.copyDescriptor((ApplicationDescriptor)descriptor);
IceGridGUI.Application.Root root = new IceGridGUI.Application.Root(this, desc);
ApplicationPane app = new ApplicationPane(root);
@@ -878,11 +859,11 @@ public class Coordinator
_mainPane.setSelectedComponent(app);
root.setSelectedNode(root);
}
-
+
public void removeApplicationFromRegistry(final String name)
{
_mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-
+
try
{
Runnable runnable = new Runnable()
@@ -897,7 +878,7 @@ public class Coordinator
{
release();
getStatusBar().setText(prefix + "failed!");
-
+
JOptionPane.showMessageDialog(
getMainFrame(),
message,
@@ -909,7 +890,6 @@ public class Coordinator
{
getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
boolean asyncRelease = false;
-
final String prefix = "Deleting application '" + name + "'...";
AMI_Admin_removeApplication cb = new AMI_Admin_removeApplication()
@@ -921,16 +901,16 @@ public class Coordinator
traceSaveToRegistry("removeApplication for application " + name + ": success");
}
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
{
release();
getStatusBar().setText(prefix + "done.");
}
});
}
-
+
public void ice_exception(final Ice.UserException e)
{
if(_traceSaveToRegistry)
@@ -938,17 +918,17 @@ public class Coordinator
traceSaveToRegistry("removeApplication for application " + name + ": failed");
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
- handleFailure(prefix, "Delete failed",
+ handleFailure(prefix, "Delete failed",
"IceGrid exception: " + e.toString());
}
-
+
});
}
-
+
public void ice_exception(final Ice.LocalException e)
{
if(_traceSaveToRegistry)
@@ -956,11 +936,11 @@ public class Coordinator
traceSaveToRegistry("removeApplication for application " + name + ": failed");
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
- handleFailure(prefix, "Delete failed",
+ handleFailure(prefix, "Delete failed",
"Communication exception: " + e.toString());
}
});
@@ -1011,7 +991,7 @@ public class Coordinator
{
JOptionPane.showMessageDialog(
_mainFrame,
- "Could not remove application '" + name +
+ "Could not remove application '" + name +
"' from IceGrid registry:\n" + e.toString(),
"Trouble with IceGrid registry",
JOptionPane.ERROR_MESSAGE);
@@ -1125,8 +1105,8 @@ public class Coordinator
{
assert serial == _latestSerial + 1;
_latestSerial = serial;
-
- if(_writeAccessCount > 0 &&
+
+ if(_writeAccessCount > 0 &&
_writeSerial <= _latestSerial &&
_onExclusiveWrite != null)
{
@@ -1141,7 +1121,7 @@ public class Coordinator
_mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
-
+
//
// From the Registry observer:
//
@@ -1183,7 +1163,7 @@ public class Coordinator
_liveDeploymentRoot.updateAdapter(node, updatedInfo);
_liveDeploymentPane.refresh();
}
-
+
void sessionLost()
{
_latestSerial = -1;
@@ -1195,17 +1175,15 @@ public class Coordinator
//
// Kill all live applications
//
- java.util.Iterator p = _liveApplications.values().iterator();
- while(p.hasNext())
+ for(ApplicationPane p : _liveApplications.values())
{
- ApplicationPane app = (ApplicationPane)p.next();
- if(app.getRoot().kill())
+ if(p.getRoot().kill())
{
- _mainPane.remove(app);
+ _mainPane.remove(p);
}
}
_liveApplications.clear();
-
+
_logout.setEnabled(false);
_openApplicationFromRegistry.setEnabled(false);
_patchApplication.setEnabled(false);
@@ -1217,18 +1195,18 @@ public class Coordinator
_releaseExclusiveWriteAccess.setEnabled(false);
_saveToRegistry.setEnabled(false);
}
-
- AdminSessionPrx login(SessionKeeper.LoginInfo info,
- Component parent,
+
+ AdminSessionPrx login(SessionKeeper.LoginInfo info,
+ Component parent,
Ice.LongHolder keepAlivePeriodHolder)
- {
+ {
_liveDeploymentRoot.clear();
AdminSessionPrx session = null;
-
+
destroyCommunicator();
- Ice.InitializationData initData = _initData;
+ Ice.InitializationData initData = _initData;
if(info.routed && info.routerSSLEnabled || !info.routed && info.registrySSLEnabled)
{
initData = (Ice.InitializationData)initData.clone();
@@ -1237,7 +1215,7 @@ public class Coordinator
//
// Transform SSL info into properties
- //
+ //
initData.properties.setProperty("IceSSL.Keystore", info.keystore);
initData.properties.setProperty("IceSSL.Password", new String(info.keyPassword));
initData.properties.setProperty("IceSSL.KeystorePassword", new String(info.keystorePassword));
@@ -1246,7 +1224,6 @@ public class Coordinator
initData.properties.setProperty("IceSSL.TruststorePassword", new String(info.truststorePassword));
}
-
//
// Clear Ice.Default.Router
// (when info.routed, we don't want to route the router)
@@ -1271,7 +1248,7 @@ public class Coordinator
//
// Router
//
-
+
Ice.Identity routerId = new Ice.Identity();
routerId.category = info.routerInstanceName;
routerId.name = "router";
@@ -1281,7 +1258,7 @@ public class Coordinator
{
str += ":" + info.routerEndpoints;
}
-
+
try
{
Glacier2.RouterPrx router = Glacier2.RouterPrxHelper.uncheckedCast(_communicator.stringToProxy(str));
@@ -1297,7 +1274,7 @@ public class Coordinator
router = Glacier2.RouterPrxHelper.uncheckedCast(router.ice_secure(true));
s = router.createSessionFromSecureConnection();
-
+
if(s == null)
{
JOptionPane.showMessageDialog(
@@ -1307,7 +1284,7 @@ public class Coordinator
+ "<IceGridInstanceName>/AdminSSLSessionManager in your Glacier2 router configuration",
"Login failed",
JOptionPane.ERROR_MESSAGE);
-
+
return null;
}
}
@@ -1325,13 +1302,13 @@ public class Coordinator
+ "<IceGridInstanceName>/AdminSessionManager in your Glacier2 router configuration",
"Login failed",
JOptionPane.ERROR_MESSAGE);
-
+
return null;
}
}
-
+
session = AdminSessionPrxHelper.uncheckedCast(s);
- keepAlivePeriodHolder.value = router.getSessionTimeout() * 1000 / 2;
+ keepAlivePeriodHolder.value = router.getSessionTimeout() * 1000 / 2;
}
catch(Glacier2.PermissionDeniedException e)
{
@@ -1377,7 +1354,7 @@ public class Coordinator
return null;
}
-
+
//
// The client uses the locator only without routing
//
@@ -1386,8 +1363,8 @@ public class Coordinator
locatorId.name = "Locator";
String str = "\"" + _communicator.identityToString(locatorId) + "\"";
str += ":" + info.registryEndpoints;
-
- RegistryPrx currentRegistry = null;
+
+ RegistryPrx currentRegistry = null;
IceGrid.LocatorPrx defaultLocator = null;
try
{
@@ -1401,9 +1378,9 @@ public class Coordinator
JOptionPane.ERROR_MESSAGE);
return null;
}
-
+
currentRegistry = defaultLocator.getLocalRegistry();
-
+
_communicator.setDefaultLocator(defaultLocator);
}
catch(Ice.LocalException e)
@@ -1443,7 +1420,7 @@ public class Coordinator
_communicator.setDefaultRouter(Ice.RouterPrxHelper.uncheckedCast(router));
registry = RegistryPrxHelper.uncheckedCast(registry.ice_router(_communicator.getDefaultRouter()));
}
-
+
do
{
try
@@ -1451,7 +1428,7 @@ public class Coordinator
if(info.registryUseSSL)
{
registry = RegistryPrxHelper.uncheckedCast(registry.ice_secure(true));
-
+
session = registry.createAdminSessionFromSecureConnection();
assert session != null;
}
@@ -1459,7 +1436,7 @@ public class Coordinator
{
registry = RegistryPrxHelper.uncheckedCast(registry.ice_preferSecure(true));
- session = registry.createAdminSession(info.registryUsername,
+ session = registry.createAdminSession(info.registryUsername,
new String(info.registryPassword));
assert session != null;
}
@@ -1505,7 +1482,7 @@ public class Coordinator
}
} while(session == null);
}
-
+
_logout.setEnabled(true);
_openApplicationFromRegistry.setEnabled(true);
_patchApplication.setEnabled(true);
@@ -1520,7 +1497,6 @@ public class Coordinator
return session;
}
-
void destroySession(AdminSessionPrx session)
{
_liveDeploymentRoot.closeAllShowLogDialogs();
@@ -1535,15 +1511,14 @@ public class Coordinator
}
else
{
- Glacier2.RouterPrx gr
- = Glacier2.RouterPrxHelper.uncheckedCast(router);
+ Glacier2.RouterPrx gr = Glacier2.RouterPrxHelper.uncheckedCast(router);
Glacier2.AMI_Router_destroySession cb = new Glacier2.AMI_Router_destroySession()
{
public void ice_response()
{
}
-
+
public void ice_exception(Ice.LocalException ex)
{
}
@@ -1672,13 +1647,13 @@ public class Coordinator
JOptionPane.ERROR_MESSAGE);
return null;
}
-
+
try
{
- BufferedReader reader =
+ BufferedReader reader =
new BufferedReader(new InputStreamReader(_icegridadminProcess.getInputStream(),
"US-ASCII"));
-
+
String str = reader.readLine();
reader.close();
@@ -1715,8 +1690,7 @@ public class Coordinator
{
FileParserPrx fileParser = FileParserPrxHelper.checkedCast(
getCommunicator().stringToProxy(_fileParser).ice_router(null));
- return fileParser.parse(file.getAbsolutePath(),
- _sessionKeeper.getRoutedAdmin());
+ return fileParser.parse(file.getAbsolutePath(), _sessionKeeper.getRoutedAdmin());
}
catch(ParseException e)
{
@@ -1754,9 +1728,7 @@ public class Coordinator
}
}
-
- public File saveToFile(boolean ask, IceGridGUI.Application.Root root,
- File file)
+ public File saveToFile(boolean ask, IceGridGUI.Application.Root root, File file)
{
if(ask || file == null)
{
@@ -1770,7 +1742,7 @@ public class Coordinator
}
int result = _saveXMLChooser.showSaveDialog(_mainFrame);
-
+
if(file == null || result == JFileChooser.APPROVE_OPTION)
{
_openChooser.setCurrentDirectory(_saveXMLChooser.getCurrentDirectory());
@@ -1822,49 +1794,49 @@ public class Coordinator
}
return file;
}
-
+
public JFileChooser getSaveLogChooser()
{
return _saveLogChooser;
- }
+ }
static private Ice.Properties createProperties(Ice.StringSeqHolder args)
{
Ice.Properties properties = Ice.Util.createProperties();
-
+
//
// Set various default values
//
properties.setProperty("Ice.Override.ConnectTimeout", "5000");
-
+
//
// For Glacier
//
properties.setProperty("Ice.ACM.Client", "0");
-
+
//
// Disable retries
//
properties.setProperty("Ice.RetryIntervals", "-1");
-
+
return Ice.Util.createProperties(args, properties);
}
Coordinator(JFrame mainFrame, Ice.StringSeqHolder args, Preferences prefs)
- {
+ {
_mainFrame = mainFrame;
_prefs = prefs;
_initData = new Ice.InitializationData();
_initData.logger = new Logger(mainFrame);
_initData.properties = createProperties(args);
-
+
if(args.value.length > 0)
{
String msg = "Extra command-line arguments: ";
- for(int i = 0; i < args.value.length; ++i)
+ for(String arg : args.value)
{
- msg += args.value[i] + " ";
+ msg += arg + " ";
}
_initData.logger.warning(msg);
}
@@ -1896,36 +1868,34 @@ public class Coordinator
//
}
- _saveXMLChooser = new JFileChooser(
- _prefs.get("current directory", null));
-
+ _saveXMLChooser = new JFileChooser(_prefs.get("current directory", null));
+
_saveXMLChooser.addChoosableFileFilter(new FileFilter()
{
public boolean accept(File f)
{
return f.isDirectory() || f.getName().endsWith(".xml");
}
-
+
public String getDescription()
{
return ".xml files";
}
});
- _saveLogChooser = new JFileChooser(
- _prefs.get("current directory", null));
-
+ _saveLogChooser = new JFileChooser(_prefs.get("current directory", null));
+
_saveLogChooser.addChoosableFileFilter(new FileFilter()
{
public boolean accept(File f)
{
- return f.isDirectory() ||
+ return f.isDirectory() ||
f.getName().endsWith(".out") ||
f.getName().endsWith(".err") ||
f.getName().endsWith(".log") ||
f.getName().endsWith(".txt");
}
-
+
public String getDescription()
{
return ".out .err .log .txt files";
@@ -1935,9 +1905,8 @@ public class Coordinator
javax.swing.UIManager.put("FileChooser.readOnly", Boolean.TRUE);
_openChooser = new JFileChooser(_saveXMLChooser.getCurrentDirectory());
-
- _openChooser.addChoosableFileFilter(_saveXMLChooser.getChoosableFileFilters()[1]);
+ _openChooser.addChoosableFileFilter(_saveXMLChooser.getChoosableFileFilters()[1]);
final int MENU_MASK = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
@@ -1946,16 +1915,16 @@ public class Coordinator
//
_newApplication = new AbstractAction("Application")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
newApplication();
}
};
- _newApplicationWithDefaultTemplates =
+ _newApplicationWithDefaultTemplates =
new AbstractAction("Application with Default Templates from Registry")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
newApplicationWithDefaultTemplates();
}
@@ -1964,17 +1933,16 @@ public class Coordinator
_login = new AbstractAction("Login...")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_sessionKeeper.relog(true);
}
};
- _login.putValue(Action.SHORT_DESCRIPTION,
- "Log into an IceGrid Registry");
+ _login.putValue(Action.SHORT_DESCRIPTION, "Log into an IceGrid Registry");
_logout = new AbstractAction("Logout")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_sessionKeeper.logout(true);
}
@@ -1984,7 +1952,7 @@ public class Coordinator
_acquireExclusiveWriteAccess = new AbstractAction("Acquire Exclusive Write Access")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
try
{
@@ -1998,33 +1966,32 @@ public class Coordinator
}
}
};
- _acquireExclusiveWriteAccess.putValue(Action.SHORT_DESCRIPTION,
+ _acquireExclusiveWriteAccess.putValue(Action.SHORT_DESCRIPTION,
"Acquire exclusive write access on the registry");
_acquireExclusiveWriteAccess.setEnabled(false);
-
_releaseExclusiveWriteAccess = new AbstractAction("Release Exclusive Write Access")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
releaseExclusiveWriteAccess();
_acquireExclusiveWriteAccess.setEnabled(true);
_releaseExclusiveWriteAccess.setEnabled(false);
}
};
- _releaseExclusiveWriteAccess.putValue(Action.SHORT_DESCRIPTION,
+ _releaseExclusiveWriteAccess.putValue(Action.SHORT_DESCRIPTION,
"Release exclusive write access on the registry");
_releaseExclusiveWriteAccess.setEnabled(false);
_openApplicationFromFile = new AbstractAction("Application from File")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
int result = _openChooser.showOpenDialog(_mainFrame);
if(result == JFileChooser.APPROVE_OPTION)
{
File file = _openChooser.getSelectedFile();
-
+
ApplicationDescriptor desc = parseFile(file);
if(desc != null)
@@ -2043,7 +2010,7 @@ public class Coordinator
JOptionPane.ERROR_MESSAGE);
return;
}
-
+
ApplicationPane app = new ApplicationPane(root);
_mainPane.addApplication(app);
_mainPane.setSelectedComponent(app);
@@ -2054,13 +2021,13 @@ public class Coordinator
};
_openApplicationFromFile.putValue(Action.SHORT_DESCRIPTION, "Open application from file");
_openApplicationFromFile.setEnabled(true);
-
+
_openApplicationFromRegistry = new AbstractAction("Application from Registry")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
Object[] applicationNames = _liveDeploymentRoot.getApplicationNames();
-
+
if(applicationNames.length == 0)
{
JOptionPane.showMessageDialog(
@@ -2072,11 +2039,11 @@ public class Coordinator
else
{
String appName = (String)JOptionPane.showInputDialog(
- _mainFrame, "Which Application do you want to open?",
- "Open Application from registry",
+ _mainFrame, "Which Application do you want to open?",
+ "Open Application from registry",
JOptionPane.QUESTION_MESSAGE, null,
applicationNames, applicationNames[0]);
-
+
if(appName != null)
{
ApplicationPane app = openLiveApplication(appName);
@@ -2097,7 +2064,7 @@ public class Coordinator
_closeApplication = new AbstractAction("Close Application")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
Tab tab = getCurrentTab();
if(tab.close())
@@ -2111,33 +2078,31 @@ public class Coordinator
if(System.getProperty("os.name").startsWith("Mac OS"))
{
- _closeApplication.putValue(Action.ACCELERATOR_KEY,
+ _closeApplication.putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_W, MENU_MASK));
}
else
{
- _closeApplication.putValue(Action.ACCELERATOR_KEY,
+ _closeApplication.putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_F4, MENU_MASK));
}
_closeApplication.setEnabled(false);
-
_save = new AbstractAction("Save")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
getCurrentTab().save();
}
};
_save.setEnabled(false);
- _save.putValue(Action.ACCELERATOR_KEY,
+ _save.putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_S, MENU_MASK));
_save.putValue(Action.SHORT_DESCRIPTION, "Save");
-
_saveToRegistry = new AbstractAction("Save to Registry")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
getCurrentTab().saveToRegistry();
}
@@ -2145,10 +2110,9 @@ public class Coordinator
_saveToRegistry.setEnabled(false);
_saveToRegistry.putValue(Action.SHORT_DESCRIPTION, "Save to registry");
-
_saveToFile = new AbstractAction("Save to File")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
getCurrentTab().saveToFile();
}
@@ -2156,22 +2120,19 @@ public class Coordinator
_saveToFile.setEnabled(false);
_saveToFile.putValue(Action.SHORT_DESCRIPTION, "Save to file");
-
_discardUpdates = new AbstractAction("Discard Updates")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
getCurrentTab().discardUpdates();
}
};
_discardUpdates.setEnabled(false);
- _discardUpdates.putValue(Action.SHORT_DESCRIPTION,
- "Discard updates and reload application");
-
+ _discardUpdates.putValue(Action.SHORT_DESCRIPTION, "Discard updates and reload application");
_exit = new AbstractAction("Exit")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
exit(0);
}
@@ -2180,7 +2141,7 @@ public class Coordinator
_back = new AbstractAction("Go Back to the Previous Node")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
getCurrentTab().back();
}
@@ -2190,7 +2151,7 @@ public class Coordinator
_forward = new AbstractAction("Go to the Next Node")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
getCurrentTab().forward();
}
@@ -2200,26 +2161,26 @@ public class Coordinator
_helpContents = new AbstractAction("Contents")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
helpContents();
- }
+ }
};
-
+
_about = new AbstractAction("About")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
about();
}
};
-
+
_patchApplication = new AbstractAction("Patch Distribution")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
Object[] applicationNames = _liveDeploymentRoot.getPatchableApplicationNames();
-
+
if(applicationNames.length == 0)
{
JOptionPane.showMessageDialog(
@@ -2231,11 +2192,11 @@ public class Coordinator
else
{
String appName = (String)JOptionPane.showInputDialog(
- _mainFrame, "Which Application do you want to patch?",
- "Patch application",
+ _mainFrame, "Which Application do you want to patch?",
+ "Patch application",
JOptionPane.QUESTION_MESSAGE, null,
applicationNames, applicationNames[0]);
-
+
if(appName != null)
{
_liveDeploymentRoot.patch(appName);
@@ -2244,13 +2205,13 @@ public class Coordinator
}
};
_patchApplication.setEnabled(false);
-
+
_showApplicationDetails = new AbstractAction("Show details")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
Object[] applicationNames = _liveDeploymentRoot.getApplicationNames();
-
+
if(applicationNames.length == 0)
{
JOptionPane.showMessageDialog(
@@ -2262,11 +2223,11 @@ public class Coordinator
else
{
String appName = (String)JOptionPane.showInputDialog(
- _mainFrame, "Which Application do you to display",
- "Show details",
+ _mainFrame, "Which Application do you to display",
+ "Show details",
JOptionPane.QUESTION_MESSAGE, null,
applicationNames, applicationNames[0]);
-
+
if(appName != null)
{
_liveDeploymentRoot.showApplicationDetails(appName);
@@ -2275,13 +2236,13 @@ public class Coordinator
}
};
_showApplicationDetails.setEnabled(false);
-
+
_removeApplicationFromRegistry = new AbstractAction("Remove from Registry")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
Object[] applicationNames = _liveDeploymentRoot.getApplicationNames();
-
+
if(applicationNames.length == 0)
{
JOptionPane.showMessageDialog(
@@ -2293,11 +2254,11 @@ public class Coordinator
else
{
String appName = (String)JOptionPane.showInputDialog(
- _mainFrame, "Which Application do you want to remove?",
- "Remove application",
+ _mainFrame, "Which Application do you want to remove?",
+ "Remove application",
JOptionPane.QUESTION_MESSAGE, null,
applicationNames, applicationNames[0]);
-
+
if(appName != null)
{
removeApplicationFromRegistry(appName);
@@ -2307,45 +2268,36 @@ public class Coordinator
};
_removeApplicationFromRegistry.setEnabled(false);
-
_cut = new ActionWrapper("Cut");
- _cut.putValue(Action.ACCELERATOR_KEY,
- KeyStroke.getKeyStroke(KeyEvent.VK_X, MENU_MASK));
+ _cut.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_X, MENU_MASK));
_cut.putValue(Action.SHORT_DESCRIPTION, "Cut");
-
+
_copy = new ActionWrapper("Copy");
- _copy.putValue(Action.ACCELERATOR_KEY,
- KeyStroke.getKeyStroke(KeyEvent.VK_C, MENU_MASK));
+ _copy.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C, MENU_MASK));
_copy.putValue(Action.SHORT_DESCRIPTION, "Copy");
-
+
_paste = new ActionWrapper("Paste");
- _paste.putValue(Action.ACCELERATOR_KEY,
- KeyStroke.getKeyStroke(KeyEvent.VK_V, MENU_MASK));
+ _paste.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_V, MENU_MASK));
_paste.putValue(Action.SHORT_DESCRIPTION, "Paste");
-
+
_delete = new ActionWrapper("Delete");
- _delete.putValue(Action.ACCELERATOR_KEY,
- KeyStroke.getKeyStroke("DELETE"));
+ _delete.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("DELETE"));
_delete.putValue(Action.SHORT_DESCRIPTION, "Delete");
_moveUp = new ActionWrapper("Move Up");
_moveDown = new ActionWrapper("Move Down");
- _showVarsMenuItem = new
- JCheckBoxMenuItem(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.SHOW_VARS));
- _showVarsTool = new
- JToggleButton(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.SHOW_VARS));
+ _showVarsMenuItem = new JCheckBoxMenuItem(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.SHOW_VARS));
+ _showVarsTool = new JToggleButton(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.SHOW_VARS));
_showVarsTool.setIcon(Utils.getIcon("/icons/24x24/show_vars.png"));
_showVarsTool.setText("");
_substituteMenuItem = new
JCheckBoxMenuItem(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.SUBSTITUTE_VARS));
- _substituteTool = new
- JToggleButton(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.SUBSTITUTE_VARS));
+ _substituteTool = new JToggleButton(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.SUBSTITUTE_VARS));
_substituteTool.setIcon(Utils.getIcon("/icons/24x24/substitute.png"));
_substituteTool.setText("");
-
ButtonGroup group = new ButtonGroup();
group.add(_showVarsMenuItem);
group.add(_substituteMenuItem);
@@ -2358,27 +2310,23 @@ public class Coordinator
_mainFrame.setJMenuBar(new MenuBar());
- _mainFrame.getContentPane().add(new ToolBar(),
- BorderLayout.PAGE_START);
-
- _mainFrame.getContentPane().add((StatusBarI)_statusBar,
- BorderLayout.PAGE_END);
+ _mainFrame.getContentPane().add(new ToolBar(), BorderLayout.PAGE_START);
-
- java.awt.KeyboardFocusManager kbm = java.awt.KeyboardFocusManager.
- getCurrentKeyboardFocusManager();
+ _mainFrame.getContentPane().add((StatusBarI)_statusBar, BorderLayout.PAGE_END);
+
+ java.awt.KeyboardFocusManager kbm = java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager();
kbm.addPropertyChangeListener("permanentFocusOwner", new FocusListener());
-
+
_liveDeploymentPane = new LiveDeploymentPane(_liveDeploymentRoot);
_mainPane = new MainPane(this);
- _mainFrame.getContentPane().add(_mainPane, BorderLayout.CENTER);
+ _mainFrame.getContentPane().add(_mainPane, BorderLayout.CENTER);
}
public LiveDeploymentPane getLiveDeploymentPane()
{
return _liveDeploymentPane;
}
-
+
public IceGridGUI.LiveDeployment.Root getLiveDeploymentRoot()
{
return _liveDeploymentRoot;
@@ -2387,15 +2335,15 @@ public class Coordinator
private void newApplication()
{
ApplicationDescriptor desc = new ApplicationDescriptor("NewApplication",
- new java.util.TreeMap(),
- new java.util.LinkedList(),
- new java.util.HashMap(),
- new java.util.HashMap(),
- new java.util.HashMap(),
- new IceGrid.DistributionDescriptor(
- "", new java.util.LinkedList()),
+ new java.util.TreeMap<String, String>(),
+ new java.util.LinkedList<ReplicaGroupDescriptor>(),
+ new java.util.HashMap<String, TemplateDescriptor>(),
+ new java.util.HashMap<String, TemplateDescriptor>(),
+ new java.util.HashMap<String, NodeDescriptor>(),
+ new DistributionDescriptor(
+ "", new java.util.LinkedList<String>()),
"",
- new java.util.HashMap());
+ new java.util.HashMap<String, PropertySetDescriptor>());
IceGridGUI.Application.Root root = new IceGridGUI.Application.Root(this, desc);
ApplicationPane app = new ApplicationPane(root);
_mainPane.addApplication(app);
@@ -2462,7 +2410,7 @@ public class Coordinator
}
}
}
-
+
//
// Otherwise, browser based-help
//
@@ -2473,17 +2421,17 @@ public class Coordinator
}
else
{
- BareBonesBrowserLaunch.openURL("http://www.zeroc.com/doc/Ice-"
+ BareBonesBrowserLaunch.openURL("http://www.zeroc.com/doc/Ice-"
+ Ice.Util.stringVersion() + "/IceGridAdmin/index.html");
}
}
private void about()
{
- String text = "IceGrid Admin version "
+ String text = "IceGrid Admin version "
+ Ice.Util.stringVersion() + "\n"
+ "Copyright \u00A9 2005-2009 ZeroC, Inc. All rights reserved.\n";
-
+
JOptionPane.showMessageDialog(
_mainFrame,
text,
@@ -2498,7 +2446,7 @@ public class Coordinator
public Object getClipboard()
{
- return _clipboard;
+ return _clipboard;
}
void showMainFrame()
@@ -2518,7 +2466,7 @@ public class Coordinator
File dir = _openChooser.getCurrentDirectory();
if(dir != null)
{
- _prefs.put("current directory", dir.getAbsolutePath());
+ _prefs.put("current directory", dir.getAbsolutePath());
}
}
@@ -2532,7 +2480,7 @@ public class Coordinator
_mainFrame.dispose();
Runtime.getRuntime().exit(status);
}
-
+
//
// Can be called by the shutdown hook thread
//
@@ -2540,7 +2488,7 @@ public class Coordinator
{
if(_communicator != null)
{
- try
+ try
{
_communicator.destroy();
}
@@ -2593,7 +2541,6 @@ public class Coordinator
_mainFrame.getExtendedState() == Frame.MAXIMIZED_BOTH);
}
-
public AdminSessionPrx getSession()
{
return _sessionKeeper.getSession();
@@ -2638,36 +2585,32 @@ public class Coordinator
{
boolean[] availableActions = _liveActionsForMenu.setTarget(node);
_appActionsForMenu.setTarget(null);
-
+
_newServerMenu.setEnabled(false);
- _newServiceMenu.setEnabled(false);
+ _newServiceMenu.setEnabled(false);
_newTemplateMenu.setEnabled(false);
_appMenu.setEnabled(true);
-
- _nodeMenu.setEnabled(
- availableActions[IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_NODE]);
- _registryMenu.setEnabled(
- availableActions[IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_REGISTRY]);
+ _nodeMenu.setEnabled(availableActions[IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_NODE]);
+
+ _registryMenu.setEnabled(availableActions[IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_REGISTRY]);
- _signalMenu.setEnabled(
- availableActions[IceGridGUI.LiveDeployment.TreeNode.SIGHUP]);
+ _signalMenu.setEnabled(availableActions[IceGridGUI.LiveDeployment.TreeNode.SIGHUP]);
+
+ _serverMenu.setEnabled(availableActions[IceGridGUI.LiveDeployment.TreeNode.OPEN_DEFINITION]);
- _serverMenu.setEnabled(
- availableActions[IceGridGUI.LiveDeployment.TreeNode.OPEN_DEFINITION]);
-
_serviceMenu.setEnabled(node instanceof IceGridGUI.LiveDeployment.Service &&
(availableActions[IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG] ||
availableActions[IceGridGUI.LiveDeployment.TreeNode.START] ||
availableActions[IceGridGUI.LiveDeployment.TreeNode.STOP]));
}
-
+
public void showActions(IceGridGUI.Application.TreeNode node)
{
boolean[] availableActions = _appActionsForMenu.setTarget(node);
_liveActionsForMenu.setTarget(null);
-
+
_newServerMenu.setEnabled(
availableActions[IceGridGUI.Application.TreeNode.NEW_SERVER] ||
availableActions[IceGridGUI.Application.TreeNode.NEW_SERVER_ICEBOX] ||
@@ -2676,7 +2619,7 @@ public class Coordinator
_newServiceMenu.setEnabled(
availableActions[IceGridGUI.Application.TreeNode.NEW_SERVICE] ||
availableActions[IceGridGUI.Application.TreeNode.NEW_SERVICE_FROM_TEMPLATE]);
-
+
_newTemplateMenu.setEnabled(
availableActions[IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER] ||
availableActions[IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER_ICEBOX] ||
@@ -2690,7 +2633,6 @@ public class Coordinator
_serviceMenu.setEnabled(false);
}
-
public boolean traceObservers()
{
return _traceObservers;
@@ -2705,7 +2647,7 @@ public class Coordinator
{
return _traceSaveToRegistry;
}
-
+
public void traceSaveToRegistry(String message)
{
trace("SaveToRegistry", message);
@@ -2723,7 +2665,6 @@ public class Coordinator
_initData.logger.trace(category, message);
}
-
private final Ice.InitializationData _initData;
private Ice.Communicator _communicator;
@@ -2732,14 +2673,14 @@ public class Coordinator
private Preferences _prefs;
private StatusBarI _statusBar = new StatusBarI();
-
+
private IceGridGUI.LiveDeployment.Root _liveDeploymentRoot;
private LiveDeploymentPane _liveDeploymentPane;
//
// Maps application-name to ApplicationPane (only for 'live' applications)
//
- private java.util.Map _liveApplications = new java.util.HashMap();
+ private java.util.Map<String, ApplicationPane> _liveApplications = new java.util.HashMap<String, ApplicationPane>();
private MainPane _mainPane;
@@ -2749,17 +2690,17 @@ public class Coordinator
//
private int _latestSerial = -1;
private int _writeSerial = -1;
-
+
private Runnable _onExclusiveWrite;
private int _writeAccessCount = 0;
private boolean _substitute = false;
-
+
private JFrame _mainFrame;
private final SessionKeeper _sessionKeeper;
private Object _clipboard;
-
+
//
// Actions
//
@@ -2804,18 +2745,17 @@ public class Coordinator
//
// Two sets of actions because the popup's target and the menu/toolbar's target
// can be different.
- //
+ //
private LiveActions _liveActionsForMenu = new LiveActions();
private LiveActions _liveActionsForPopup = new LiveActions();
private ApplicationActions _appActionsForMenu = new ApplicationActions(false);
private ApplicationActions _appActionsForPopup = new ApplicationActions(true);
-
-
+
private JToggleButton _showVarsTool;
private JToggleButton _substituteTool;
private JCheckBoxMenuItem _substituteMenuItem;
private JCheckBoxMenuItem _showVarsMenuItem;
-
+
private JMenu _newMenu;
private JMenu _newServerMenu;
private JMenu _newServiceMenu;
@@ -2832,7 +2772,7 @@ public class Coordinator
private JFileChooser _openChooser;
private JFileChooser _saveXMLChooser;
private JFileChooser _saveLogChooser;
-
+
private Process _icegridadminProcess;
private String _fileParser;
diff --git a/java/src/IceGridGUI/EditorBase.java b/java/src/IceGridGUI/EditorBase.java
index 9d6d66829d4..1a3bc7d8245 100644
--- a/java/src/IceGridGUI/EditorBase.java
+++ b/java/src/IceGridGUI/EditorBase.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import java.awt.BorderLayout;
@@ -26,7 +27,7 @@ import IceGrid.*;
// Base class for all editors
//
public abstract class EditorBase
-{
+{
public JComponent getProperties()
{
if(_propertiesPanel == null)
@@ -35,37 +36,36 @@ public abstract class EditorBase
}
return _propertiesPanel;
}
-
+
public JToolBar getToolBar()
{
return null;
}
-
+
protected abstract void appendProperties(DefaultFormBuilder builder);
protected void buildPropertiesPanel()
{
- FormLayout layout = new FormLayout(
- "right:pref, 3dlu, fill:pref:grow, 3dlu, pref", "");
-
+ FormLayout layout = new FormLayout("right:pref, 3dlu, fill:pref:grow, 3dlu, pref", "");
+
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.setBorder(Borders.DLU2_BORDER);
builder.setRowGroupingEnabled(true);
builder.setLineGapSize(LayoutStyle.getCurrent().getLinePad());
-
+
appendProperties(builder);
-
- JScrollPane scrollPane =
+
+ JScrollPane scrollPane =
new JScrollPane(builder.getPanel(),
- JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
-
+
scrollPane.setBorder(Borders.DIALOG_BORDER);
-
+
_propertiesPanel = new JPanel(new BorderLayout());
_propertiesPanel.add(scrollPane, BorderLayout.CENTER);
_propertiesPanel.setBorder(Borders.EMPTY_BORDER);
}
-
- protected JPanel _propertiesPanel;
+
+ protected JPanel _propertiesPanel;
}
diff --git a/java/src/IceGridGUI/LiveActions.java b/java/src/IceGridGUI/LiveActions.java
index ec939d2279b..ee50ca90569 100644
--- a/java/src/IceGridGUI/LiveActions.java
+++ b/java/src/IceGridGUI/LiveActions.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import java.awt.event.ActionEvent;
@@ -26,23 +27,21 @@ public class LiveActions
{
super(name);
_name = name;
- putValue(Action.SHORT_DESCRIPTION,
- "Send " + _name);
+ putValue(Action.SHORT_DESCRIPTION, "Send " + _name);
}
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.signal(_name);
}
private String _name;
- };
-
+ }
public Action get(int index)
{
return _array[index];
}
-
+
public boolean[] setTarget(TreeNode target)
{
_target = target;
@@ -53,7 +52,7 @@ public class LiveActions
availableActions = new boolean[TreeNode.ACTION_COUNT];
}
else
- {
+ {
availableActions = _target.getAvailableActions();
}
@@ -67,50 +66,42 @@ public class LiveActions
LiveActions()
{
- _array[TreeNode.START] = new AbstractAction(
- "Start", Utils.getIcon("/icons/16x16/start.png"))
+ _array[TreeNode.START] = new AbstractAction("Start", Utils.getIcon("/icons/16x16/start.png"))
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.start();
}
};
- _array[TreeNode.START].putValue(Action.SHORT_DESCRIPTION,
- "Start this server or service");
+ _array[TreeNode.START].putValue(Action.SHORT_DESCRIPTION, "Start this server or service");
- _array[TreeNode.STOP] = new AbstractAction(
- "Stop", Utils.getIcon("/icons/16x16/stop.png"))
+ _array[TreeNode.STOP] = new AbstractAction("Stop", Utils.getIcon("/icons/16x16/stop.png"))
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.stop();
}
};
- _array[TreeNode.STOP].putValue(Action.SHORT_DESCRIPTION,
- "Stop this server or service");
-
+ _array[TreeNode.STOP].putValue(Action.SHORT_DESCRIPTION, "Stop this server or service");
+
- _array[TreeNode.ENABLE] = new AbstractAction(
- "Enable", Utils.getIcon("/icons/16x16/enable.png"))
+ _array[TreeNode.ENABLE] = new AbstractAction("Enable", Utils.getIcon("/icons/16x16/enable.png"))
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.enable();
}
};
- _array[TreeNode.ENABLE].putValue(Action.SHORT_DESCRIPTION,
- "Enable this server");
-
- _array[TreeNode.DISABLE] = new AbstractAction(
- "Disable", Utils.getIcon("/icons/16x16/disable.png"))
+ _array[TreeNode.ENABLE].putValue(Action.SHORT_DESCRIPTION, "Enable this server");
+
+ _array[TreeNode.DISABLE] = new AbstractAction("Disable", Utils.getIcon("/icons/16x16/disable.png"))
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.disable();
}
};
- _array[TreeNode.DISABLE].putValue(Action.SHORT_DESCRIPTION,
- "Disable this server");
+ _array[TreeNode.DISABLE].putValue(Action.SHORT_DESCRIPTION, "Disable this server");
_array[TreeNode.SIGHUP] = new SendSignal("SIGHUP");
_array[TreeNode.SIGINT] = new SendSignal("SIGINT");
@@ -122,49 +113,44 @@ public class LiveActions
_array[TreeNode.WRITE_MESSAGE] = new AbstractAction("Write Message")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.writeMessage();
}
};
- _array[TreeNode.WRITE_MESSAGE].putValue(Action.SHORT_DESCRIPTION,
- "Write message to stdout or stderr");
-
+ _array[TreeNode.WRITE_MESSAGE].putValue(Action.SHORT_DESCRIPTION, "Write message to stdout or stderr");
+
_array[TreeNode.RETRIEVE_STDOUT] = new AbstractAction("Retrieve stdout")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.retrieveOutput(true);
}
};
- _array[TreeNode.RETRIEVE_STDOUT].putValue(Action.SHORT_DESCRIPTION,
- "Retrieve stdout");
+ _array[TreeNode.RETRIEVE_STDOUT].putValue(Action.SHORT_DESCRIPTION, "Retrieve stdout");
_array[TreeNode.RETRIEVE_STDERR] = new AbstractAction("Retrieve stderr")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.retrieveOutput(false);
}
};
- _array[TreeNode.RETRIEVE_STDERR].putValue(Action.SHORT_DESCRIPTION,
- "Retrieve stderr");
+ _array[TreeNode.RETRIEVE_STDERR].putValue(Action.SHORT_DESCRIPTION, "Retrieve stderr");
_array[TreeNode.RETRIEVE_LOG] = new AbstractAction("Retrieve Log")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.retrieveLog();
}
};
- _array[TreeNode.RETRIEVE_LOG].putValue(Action.SHORT_DESCRIPTION,
- "Retrieve log file from the server");
-
+ _array[TreeNode.RETRIEVE_LOG].putValue(Action.SHORT_DESCRIPTION, "Retrieve log file from the server");
_array[TreeNode.SHUTDOWN_NODE] = new AbstractAction("Shutdown")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.shutdownNode();
}
@@ -172,39 +158,36 @@ public class LiveActions
_array[TreeNode.SHUTDOWN_REGISTRY] = new AbstractAction("Shutdown")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.shutdownRegistry();
}
};
-
- _array[TreeNode.PATCH_SERVER] =
- new AbstractAction("Patch Distribution")
+
+ _array[TreeNode.PATCH_SERVER] = new AbstractAction("Patch Distribution")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.patchServer();
}
};
- _array[TreeNode.ADD_OBJECT] =
- new AbstractAction("Add Well-known Object")
+ _array[TreeNode.ADD_OBJECT] = new AbstractAction("Add Well-known Object")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.addObject();
}
};
- _array[TreeNode.OPEN_DEFINITION] =
- new AbstractAction("Open Definition")
+ _array[TreeNode.OPEN_DEFINITION] = new AbstractAction("Open Definition")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.openDefinition();
}
};
-
+
}
private TreeNode _target;
diff --git a/java/src/IceGridGUI/LiveDeployment/Adapter.java b/java/src/IceGridGUI/LiveDeployment/Adapter.java
index 13a61fd5e2e..fd1d33e631a 100644
--- a/java/src/IceGridGUI/LiveDeployment/Adapter.java
+++ b/java/src/IceGridGUI/LiveDeployment/Adapter.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.awt.Component;
@@ -21,7 +22,6 @@ import java.util.Enumeration;
import IceGrid.*;
import IceGridGUI.*;
-
class Adapter extends TreeNode
{
public Editor getEditor()
@@ -41,7 +41,7 @@ class Adapter extends TreeNode
boolean expanded,
boolean leaf,
int row,
- boolean hasFocus)
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
@@ -60,12 +60,11 @@ class Adapter extends TreeNode
}
_cellRenderer.setToolTipText(_toolTip);
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
- Adapter(TreeNode parent, String adapterName, Utils.Resolver resolver,
- String adapterId, AdapterDescriptor descriptor, Ice.ObjectPrx proxy)
+ Adapter(TreeNode parent, String adapterName, Utils.Resolver resolver, String adapterId,
+ AdapterDescriptor descriptor, Ice.ObjectPrx proxy)
{
super(parent, adapterName);
_resolver = resolver;
@@ -79,7 +78,7 @@ class Adapter extends TreeNode
{
return _descriptor;
}
-
+
Utils.Resolver getResolver()
{
return _resolver;
@@ -90,7 +89,7 @@ class Adapter extends TreeNode
return _currentEndpoints;
}
- java.util.Map getProperties()
+ java.util.Map<String, String> getProperties()
{
if(_parent instanceof Server)
{
@@ -122,12 +121,10 @@ class Adapter extends TreeNode
}
}
- boolean update(java.util.List infoList)
+ boolean update(java.util.List<AdapterDynamicInfo> infoList)
{
- java.util.Iterator p = infoList.iterator();
- while(p.hasNext())
+ for(AdapterDynamicInfo info : infoList)
{
- AdapterDynamicInfo info = (AdapterDynamicInfo)p.next();
if(update(info))
{
return true;
@@ -159,7 +156,6 @@ class Adapter extends TreeNode
}
}
-
private AdapterDescriptor _descriptor;
private Utils.Resolver _resolver;
private String _adapterId;
diff --git a/java/src/IceGridGUI/LiveDeployment/AdapterEditor.java b/java/src/IceGridGUI/LiveDeployment/AdapterEditor.java
index b1fd5c4f22b..ee0f5a77313 100644
--- a/java/src/IceGridGUI/LiveDeployment/AdapterEditor.java
+++ b/java/src/IceGridGUI/LiveDeployment/AdapterEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import javax.swing.AbstractAction;
@@ -43,16 +44,15 @@ class AdapterEditor extends Editor
_serverLifetime.setEnabled(false);
}
-
void show(Adapter adapter)
{
AdapterDescriptor descriptor = adapter.getDescriptor();
Utils.Resolver resolver = adapter.getResolver();
-
+
_id.setText(resolver.substitute(descriptor.id));
String currentEndpoints = adapter.getCurrentEndpoints();
-
+
if(currentEndpoints == null)
{
_currentStatus.setText("Inactive");
@@ -63,19 +63,19 @@ class AdapterEditor extends Editor
_currentStatus.setText("Active");
_currentEndpoints.setText(currentEndpoints);
}
-
+
_description.setText(resolver.substitute(descriptor.description));
_replicaGroupId.setText(resolver.substitute(descriptor.replicaGroupId));
_priority.setText(resolver.substitute(descriptor.priority));
- java.util.Map properties = adapter.getProperties();
-
+ java.util.Map<String, String> properties = adapter.getProperties();
+
// getId() returns the name of the adapter!
- _endpoints.setText(resolver.substitute((String)properties.get(adapter.getId() + ".Endpoints")));
+ _endpoints.setText(resolver.substitute(properties.get(adapter.getId() + ".Endpoints")));
_publishedEndpoints.setText(
resolver.substitute((String)properties.get(adapter.getId() + ".PublishedEndpoints")));
-
- _registerProcess.setSelected(descriptor.registerProcess);
+
+ _registerProcess.setSelected(descriptor.registerProcess);
_serverLifetime.setSelected(descriptor.serverLifetime);
_objects.setObjects(descriptor.objects, resolver);
@@ -95,26 +95,25 @@ class AdapterEditor extends Editor
builder.nextLine();
builder.appendSeparator("Configuration");
-
+
builder.append("Description");
builder.nextLine();
builder.append("");
builder.nextRow(-2);
CellConstraints cc = new CellConstraints();
JScrollPane scrollPane = new JScrollPane(_description);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
builder.nextRow(2);
builder.nextLine();
builder.append("Adapter ID");
builder.append(_id, 3);
builder.nextLine();
-
+
builder.append("Replica Group");
builder.append(_replicaGroupId, 3);
builder.nextLine();
-
+
builder.append("Priority");
builder.append(_priority, 3);
builder.nextLine();
@@ -141,8 +140,7 @@ class AdapterEditor extends Editor
builder.append("");
builder.nextRow(-6);
scrollPane = new JScrollPane(_objects);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
@@ -155,8 +153,7 @@ class AdapterEditor extends Editor
builder.append("");
builder.nextRow(-6);
scrollPane = new JScrollPane(_allocatables);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
}
@@ -179,7 +176,7 @@ class AdapterEditor extends Editor
private JCheckBox _registerProcess = new JCheckBox("Register Process");
private JCheckBox _serverLifetime = new JCheckBox("Server Lifetime");
-
+
private TableField _objects = new TableField("Identity", "Type");
private TableField _allocatables = new TableField("Identity", "Type");
}
diff --git a/java/src/IceGridGUI/LiveDeployment/ApplicationDetailsDialog.java b/java/src/IceGridGUI/LiveDeployment/ApplicationDetailsDialog.java
index 5ea9b7bfaa3..6e21de1ba3a 100644
--- a/java/src/IceGridGUI/LiveDeployment/ApplicationDetailsDialog.java
+++ b/java/src/IceGridGUI/LiveDeployment/ApplicationDetailsDialog.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.awt.BorderLayout;
@@ -38,8 +39,7 @@ class ApplicationDetailsDialog extends JDialog
{
ApplicationDetailsDialog(final Root root)
{
- super(root.getCoordinator().getMainFrame(),
- "Application Details - IceGrid Admin", true);
+ super(root.getCoordinator().getMainFrame(), "Application Details - IceGrid Admin", true);
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
_mainFrame = root.getCoordinator().getMainFrame();
@@ -50,13 +50,13 @@ class ApplicationDetailsDialog extends JDialog
_updateTime.setEditable(false);
_updateUser.setEditable(false);
_revision.setEditable(false);
-
+
FormLayout layout = new FormLayout("right:pref, 3dlu, pref", "");
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.setDefaultDialogBorder();
builder.setRowGroupingEnabled(true);
builder.setLineGapSize(LayoutStyle.getCurrent().getLinePad());
-
+
builder.append("Name", _name);
builder.nextLine();
builder.append("UUID", _uuid);
@@ -74,7 +74,7 @@ class ApplicationDetailsDialog extends JDialog
Container contentPane = getContentPane();
contentPane.add(builder.getPanel());
-
+
pack();
setResizable(false);
}
@@ -101,5 +101,4 @@ class ApplicationDetailsDialog extends JDialog
private JTextField _updateUser = new JTextField(30);
private JTextField _revision = new JTextField(30);
private JFrame _mainFrame;
-
}
diff --git a/java/src/IceGridGUI/LiveDeployment/CommunicatorEditor.java b/java/src/IceGridGUI/LiveDeployment/CommunicatorEditor.java
index 9c8e8b1ebc2..ae1228fa51a 100644
--- a/java/src/IceGridGUI/LiveDeployment/CommunicatorEditor.java
+++ b/java/src/IceGridGUI/LiveDeployment/CommunicatorEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import javax.swing.JScrollPane;
@@ -25,8 +26,7 @@ class CommunicatorEditor extends Editor
_description.setOpaque(false);
}
- protected void show(CommunicatorDescriptor descriptor,
- java.util.SortedMap properties,
+ protected void show(CommunicatorDescriptor descriptor, java.util.SortedMap<String, String> properties,
Utils.Resolver resolver)
{
_description.setText(resolver.substitute(descriptor.description));
@@ -41,11 +41,11 @@ class CommunicatorEditor extends Editor
builder.nextRow(-2);
CellConstraints cc = new CellConstraints();
JScrollPane scrollPane = new JScrollPane(_description);
- builder.add(scrollPane,
+ builder.add(scrollPane,
cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
builder.nextRow(2);
builder.nextLine();
-
+
builder.append("Properties");
builder.nextLine();
builder.append("");
@@ -57,8 +57,7 @@ class CommunicatorEditor extends Editor
builder.nextRow(-6);
scrollPane = new JScrollPane(_properties);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
}
@@ -66,4 +65,3 @@ class CommunicatorEditor extends Editor
private JTextArea _description = new JTextArea(3, 20);
private TableField _properties = new TableField("Name", "Value");
}
-
diff --git a/java/src/IceGridGUI/LiveDeployment/DbEnv.java b/java/src/IceGridGUI/LiveDeployment/DbEnv.java
index 6b60cf05056..a491439b2ae 100644
--- a/java/src/IceGridGUI/LiveDeployment/DbEnv.java
+++ b/java/src/IceGridGUI/LiveDeployment/DbEnv.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.awt.Component;
@@ -21,23 +22,22 @@ import IceGridGUI.*;
class DbEnv extends TreeNode
{
public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
_cellRenderer = new DefaultTreeCellRenderer();
_cellRenderer.setLeafIcon(Utils.getIcon("/icons/16x16/database.png"));
}
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
-
+
public Editor getEditor()
{
if(_editor == null)
@@ -48,8 +48,7 @@ class DbEnv extends TreeNode
return _editor;
}
- DbEnv(TreeNode parent, String dbEnvName, Utils.Resolver resolver,
- DbEnvDescriptor descriptor)
+ DbEnv(TreeNode parent, String dbEnvName, Utils.Resolver resolver, DbEnvDescriptor descriptor)
{
super(parent, dbEnvName);
_resolver = resolver;
@@ -71,5 +70,5 @@ class DbEnv extends TreeNode
private DbEnvDescriptor _descriptor;
static private DbEnvEditor _editor;
- static private DefaultTreeCellRenderer _cellRenderer;
+ static private DefaultTreeCellRenderer _cellRenderer;
}
diff --git a/java/src/IceGridGUI/LiveDeployment/DbEnvEditor.java b/java/src/IceGridGUI/LiveDeployment/DbEnvEditor.java
index acd279cdc63..94303bcea20 100644
--- a/java/src/IceGridGUI/LiveDeployment/DbEnvEditor.java
+++ b/java/src/IceGridGUI/LiveDeployment/DbEnvEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import javax.swing.JScrollPane;
@@ -57,11 +58,10 @@ class DbEnvEditor extends Editor
builder.nextRow(-2);
CellConstraints cc = new CellConstraints();
JScrollPane scrollPane = new JScrollPane(_description);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
builder.nextRow(2);
builder.nextLine();
-
+
builder.append("DB Home" );
builder.append(_dbHome, 3);
builder.nextLine();
@@ -78,8 +78,7 @@ class DbEnvEditor extends Editor
builder.append("");
builder.nextRow(-6);
scrollPane = new JScrollPane(_properties);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
}
diff --git a/java/src/IceGridGUI/LiveDeployment/Editor.java b/java/src/IceGridGUI/LiveDeployment/Editor.java
index 7ac4b19fd0b..401652c9634 100644
--- a/java/src/IceGridGUI/LiveDeployment/Editor.java
+++ b/java/src/IceGridGUI/LiveDeployment/Editor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import IceGridGUI.*;
@@ -14,5 +15,3 @@ import IceGrid.*;
public abstract class Editor extends EditorBase
{
}
-
-
diff --git a/java/src/IceGridGUI/LiveDeployment/ListArrayTreeNode.java b/java/src/IceGridGUI/LiveDeployment/ListArrayTreeNode.java
index daa3b6bf437..612e294beb5 100644
--- a/java/src/IceGridGUI/LiveDeployment/ListArrayTreeNode.java
+++ b/java/src/IceGridGUI/LiveDeployment/ListArrayTreeNode.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.util.Enumeration;
@@ -28,7 +29,7 @@ abstract class ListArrayTreeNode extends TreeNode
{
return true;
}
-
+
while(++_index < _childrenArray.length)
{
_p = _childrenArray[_index].iterator();
@@ -58,17 +59,17 @@ abstract class ListArrayTreeNode extends TreeNode
}
}
}
-
+
private int _index = 0;
private java.util.Iterator _p = _childrenArray[0].iterator();
};
}
-
+
public boolean getAllowsChildren()
{
return true;
}
-
+
public javax.swing.tree.TreeNode getChildAt(int childIndex)
{
if(childIndex < 0)
@@ -76,39 +77,39 @@ abstract class ListArrayTreeNode extends TreeNode
throw new ArrayIndexOutOfBoundsException(childIndex);
}
int offset = 0;
- for(int i = 0; i < _childrenArray.length; ++i)
+ for(java.util.List l : _childrenArray)
{
- if(childIndex < offset + _childrenArray[i].size())
+ if(childIndex < offset + l.size())
{
- return (javax.swing.tree.TreeNode)_childrenArray[i].get(childIndex - offset);
+ return (javax.swing.tree.TreeNode)l.get(childIndex - offset);
}
else
{
- offset += _childrenArray[i].size();
+ offset += l.size();
}
}
throw new ArrayIndexOutOfBoundsException(childIndex);
}
-
+
public int getChildCount()
{
int result = 0;
- for(int i = 0; i < _childrenArray.length; ++i)
+ for(java.util.List l : _childrenArray)
{
- result += _childrenArray[i].size();
+ result += l.size();
}
return result;
}
-
+
public int getIndex(javax.swing.tree.TreeNode node)
{
int offset = 0;
- for(int i = 0; i < _childrenArray.length; ++i)
+ for(java.util.List l : _childrenArray)
{
- int index = _childrenArray[i].indexOf(node);
+ int index = l.indexOf(node);
if(index == -1)
{
- offset += _childrenArray[i].size();
+ offset += l.size();
}
else
{
@@ -120,9 +121,9 @@ abstract class ListArrayTreeNode extends TreeNode
public boolean isLeaf()
{
- for(int i = 0; i < _childrenArray.length; ++i)
+ for(java.util.List l : _childrenArray)
{
- if(!_childrenArray[i].isEmpty())
+ if(!l.isEmpty())
{
return false;
}
diff --git a/java/src/IceGridGUI/LiveDeployment/ListTreeNode.java b/java/src/IceGridGUI/LiveDeployment/ListTreeNode.java
index 55aaf4246a3..47663f32c17 100644
--- a/java/src/IceGridGUI/LiveDeployment/ListTreeNode.java
+++ b/java/src/IceGridGUI/LiveDeployment/ListTreeNode.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.util.Enumeration;
@@ -31,16 +32,16 @@ abstract class ListTreeNode extends TreeNode
{
return _p.next();
}
-
+
private java.util.Iterator _p = _children.iterator();
};
}
-
+
public boolean getAllowsChildren()
{
return true;
}
-
+
public javax.swing.tree.TreeNode getChildAt(int childIndex)
{
if(childIndex < 0)
@@ -56,12 +57,12 @@ abstract class ListTreeNode extends TreeNode
throw new ArrayIndexOutOfBoundsException(childIndex);
}
}
-
+
public int getChildCount()
{
return _children.size();
}
-
+
public int getIndex(javax.swing.tree.TreeNode node)
{
return _children.indexOf(node);
@@ -77,5 +78,6 @@ abstract class ListTreeNode extends TreeNode
super(parent, id);
}
- protected final java.util.List _children = new java.util.LinkedList();
+ protected final java.util.List<javax.swing.tree.TreeNode> _children =
+ new java.util.LinkedList<javax.swing.tree.TreeNode>();
}
diff --git a/java/src/IceGridGUI/LiveDeployment/Node.java b/java/src/IceGridGUI/LiveDeployment/Node.java
index f70237f67a6..5decca4c8f6 100644
--- a/java/src/IceGridGUI/LiveDeployment/Node.java
+++ b/java/src/IceGridGUI/LiveDeployment/Node.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.awt.Component;
@@ -71,8 +72,7 @@ class Node extends ListTreeNode
return _id + (stdout ? ".out" : ".err");
}
});
- }
-
+ }
public void shutdownNode()
{
@@ -88,7 +88,7 @@ class Node extends ListTreeNode
{
amiSuccess(prefix);
}
-
+
public void ice_exception(Ice.UserException e)
{
amiFailure(prefix, "Failed to shutdown " + _id, e);
@@ -96,16 +96,16 @@ class Node extends ListTreeNode
public void ice_exception(Ice.LocalException e)
{
- amiFailure(prefix, "Failed to shutdown " + _id,
+ amiFailure(prefix, "Failed to shutdown " + _id,
e.toString());
}
};
try
- {
+ {
getCoordinator().getMainFrame().setCursor(
Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-
+
getCoordinator().getAdmin().shutdownNode_async(cb, _id);
}
catch(Ice.LocalException e)
@@ -131,12 +131,11 @@ class Node extends ListTreeNode
_popup.addSeparator();
_popup.add(la.get(SHUTDOWN_NODE));
}
-
+
la.setTarget(this);
return _popup;
}
-
public Editor getEditor()
{
if(_editor == null)
@@ -148,13 +147,13 @@ class Node extends ListTreeNode
}
public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
@@ -191,8 +190,7 @@ class Node extends ListTreeNode
}
}
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
Node(Root parent, NodeDynamicInfo info)
@@ -201,8 +199,7 @@ class Node extends ListTreeNode
up(info, false);
}
-
- Node(Root parent, ApplicationDescriptor appDesc,
+ Node(Root parent, ApplicationDescriptor appDesc,
String nodeName, NodeDescriptor nodeDesc)
{
super(parent, nodeName);
@@ -220,32 +217,30 @@ class Node extends ListTreeNode
update.loadFactor == null ? "" : update.loadFactor.value,
update.description == null ? "" : update.description.value,
update.propertySets);
-
+
appDesc.nodes.put(_id, nodeDesc);
add(appDesc, nodeDesc);
}
- Utils.ExpandedPropertySet expand(PropertySetDescriptor descriptor,
- String applicationName, Utils.Resolver resolver)
+ Utils.ExpandedPropertySet expand(PropertySetDescriptor descriptor, String applicationName, Utils.Resolver resolver)
{
Utils.ExpandedPropertySet result = new Utils.ExpandedPropertySet();
result.references = new Utils.ExpandedPropertySet[descriptor.references.length];
-
- for(int i = 0; i < descriptor.references.length; ++i)
+
+ int i = 0;
+ for(String ref : descriptor.references)
{
- result.references[i] = expand(
- findNamedPropertySet(resolver.substitute(descriptor.references[i]),
- applicationName),
- applicationName, resolver);
+ result.references[i++] = expand(findNamedPropertySet(resolver.substitute(ref), applicationName),
+ applicationName, resolver);
}
result.properties = descriptor.properties;
return result;
}
-
+
PropertySetDescriptor findNamedPropertySet(String name, String applicationName)
{
- ApplicationData appData = (ApplicationData)_map.get(applicationName);
+ ApplicationData appData = _map.get(applicationName);
if(appData != null)
{
NodeDescriptor descriptor = appData.descriptor;
@@ -262,25 +257,23 @@ class Node extends ListTreeNode
{
ApplicationData data = new ApplicationData();
data.descriptor = nodeDesc;
- data.resolver = new Utils.Resolver(new java.util.Map[]{appDesc.variables, nodeDesc.variables});
+ @SuppressWarnings("unchecked")
+ Utils.Resolver resolver = new Utils.Resolver(new java.util.Map[]{appDesc.variables, nodeDesc.variables});
+ data.resolver = resolver;
data.resolver.put("application", appDesc.name);
data.resolver.put("node", _id);
putInfoVariables(data.resolver);
_map.put(appDesc.name, data);
-
- java.util.Iterator p = nodeDesc.serverInstances.iterator();
- while(p.hasNext())
+
+ for(ServerInstanceDescriptor p : nodeDesc.serverInstances)
{
- ServerInstanceDescriptor desc = (ServerInstanceDescriptor)p.next();
- insertServer(createServer(appDesc, data.resolver, desc));
+ insertServer(createServer(appDesc, data.resolver, p));
}
-
- p = nodeDesc.servers.iterator();
- while(p.hasNext())
+
+ for(ServerDescriptor p : nodeDesc.servers)
{
- ServerDescriptor desc = (ServerDescriptor)p.next();
- insertServer(createServer(appDesc, data.resolver, desc));
+ insertServer(createServer(appDesc, data.resolver, p));
}
}
@@ -292,10 +285,10 @@ class Node extends ListTreeNode
return true;
}
- java.util.List toRemove = new java.util.LinkedList();
+ java.util.List<Server> toRemove = new java.util.LinkedList<Server>();
int[] toRemoveIndices = new int[_children.size()];
int i = 0;
-
+
for(int index = 0; index < _children.size(); ++index)
{
Server server = (Server)_children.get(index);
@@ -312,12 +305,11 @@ class Node extends ListTreeNode
return false;
}
- void update(ApplicationDescriptor appDesc, NodeUpdateDescriptor update,
- boolean variablesChanged, java.util.Set serviceTemplates,
- java.util.Set serverTemplates)
+ void update(ApplicationDescriptor appDesc, NodeUpdateDescriptor update, boolean variablesChanged,
+ java.util.Set<String> serviceTemplates, java.util.Set<String> serverTemplates)
{
ApplicationData data = (ApplicationData)_map.get(appDesc.name);
-
+
if(data == null)
{
if(update != null)
@@ -329,7 +321,7 @@ class Node extends ListTreeNode
update.loadFactor == null ? "" : update.loadFactor.value,
update.description == null ? "" : update.description.value,
update.propertySets);
-
+
appDesc.nodes.put(_id, nodeDesc);
add(appDesc, nodeDesc);
}
@@ -341,8 +333,8 @@ class Node extends ListTreeNode
}
NodeDescriptor nodeDesc = data.descriptor;
- java.util.Set freshServers = new java.util.HashSet();
-
+ java.util.Set<Server> freshServers = new java.util.HashSet<Server>();
+
if(update != null)
{
//
@@ -356,33 +348,31 @@ class Node extends ListTreeNode
{
nodeDesc.loadFactor = update.loadFactor.value;
}
-
+
nodeDesc.variables.keySet().removeAll(java.util.Arrays.asList(update.removeVariables));
nodeDesc.variables.putAll(update.variables);
-
+
if(!variablesChanged)
{
- variablesChanged = update.removeVariables.length > 0 ||
- !update.variables.isEmpty();
+ variablesChanged = update.removeVariables.length > 0 || !update.variables.isEmpty();
}
- nodeDesc.propertySets.keySet().removeAll(
- java.util.Arrays.asList(update.removePropertySets));
+ nodeDesc.propertySets.keySet().removeAll(java.util.Arrays.asList(update.removePropertySets));
nodeDesc.propertySets.putAll(update.propertySets);
//
// Remove servers
//
- for(int i = 0; i < update.removeServers.length; ++i)
+ for(String id : update.removeServers)
{
- Server server = findServer(update.removeServers[i]);
+ Server server = findServer(id);
if(server == null)
{
//
// This should never happen
//
- String errorMsg = "LiveDeployment/Node: unable to remove server '" + update.removeServers[i]
- + "'; please report this bug.";
+ String errorMsg = "LiveDeployment/Node: unable to remove server '" + id +
+ "'; please report this bug.";
getCoordinator().getCommunicator().getLogger().error(errorMsg);
}
@@ -390,7 +380,7 @@ class Node extends ListTreeNode
{
server.removeCallbacks();
removeDescriptor(nodeDesc, server);
- int index = getIndex(server);
+ int index = getIndex(server);
_children.remove(server);
getRoot().getTreeModel().nodesWereRemoved(this, new int[]{index}, new Object[]{server});
}
@@ -399,12 +389,10 @@ class Node extends ListTreeNode
//
// Add/update servers
//
- java.util.Iterator p = update.serverInstances.iterator();
- while(p.hasNext())
+ for(ServerInstanceDescriptor desc : update.serverInstances)
{
- ServerInstanceDescriptor desc = (ServerInstanceDescriptor)p.next();
Server server = createServer(appDesc, data.resolver, desc);
-
+
Server oldServer = findServer(server.getId());
if(oldServer == null)
{
@@ -420,14 +408,11 @@ class Node extends ListTreeNode
nodeDesc.serverInstances.add(desc);
}
}
-
- p = update.servers.iterator();
- while(p.hasNext())
+
+ for(ServerDescriptor desc : update.servers)
{
- ServerDescriptor desc = (ServerDescriptor)p.next();
-
Server server = createServer(appDesc, data.resolver, desc);
-
+
Server oldServer = findServer(server.getId());
if(oldServer == null)
{
@@ -444,29 +429,26 @@ class Node extends ListTreeNode
}
}
}
-
+
if(variablesChanged || !serviceTemplates.isEmpty() || !serverTemplates.isEmpty())
{
//
// Rebuild every other server in this application
//
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(javax.swing.tree.TreeNode p : _children)
{
- Server server = (Server)p.next();
+ Server server = (Server)p;
if(server.getApplication() == appDesc)
{
if(!freshServers.contains(server))
{
- server.rebuild(data.resolver,
- variablesChanged,
- serviceTemplates, serverTemplates);
+ server.rebuild(data.resolver, variablesChanged, serviceTemplates, serverTemplates);
}
}
}
}
}
-
+
NodeInfo getStaticInfo()
{
if(_info == null)
@@ -478,7 +460,7 @@ class Node extends ListTreeNode
return _info.info;
}
}
-
+
boolean isRunningWindows()
{
return _windows;
@@ -494,7 +476,7 @@ class Node extends ListTreeNode
{
boolean updated = resolver.put("node.os", _info.info.os);
updated = resolver.put("node.hostname", _info.info.hostname) || updated;
- updated = resolver.put("node.release", _info.info.release) || updated;
+ updated = resolver.put("node.release", _info.info.release) || updated;
updated = resolver.put("node.version", _info.info.version) || updated;
updated = resolver.put("node.machine", _info.info.machine) || updated;
updated = resolver.put("node.datadir", _info.info.dataDir) || updated;
@@ -507,23 +489,19 @@ class Node extends ListTreeNode
_up = true;
_info = info;
_windows = info.info.os.toLowerCase().startsWith("windows");
-
+
//
// Update variables and rebuild all affected servers
//
- java.util.Iterator p = _map.values().iterator();
- while(p.hasNext())
+ for(ApplicationData data : _map.values())
{
- ApplicationData data = (ApplicationData)p.next();
-
if(putInfoVariables(data.resolver))
{
String appName = data.resolver.find("application");
- java.util.Iterator q = _children.iterator();
- while(q.hasNext())
+ for(javax.swing.tree.TreeNode p : _children)
{
- Server server = (Server)q.next();
+ Server server = (Server)p;
if(server.getApplication().name.equals(appName))
{
server.rebuild(data.resolver, true, null, null);
@@ -531,15 +509,13 @@ class Node extends ListTreeNode
}
}
}
-
+
//
// Tell every server on this node
//
- java.util.Set updatedServers = new java.util.HashSet();
- p = _info.servers.iterator();
- while(p.hasNext())
+ java.util.Set<Server> updatedServers = new java.util.HashSet<Server>();
+ for(ServerDynamicInfo sinfo : _info.servers)
{
- ServerDynamicInfo sinfo = (ServerDynamicInfo)p.next();
Server server = findServer(sinfo.id);
if(server != null)
{
@@ -547,10 +523,9 @@ class Node extends ListTreeNode
updatedServers.add(server);
}
}
- p = _children.iterator();
- while(p.hasNext())
+ for(javax.swing.tree.TreeNode p : _children)
{
- Server server = (Server)p.next();
+ Server server = (Server)p;
if(!updatedServers.contains(server))
{
server.update(ServerState.Inactive, 0, true, true);
@@ -560,7 +535,7 @@ class Node extends ListTreeNode
//
// Tell adapters
//
- p = _children.iterator();
+ java.util.Iterator<javax.swing.tree.TreeNode> p = _children.iterator();
int updateCount = 0;
while(p.hasNext() && updateCount < _info.adapters.size())
{
@@ -586,10 +561,9 @@ class Node extends ListTreeNode
}
else
{
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(javax.swing.tree.TreeNode p : _children)
{
- Server server = (Server)p.next();
+ Server server = (Server)p;
server.nodeDown();
}
@@ -602,10 +576,10 @@ class Node extends ListTreeNode
{
if(_info != null)
{
- java.util.ListIterator p = _info.servers.listIterator();
+ java.util.ListIterator<ServerDynamicInfo> p = _info.servers.listIterator();
while(p.hasNext())
{
- ServerDynamicInfo sinfo = (ServerDynamicInfo)p.next();
+ ServerDynamicInfo sinfo = p.next();
if(sinfo.id.equals(updatedInfo.id))
{
p.set(updatedInfo);
@@ -617,8 +591,7 @@ class Node extends ListTreeNode
Server server = findServer(updatedInfo.id);
if(server != null)
{
- server.update(updatedInfo.state, updatedInfo.pid,
- updatedInfo.enabled, true);
+ server.update(updatedInfo.state, updatedInfo.pid, updatedInfo.enabled, true);
}
}
@@ -626,10 +599,10 @@ class Node extends ListTreeNode
{
if(_info != null)
{
- java.util.ListIterator p = _info.adapters.listIterator();
+ java.util.ListIterator<AdapterDynamicInfo> p = _info.adapters.listIterator();
while(p.hasNext())
{
- AdapterDynamicInfo ainfo = (AdapterDynamicInfo)p.next();
+ AdapterDynamicInfo ainfo = p.next();
if(ainfo.id.equals(updatedInfo.id))
{
p.set(updatedInfo);
@@ -638,25 +611,24 @@ class Node extends ListTreeNode
}
}
- java.util.Iterator p = _children.iterator();
- while(p.hasNext())
+ for(javax.swing.tree.TreeNode p : _children)
{
- Server server = (Server)p.next();
+ Server server = (Server)p;
if(server.updateAdapter(updatedInfo))
{
break;
}
}
}
-
+
Ice.ObjectPrx getProxy(String adapterId)
{
if(_info != null)
{
- java.util.ListIterator p = _info.adapters.listIterator();
+ java.util.ListIterator<AdapterDynamicInfo> p = _info.adapters.listIterator();
while(p.hasNext())
{
- AdapterDynamicInfo ainfo = (AdapterDynamicInfo)p.next();
+ AdapterDynamicInfo ainfo = p.next();
if(ainfo.id.equals(adapterId))
{
return ainfo.proxy;
@@ -666,29 +638,25 @@ class Node extends ListTreeNode
return null;
}
- java.util.SortedMap getLoadFactors()
+ java.util.SortedMap<String, String> getLoadFactors()
{
- java.util.SortedMap result = new java.util.TreeMap();
-
- java.util.Iterator p = _map.entrySet().iterator();
- while(p.hasNext())
+ java.util.SortedMap<String, String> result = new java.util.TreeMap<String, String>();
+
+ for(java.util.Map.Entry<String, ApplicationData> p : _map.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
-
- ApplicationData ad = (ApplicationData)entry.getValue();
-
+ ApplicationData ad = p.getValue();
+
String val = ad.resolver.substitute(ad.descriptor.loadFactor);
if(val.length() == 0)
{
val = "Default";
}
- result.put(entry.getKey(), val);
+ result.put(p.getKey(), val);
}
return result;
}
-
void showLoad()
{
AMI_Admin_getNodeLoad cb = new AMI_Admin_getNodeLoad()
@@ -708,15 +676,15 @@ class Node extends ListTreeNode
format.setMaximumFractionDigits(2);
format.setMinimumFractionDigits(2);
}
-
- final String load =
+
+ final String load =
format.format(loadInfo.avg1) + " " +
format.format(loadInfo.avg5) + " " +
- format.format(loadInfo.avg15);
+ format.format(loadInfo.avg15);
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_editor.setLoad(load, Node.this);
}
@@ -725,9 +693,9 @@ class Node extends ListTreeNode
public void ice_exception(final Ice.UserException e)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
if(e instanceof IceGrid.NodeNotExistException)
{
@@ -745,13 +713,13 @@ class Node extends ListTreeNode
}
}
});
- }
-
+ }
+
public void ice_exception(final Ice.LocalException e)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_editor.setLoad("Error: " + e.toString(), Node.this);
}
@@ -760,10 +728,10 @@ class Node extends ListTreeNode
};
try
- {
+ {
getCoordinator().getMainFrame().setCursor(
Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-
+
IceGrid.AdminPrx admin = getCoordinator().getAdmin();
if(admin == null)
{
@@ -785,33 +753,31 @@ class Node extends ListTreeNode
}
}
-
- private Server createServer(ApplicationDescriptor application,
- Utils.Resolver resolver, ServerInstanceDescriptor instanceDescriptor)
+ private Server createServer(ApplicationDescriptor application, Utils.Resolver resolver,
+ ServerInstanceDescriptor instanceDescriptor)
{
//
// Find template
//
- TemplateDescriptor templateDescriptor =
+ TemplateDescriptor templateDescriptor =
(TemplateDescriptor)application.serverTemplates.get(instanceDescriptor.template);
assert templateDescriptor != null;
-
- ServerDescriptor serverDescriptor =
- (ServerDescriptor)templateDescriptor.descriptor;
-
+
+ ServerDescriptor serverDescriptor = (ServerDescriptor)templateDescriptor.descriptor;
+
assert serverDescriptor != null;
-
+
//
// Build resolver
//
- Utils.Resolver instanceResolver =
- new Utils.Resolver(resolver,
+ Utils.Resolver instanceResolver =
+ new Utils.Resolver(resolver,
instanceDescriptor.parameterValues,
templateDescriptor.parameterDefaults);
-
+
String serverId = instanceResolver.substitute(serverDescriptor.id);
instanceResolver.put("server", serverId);
-
+
//
// Lookup dynamic info
//
@@ -820,15 +786,13 @@ class Node extends ListTreeNode
boolean enabled = true;
if(_info != null)
{
- java.util.Iterator p = _info.servers.iterator();
- while(p.hasNext())
+ for(ServerDynamicInfo info : _info.servers)
{
- ServerDynamicInfo sinfo = (ServerDynamicInfo)p.next();
- if(sinfo.id.equals(serverId))
+ if(info.id.equals(serverId))
{
- serverState = sinfo.state;
- pid = sinfo.pid;
- enabled = sinfo.enabled;
+ serverState = info.state;
+ pid = info.pid;
+ enabled = info.enabled;
break;
}
}
@@ -837,21 +801,19 @@ class Node extends ListTreeNode
//
// Create server
//
- return new Server(this, serverId, instanceResolver, instanceDescriptor,
- serverDescriptor, application,
+ return new Server(this, serverId, instanceResolver, instanceDescriptor, serverDescriptor, application,
serverState, pid, enabled);
-
}
- private Server createServer(ApplicationDescriptor application,
- Utils.Resolver resolver, ServerDescriptor serverDescriptor)
+ private Server createServer(ApplicationDescriptor application, Utils.Resolver resolver,
+ ServerDescriptor serverDescriptor)
{
//
// Build resolver
//
Utils.Resolver instanceResolver = new Utils.Resolver(resolver);
String serverId = instanceResolver.substitute(serverDescriptor.id);
- instanceResolver.put("server", serverId);
+ instanceResolver.put("server", serverId);
//
// Lookup dynamic info
@@ -861,15 +823,13 @@ class Node extends ListTreeNode
boolean enabled = true;
if(_info != null)
{
- java.util.Iterator p = _info.servers.iterator();
- while(p.hasNext())
+ for(ServerDynamicInfo info : _info.servers)
{
- ServerDynamicInfo sinfo = (ServerDynamicInfo)p.next();
- if(sinfo.id.equals(serverId))
+ if(info.id.equals(serverId))
{
- serverState = sinfo.state;
- pid = sinfo.pid;
- enabled = sinfo.enabled;
+ serverState = info.state;
+ pid = info.pid;
+ enabled = info.enabled;
break;
}
}
@@ -878,9 +838,8 @@ class Node extends ListTreeNode
//
// Create server
//
- return new Server(this, serverId, instanceResolver, null, serverDescriptor,
- application, serverState, pid, enabled);
-
+ return new Server(this, serverId, instanceResolver, null, serverDescriptor, application, serverState, pid,
+ enabled);
}
private void insertServer(Server server)
@@ -893,11 +852,9 @@ class Node extends ListTreeNode
return (Server)find(id, _children);
}
-
private void removeDescriptor(NodeDescriptor nodeDesc, Server server)
{
- ServerInstanceDescriptor instanceDescriptor =
- server.getInstanceDescriptor();
+ ServerInstanceDescriptor instanceDescriptor = server.getInstanceDescriptor();
if(instanceDescriptor != null)
{
removeDescriptor(nodeDesc, instanceDescriptor);
@@ -913,7 +870,7 @@ class Node extends ListTreeNode
//
// A straight remove uses equals(), which is not the desired behavior
//
- java.util.Iterator p = nodeDesc.servers.iterator();
+ java.util.Iterator<ServerDescriptor> p = nodeDesc.servers.iterator();
while(p.hasNext())
{
if(sd == p.next())
@@ -929,7 +886,7 @@ class Node extends ListTreeNode
//
// A straight remove uses equals(), which is not the desired behavior
//
- java.util.Iterator p = nodeDesc.serverInstances.iterator();
+ java.util.Iterator<ServerInstanceDescriptor> p = nodeDesc.serverInstances.iterator();
while(p.hasNext())
{
if(sd == p.next())
@@ -940,7 +897,6 @@ class Node extends ListTreeNode
}
}
-
static class ApplicationData
{
NodeDescriptor descriptor;
@@ -950,8 +906,8 @@ class Node extends ListTreeNode
//
// Application name to ApplicationData
//
- private final java.util.SortedMap _map = new java.util.TreeMap();
-
+ private final java.util.SortedMap<String, ApplicationData> _map = new java.util.TreeMap<String, ApplicationData>();
+
private boolean _up = false;
private NodeDynamicInfo _info;
private boolean _windows = false;
diff --git a/java/src/IceGridGUI/LiveDeployment/NodeEditor.java b/java/src/IceGridGUI/LiveDeployment/NodeEditor.java
index 2533da9dc01..89f6bd48d3a 100644
--- a/java/src/IceGridGUI/LiveDeployment/NodeEditor.java
+++ b/java/src/IceGridGUI/LiveDeployment/NodeEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.awt.event.ActionEvent;
@@ -20,7 +21,6 @@ import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-
import IceGrid.*;
import IceGridGUI.*;
@@ -35,12 +35,12 @@ class NodeEditor extends Editor
Action refresh = new AbstractAction("Refresh")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.showLoad();
}
};
- refresh.putValue(Action.SHORT_DESCRIPTION,
+ refresh.putValue(Action.SHORT_DESCRIPTION,
"Fetch the latest values from this IceGrid Node");
_refreshButton = new JButton(refresh);
}
@@ -50,7 +50,7 @@ class NodeEditor extends Editor
_target = node;
NodeInfo info = node.getStaticInfo();
-
+
if(info == null)
{
_hostname.setText("Unknown");
@@ -64,30 +64,28 @@ class NodeEditor extends Editor
_hostname.setText(info.hostname);
_os.setText(info.os + " " + info.release + " " + info.version);
_os.setCaretPosition(0);
- _machineType.setText(info.machine + " with " +
- info.nProcessors
- + " CPU"
+ _machineType.setText(info.machine + " with " +
+ info.nProcessors
+ + " CPU"
+ (info.nProcessors >= 2 ? "s" : ""));
-
+
if(node.isRunningWindows())
{
_loadAverageLabel.setText("CPU Usage");
- _loadAverage.setToolTipText(
- "CPU usage in the past 1 min, 5 min and 15 min period");
+ _loadAverage.setToolTipText("CPU usage in the past 1 min, 5 min and 15 min period");
}
else
{
_loadAverageLabel.setText("Load Average");
- _loadAverage.setToolTipText(
- "Load average in the past 1 min, 5 min and 15 min period");
+ _loadAverage.setToolTipText("Load average in the past 1 min, 5 min and 15 min period");
}
_loadAverage.setText("Refreshing...");
node.showLoad();
}
- _loadFactor.setSortedMap(node.getLoadFactors());
+ _loadFactor.setSortedMap(node.getLoadFactors());
}
-
+
void setLoad(String load, Node node)
{
if(node == _target)
@@ -96,13 +94,13 @@ class NodeEditor extends Editor
}
//
// Otherwise, we've already moved to another node
- //
+ //
}
protected void appendProperties(DefaultFormBuilder builder)
{
builder.appendSeparator("System Information");
-
+
builder.append("Hostname");
builder.append(_hostname, 3);
builder.nextLine();
@@ -131,8 +129,7 @@ class NodeEditor extends Editor
builder.nextRow(-6);
CellConstraints cc = new CellConstraints();
JScrollPane scrollPane = new JScrollPane(_loadFactor);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
}
diff --git a/java/src/IceGridGUI/LiveDeployment/ObjectDialog.java b/java/src/IceGridGUI/LiveDeployment/ObjectDialog.java
index 1653cf597e4..f71c4b5fef9 100644
--- a/java/src/IceGridGUI/LiveDeployment/ObjectDialog.java
+++ b/java/src/IceGridGUI/LiveDeployment/ObjectDialog.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.awt.BorderLayout;
@@ -40,10 +41,10 @@ class ObjectDialog extends JDialog
{
super(root.getCoordinator().getMainFrame(),
(readOnly ? "" : "New ") + "Dynamic Well-Known Object - IceGrid Admin", true);
-
+
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
_mainFrame = root.getCoordinator().getMainFrame();
-
+
_proxy.setLineWrap(true);
if(readOnly)
@@ -56,24 +57,23 @@ class ObjectDialog extends JDialog
{
_typeCombo.setEditable(true);
}
-
+
FormLayout layout = new FormLayout("right:pref, 3dlu, pref", "");
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.setDefaultDialogBorder();
builder.setRowGroupingEnabled(true);
builder.setLineGapSize(LayoutStyle.getCurrent().getLinePad());
-
+
builder.append("Proxy");
builder.nextLine();
builder.append("");
builder.nextRow(-2);
CellConstraints cc = new CellConstraints();
JScrollPane scrollPane = new JScrollPane(_proxy);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 1, 3));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 1, 3));
builder.nextRow(2);
builder.nextLine();
-
+
if(readOnly)
{
builder.append("Type", _type);
@@ -84,7 +84,6 @@ class ObjectDialog extends JDialog
}
builder.nextLine();
-
Container contentPane = getContentPane();
if(readOnly)
{
@@ -104,7 +103,7 @@ class ObjectDialog extends JDialog
{
type = _typeCombo.getSelectedItem().toString();
}
-
+
if(root.addObject(_proxy.getText(), type))
{
setVisible(false);
@@ -118,7 +117,7 @@ class ObjectDialog extends JDialog
};
okButton.addActionListener(okListener);
getRootPane().setDefaultButton(okButton);
-
+
JButton cancelButton = new JButton("Cancel");
ActionListener cancelListener = new ActionListener()
{
@@ -128,12 +127,11 @@ class ObjectDialog extends JDialog
}
};
cancelButton.addActionListener(cancelListener);
-
-
- JComponent buttonBar =
+
+ JComponent buttonBar =
ButtonBarFactory.buildOKCancelBar(okButton, cancelButton);
buttonBar.setBorder(Borders.DIALOG_BORDER);
-
+
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
contentPane.add(builder.getPanel());
contentPane.add(buttonBar);
diff --git a/java/src/IceGridGUI/LiveDeployment/RegistryEditor.java b/java/src/IceGridGUI/LiveDeployment/RegistryEditor.java
index bc798f75276..985b8753853 100644
--- a/java/src/IceGridGUI/LiveDeployment/RegistryEditor.java
+++ b/java/src/IceGridGUI/LiveDeployment/RegistryEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.awt.event.ActionEvent;
@@ -39,14 +40,14 @@ class RegistryEditor extends Editor
Action openDefinition = new AbstractAction("Open definition")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
int selectedRow = _applications.getSelectedRow();
if(selectedRow != -1)
{
String appName = (String)_applications.getValueAt(selectedRow, 0);
ApplicationPane app = _target.getCoordinator().openLiveApplication(appName);
-
+
if(app != null && app.getRoot().getSelectedNode() == null)
{
app.getRoot().setSelectedNode(app.getRoot());
@@ -57,7 +58,7 @@ class RegistryEditor extends Editor
Action showDetails = new AbstractAction("Show details")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
int selectedRow = _applications.getSelectedRow();
if(selectedRow != -1)
@@ -70,7 +71,7 @@ class RegistryEditor extends Editor
final Action patch = new AbstractAction("Patch distribution")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
int selectedRow = _applications.getSelectedRow();
if(selectedRow != -1)
@@ -83,7 +84,7 @@ class RegistryEditor extends Editor
Action removeApplication = new AbstractAction("Remove from registry")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
int selectedRow = _applications.getSelectedRow();
if(selectedRow != -1)
@@ -93,10 +94,10 @@ class RegistryEditor extends Editor
int confirm = JOptionPane.showConfirmDialog(
_target.getCoordinator().getMainFrame(),
"You are about to remove application '" + appName + "' from the IceGrid registry. "
- + "Do you want to proceed?",
+ + "Do you want to proceed?",
"Remove Confirmation",
JOptionPane.YES_NO_OPTION);
-
+
if(confirm == JOptionPane.YES_OPTION)
{
_target.getCoordinator().removeApplicationFromRegistry(appName);
@@ -105,12 +106,10 @@ class RegistryEditor extends Editor
}
};
- removeApplication.putValue(Action.ACCELERATOR_KEY,
- KeyStroke.getKeyStroke("DELETE"));
+ removeApplication.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("DELETE"));
_applications.getActionMap().put("delete", removeApplication);
- _applications.getInputMap().put(
- KeyStroke.getKeyStroke("DELETE"), "delete");
+ _applications.getInputMap().put(KeyStroke.getKeyStroke("DELETE"), "delete");
final JPopupMenu appPopup = new JPopupMenu();
appPopup.add(openDefinition);
@@ -135,17 +134,17 @@ class RegistryEditor extends Editor
}
}
- public void mousePressed(MouseEvent e)
+ public void mousePressed(MouseEvent e)
{
maybeShowPopup(e);
}
-
- public void mouseReleased(MouseEvent e)
+
+ public void mouseReleased(MouseEvent e)
{
maybeShowPopup(e);
}
-
- private void maybeShowPopup(MouseEvent e)
+
+ private void maybeShowPopup(MouseEvent e)
{
int selectedRow = _applications.getSelectedRow();
if (e.isPopupTrigger() && selectedRow != -1)
@@ -161,7 +160,7 @@ class RegistryEditor extends Editor
Action deleteObject = new AbstractAction("Remove selected object")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(_target.getCoordinator().connectedToMaster())
{
@@ -173,17 +172,14 @@ class RegistryEditor extends Editor
}
}
};
- deleteObject.putValue(Action.ACCELERATOR_KEY,
- KeyStroke.getKeyStroke("DELETE"));
+ deleteObject.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("DELETE"));
_objects.getActionMap().put("delete", deleteObject);
- _objects.getInputMap().put(
- KeyStroke.getKeyStroke("DELETE"), "delete");
+ _objects.getInputMap().put(KeyStroke.getKeyStroke("DELETE"), "delete");
-
Action showObject = new AbstractAction("Show details")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
int selectedRow = _objects.getSelectedRow();
if(selectedRow != -1)
@@ -197,7 +193,7 @@ class RegistryEditor extends Editor
Action addObject = new AbstractAction("Add a new well-known object")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(_target.getCoordinator().connectedToMaster())
{
@@ -205,18 +201,15 @@ class RegistryEditor extends Editor
}
}
};
- addObject.putValue(Action.ACCELERATOR_KEY,
- KeyStroke.getKeyStroke("INSERT"));
+ addObject.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("INSERT"));
_objects.getActionMap().put("insert", addObject);
- _objects.getInputMap().put(
- KeyStroke.getKeyStroke("INSERT"), "insert");
+ _objects.getInputMap().put(KeyStroke.getKeyStroke("INSERT"), "insert");
_objects.setToolTipText("<html>Well-known objects registered through the Admin interface.<br>"
- + "Well-known objects registered using Adapter or Replica Group<br>"
+ + "Well-known objects registered using Adapter or Replica Group<br>"
+ "definitions are not displayed here.</html>");
-
final JPopupMenu objectsPopup = new JPopupMenu();
objectsPopup.add(addObject);
objectsPopup.addSeparator();
@@ -240,17 +233,17 @@ class RegistryEditor extends Editor
}
}
- public void mousePressed(MouseEvent e)
+ public void mousePressed(MouseEvent e)
{
maybeShowPopup(e);
}
-
- public void mouseReleased(MouseEvent e)
+
+ public void mouseReleased(MouseEvent e)
{
maybeShowPopup(e);
}
-
- private void maybeShowPopup(MouseEvent e)
+
+ private void maybeShowPopup(MouseEvent e)
{
if (e.isPopupTrigger())
{
@@ -261,10 +254,9 @@ class RegistryEditor extends Editor
}
});
-
Action deleteAdapter = new AbstractAction("Remove selected adapter")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
if(_target.getCoordinator().connectedToMaster())
{
@@ -276,12 +268,10 @@ class RegistryEditor extends Editor
}
}
};
- deleteAdapter.putValue(Action.ACCELERATOR_KEY,
- KeyStroke.getKeyStroke("DELETE"));
+ deleteAdapter.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("DELETE"));
_adapters.getActionMap().put("delete", deleteAdapter);
- _adapters.getInputMap().put(
- KeyStroke.getKeyStroke("DELETE"), "delete");
+ _adapters.getInputMap().put(KeyStroke.getKeyStroke("DELETE"), "delete");
_adapters.setToolTipText("<html>Object adapters registered at run time.</html>");
final JPopupMenu adaptersPopup = new JPopupMenu();
@@ -289,17 +279,17 @@ class RegistryEditor extends Editor
_adapters.addMouseListener(new MouseAdapter()
{
- public void mousePressed(MouseEvent e)
+ public void mousePressed(MouseEvent e)
{
maybeShowPopup(e);
}
-
- public void mouseReleased(MouseEvent e)
+
+ public void mouseReleased(MouseEvent e)
{
maybeShowPopup(e);
}
-
- private void maybeShowPopup(MouseEvent e)
+
+ private void maybeShowPopup(MouseEvent e)
{
if (e.isPopupTrigger() && _adapters.getSelectedRow() != -1)
{
@@ -308,7 +298,7 @@ class RegistryEditor extends Editor
}
});
}
-
+
protected void appendProperties(DefaultFormBuilder builder)
{
CellConstraints cc = new CellConstraints();
@@ -336,8 +326,7 @@ class RegistryEditor extends Editor
builder.nextRow(-14);
JScrollPane scrollPane = new JScrollPane(_applications);
scrollPane.setToolTipText(_applications.getToolTipText());
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 14));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 14));
builder.nextRow(14);
builder.nextLine();
@@ -383,8 +372,7 @@ class RegistryEditor extends Editor
builder.nextRow(-14);
scrollPane = new JScrollPane(_adapters);
scrollPane.setToolTipText(_adapters.getToolTipText());
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 14));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 14));
builder.nextRow(14);
builder.nextLine();
}
@@ -408,6 +396,6 @@ class RegistryEditor extends Editor
private TableField _applications = new TableField("Name", "Last Update");
private TableField _objects = new TableField("Proxy", "Type");
private TableField _adapters = new TableField("ID", "Endpoints", "Replica Group");
-
+
private Root _target;
}
diff --git a/java/src/IceGridGUI/LiveDeployment/Root.java b/java/src/IceGridGUI/LiveDeployment/Root.java
index 41cd8016937..99f8da96e88 100644
--- a/java/src/IceGridGUI/LiveDeployment/Root.java
+++ b/java/src/IceGridGUI/LiveDeployment/Root.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.awt.Component;
@@ -31,7 +32,7 @@ import IceGridGUI.*;
//
public class Root extends ListArrayTreeNode
{
- public Root(Coordinator coordinator)
+ public Root(Coordinator coordinator)
{
super(null, "Root", 2);
_coordinator = coordinator;
@@ -87,7 +88,7 @@ public class Root extends ListArrayTreeNode
{
amiSuccess(prefix);
}
-
+
public void ice_exception(Ice.UserException e)
{
amiFailure(prefix, "Failed to shutdown " + _replicaName, e);
@@ -95,16 +96,15 @@ public class Root extends ListArrayTreeNode
public void ice_exception(Ice.LocalException e)
{
- amiFailure(prefix, "Failed to shutdown " + _replicaName,
+ amiFailure(prefix, "Failed to shutdown " + _replicaName,
e.toString());
}
};
try
- {
- _coordinator.getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-
+ {
+ _coordinator.getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
_coordinator.getAdmin().shutdownRegistry_async(cb, _replicaName);
}
catch(Ice.LocalException e)
@@ -113,15 +113,13 @@ public class Root extends ListArrayTreeNode
}
finally
{
- _coordinator.getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ _coordinator.getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
-
public ApplicationDescriptor getApplicationDescriptor(String name)
{
- ApplicationInfo app = (ApplicationInfo)_infoMap.get(name);
+ ApplicationInfo app = _infoMap.get(name);
if(app == null)
{
return null;
@@ -139,40 +137,32 @@ public class Root extends ListArrayTreeNode
public Object[] getPatchableApplicationNames()
{
- java.util.List result = new java.util.ArrayList();
+ java.util.List<String> result = new java.util.ArrayList<String>();
- java.util.Iterator p = _infoMap.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, ApplicationInfo> p : _infoMap.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
-
- ApplicationInfo app = (ApplicationInfo)entry.getValue();
+ ApplicationInfo app = p.getValue();
if(app.descriptor.distrib.icepatch.length() > 0)
{
- result.add(entry.getKey());
+ result.add(p.getKey());
}
}
return result.toArray();
}
-
- public java.util.SortedMap getApplicationMap()
+
+ public java.util.SortedMap<String, String> getApplicationMap()
{
- java.util.SortedMap r = new java.util.TreeMap();
-
- java.util.Iterator p = _infoMap.entrySet().iterator();
- while(p.hasNext())
+ java.util.SortedMap<String, String> r = new java.util.TreeMap<String, String>();
+
+ for(java.util.Map.Entry<String, ApplicationInfo> p : _infoMap.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
+ ApplicationInfo app = p.getValue();
- ApplicationInfo app = (ApplicationInfo)entry.getValue();
-
- r.put(entry.getKey(),
- java.text.DateFormat.getDateTimeInstance().format(new java.util.Date(app.updateTime)));
+ r.put(p.getKey(), java.text.DateFormat.getDateTimeInstance().format(new java.util.Date(app.updateTime)));
}
return r;
}
-
public Editor getEditor()
{
if(_editor == null)
@@ -184,13 +174,13 @@ public class Root extends ListArrayTreeNode
}
public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
@@ -198,33 +188,30 @@ public class Root extends ListArrayTreeNode
// Initialization
//
_cellRenderer = new DefaultTreeCellRenderer();
-
+
Icon icon = Utils.getIcon("/icons/16x16/registry.png");
_cellRenderer.setOpenIcon(icon);
_cellRenderer.setClosedIcon(icon);
}
-
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
- }
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
+ }
- public void applicationInit(String instanceName, String replicaName, java.util.List applications)
+ public void applicationInit(String instanceName, String replicaName, java.util.List<ApplicationInfo> applications)
{
closeAllShowLogDialogs();
_instanceName = instanceName;
_replicaName = replicaName;
_label = instanceName + " (" + _replicaName + ")";
- _tree.setRootVisible(true);
-
- java.util.Iterator p = applications.iterator();
- while(p.hasNext())
+ _tree.setRootVisible(true);
+
+ for(ApplicationInfo p : applications)
{
- applicationAdded((ApplicationInfo)p.next());
+ applicationAdded(p);
}
}
-
+
//
// Called when the session to the IceGrid Registry is closed
//
@@ -245,12 +232,12 @@ public class Root extends ListArrayTreeNode
{
int shutdown = JOptionPane.showConfirmDialog(
_coordinator.getMainFrame(),
- "You are about to install or refresh your"
+ "You are about to install or refresh your"
+ " application distribution.\n"
- + " Do you want shut down all servers affected by this update?",
+ + " Do you want shut down all servers affected by this update?",
"Patch Confirmation",
JOptionPane.YES_NO_CANCEL_OPTION);
-
+
if(shutdown == JOptionPane.CANCEL_OPTION)
{
return;
@@ -268,10 +255,10 @@ public class Root extends ListArrayTreeNode
{
amiSuccess(prefix);
}
-
+
public void ice_exception(Ice.UserException e)
{
- amiFailure(prefix, "Failed to patch '"
+ amiFailure(prefix, "Failed to patch '"
+ applicationName + "'", e);
}
@@ -281,14 +268,11 @@ public class Root extends ListArrayTreeNode
applicationName + "'", e.toString());
}
};
-
+
try
- {
- _coordinator.getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- _coordinator.getAdmin().
- patchApplication_async(cb, applicationName,
- shutdown == JOptionPane.YES_OPTION);
+ {
+ _coordinator.getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ _coordinator.getAdmin().patchApplication_async(cb, applicationName, shutdown == JOptionPane.YES_OPTION);
}
catch(Ice.LocalException e)
{
@@ -296,14 +280,13 @@ public class Root extends ListArrayTreeNode
}
finally
{
- _coordinator.getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ _coordinator.getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
public void showApplicationDetails(String appName)
{
- ApplicationInfo app = (ApplicationInfo)_infoMap.get(appName);
+ ApplicationInfo app = _infoMap.get(appName);
if(app != null)
{
if(_applicationDetailsDialog == null)
@@ -321,13 +304,11 @@ public class Root extends ListArrayTreeNode
public void applicationAdded(ApplicationInfo info)
{
_infoMap.put(info.descriptor.name, info);
-
- java.util.Iterator p = info.descriptor.nodes.entrySet().iterator();
- while(p.hasNext())
+
+ for(java.util.Map.Entry<String, NodeDescriptor> p : info.descriptor.nodes.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- String nodeName = (String)entry.getKey();
- NodeDescriptor nodeDesc = (NodeDescriptor)entry.getValue();
+ String nodeName = p.getKey();
+ NodeDescriptor nodeDesc = p.getValue();
Node node = findNode(nodeName);
if(node == null)
@@ -345,13 +326,13 @@ public class Root extends ListArrayTreeNode
{
_infoMap.remove(name);
- java.util.List toRemove = new java.util.LinkedList();
+ java.util.List<Node> toRemove = new java.util.LinkedList<Node>();
int[] toRemoveIndices = new int[_nodes.size()];
int i = 0;
for(int index = 0; index < _nodes.size(); ++index)
{
- Node node = (Node)_nodes.get(index);
+ Node node = _nodes.get(index);
if(node.remove(name))
{
toRemove.add(node);
@@ -361,10 +342,10 @@ public class Root extends ListArrayTreeNode
removeNodes(resize(toRemoveIndices, toRemove.size()), toRemove);
}
-
+
public void applicationUpdated(ApplicationUpdateInfo update)
{
- ApplicationInfo app = (ApplicationInfo)_infoMap.get(update.descriptor.name);
+ ApplicationInfo app = _infoMap.get(update.descriptor.name);
app.updateTime = update.updateTime;
app.updateUser = update.updateUser;
@@ -386,44 +367,42 @@ public class Root extends ListArrayTreeNode
appDesc.variables.keySet().removeAll(java.util.Arrays.asList(update.descriptor.removeVariables));
appDesc.variables.putAll(update.descriptor.variables);
- boolean variablesChanged = update.descriptor.removeVariables.length > 0 || !update.descriptor.variables.isEmpty();
+ boolean variablesChanged = update.descriptor.removeVariables.length > 0 ||
+ !update.descriptor.variables.isEmpty();
//
// Update only descriptors (no tree node shown in this view)
//
- appDesc.propertySets.keySet().
- removeAll(java.util.Arrays.asList(update.descriptor.removePropertySets));
+ appDesc.propertySets.keySet().removeAll(java.util.Arrays.asList(update.descriptor.removePropertySets));
appDesc.propertySets.putAll(update.descriptor.propertySets);
- for(int i = 0; i < update.descriptor.removeReplicaGroups.length; ++i)
+ for(String id : update.descriptor.removeReplicaGroups)
{
- for(int j = 0; j < appDesc.replicaGroups.size(); ++j)
+ for(int i = 0; i < appDesc.replicaGroups.size(); ++i)
{
- ReplicaGroupDescriptor rgd = (ReplicaGroupDescriptor)appDesc.replicaGroups.get(j);
- if(rgd.id.equals(update.descriptor.removeReplicaGroups[i]))
+ ReplicaGroupDescriptor rgd = appDesc.replicaGroups.get(i);
+ if(rgd.id.equals(id))
{
- appDesc.replicaGroups.remove(j);
+ appDesc.replicaGroups.remove(i);
break; // for
}
}
}
- for(int i = 0; i < update.descriptor.replicaGroups.size(); ++i)
+ for(ReplicaGroupDescriptor newRgd : update.descriptor.replicaGroups)
{
- ReplicaGroupDescriptor newRgd = (ReplicaGroupDescriptor)update.descriptor.replicaGroups.get(i);
-
boolean replaced = false;
- int j = 0;
- while(j < appDesc.replicaGroups.size() && !replaced)
+ int i = 0;
+ while(i < appDesc.replicaGroups.size() && !replaced)
{
- ReplicaGroupDescriptor oldRgd = (ReplicaGroupDescriptor)appDesc.replicaGroups.get(j);
-
+ ReplicaGroupDescriptor oldRgd = appDesc.replicaGroups.get(i);
+
if(newRgd.id.equals(oldRgd.id))
{
- appDesc.replicaGroups.set(j, newRgd);
+ appDesc.replicaGroups.set(i, newRgd);
replaced = true;
}
- j++;
+ i++;
}
if(!replaced)
@@ -431,13 +410,11 @@ public class Root extends ListArrayTreeNode
appDesc.replicaGroups.add(newRgd);
}
}
-
- appDesc.serviceTemplates.keySet().
- removeAll(java.util.Arrays.asList(update.descriptor.removeServiceTemplates));
+
+ appDesc.serviceTemplates.keySet().removeAll(java.util.Arrays.asList(update.descriptor.removeServiceTemplates));
appDesc.serviceTemplates.putAll(update.descriptor.serviceTemplates);
-
- appDesc.serverTemplates.keySet().
- removeAll(java.util.Arrays.asList(update.descriptor.removeServerTemplates));
+
+ appDesc.serverTemplates.keySet().removeAll(java.util.Arrays.asList(update.descriptor.removeServerTemplates));
appDesc.serverTemplates.putAll(update.descriptor.serverTemplates);
//
@@ -445,59 +422,55 @@ public class Root extends ListArrayTreeNode
//
//
- // Removal
+ // Removal
//
appDesc.nodes.keySet().removeAll(java.util.Arrays.asList(update.descriptor.removeNodes));
- for(int i = 0; i < update.descriptor.removeNodes.length; ++i)
+ for(String name : update.descriptor.removeNodes)
{
- Node node = findNode(update.descriptor.removeNodes[i]);
+ Node node = findNode(name);
if(node.remove(update.descriptor.name))
{
- int index = getIndex(node);
+ int index = getIndex(node);
_nodes.remove(node);
_treeModel.nodesWereRemoved(this, new int[]{index}, new Object[]{node});
}
}
-
+
//
// Add/update
//
- java.util.Iterator p = update.descriptor.nodes.iterator();
- java.util.Set freshNodes = new java.util.HashSet();
- while(p.hasNext())
+ java.util.Set<Node> freshNodes = new java.util.HashSet<Node>();
+ for(NodeUpdateDescriptor desc : update.descriptor.nodes)
{
- NodeUpdateDescriptor nodeUpdateDesc = (NodeUpdateDescriptor)p.next();
-
- String nodeName = nodeUpdateDesc.name;
+ String nodeName = desc.name;
Node node = findNode(nodeName);
if(node == null)
{
- node = new Node(this, appDesc, nodeUpdateDesc);
+ node = new Node(this, appDesc, desc);
insertNode(node);
}
else
{
- node.update(appDesc, nodeUpdateDesc, variablesChanged,
+ node.update(appDesc, desc, variablesChanged,
update.descriptor.serviceTemplates.keySet(), update.descriptor.serverTemplates.keySet());
}
freshNodes.add(node);
}
-
+
//
// Notify non-fresh nodes if needed
//
- if(variablesChanged || !update.descriptor.serviceTemplates.isEmpty() || !update.descriptor.serverTemplates.isEmpty())
+ if(variablesChanged || !update.descriptor.serviceTemplates.isEmpty() ||
+ !update.descriptor.serverTemplates.isEmpty())
{
- p = _nodes.iterator();
- while(p.hasNext())
+ for(Node p : _nodes)
{
- Node node = (Node)p.next();
- if(!freshNodes.contains(node))
+ if(!freshNodes.contains(p))
{
- node.update(appDesc, null, variablesChanged,
- update.descriptor.serviceTemplates.keySet(), update.descriptor.serverTemplates.keySet());
+ p.update(appDesc, null, variablesChanged, update.descriptor.serviceTemplates.keySet(),
+ update.descriptor.serverTemplates.keySet());
}
}
}
@@ -505,50 +478,49 @@ public class Root extends ListArrayTreeNode
public void adapterInit(AdapterInfo[] adapters)
{
- for(int i = 0; i < adapters.length; ++i)
+ for(AdapterInfo info : adapters)
{
- _adapters.put(adapters[i].id, adapters[i]);
- }
+ _adapters.put(info.id, info);
+ }
}
public void adapterAdded(AdapterInfo info)
{
_adapters.put(info.id, info);
- }
+ }
public void adapterUpdated(AdapterInfo info)
{
_adapters.put(info.id, info);
- }
+ }
public void adapterRemoved(String id)
{
_adapters.remove(id);
- }
-
+ }
+
public void objectInit(ObjectInfo[] objects)
{
- for(int i = 0; i < objects.length; ++i)
+ for(ObjectInfo info : objects)
{
- _objects.put(Ice.Util.identityToString(objects[i].proxy.ice_getIdentity()), objects[i]);
+ _objects.put(Ice.Util.identityToString(info.proxy.ice_getIdentity()), info);
}
}
public void objectAdded(ObjectInfo info)
{
_objects.put(Ice.Util.identityToString(info.proxy.ice_getIdentity()), info);
- }
+ }
public void objectUpdated(ObjectInfo info)
{
_objects.put(Ice.Util.identityToString(info.proxy.ice_getIdentity()), info);
- }
+ }
public void objectRemoved(Ice.Identity id)
{
_objects.remove(Ice.Util.identityToString(id));
- }
-
+ }
//
// From the Registry Observer:
@@ -611,7 +583,7 @@ public class Root extends ListArrayTreeNode
{
if(node.down())
{
- int index = getIndex(node);
+ int index = getIndex(node);
_nodes.remove(node);
_treeModel.nodesWereRemoved(this, new int[]{index}, new Object[]{node});
}
@@ -650,7 +622,7 @@ public class Root extends ListArrayTreeNode
_popup.addSeparator();
_popup.add(la.get(SHUTDOWN_REGISTRY));
}
-
+
la.setTarget(this);
return _popup;
}
@@ -679,7 +651,7 @@ public class Root extends ListArrayTreeNode
{
return _label;
}
-
+
//
// Check that this node is attached to the tree
//
@@ -720,12 +692,12 @@ public class Root extends ListArrayTreeNode
return _instanceName;
}
- java.util.SortedMap getObjects()
+ java.util.SortedMap<String, ObjectInfo> getObjects()
{
return _objects;
}
- java.util.SortedMap getAdapters()
+ java.util.SortedMap<String, AdapterInfo> getAdapters()
{
return _adapters;
}
@@ -767,7 +739,7 @@ public class Root extends ListArrayTreeNode
String prefix = "Adding well-known object '" + strIdentity + "'...";
try
- {
+ {
_coordinator.getStatusBar().setText(prefix);
_coordinator.getMainFrame().setCursor(
Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
@@ -820,7 +792,6 @@ public class Root extends ListArrayTreeNode
return true;
}
-
void removeObject(String strProxy)
{
Ice.ObjectPrx proxy = _coordinator.getCommunicator().stringToProxy(strProxy);
@@ -829,7 +800,7 @@ public class Root extends ListArrayTreeNode
final String prefix = "Removing well-known object '" + strIdentity + "'...";
_coordinator.getStatusBar().setText(prefix);
-
+
AMI_Admin_removeObject cb = new AMI_Admin_removeObject()
{
//
@@ -839,34 +810,31 @@ public class Root extends ListArrayTreeNode
{
amiSuccess(prefix);
}
-
+
public void ice_exception(Ice.UserException e)
{
amiFailure(prefix, "Failed to remove object '" + strIdentity + "'", e);
}
-
+
public void ice_exception(Ice.LocalException e)
{
amiFailure(prefix, "Failed to remove object '" + strIdentity + "'",
e.toString());
}
};
-
+
try
- {
- _coordinator.getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ {
+ _coordinator.getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
_coordinator.getAdmin().removeObject_async(cb, identity);
}
catch(Ice.LocalException e)
{
- failure(prefix, "Failed to remove object '" + strIdentity + "'",
- e.toString());
+ failure(prefix, "Failed to remove object '" + strIdentity + "'", e.toString());
}
finally
{
- _coordinator.getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ _coordinator.getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
@@ -874,7 +842,7 @@ public class Root extends ListArrayTreeNode
{
final String prefix = "Removing adapter '" + adapterId + "'...";
_coordinator.getStatusBar().setText(prefix);
-
+
AMI_Admin_removeAdapter cb = new AMI_Admin_removeAdapter()
{
//
@@ -884,23 +852,22 @@ public class Root extends ListArrayTreeNode
{
amiSuccess(prefix);
}
-
+
public void ice_exception(Ice.UserException e)
{
amiFailure(prefix, "Failed to remove adapter '" + adapterId + "'", e);
}
-
+
public void ice_exception(Ice.LocalException e)
{
- amiFailure(prefix, "Failed to remove adapter '" + adapterId + "'",
+ amiFailure(prefix, "Failed to remove adapter '" + adapterId + "'",
e.toString());
}
};
-
+
try
- {
- _coordinator.getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ {
+ _coordinator.getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
_coordinator.getAdmin().removeAdapter_async(cb, adapterId);
}
catch(Ice.LocalException e)
@@ -909,11 +876,10 @@ public class Root extends ListArrayTreeNode
}
finally
{
- _coordinator.getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ _coordinator.getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
-
+
public void retrieveOutput(final boolean stdout)
{
getRoot().openShowLogDialog(new ShowLogDialog.FileIteratorFactory()
@@ -939,31 +905,28 @@ public class Root extends ListArrayTreeNode
{
return "Registry " + _label + " " + (stdout ? "stdout" : "stderr");
}
-
+
public String getDefaultFilename()
{
return _replicaName + (stdout ? ".out" : ".err");
}
});
- }
-
+ }
PropertySetDescriptor findNamedPropertySet(String name, String applicationName)
{
- ApplicationInfo app = (ApplicationInfo)
- _infoMap.get(applicationName);
+ ApplicationInfo app = (ApplicationInfo)_infoMap.get(applicationName);
return (PropertySetDescriptor)app.descriptor.propertySets.get(name);
}
-
void openShowLogDialog(ShowLogDialog.FileIteratorFactory factory)
{
- ShowLogDialog d = (ShowLogDialog)_showLogDialogMap.get(factory.getTitle());
+ ShowLogDialog d = _showLogDialogMap.get(factory.getTitle());
if(d == null)
{
- d = new ShowLogDialog(this, factory,
- _logMaxLines, _logMaxSize, _logInitialLines, _logMaxReadSize, _logPeriod);
-
+ d = new ShowLogDialog(this, factory, _logMaxLines, _logMaxSize, _logInitialLines, _logMaxReadSize,
+ _logPeriod);
+
_showLogDialogMap.put(factory.getTitle(), d);
}
else
@@ -979,11 +942,9 @@ public class Root extends ListArrayTreeNode
public void closeAllShowLogDialogs()
{
- java.util.Iterator p = _showLogDialogMap.values().iterator();
- while(p.hasNext())
+ for(ShowLogDialog p : _showLogDialogMap.values())
{
- ShowLogDialog d = (ShowLogDialog)p.next();
- d.close(false);
+ p.close(false);
}
_showLogDialogMap.clear();
}
@@ -993,7 +954,6 @@ public class Root extends ListArrayTreeNode
return _messageSizeMax;
}
-
public void setLogPrefs(int maxLines, int maxSize, int initialLines, int maxReadSize, int period)
{
_logMaxLines = maxLines;
@@ -1004,7 +964,7 @@ public class Root extends ListArrayTreeNode
storeLogPrefs();
}
-
+
private void loadLogPrefs()
{
Preferences logPrefs = _coordinator.getPrefs().node("Log");
@@ -1030,12 +990,11 @@ public class Root extends ListArrayTreeNode
logPrefs.putInt("period", _logPeriod);
}
-
private Node findNode(String nodeName)
{
return (Node)find(nodeName, _nodes);
}
-
+
private void insertNode(Node node)
{
String nodeName = node.toString();
@@ -1061,14 +1020,14 @@ public class Root extends ListArrayTreeNode
_treeModel.nodesWereRemoved(this, toRemoveIndices, toRemove.toArray());
}
}
-
+
public static int computeMessageSizeMax(int num)
{
if(num <= 0)
{
num = 1024;
}
-
+
if(num > 0x7fffffff / 1024)
{
return 0x7fffffff;
@@ -1079,28 +1038,27 @@ public class Root extends ListArrayTreeNode
}
}
-
private final Coordinator _coordinator;
private String _instanceName = "";
private String _replicaName;
- private final java.util.List _nodes = new java.util.LinkedList();
- private final java.util.List _slaves = new java.util.LinkedList();
+ private final java.util.List<Node> _nodes = new java.util.LinkedList<Node>();
+ private final java.util.List<Slave> _slaves = new java.util.LinkedList<Slave>();
//
// Maps application name to current application info
//
- private final java.util.Map _infoMap = new java.util.TreeMap();
+ private final java.util.Map<String, ApplicationInfo> _infoMap = new java.util.TreeMap<String, ApplicationInfo>();
//
// Map AdapterId => AdapterInfo
//
- private java.util.SortedMap _adapters = new java.util.TreeMap();
+ private java.util.SortedMap<String, AdapterInfo> _adapters = new java.util.TreeMap<String, AdapterInfo>();
//
// Map stringified identity => ObjectInfo
//
- private java.util.SortedMap _objects = new java.util.TreeMap();
+ private java.util.SortedMap<String, ObjectInfo> _objects = new java.util.TreeMap<String, ObjectInfo>();
//
// 'this' is the root of the tree
@@ -1109,7 +1067,7 @@ public class Root extends ListArrayTreeNode
private final DefaultTreeModel _treeModel;
private RegistryInfo _info;
-
+
private String _label;
private ObjectDialog _addObjectDialog;
@@ -1120,14 +1078,14 @@ public class Root extends ListArrayTreeNode
//
final int _messageSizeMax;
- java.util.Map _showLogDialogMap = new java.util.HashMap();
-
+ java.util.Map<String, ShowLogDialog> _showLogDialogMap = new java.util.HashMap<String, ShowLogDialog>();
+
int _logMaxLines;
int _logMaxSize;
int _logInitialLines;
int _logMaxReadSize;
int _logPeriod;
-
+
private ApplicationDetailsDialog _applicationDetailsDialog;
static private RegistryEditor _editor;
diff --git a/java/src/IceGridGUI/LiveDeployment/Server.java b/java/src/IceGridGUI/LiveDeployment/Server.java
index 03b4d1e7c9c..516680c8725 100644
--- a/java/src/IceGridGUI/LiveDeployment/Server.java
+++ b/java/src/IceGridGUI/LiveDeployment/Server.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.awt.Component;
@@ -46,8 +47,8 @@ class Server extends ListArrayTreeNode
actions[RETRIEVE_STDOUT] = true;
actions[RETRIEVE_STDERR] = true;
actions[RETRIEVE_LOG] = _serverDescriptor.logs.length > 0;
-
- actions[PATCH_SERVER] =
+
+ actions[PATCH_SERVER] =
!_serverDescriptor.distrib.icepatch.equals("");
if(_state != ServerState.Inactive)
@@ -82,7 +83,7 @@ class Server extends ListArrayTreeNode
{
amiSuccess(prefix);
}
-
+
public void ice_exception(Ice.UserException e)
{
amiFailure(prefix, "Failed to start " + _id, e);
@@ -93,11 +94,10 @@ class Server extends ListArrayTreeNode
amiFailure(prefix, "Failed to start " + _id, e.toString());
}
};
-
+
try
- {
- getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ {
+ getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
getCoordinator().getAdmin().startServer_async(cb, _id);
}
catch(Ice.LocalException e)
@@ -106,11 +106,10 @@ class Server extends ListArrayTreeNode
}
finally
{
- getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
-
+
public void stop()
{
final String prefix = "Stopping server '" + _id + "'...";
@@ -125,7 +124,7 @@ class Server extends ListArrayTreeNode
{
amiSuccess(prefix);
}
-
+
public void ice_exception(Ice.UserException e)
{
amiFailure(prefix, "Failed to stop " + _id, e);
@@ -136,11 +135,10 @@ class Server extends ListArrayTreeNode
amiFailure(prefix, "Failed to stop " + _id, e.toString());
}
};
-
+
try
- {
- getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ {
+ getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
getCoordinator().getAdmin().stopServer_async(cb, _id);
}
catch(Ice.LocalException e)
@@ -149,8 +147,7 @@ class Server extends ListArrayTreeNode
}
finally
{
- getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
@@ -178,7 +175,8 @@ class Server extends ListArrayTreeNode
getRoot().openShowLogDialog(new ShowLogDialog.FileIteratorFactory()
{
public FileIteratorPrx open(int count)
- throws FileNotAvailableException, ServerNotExistException, NodeUnreachableException, DeploymentException
+ throws FileNotAvailableException, ServerNotExistException, NodeUnreachableException,
+ DeploymentException
{
AdminSessionPrx session = getRoot().getCoordinator().getSession();
FileIteratorPrx result;
@@ -203,14 +201,14 @@ class Server extends ListArrayTreeNode
return _id + (stdout ? ".out" : ".err");
}
});
- }
+ }
public void retrieveLog()
{
assert _serverDescriptor.logs.length > 0;
String path = null;
-
+
if(_serverDescriptor.logs.length == 1)
{
path = _resolver.substitute(_serverDescriptor.logs[0]);
@@ -218,46 +216,47 @@ class Server extends ListArrayTreeNode
else
{
Object[] pathArray = new Object[_serverDescriptor.logs.length];
- for(int i = 0; i < _serverDescriptor.logs.length; ++i)
+ int i = 0;
+ for(String log : _serverDescriptor.logs)
{
- pathArray[i] = _resolver.substitute(_serverDescriptor.logs[i]);
+ pathArray[i++] = _resolver.substitute(log);
}
-
+
path = (String)JOptionPane.showInputDialog(
- getCoordinator().getMainFrame(),
- "Which log file do you want to retrieve?",
- "Retrieve Log File",
+ getCoordinator().getMainFrame(),
+ "Which log file do you want to retrieve?",
+ "Retrieve Log File",
JOptionPane.QUESTION_MESSAGE, null,
pathArray, pathArray[0]);
}
-
+
if(path != null)
{
final String fPath = path;
-
+
getRoot().openShowLogDialog(new ShowLogDialog.FileIteratorFactory()
{
public FileIteratorPrx open(int count)
- throws FileNotAvailableException, ServerNotExistException, NodeUnreachableException,
+ throws FileNotAvailableException, ServerNotExistException, NodeUnreachableException,
DeploymentException
{
AdminSessionPrx session = getRoot().getCoordinator().getSession();
return session.openServerLog(_id, fPath, count);
}
-
+
public String getTitle()
{
return "Server " + _id + " " + new java.io.File(fPath).getName();
}
-
+
public String getDefaultFilename()
{
return new java.io.File(fPath).getName();
}
});
- }
+ }
}
-
+
public void signal(final String s)
{
final String prefix = "Sending '" + s + "' to server '" + _id + "'...";
@@ -272,7 +271,7 @@ class Server extends ListArrayTreeNode
{
amiSuccess(prefix);
}
-
+
public void ice_exception(Ice.UserException e)
{
amiFailure(prefix, "Failed to deliver signal " + s + " to " + _id, e);
@@ -283,9 +282,9 @@ class Server extends ListArrayTreeNode
amiFailure(prefix, "Failed to deliver signal " + s + " to " + _id, e.toString());
}
};
-
+
try
- {
+ {
getCoordinator().getAdmin().sendSignal_async(cb, _id, s);
}
catch(Ice.LocalException e)
@@ -297,18 +296,18 @@ class Server extends ListArrayTreeNode
public void patchServer()
{
String message = _serverDescriptor.applicationDistrib ?
- "You are about to install or refresh your"
+ "You are about to install or refresh your"
+ " server distribution and your application distribution onto this node.\n"
+ "Do you want shut down all servers affected by this update?" :
- "You are about to install or refresh the distribution for this server.\n"
+ "You are about to install or refresh the distribution for this server.\n"
+ "Do you want to shut down the server for this update?";
int shutdown = JOptionPane.showConfirmDialog(
getCoordinator().getMainFrame(),
- message,
+ message,
"Patch Confirmation",
JOptionPane.YES_NO_CANCEL_OPTION);
-
+
if(shutdown == JOptionPane.CANCEL_OPTION)
{
return;
@@ -326,7 +325,7 @@ class Server extends ListArrayTreeNode
{
amiSuccess(prefix);
}
-
+
public void ice_exception(Ice.UserException e)
{
amiFailure(prefix, "Failed to patch " + _id, e);
@@ -337,14 +336,11 @@ class Server extends ListArrayTreeNode
amiFailure(prefix, "Failed to patch " + _id, e.toString());
}
};
-
+
try
- {
- getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- getCoordinator().getAdmin().
- patchServer_async(cb, _id,
- shutdown == JOptionPane.YES_OPTION);
+ {
+ getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ getCoordinator().getAdmin().patchServer_async(cb, _id, shutdown == JOptionPane.YES_OPTION);
}
catch(Ice.LocalException e)
{
@@ -352,18 +348,16 @@ class Server extends ListArrayTreeNode
}
finally
{
- getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
private void enableServer(boolean enable)
{
- final String prefix = (enable ?
- "Enabling" : "Disabling") + " server '" + _id + "'...";
-
+ final String prefix = (enable ? "Enabling" : "Disabling") + " server '" + _id + "'...";
+
final String action = enable ? "enable" : "disable";
-
+
getCoordinator().getStatusBar().setText(prefix);
AMI_Admin_enableServer cb = new AMI_Admin_enableServer()
@@ -375,7 +369,7 @@ class Server extends ListArrayTreeNode
{
amiSuccess(prefix);
}
-
+
public void ice_exception(Ice.UserException e)
{
amiFailure(prefix, "Failed to " + action + " " + _id, e);
@@ -386,11 +380,10 @@ class Server extends ListArrayTreeNode
amiFailure(prefix, "Failed to " + action + " " + _id, e.toString());
}
};
-
+
try
- {
- getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ {
+ getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
getCoordinator().getAdmin().enableServer_async(cb, _id, enable);
}
catch(Ice.LocalException e)
@@ -399,15 +392,14 @@ class Server extends ListArrayTreeNode
}
finally
{
- getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
void showRuntimeProperties()
{
Ice.ObjectPrx serverAdmin = getServerAdmin();
-
+
if(serverAdmin == null)
{
_editor.setBuildId("", this);
@@ -416,31 +408,33 @@ class Server extends ListArrayTreeNode
{
Ice.AMI_PropertiesAdmin_getPropertiesForPrefix cb = new Ice.AMI_PropertiesAdmin_getPropertiesForPrefix()
{
- public void ice_response(final java.util.Map properties)
+ public void ice_response(final java.util.Map<String, String> properties)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
- _editor.setRuntimeProperties((java.util.SortedMap)properties, Server.this);
+ _editor.setRuntimeProperties((java.util.SortedMap<String, String>)properties,
+ Server.this);
}
});
}
-
+
public void ice_exception(final Ice.LocalException e)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
if(e instanceof Ice.ObjectNotExistException)
{
- _editor.setBuildId("Error: can't reach this server's Admin object", Server.this);
+ _editor.setBuildId("Error: can't reach this server's Admin object",
+ Server.this);
}
else if(e instanceof Ice.FacetNotExistException)
{
- _editor.setBuildId("Error: this server's Admin object does not provide a 'Properties' facet",
- Server.this);
+ _editor.setBuildId("Error: this server's Admin object does not provide a " +
+ "'Properties' facet", Server.this);
}
else
{
@@ -454,8 +448,9 @@ class Server extends ListArrayTreeNode
try
- {
- Ice.PropertiesAdminPrx propAdmin = Ice.PropertiesAdminPrxHelper.uncheckedCast(serverAdmin.ice_facet("Properties"));
+ {
+ Ice.PropertiesAdminPrx propAdmin =
+ Ice.PropertiesAdminPrxHelper.uncheckedCast(serverAdmin.ice_facet("Properties"));
propAdmin.getPropertiesForPrefix_async(cb, "");
}
catch(Ice.LocalException e)
@@ -498,7 +493,7 @@ class Server extends ListArrayTreeNode
_signalMenu = new JMenu("Send Signal");
_popup.add(_signalMenu);
-
+
_signalMenu.add(la.get(SIGHUP));
_signalMenu.add(la.get(SIGINT));
_signalMenu.add(la.get(SIGQUIT));
@@ -509,13 +504,12 @@ class Server extends ListArrayTreeNode
_popup.addSeparator();
_popup.add(la.get(OPEN_DEFINITION));
}
-
+
la.setTarget(this);
_signalMenu.setEnabled(la.get(SIGHUP).isEnabled());
return _popup;
}
-
public Editor getEditor()
{
if(_editor == null)
@@ -533,7 +527,7 @@ class Server extends ListArrayTreeNode
boolean expanded,
boolean leaf,
int row,
- boolean hasFocus)
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
@@ -547,80 +541,71 @@ class Server extends ListArrayTreeNode
//
_icons = new Icon[8][2][2];
_icons[0][0][0] = Utils.getIcon("/icons/16x16/server_unknown.png");
- _icons[ServerState.Inactive.value() + 1][0][0]
- = Utils.getIcon("/icons/16x16/server_inactive.png");
- _icons[ServerState.Activating.value() + 1][0][0] =
+ _icons[ServerState.Inactive.ordinal() + 1][0][0] = Utils.getIcon("/icons/16x16/server_inactive.png");
+ _icons[ServerState.Activating.ordinal() + 1][0][0] = Utils.getIcon("/icons/16x16/server_activating.png");
+ _icons[ServerState.ActivationTimedOut.ordinal() + 1][0][0] =
Utils.getIcon("/icons/16x16/server_activating.png");
- _icons[ServerState.ActivationTimedOut.value() + 1][0][0] =
- Utils.getIcon("/icons/16x16/server_activating.png");
- _icons[ServerState.Active.value() + 1][0][0] =
- Utils.getIcon("/icons/16x16/server_active.png");
- _icons[ServerState.Deactivating.value() + 1][0][0] =
+ _icons[ServerState.Active.ordinal() + 1][0][0] = Utils.getIcon("/icons/16x16/server_active.png");
+ _icons[ServerState.Deactivating.ordinal() + 1][0][0] =
Utils.getIcon("/icons/16x16/server_deactivating.png");
- _icons[ServerState.Destroying.value() + 1][0][0] =
- Utils.getIcon("/icons/16x16/server_destroying.png");
- _icons[ServerState.Destroyed.value() + 1][0][0] =
- Utils.getIcon("/icons/16x16/server_destroyed.png");
+ _icons[ServerState.Destroying.ordinal() + 1][0][0] = Utils.getIcon("/icons/16x16/server_destroying.png");
+ _icons[ServerState.Destroyed.ordinal() + 1][0][0] = Utils.getIcon("/icons/16x16/server_destroyed.png");
//
// IceBox servers
//
_icons[0][1][0] = Utils.getIcon("/icons/16x16/icebox_server_unknown.png");
- _icons[ServerState.Inactive.value() + 1][1][0]
- = Utils.getIcon("/icons/16x16/icebox_server_inactive.png");
- _icons[ServerState.Activating.value() + 1][1][0] =
+ _icons[ServerState.Inactive.ordinal() + 1][1][0] = Utils.getIcon("/icons/16x16/icebox_server_inactive.png");
+ _icons[ServerState.Activating.ordinal() + 1][1][0] =
Utils.getIcon("/icons/16x16/icebox_server_activating.png");
- _icons[ServerState.ActivationTimedOut.value() + 1][1][0] =
+ _icons[ServerState.ActivationTimedOut.ordinal() + 1][1][0] =
Utils.getIcon("/icons/16x16/icebox_server_activating.png");
- _icons[ServerState.Active.value() + 1][1][0] =
- Utils.getIcon("/icons/16x16/icebox_server_active.png");
- _icons[ServerState.Deactivating.value() + 1][1][0] =
+ _icons[ServerState.Active.ordinal() + 1][1][0] = Utils.getIcon("/icons/16x16/icebox_server_active.png");
+ _icons[ServerState.Deactivating.ordinal() + 1][1][0] =
Utils.getIcon("/icons/16x16/icebox_server_deactivating.png");
- _icons[ServerState.Destroying.value() + 1][1][0] =
+ _icons[ServerState.Destroying.ordinal() + 1][1][0] =
Utils.getIcon("/icons/16x16/icebox_server_destroying.png");
- _icons[ServerState.Destroyed.value() + 1][1][0] =
+ _icons[ServerState.Destroyed.ordinal() + 1][1][0] =
Utils.getIcon("/icons/16x16/icebox_server_destroyed.png");
//
// Regular servers (disabled)
//
_icons[0][0][1] = Utils.getIcon("/icons/16x16/server_unknown.png");
- _icons[ServerState.Inactive.value() + 1][0][1]
- = Utils.getIcon("/icons/16x16/server_disabled_inactive.png");
- _icons[ServerState.Activating.value() + 1][0][1] =
+ _icons[ServerState.Inactive.ordinal() + 1][0][1] =
+ Utils.getIcon("/icons/16x16/server_disabled_inactive.png");
+ _icons[ServerState.Activating.ordinal() + 1][0][1] =
Utils.getIcon("/icons/16x16/server_disabled_activating.png");
- _icons[ServerState.ActivationTimedOut.value() + 1][0][1] =
+ _icons[ServerState.ActivationTimedOut.ordinal() + 1][0][1] =
Utils.getIcon("/icons/16x16/server_disabled_activating.png");
- _icons[ServerState.Active.value() + 1][0][1] =
- Utils.getIcon("/icons/16x16/server_disabled_active.png");
- _icons[ServerState.Deactivating.value() + 1][0][1] =
+ _icons[ServerState.Active.ordinal() + 1][0][1] = Utils.getIcon("/icons/16x16/server_disabled_active.png");
+ _icons[ServerState.Deactivating.ordinal() + 1][0][1] =
Utils.getIcon("/icons/16x16/server_disabled_deactivating.png");
- _icons[ServerState.Destroying.value() + 1][0][1] =
+ _icons[ServerState.Destroying.ordinal() + 1][0][1] =
Utils.getIcon("/icons/16x16/server_disabled_destroying.png");
- _icons[ServerState.Destroyed.value() + 1][0][1] =
+ _icons[ServerState.Destroyed.ordinal() + 1][0][1] =
Utils.getIcon("/icons/16x16/server_disabled_destroyed.png");
//
// IceBox servers (disabled)
//
_icons[0][1][1] = Utils.getIcon("/icons/16x16/icebox_server_unknown.png");
- _icons[ServerState.Inactive.value() + 1][1][1]
+ _icons[ServerState.Inactive.ordinal() + 1][1][1]
= Utils.getIcon("/icons/16x16/icebox_server_disabled_inactive.png");
- _icons[ServerState.Activating.value() + 1][1][1] =
+ _icons[ServerState.Activating.ordinal() + 1][1][1] =
Utils.getIcon("/icons/16x16/icebox_server_disabled_activating.png");
- _icons[ServerState.ActivationTimedOut.value() + 1][1][1] =
+ _icons[ServerState.ActivationTimedOut.ordinal() + 1][1][1] =
Utils.getIcon("/icons/16x16/icebox_server_disabled_activating.png");
- _icons[ServerState.Active.value() + 1][1][1] =
+ _icons[ServerState.Active.ordinal() + 1][1][1] =
Utils.getIcon("/icons/16x16/icebox_server_disabled_active.png");
- _icons[ServerState.Deactivating.value() + 1][1][1] =
+ _icons[ServerState.Deactivating.ordinal() + 1][1][1] =
Utils.getIcon("/icons/16x16/icebox_server_disabled_deactivating.png");
- _icons[ServerState.Destroying.value() + 1][1][1] =
+ _icons[ServerState.Destroying.ordinal() + 1][1][1] =
Utils.getIcon("/icons/16x16/icebox_server_disabled_destroying.png");
- _icons[ServerState.Destroyed.value() + 1][1][1] =
+ _icons[ServerState.Destroyed.ordinal() + 1][1][1] =
Utils.getIcon("/icons/16x16/icebox_server_disabled_destroyed.png");
-
}
-
+
int icebox = _serverDescriptor instanceof IceBoxDescriptor ? 1 : 0;
int disabled = _enabled ? 0 : 1;
@@ -631,32 +616,29 @@ class Server extends ListArrayTreeNode
else
{
_cellRenderer.setClosedIcon(_icons[_stateIconIndex][icebox][disabled]);
- }
+ }
_cellRenderer.setToolTipText(_toolTip);
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
-
- Server(Node parent, String serverId, Utils.Resolver resolver,
- ServerInstanceDescriptor instanceDescriptor,
- ServerDescriptor serverDescriptor, ApplicationDescriptor application,
- ServerState state, int pid, boolean enabled)
+ Server(Node parent, String serverId, Utils.Resolver resolver, ServerInstanceDescriptor instanceDescriptor,
+ ServerDescriptor serverDescriptor, ApplicationDescriptor application, ServerState state, int pid,
+ boolean enabled)
{
super(parent, serverId, 3);
_resolver = resolver;
-
+
_instanceDescriptor = instanceDescriptor;
_serverDescriptor = serverDescriptor;
_application = application;
-
+
_childrenArray[0] = _adapters;
_childrenArray[1] = _dbEnvs;
_childrenArray[2] = _services;
update(state, pid, enabled, false);
-
+
createAdapters();
createDbEnvs();
createServices();
@@ -686,12 +668,12 @@ class Server extends ListArrayTreeNode
{
return _serviceObserver != null;
}
-
+
int getPid()
{
return _pid;
}
-
+
boolean isEnabled()
{
return _enabled;
@@ -727,7 +709,7 @@ class Server extends ListArrayTreeNode
}
void rebuild(Server server)
- {
+ {
_resolver = server._resolver;
_instanceDescriptor = server._instanceDescriptor;
_serverDescriptor = server._serverDescriptor;
@@ -736,7 +718,7 @@ class Server extends ListArrayTreeNode
_adapters = server._adapters;
_dbEnvs = server._dbEnvs;
_services = server._services;
-
+
_childrenArray[0] = _adapters;
_childrenArray[1] = _dbEnvs;
_childrenArray[2] = _services;
@@ -764,20 +746,19 @@ class Server extends ListArrayTreeNode
getRoot().getTreeModel().nodeStructureChanged(this);
}
- void rebuild(Utils.Resolver resolver, boolean variablesChanged, java.util.Set serviceTemplates,
- java.util.Set serverTemplates)
+ void rebuild(Utils.Resolver resolver, boolean variablesChanged, java.util.Set<String> serviceTemplates,
+ java.util.Set<String> serverTemplates)
{
- if(variablesChanged ||
- (_instanceDescriptor != null && serverTemplates != null && serverTemplates.contains(_instanceDescriptor.template)))
+ if(variablesChanged ||
+ (_instanceDescriptor != null && serverTemplates != null &&
+ serverTemplates.contains(_instanceDescriptor.template)))
{
if(_instanceDescriptor != null)
{
- TemplateDescriptor templateDescriptor =
- (TemplateDescriptor)_application.serverTemplates.get(_instanceDescriptor.template);
+ TemplateDescriptor templateDescriptor = _application.serverTemplates.get(_instanceDescriptor.template);
assert templateDescriptor != null;
-
- _resolver.reset(resolver, _instanceDescriptor.parameterValues,
- templateDescriptor.parameterDefaults);
+
+ _resolver.reset(resolver, _instanceDescriptor.parameterValues, templateDescriptor.parameterDefaults);
_resolver.put("server", _id);
_serverDescriptor = (ServerDescriptor)templateDescriptor.descriptor;
}
@@ -786,7 +767,7 @@ class Server extends ListArrayTreeNode
_resolver.reset(resolver);
_resolver.put("server", _id);
}
-
+
_adapters.clear();
createAdapters();
_dbEnvs.clear();
@@ -795,10 +776,11 @@ class Server extends ListArrayTreeNode
_servicePropertySets.clear();
createServices();
updateServices();
-
+
getRoot().getTreeModel().nodeStructureChanged(this);
}
- else if(serviceTemplates != null && serviceTemplates.size() > 0 && _serverDescriptor instanceof IceBoxDescriptor)
+ else if(serviceTemplates != null && serviceTemplates.size() > 0 &&
+ _serverDescriptor instanceof IceBoxDescriptor)
{
_services.clear();
_servicePropertySets.clear();
@@ -824,7 +806,7 @@ class Server extends ListArrayTreeNode
}
else
{
- _stateIconIndex = _state.value() + 1;
+ _stateIconIndex = _state.ordinal() + 1;
}
if(_serverDescriptor instanceof IceBoxDescriptor)
@@ -842,11 +824,12 @@ class Server extends ListArrayTreeNode
{
public void servicesStarted(final String[] services, Ice.Current current)
{
- final java.util.Set<String> serviceSet = new java.util.HashSet<String>(java.util.Arrays.asList(services));
+ final java.util.Set<String> serviceSet =
+ new java.util.HashSet<String>(java.util.Arrays.asList(services));
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
for(Service service: _services)
{
@@ -860,14 +843,15 @@ class Server extends ListArrayTreeNode
}
});
}
-
+
public void servicesStopped(final String[] services, Ice.Current current)
{
- final java.util.Set<String> serviceSet = new java.util.HashSet<String>(java.util.Arrays.asList(services));
+ final java.util.Set<String> serviceSet =
+ new java.util.HashSet<String>(java.util.Arrays.asList(services));
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
for(Service service: _services)
{
@@ -881,11 +865,11 @@ class Server extends ListArrayTreeNode
}
});
}
-
+
};
-
+
_serviceObserver = IceBox.ServiceObserverPrxHelper.uncheckedCast(
- getCoordinator().addCallback(servant, _id, "IceBox.ServiceManager"));
+ getCoordinator().addCallback(servant, _id, "IceBox.ServiceManager"));
if(_serviceObserver == null)
{
@@ -896,23 +880,23 @@ class Server extends ListArrayTreeNode
JOptionPane.ERROR_MESSAGE);
}
}
-
+
}
-
+
if(_serviceObserver != null)
{
//
// Add observer to service manager using AMI call
// Note that duplicate registrations are ignored
//
-
+
IceBox.AMI_ServiceManager_addObserver cb = new IceBox.AMI_ServiceManager_addObserver()
{
public void ice_response()
{
// all is good
}
-
+
public void ice_exception(Ice.LocalException e)
{
JOptionPane.showMessageDialog(
@@ -922,13 +906,14 @@ class Server extends ListArrayTreeNode
JOptionPane.ERROR_MESSAGE);
}
};
-
+
Ice.ObjectPrx serverAdmin = getServerAdmin();
if(serverAdmin != null)
{
- IceBox.ServiceManagerPrx serviceManager =
- IceBox.ServiceManagerPrxHelper.uncheckedCast(serverAdmin.ice_facet("IceBox.ServiceManager"));
-
+ IceBox.ServiceManagerPrx serviceManager =
+ IceBox.ServiceManagerPrxHelper.uncheckedCast(
+ serverAdmin.ice_facet("IceBox.ServiceManager"));
+
try
{
serviceManager.addObserver_async(cb, _serviceObserver);
@@ -949,10 +934,10 @@ class Server extends ListArrayTreeNode
{
for(Service service: _services)
{
- service.stopped();
+ service.stopped();
}
}
-
+
if(fireEvent)
{
getRoot().getTreeModel().nodeChanged(this);
@@ -962,11 +947,9 @@ class Server extends ListArrayTreeNode
boolean updateAdapter(AdapterDynamicInfo info)
{
- java.util.Iterator p = _adapters.iterator();
- while(p.hasNext())
+ for(Adapter p : _adapters)
{
- Adapter adapter = (Adapter)p.next();
- if(adapter.update(info))
+ if(p.update(info))
{
return true;
}
@@ -975,40 +958,44 @@ class Server extends ListArrayTreeNode
//
// Could be in one of the services as well
//
- p = _services.iterator();
- while(p.hasNext())
+ for(Service p : _services)
{
- Service service = (Service)p.next();
- if(service.updateAdapter(info))
+ if(p.updateAdapter(info))
{
return true;
}
}
+
return false;
}
- int updateAdapters(java.util.List infoList)
+ int updateAdapters(java.util.List<AdapterDynamicInfo> infoList)
{
int result = 0;
- java.util.Iterator p = _adapters.iterator();
- while(p.hasNext() && result < infoList.size())
{
- Adapter adapter = (Adapter)p.next();
- if(adapter.update(infoList))
+ java.util.Iterator<Adapter> p = _adapters.iterator();
+ while(p.hasNext() && result < infoList.size())
{
- result++;
+ Adapter adapter = p.next();
+ if(adapter.update(infoList))
+ {
+ result++;
+ }
}
}
//
// Could be in one of the services as well
//
- p = _services.iterator();
- while(p.hasNext() && result < infoList.size())
{
- Service service = (Service)p.next();
- result += service.updateAdapters(infoList);
+ java.util.Iterator<Service> p = _services.iterator();
+ while(p.hasNext() && result < infoList.size())
+ {
+ Service service = p.next();
+ result += service.updateAdapters(infoList);
+ }
}
+
return result;
}
@@ -1016,34 +1003,27 @@ class Server extends ListArrayTreeNode
{
update(null, 0, true, true);
- java.util.Iterator p = _adapters.iterator();
- while(p.hasNext())
+ for(Adapter p : _adapters)
{
- Adapter adapter = (Adapter)p.next();
- adapter.update((AdapterDynamicInfo)null);
+ p.update((AdapterDynamicInfo)null);
}
-
- p = _services.iterator();
- while(p.hasNext())
+
+ for(Service p : _services)
{
- Service service = (Service)p.next();
- service.nodeDown();
+ p.nodeDown();
}
}
- java.util.SortedMap getProperties()
+ java.util.SortedMap<String, String> getProperties()
{
- java.util.List psList = new java.util.LinkedList();
+ java.util.List<Utils.ExpandedPropertySet> psList = new java.util.LinkedList<Utils.ExpandedPropertySet>();
Node node = (Node)_parent;
-
- psList.add(node.expand(_serverDescriptor.propertySet,
- _application.name, _resolver));
+ psList.add(node.expand(_serverDescriptor.propertySet, _application.name, _resolver));
if(_instanceDescriptor != null)
{
- psList.add(node.expand(_instanceDescriptor.propertySet,
- _application.name, _resolver));
+ psList.add(node.expand(_instanceDescriptor.propertySet, _application.name, _resolver));
}
return Utils.propertySetsToMap(psList, _resolver);
@@ -1056,34 +1036,26 @@ class Server extends ListArrayTreeNode
private void createAdapters()
{
- java.util.Iterator p = _serverDescriptor.adapters.iterator();
- while(p.hasNext())
+ for(AdapterDescriptor p : _serverDescriptor.adapters)
{
- AdapterDescriptor descriptor = (AdapterDescriptor)p.next();
- String adapterName = Utils.substitute(descriptor.name, _resolver);
- String adapterId = Utils.substitute(descriptor.id, _resolver);
+ String adapterName = Utils.substitute(p.name, _resolver);
+ String adapterId = Utils.substitute(p.id, _resolver);
Ice.ObjectPrx proxy = null;
if(adapterId.length() > 0)
{
proxy = ((Node)_parent).getProxy(adapterId);
}
- insertSortedChild(new Adapter(this, adapterName,
- _resolver, adapterId, descriptor, proxy),
- _adapters, null);
+ insertSortedChild(new Adapter(this, adapterName, _resolver, adapterId, p, proxy), _adapters, null);
}
}
-
+
private void createDbEnvs()
{
- java.util.Iterator p = _serverDescriptor.dbEnvs.iterator();
- while(p.hasNext())
+ for(DbEnvDescriptor p : _serverDescriptor.dbEnvs)
{
- DbEnvDescriptor descriptor = (DbEnvDescriptor)p.next();
- String dbEnvName = Utils.substitute(descriptor.name, _resolver);
-
- insertSortedChild(new DbEnv(this, dbEnvName, _resolver, descriptor),
- _dbEnvs, null);
+ String dbEnvName = Utils.substitute(p.name, _resolver);
+ insertSortedChild(new DbEnv(this, dbEnvName, _resolver, p), _dbEnvs, null);
}
}
@@ -1093,21 +1065,18 @@ class Server extends ListArrayTreeNode
{
if(_instanceDescriptor != null)
{
- java.util.Iterator p = _instanceDescriptor.servicePropertySets.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, PropertySetDescriptor> p :
+ _instanceDescriptor.servicePropertySets.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- _servicePropertySets.put(_resolver.substitute((String)entry.getKey()), entry.getValue());
+ _servicePropertySets.put(_resolver.substitute(p.getKey()), p.getValue());
}
}
IceBoxDescriptor iceBoxDescriptor = (IceBoxDescriptor)_serverDescriptor;
-
- java.util.Iterator p = iceBoxDescriptor.services.iterator();
- while(p.hasNext())
+
+ for(ServiceInstanceDescriptor p : iceBoxDescriptor.services)
{
- ServiceInstanceDescriptor descriptor = (ServiceInstanceDescriptor)p.next();
- createService(descriptor);
+ createService(p);
}
}
}
@@ -1117,18 +1086,18 @@ class Server extends ListArrayTreeNode
ServiceDescriptor serviceDescriptor = null;
String serviceName = null;
Utils.Resolver serviceResolver = null;
-
+
if(descriptor.template.length() > 0)
{
- TemplateDescriptor templateDescriptor
+ TemplateDescriptor templateDescriptor
= (TemplateDescriptor)_application.serviceTemplates.get(descriptor.template);
-
+
assert templateDescriptor != null;
-
+
serviceDescriptor = (ServiceDescriptor)templateDescriptor.descriptor;
assert serviceDescriptor != null;
-
- serviceResolver = new Utils.Resolver(_resolver,
+
+ serviceResolver = new Utils.Resolver(_resolver,
descriptor.parameterValues,
templateDescriptor.parameterDefaults);
serviceName = serviceResolver.substitute(serviceDescriptor.name);
@@ -1138,17 +1107,16 @@ class Server extends ListArrayTreeNode
{
serviceDescriptor = descriptor.descriptor;
assert serviceDescriptor != null;
-
+
serviceResolver = new Utils.Resolver(_resolver);
serviceName = _resolver.substitute(serviceDescriptor.name);
serviceResolver.put("service", serviceName);
}
- PropertySetDescriptor serverInstancePSDescriptor =
- (PropertySetDescriptor)_servicePropertySets.get(serviceName);
+ PropertySetDescriptor serverInstancePSDescriptor = (PropertySetDescriptor)_servicePropertySets.get(serviceName);
- _services.add(new Service(this, serviceName, serviceResolver,
- descriptor, serviceDescriptor, serverInstancePSDescriptor));
+ _services.add(new Service(this, serviceName, serviceResolver, descriptor, serviceDescriptor,
+ serverInstancePSDescriptor));
}
Ice.ObjectPrx getServerAdmin()
@@ -1169,12 +1137,11 @@ class Server extends ListArrayTreeNode
return admin.ice_identity(adminId);
}
}
-
-
+
static private String toolTip(ServerState state, int pid, boolean enabled)
{
String result = (state == null ? "Unknown" : state.toString());
-
+
if(!enabled)
{
result += ", disabled";
@@ -1187,9 +1154,9 @@ class Server extends ListArrayTreeNode
return result;
}
-
private ServerInstanceDescriptor _instanceDescriptor;
- private java.util.Map _servicePropertySets = new java.util.HashMap(); // with substituted names!
+ private java.util.Map<String, PropertySetDescriptor> _servicePropertySets =
+ new java.util.HashMap<String, PropertySetDescriptor>(); // with substituted names!
private ServerDescriptor _serverDescriptor;
private ApplicationDescriptor _application;
diff --git a/java/src/IceGridGUI/LiveDeployment/ServerEditor.java b/java/src/IceGridGUI/LiveDeployment/ServerEditor.java
index a7f09225582..d4e5045f712 100644
--- a/java/src/IceGridGUI/LiveDeployment/ServerEditor.java
+++ b/java/src/IceGridGUI/LiveDeployment/ServerEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.awt.event.ActionEvent;
@@ -48,19 +49,19 @@ class ServerEditor extends CommunicatorEditor
_enabled.setEnabled(false);
_currentPid.setEditable(false);
_buildId.setEditable(false);
-
+
_application.setEditable(false);
_exe.setEditable(false);
_iceVersion.setEditable(false);
_pwd.setEditable(false);
-
+
_activation.setEditable(false);
_activationTimeout.setEditable(false);
_deactivationTimeout.setEditable(false);
_options.setEditable(false);
_user.setEditable(false);
-
+
_allocatable.setEnabled(false);
_applicationDistrib.setEnabled(false);
_icepatch.setEditable(false);
@@ -68,34 +69,29 @@ class ServerEditor extends CommunicatorEditor
Action refresh = new AbstractAction("Refresh")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_buildId.setText("Retrieving...");
_properties.clear();
_target.showRuntimeProperties();
}
};
- refresh.putValue(Action.SHORT_DESCRIPTION,
- "Reread the properties from the server");
+ refresh.putValue(Action.SHORT_DESCRIPTION, "Reread the properties from the server");
_refreshButton = new JButton(refresh);
- Action gotoApplication = new AbstractAction(
- "", Utils.getIcon("/icons/16x16/goto.png"))
+ Action gotoApplication = new AbstractAction("", Utils.getIcon("/icons/16x16/goto.png"))
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_target.openDefinition();
}
};
- gotoApplication.putValue(Action.SHORT_DESCRIPTION,
- "View/Edit this application");
+ gotoApplication.putValue(Action.SHORT_DESCRIPTION, "View/Edit this application");
_gotoApplication = new JButton(gotoApplication);
}
-
void show(Server server)
{
-
Server previousServer = _target;
_target = server;
@@ -136,7 +132,7 @@ class ServerEditor extends CommunicatorEditor
{
_buildId.setText("Retrieving...");
_properties.clear();
-
+
//
// Retrieve all properties in background
//
@@ -148,7 +144,6 @@ class ServerEditor extends CommunicatorEditor
// Otherwise, use current value
//
_refreshButton.setEnabled(true);
-
}
else
{
@@ -158,11 +153,11 @@ class ServerEditor extends CommunicatorEditor
_refreshButton.setEnabled(false);
}
}
-
+
_application.setText(resolver.find("application"));
super.show(descriptor, server.getProperties(), resolver);
-
+
_exe.setText(resolver.substitute(descriptor.exe));
_iceVersion.setText(resolver.substitute(descriptor.iceVersion));
_pwd.setText(resolver.substitute(descriptor.pwd));
@@ -175,9 +170,8 @@ class ServerEditor extends CommunicatorEditor
return resolver.substitute((String)obj);
}
};
-
- _options.setText(
- Utils.stringify(descriptor.options, stringifier, " ", toolTipHolder));
+
+ _options.setText(Utils.stringify(descriptor.options, stringifier, " ", toolTipHolder));
_options.setToolTipText(toolTipHolder.value);
_envs.setEnvs(descriptor.envs, resolver);
@@ -187,16 +181,16 @@ class ServerEditor extends CommunicatorEditor
_activation.setText(resolver.substitute(descriptor.activation));
_activationTimeout.setText(resolver.substitute(descriptor.activationTimeout));
_deactivationTimeout.setText(resolver.substitute(descriptor.deactivationTimeout));
-
+
_allocatable.setSelected(descriptor.allocatable);
_applicationDistrib.setSelected(descriptor.applicationDistrib);
_icepatch.setText(resolver.substitute(resolver.substitute(descriptor.distrib.icepatch)));
toolTipHolder = new Ice.StringHolder();
-
+
_directories.setText(
- Utils.stringify(descriptor.distrib.directories, stringifier, ", ",
+ Utils.stringify(descriptor.distrib.directories, stringifier, ", ",
toolTipHolder));
String toolTip = "<html>Include only these directories";
@@ -224,14 +218,14 @@ class ServerEditor extends CommunicatorEditor
//
}
- void setRuntimeProperties(java.util.SortedMap map, Server server)
+ void setRuntimeProperties(java.util.SortedMap<String, String> map, Server server)
{
if(server == _target)
{
_properties.setSortedMap(map);
_propertiesRetrieved = true;
- String buildString = (String)map.get("BuildId");
+ String buildString = map.get("BuildId");
if(buildString == null)
{
_buildId.setText("");
@@ -277,11 +271,10 @@ class ServerEditor extends CommunicatorEditor
builder.nextRow(-6);
CellConstraints cc = new CellConstraints();
JScrollPane scrollPane = new JScrollPane(_properties);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
-
+
builder.appendSeparator("Configuration");
builder.append("Application");
@@ -293,7 +286,7 @@ class ServerEditor extends CommunicatorEditor
// Add Communicator fields
//
super.appendProperties(builder);
-
+
builder.appendSeparator("Activation");
builder.append("Path to Executable");
builder.append(_exe, 3);
@@ -319,8 +312,7 @@ class ServerEditor extends CommunicatorEditor
builder.append("");
builder.nextRow(-6);
scrollPane = new JScrollPane(_envs);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
@@ -355,7 +347,6 @@ class ServerEditor extends CommunicatorEditor
_propertiesPanel.setName("Server Properties");
}
-
private class ToolBar extends JToolBar
{
private ToolBar()
@@ -364,7 +355,7 @@ class ServerEditor extends CommunicatorEditor
putClientProperty(PlasticLookAndFeel.BORDER_STYLE_KEY, BorderStyle.SEPARATOR);
setFloatable(false);
putClientProperty("JToolBar.isRollover", Boolean.TRUE);
-
+
LiveActions la = _coordinator.getLiveActionsForMenu();
add(la.get(TreeNode.START));
@@ -375,7 +366,6 @@ class ServerEditor extends CommunicatorEditor
}
}
-
private Coordinator _coordinator;
private Server _target;
@@ -394,15 +384,14 @@ class ServerEditor extends CommunicatorEditor
private JTextField _iceVersion = new JTextField(20);
private JTextField _pwd = new JTextField(20);
private JTextField _user = new JTextField(20);
-
+
private JTextField _activation = new JTextField(20);
private JTextField _activationTimeout = new JTextField(20);
private JTextField _deactivationTimeout = new JTextField(20);
private JCheckBox _allocatable = new JCheckBox("Allocatable");
+ private TableField _envs = new TableField("Name", "Value");
- private TableField _envs = new TableField("Name", "Value");
-
private JTextField _options = new JTextField(20);
private JCheckBox _applicationDistrib = new JCheckBox("Depends on the application distribution");
diff --git a/java/src/IceGridGUI/LiveDeployment/Service.java b/java/src/IceGridGUI/LiveDeployment/Service.java
index 121e9eebae6..8e2c1c66fdd 100644
--- a/java/src/IceGridGUI/LiveDeployment/Service.java
+++ b/java/src/IceGridGUI/LiveDeployment/Service.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.awt.Component;
@@ -50,19 +51,19 @@ public class Service extends ListArrayTreeNode
actions[STOP] = true;
}
}
-
+
return actions;
}
public void start()
{
Ice.ObjectPrx serverAdmin = ((Server)_parent).getServerAdmin();
-
+
if(serverAdmin != null)
{
final String prefix = "Starting service '" + _id + "'...";
getCoordinator().getStatusBar().setText(prefix);
-
+
IceBox.AMI_ServiceManager_startService cb = new IceBox.AMI_ServiceManager_startService()
{
//
@@ -72,7 +73,7 @@ public class Service extends ListArrayTreeNode
{
amiSuccess(prefix);
}
-
+
public void ice_exception(Ice.UserException e)
{
if(e instanceof IceBox.AlreadyStartedException)
@@ -90,12 +91,12 @@ public class Service extends ListArrayTreeNode
amiFailure(prefix, "Failed to start service " + _id, e.toString());
}
};
-
+
IceBox.ServiceManagerPrx serviceManager = IceBox.ServiceManagerPrxHelper.
uncheckedCast(serverAdmin.ice_facet("IceBox.ServiceManager"));
-
+
try
- {
+ {
serviceManager.startService_async(cb, _id);
}
catch(Ice.LocalException e)
@@ -104,16 +105,16 @@ public class Service extends ListArrayTreeNode
}
}
}
-
+
public void stop()
{
Ice.ObjectPrx serverAdmin = ((Server)_parent).getServerAdmin();
-
+
if(serverAdmin != null)
{
final String prefix = "Stopping service '" + _id + "'...";
getCoordinator().getStatusBar().setText(prefix);
-
+
IceBox.AMI_ServiceManager_stopService cb = new IceBox.AMI_ServiceManager_stopService()
{
//
@@ -123,7 +124,7 @@ public class Service extends ListArrayTreeNode
{
amiSuccess(prefix);
}
-
+
public void ice_exception(Ice.UserException e)
{
if(e instanceof IceBox.AlreadyStoppedException)
@@ -141,12 +142,12 @@ public class Service extends ListArrayTreeNode
amiFailure(prefix, "Failed to stop service " + _id, e.toString());
}
};
-
+
IceBox.ServiceManagerPrx serviceManager = IceBox.ServiceManagerPrxHelper.
uncheckedCast(serverAdmin.ice_facet("IceBox.ServiceManager"));
-
+
try
- {
+ {
serviceManager.stopService_async(cb, _id);
}
catch(Ice.LocalException e)
@@ -156,13 +157,12 @@ public class Service extends ListArrayTreeNode
}
}
-
public void retrieveLog()
{
assert _serviceDescriptor.logs.length > 0;
String path = null;
-
+
if(_serviceDescriptor.logs.length == 1)
{
path = _resolver.substitute(_serviceDescriptor.logs[0]);
@@ -170,54 +170,55 @@ public class Service extends ListArrayTreeNode
else
{
Object[] pathArray = new Object[_serviceDescriptor.logs.length];
- for(int i = 0; i < _serviceDescriptor.logs.length; ++i)
+ int i = 0;
+ for(String log : _serviceDescriptor.logs)
{
- pathArray[i] = _resolver.substitute(_serviceDescriptor.logs[i]);
+ pathArray[i++] = _resolver.substitute(log);
}
-
+
path = (String)JOptionPane.showInputDialog(
- getCoordinator().getMainFrame(),
- "Which log file do you want to retrieve?",
- "Retrieve Log File",
+ getCoordinator().getMainFrame(),
+ "Which log file do you want to retrieve?",
+ "Retrieve Log File",
JOptionPane.QUESTION_MESSAGE, null,
pathArray, pathArray[0]);
}
-
+
if(path != null)
{
final String fPath = path;
-
+
getRoot().openShowLogDialog(new ShowLogDialog.FileIteratorFactory()
{
public FileIteratorPrx open(int count)
- throws FileNotAvailableException, ServerNotExistException, NodeUnreachableException,
+ throws FileNotAvailableException, ServerNotExistException, NodeUnreachableException,
DeploymentException
{
AdminSessionPrx session = getRoot().getCoordinator().getSession();
return session.openServerLog(_parent.getId(), fPath, count);
}
-
+
public String getTitle()
{
return "Service " + _parent.getId() + "/" + _id + " " + new java.io.File(fPath).getName();
}
-
+
public String getDefaultFilename()
{
return new java.io.File(fPath).getName();
}
});
- }
+ }
}
public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
@@ -226,9 +227,9 @@ public class Service extends ListArrayTreeNode
_startedIcon = Utils.getIcon("/icons/16x16/service_running.png");
_stoppedIcon = Utils.getIcon("/icons/16x16/service.png");
}
-
+
Icon icon = _started ? _startedIcon : _stoppedIcon;
-
+
if(expanded)
{
_cellRenderer.setOpenIcon(icon);
@@ -238,9 +239,7 @@ public class Service extends ListArrayTreeNode
_cellRenderer.setClosedIcon(icon);
}
-
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
public Editor getEditor()
@@ -265,24 +264,21 @@ public class Service extends ListArrayTreeNode
_popup.addSeparator();
_popup.add(la.get(RETRIEVE_LOG));
}
-
+
la.setTarget(this);
return _popup;
}
-
- Service(Server parent, String serviceName, Utils.Resolver resolver,
- ServiceInstanceDescriptor descriptor,
- ServiceDescriptor serviceDescriptor,
- PropertySetDescriptor serverInstancePSDescriptor)
+ Service(Server parent, String serviceName, Utils.Resolver resolver, ServiceInstanceDescriptor descriptor,
+ ServiceDescriptor serviceDescriptor, PropertySetDescriptor serverInstancePSDescriptor)
{
super(parent, serviceName, 2);
_resolver = resolver;
-
+
_instanceDescriptor = descriptor;
_serviceDescriptor = serviceDescriptor;
_serverInstancePSDescriptor = serverInstancePSDescriptor;
-
+
_childrenArray[0] = _adapters;
_childrenArray[1] = _dbEnvs;
@@ -292,11 +288,9 @@ public class Service extends ListArrayTreeNode
boolean updateAdapter(AdapterDynamicInfo info)
{
- java.util.Iterator p = _adapters.iterator();
- while(p.hasNext())
+ for(Adapter p : _adapters)
{
- Adapter adapter = (Adapter)p.next();
- if(adapter.update(info))
+ if(p.update(info))
{
return true;
}
@@ -304,13 +298,13 @@ public class Service extends ListArrayTreeNode
return false;
}
- int updateAdapters(java.util.List infoList)
+ int updateAdapters(java.util.List<AdapterDynamicInfo> infoList)
{
int result = 0;
- java.util.Iterator p = _adapters.iterator();
+ java.util.Iterator<Adapter> p = _adapters.iterator();
while(p.hasNext() && result < infoList.size())
{
- Adapter adapter = (Adapter)p.next();
+ Adapter adapter = p.next();
if(adapter.update(infoList))
{
result++;
@@ -321,11 +315,9 @@ public class Service extends ListArrayTreeNode
void nodeDown()
{
- java.util.Iterator p = _adapters.iterator();
- while(p.hasNext())
+ for(Adapter p : _adapters)
{
- Adapter adapter = (Adapter)p.next();
- adapter.update((AdapterDynamicInfo)null);
+ p.update((AdapterDynamicInfo)null);
}
}
@@ -352,11 +344,10 @@ public class Service extends ListArrayTreeNode
}
}
-
void showRuntimeProperties()
{
Ice.ObjectPrx serverAdmin = ((Server)_parent).getServerAdmin();
-
+
if(serverAdmin == null)
{
_editor.setBuildId("", this);
@@ -365,22 +356,23 @@ public class Service extends ListArrayTreeNode
{
Ice.AMI_PropertiesAdmin_getPropertiesForPrefix cb = new Ice.AMI_PropertiesAdmin_getPropertiesForPrefix()
{
- public void ice_response(final java.util.Map properties)
+ public void ice_response(final java.util.Map<String, String> properties)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
- _editor.setRuntimeProperties((java.util.SortedMap)properties, Service.this);
+ _editor.setRuntimeProperties((java.util.SortedMap<String, String>)properties,
+ Service.this);
}
});
}
-
+
public void ice_exception(final Ice.LocalException e)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
if(e instanceof Ice.ObjectNotExistException)
{
@@ -388,8 +380,8 @@ public class Service extends ListArrayTreeNode
}
else if(e instanceof Ice.FacetNotExistException)
{
- _editor.setBuildId("Error: this icebox Admin object does not provide a 'Properties' facet for this service",
- Service.this);
+ _editor.setBuildId("Error: this icebox Admin object does not provide a " +
+ "'Properties' facet for this service", Service.this);
}
else
{
@@ -400,11 +392,11 @@ public class Service extends ListArrayTreeNode
}
};
-
try
- {
- Ice.PropertiesAdminPrx propAdmin = Ice.PropertiesAdminPrxHelper.uncheckedCast(serverAdmin.ice_facet("IceBox.Service."
- + _id + ".Properties"));
+ {
+ Ice.PropertiesAdminPrx propAdmin =
+ Ice.PropertiesAdminPrxHelper.uncheckedCast(serverAdmin.ice_facet("IceBox.Service." + _id +
+ ".Properties"));
propAdmin.getPropertiesForPrefix_async(cb, "");
}
catch(Ice.LocalException e)
@@ -429,26 +421,23 @@ public class Service extends ListArrayTreeNode
return _instanceDescriptor;
}
- java.util.SortedMap getProperties()
+ java.util.SortedMap<String, String> getProperties()
{
- java.util.List psList = new java.util.LinkedList();
+ java.util.List<Utils.ExpandedPropertySet> psList = new java.util.LinkedList<Utils.ExpandedPropertySet>();
Node node = (Node)_parent.getParent();
String applicationName = ((Server)_parent).getApplication().name;
- psList.add(node.expand(_serviceDescriptor.propertySet,
- applicationName, _resolver));
+ psList.add(node.expand(_serviceDescriptor.propertySet, applicationName, _resolver));
if(_instanceDescriptor != null)
{
- psList.add(node.expand(_instanceDescriptor.propertySet,
- applicationName, _resolver));
- }
+ psList.add(node.expand(_instanceDescriptor.propertySet, applicationName, _resolver));
+ }
if(_serverInstancePSDescriptor != null)
{
- psList.add(node.expand(_serverInstancePSDescriptor,
- applicationName, _resolver));
+ psList.add(node.expand(_serverInstancePSDescriptor, applicationName, _resolver));
}
@@ -457,45 +446,37 @@ public class Service extends ListArrayTreeNode
private void createAdapters()
{
- java.util.Iterator p = _serviceDescriptor.adapters.iterator();
- while(p.hasNext())
+ for(AdapterDescriptor p : _serviceDescriptor.adapters)
{
- AdapterDescriptor descriptor = (AdapterDescriptor)p.next();
- String adapterName = Utils.substitute(descriptor.name, _resolver);
-
- String adapterId = Utils.substitute(descriptor.id, _resolver);
+ String adapterName = Utils.substitute(p.name, _resolver);
+
+ String adapterId = Utils.substitute(p.id, _resolver);
Ice.ObjectPrx proxy = null;
if(adapterId.length() > 0)
{
proxy = ((Node)_parent.getParent()).getProxy(adapterId);
}
-
- insertSortedChild(
- new Adapter(this, adapterName,
- _resolver, adapterId, descriptor, proxy),
- _adapters, null);
+
+ insertSortedChild(new Adapter(this, adapterName, _resolver, adapterId, p, proxy), _adapters, null);
}
}
-
+
private void createDbEnvs()
{
- java.util.Iterator p = _serviceDescriptor.dbEnvs.iterator();
- while(p.hasNext())
+ for(DbEnvDescriptor p : _serviceDescriptor.dbEnvs)
{
- DbEnvDescriptor descriptor = (DbEnvDescriptor)p.next();
- String dbEnvName = Utils.substitute(descriptor.name, _resolver);
- insertSortedChild(
- new DbEnv(this, dbEnvName, _resolver, descriptor), _dbEnvs, null);
+ String dbEnvName = Utils.substitute(p.name, _resolver);
+ insertSortedChild(new DbEnv(this, dbEnvName, _resolver, p), _dbEnvs, null);
}
- }
+ }
private final ServiceInstanceDescriptor _instanceDescriptor;
private final ServiceDescriptor _serviceDescriptor;
private final PropertySetDescriptor _serverInstancePSDescriptor;
private final Utils.Resolver _resolver;
- private final java.util.List _adapters = new java.util.LinkedList();
- private final java.util.List _dbEnvs = new java.util.LinkedList();
+ private final java.util.List<Adapter> _adapters = new java.util.LinkedList<Adapter>();
+ private final java.util.List<DbEnv> _dbEnvs = new java.util.LinkedList<DbEnv>();
private boolean _started = false;
diff --git a/java/src/IceGridGUI/LiveDeployment/ServiceEditor.java b/java/src/IceGridGUI/LiveDeployment/ServiceEditor.java
index 5b09f6303a5..559121a092d 100644
--- a/java/src/IceGridGUI/LiveDeployment/ServiceEditor.java
+++ b/java/src/IceGridGUI/LiveDeployment/ServiceEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.awt.event.ActionEvent;
@@ -26,7 +27,6 @@ import com.jgoodies.looks.HeaderStyle;
import com.jgoodies.looks.BorderStyle;
import com.jgoodies.looks.plastic.PlasticLookAndFeel;
-
import IceGrid.*;
import IceGridGUI.*;
@@ -51,15 +51,14 @@ class ServiceEditor extends CommunicatorEditor
Action refresh = new AbstractAction("Refresh")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
_buildId.setText("Retrieving...");
_properties.clear();
_target.showRuntimeProperties();
}
};
- refresh.putValue(Action.SHORT_DESCRIPTION,
- "Reread the properties from the service");
+ refresh.putValue(Action.SHORT_DESCRIPTION, "Reread the properties from the service");
_refreshButton = new JButton(refresh);
}
@@ -82,7 +81,7 @@ class ServiceEditor extends CommunicatorEditor
{
_buildId.setText("Retrieving...");
_properties.clear();
-
+
//
// Retrieve all properties in background
//
@@ -103,7 +102,7 @@ class ServiceEditor extends CommunicatorEditor
builder.append("", _started);
builder.nextLine();
-
+
builder.append("Build Id");
builder.append(_buildId, _refreshButton);
builder.nextLine();
@@ -120,8 +119,7 @@ class ServiceEditor extends CommunicatorEditor
builder.nextRow(-6);
CellConstraints cc = new CellConstraints();
JScrollPane scrollPane = new JScrollPane(_properties);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
@@ -155,12 +153,12 @@ class ServiceEditor extends CommunicatorEditor
//
}
- void setRuntimeProperties(java.util.SortedMap map, Service service)
+ void setRuntimeProperties(java.util.SortedMap<String, String> map, Service service)
{
if(service == _target )
{
_properties.setSortedMap(map);
-
+
String buildString = (String)map.get("BuildId");
if(buildString == null)
{
@@ -184,7 +182,7 @@ class ServiceEditor extends CommunicatorEditor
putClientProperty(PlasticLookAndFeel.BORDER_STYLE_KEY, BorderStyle.SEPARATOR);
setFloatable(false);
putClientProperty("JToolBar.isRollover", Boolean.TRUE);
-
+
LiveActions la = _coordinator.getLiveActionsForMenu();
add(la.get(TreeNode.START));
@@ -201,4 +199,3 @@ class ServiceEditor extends CommunicatorEditor
private TableField _properties = new TableField("Name", "Value");
private JToolBar _toolBar;
}
-
diff --git a/java/src/IceGridGUI/LiveDeployment/ShowLogDialog.java b/java/src/IceGridGUI/LiveDeployment/ShowLogDialog.java
index f7abb46f130..327f02f51e3 100644
--- a/java/src/IceGridGUI/LiveDeployment/ShowLogDialog.java
+++ b/java/src/IceGridGUI/LiveDeployment/ShowLogDialog.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.awt.Cursor;
@@ -70,7 +71,7 @@ class ShowLogDialog extends JDialog
SwingUtilities.invokeLater(new Runnable()
{
public void run()
- {
+ {
for(int i = 0; i < lines.length; ++i)
{
//
@@ -94,7 +95,7 @@ class ShowLogDialog extends JDialog
{
javax.swing.text.Document doc = getDocument();
javax.swing.text.Element rootElt = doc.getDefaultRootElement();
-
+
//
// We keep at least one line, no matter its length
//
@@ -114,7 +115,6 @@ class ShowLogDialog extends JDialog
}
setCaretPosition(doc.getLength());
}
-
}
private class ReaderThread extends Thread
@@ -147,7 +147,7 @@ class ShowLogDialog extends JDialog
{
stopReading();
}
-
+
JOptionPane.showMessageDialog(
ShowLogDialog.this,
message,
@@ -157,7 +157,6 @@ class ShowLogDialog extends JDialog
});
}
-
public void run()
{
//
@@ -236,7 +235,7 @@ class ShowLogDialog extends JDialog
firstRun = false;
}
}
-
+
if(_done)
{
cleanupIterator();
@@ -245,13 +244,13 @@ class ShowLogDialog extends JDialog
}
boolean eofEncountered = false;
-
+
while(!eofEncountered)
{
int maxLines;
int maxSize;
int maxReadSize;
-
+
synchronized(this)
{
if(_done || _paused)
@@ -263,12 +262,12 @@ class ShowLogDialog extends JDialog
maxSize = _threadMaxSize;
maxReadSize = _threadMaxReadSize;
}
-
+
Ice.StringSeqHolder linesHolder = new Ice.StringSeqHolder();
try
{
- eofEncountered = _p.read(maxReadSize, linesHolder);
+ eofEncountered = _p.read(maxReadSize, linesHolder);
}
catch(IceGrid.FileNotAvailableException e)
{
@@ -307,12 +306,12 @@ class ShowLogDialog extends JDialog
});
return;
}
-
+
_textArea.appendLines(linesHolder.value, maxLines, maxSize);
}
}
}
-
+
private void cleanupIterator()
{
try
@@ -351,7 +350,7 @@ class ShowLogDialog extends JDialog
notify();
}
}
-
+
synchronized void setPrefs()
{
_threadMaxLines = _maxLines;
@@ -371,7 +370,7 @@ class ShowLogDialog extends JDialog
private int _threadMaxReadSize;
private int _threadPeriod;
}
-
+
private class MenuBar extends JMenuBar
{
private MenuBar()
@@ -383,7 +382,7 @@ class ShowLogDialog extends JDialog
//
// File menu
- //
+ //
JMenu fileMenu = new JMenu("File");
fileMenu.setMnemonic(java.awt.event.KeyEvent.VK_F);
add(fileMenu);
@@ -400,16 +399,16 @@ class ShowLogDialog extends JDialog
fileMenu.add(_stopItem);
bg.add(_stopItem);
fileMenu.addSeparator();
-
+
Action save = new AbstractAction("Save As...")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
JFileChooser fileChooser = _root.getCoordinator().getSaveLogChooser();
-
+
fileChooser.setSelectedFile(new java.io.File(fileChooser.getCurrentDirectory(),
_factory.getDefaultFilename()));
-
+
java.io.File file = null;
while(file == null)
@@ -418,7 +417,7 @@ class ShowLogDialog extends JDialog
if(result == JFileChooser.APPROVE_OPTION)
{
file = fileChooser.getSelectedFile();
-
+
if(file != null)
{
if(!file.exists() && file.getName().indexOf('.') == -1)
@@ -427,7 +426,7 @@ class ShowLogDialog extends JDialog
}
java.io.OutputStreamWriter os = null;
-
+
try
{
os = new java.io.OutputStreamWriter(new java.io.FileOutputStream(file));
@@ -468,8 +467,7 @@ class ShowLogDialog extends JDialog
}
}
};
- save.putValue(Action.ACCELERATOR_KEY,
- KeyStroke.getKeyStroke(KeyEvent.VK_S, MENU_MASK));
+ save.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, MENU_MASK));
save.putValue(Action.SHORT_DESCRIPTION, "Save As...");
fileMenu.add(save);
fileMenu.addSeparator();
@@ -491,10 +489,9 @@ class ShowLogDialog extends JDialog
{
_textArea.copy();
}
-
+
};
- copy.putValue(Action.ACCELERATOR_KEY,
- KeyStroke.getKeyStroke(KeyEvent.VK_C, MENU_MASK));
+ copy.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C, MENU_MASK));
copy.putValue(Action.SHORT_DESCRIPTION, "Copy");
editMenu.add(copy);
@@ -507,8 +504,7 @@ class ShowLogDialog extends JDialog
_textArea.selectAll();
}
};
- selectAll.putValue(Action.ACCELERATOR_KEY,
- KeyStroke.getKeyStroke(KeyEvent.VK_A, MENU_MASK));
+ selectAll.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, MENU_MASK));
selectAll.putValue(Action.SHORT_DESCRIPTION, "Select All");
editMenu.add(selectAll);
@@ -519,7 +515,7 @@ class ShowLogDialog extends JDialog
{
new ShowLogPrefsDialog(ShowLogDialog.this);
}
- });
+ });
}
}
@@ -552,12 +548,11 @@ class ShowLogDialog extends JDialog
}
}
-
- ShowLogDialog(Root root, FileIteratorFactory factory,
- int maxLines, int maxSize, int initialLines, int maxReadSize, int period)
+ ShowLogDialog(Root root, FileIteratorFactory factory, int maxLines, int maxSize, int initialLines, int maxReadSize,
+ int period)
{
super(root.getCoordinator().getMainFrame(), factory.getTitle() + " - IceGrid Admin", false);
-
+
_maxLines = maxLines;
_maxSize = maxSize;
_initialLines = initialLines;
@@ -566,7 +561,7 @@ class ShowLogDialog extends JDialog
_factory = factory;
_root = root;
- setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
+ setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter()
{
public void windowClosing(java.awt.event.WindowEvent e)
@@ -582,15 +577,15 @@ class ShowLogDialog extends JDialog
pause();
}
};
-
+
_play = new AbstractAction("Play")
{
public void actionPerformed(ActionEvent e)
{
play();
}
- };
-
+ };
+
_stop = new AbstractAction("Stop")
{
public void actionPerformed(ActionEvent e)
@@ -598,20 +593,19 @@ class ShowLogDialog extends JDialog
stopReading();
}
};
-
+
setJMenuBar(new MenuBar());
- getContentPane().add(new ToolBar(),
- BorderLayout.PAGE_START);
+ getContentPane().add(new ToolBar(), BorderLayout.PAGE_START);
- JScrollPane scrollPane = new JScrollPane(_textArea,
- JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane scrollPane = new JScrollPane(_textArea,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
getContentPane().add(scrollPane);
-
+
pack();
setResizable(true);
-
+
setLocationRelativeTo(root.getCoordinator().getMainFrame());
play();
}
@@ -628,7 +622,7 @@ class ShowLogDialog extends JDialog
if(_thread != null)
{
_thread.terminate();
-
+
try
{
_thread.join();
@@ -636,7 +630,7 @@ class ShowLogDialog extends JDialog
catch(InterruptedException e)
{
}
-
+
_thread = null;
_stopItem.setSelected(true);
_stopButton.setSelected(true);
@@ -674,7 +668,7 @@ class ShowLogDialog extends JDialog
{
return _initialLines;
}
-
+
int getMaxReadSize()
{
return _maxReadSize;
@@ -692,15 +686,15 @@ class ShowLogDialog extends JDialog
maxLines = 50;
}
_maxLines = maxLines;
-
+
if(maxSize < 1000)
{
maxSize = 1000;
}
_maxSize = maxSize;
-
+
_initialLines = initialLines;
-
+
if(maxReadSize < 100)
{
maxReadSize = 100;
@@ -710,7 +704,7 @@ class ShowLogDialog extends JDialog
maxReadSize = _root.getMessageSizeMax() - 512;
}
_maxReadSize = maxReadSize;
-
+
if(period < 200)
{
period = 200;
@@ -720,14 +714,13 @@ class ShowLogDialog extends JDialog
period = 5000;
}
_period = period;
-
+
if(_thread != null)
{
_thread.setPrefs();
}
-
- _root.setLogPrefs(_maxLines, _maxSize, _initialLines, _maxReadSize, _period);
+ _root.setLogPrefs(_maxLines, _maxSize, _initialLines, _maxReadSize, _period);
}
void close(boolean notifyRoot)
diff --git a/java/src/IceGridGUI/LiveDeployment/ShowLogPrefsDialog.java b/java/src/IceGridGUI/LiveDeployment/ShowLogPrefsDialog.java
index c3dea18def7..4e6b1423b70 100644
--- a/java/src/IceGridGUI/LiveDeployment/ShowLogPrefsDialog.java
+++ b/java/src/IceGridGUI/LiveDeployment/ShowLogPrefsDialog.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.awt.event.ActionEvent;
@@ -34,11 +35,11 @@ class ShowLogPrefsDialog extends JDialog
{
super(sld, "Preferences - IceGrid Admin", true);
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
-
+
final JTextField maxLinesField = new JTextField(10);
maxLinesField.setText(Integer.toString(sld.getMaxLines()));
maxLinesField.setToolTipText("Maximum number of lines in this dialog's buffer");
-
+
final JTextField maxSizeField = new JTextField(10);
maxSizeField.setText(Integer.toString(sld.getMaxSize()));
maxSizeField.setToolTipText("Maximum number of characters in this dialog's buffer");
@@ -67,7 +68,7 @@ class ShowLogPrefsDialog extends JDialog
int initialLines = parseInt(initialLinesField, "Initial tail (lines)");
int maxReadSize = parseInt(maxReadSizeField, "Max bytes read per request");
int period = (int)(parseFloat(periodField, "Poll period (seconds)") * 1000);
-
+
sld.setPrefs(maxLines, maxSize, initialLines, maxReadSize, period);
dispose();
}
@@ -79,7 +80,7 @@ class ShowLogPrefsDialog extends JDialog
};
okButton.addActionListener(okListener);
getRootPane().setDefaultButton(okButton);
-
+
JButton cancelButton = new JButton("Cancel");
ActionListener cancelListener = new ActionListener()
{
@@ -89,14 +90,13 @@ class ShowLogPrefsDialog extends JDialog
}
};
cancelButton.addActionListener(cancelListener);
-
-
+
FormLayout layout = new FormLayout("left:pref, 3dlu, fill:pref:grow", "");
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.setDefaultDialogBorder();
builder.setRowGroupingEnabled(true);
builder.setLineGapSize(LayoutStyle.getCurrent().getLinePad());
-
+
builder.append("Max lines in buffer", maxLinesField);
builder.nextLine();
builder.append("Max characters in buffer", maxSizeField);
@@ -107,23 +107,22 @@ class ShowLogPrefsDialog extends JDialog
builder.nextLine();
builder.append("Poll period (seconds)", periodField);
builder.nextLine();
-
- JComponent buttonBar =
+
+ JComponent buttonBar =
ButtonBarFactory.buildOKCancelBar(okButton, cancelButton);
buttonBar.setBorder(Borders.DIALOG_BORDER);
-
+
java.awt.Container contentPane = getContentPane();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
contentPane.add(builder.getPanel());
contentPane.add(buttonBar);
-
+
pack();
setResizable(false);
setLocationRelativeTo(sld);
setVisible(true);
}
-
private int parseInt(JTextField field, String label) throws NumberFormatException
{
try
@@ -137,7 +136,7 @@ class ShowLogPrefsDialog extends JDialog
label + " must be an integer",
"Invalid entry",
JOptionPane.ERROR_MESSAGE);
-
+
throw e;
}
}
@@ -155,7 +154,7 @@ class ShowLogPrefsDialog extends JDialog
label + " must be a decimal number",
"Invalid entry",
JOptionPane.ERROR_MESSAGE);
-
+
throw e;
}
}
diff --git a/java/src/IceGridGUI/LiveDeployment/Slave.java b/java/src/IceGridGUI/LiveDeployment/Slave.java
index 59296eb1ea1..5b7a3ce3fb6 100644
--- a/java/src/IceGridGUI/LiveDeployment/Slave.java
+++ b/java/src/IceGridGUI/LiveDeployment/Slave.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.awt.Component;
@@ -21,7 +22,6 @@ import javax.swing.tree.TreePath;
import IceGrid.*;
import IceGridGUI.*;
-
class Slave extends TreeNode
{
//
@@ -50,7 +50,7 @@ class Slave extends TreeNode
{
amiSuccess(prefix);
}
-
+
public void ice_exception(Ice.UserException e)
{
amiFailure(prefix, "Failed to shutdown " + _id, e);
@@ -58,16 +58,15 @@ class Slave extends TreeNode
public void ice_exception(Ice.LocalException e)
{
- amiFailure(prefix, "Failed to shutdown " + _id,
+ amiFailure(prefix, "Failed to shutdown " + _id,
e.toString());
}
};
try
- {
- getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-
+ {
+ getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
getCoordinator().getAdmin().shutdownRegistry_async(cb, _id);
}
catch(Ice.LocalException e)
@@ -76,8 +75,7 @@ class Slave extends TreeNode
}
finally
{
- getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
@@ -106,7 +104,7 @@ class Slave extends TreeNode
{
return "Registry " + _title + " " + (stdout ? "stdout" : "stderr");
}
-
+
public String getDefaultFilename()
{
return _id + (stdout ? ".out" : ".err");
@@ -126,12 +124,11 @@ class Slave extends TreeNode
_popup.addSeparator();
_popup.add(la.get(SHUTDOWN_REGISTRY));
}
-
+
la.setTarget(this);
return _popup;
}
-
public Editor getEditor()
{
if(_editor == null)
@@ -149,7 +146,7 @@ class Slave extends TreeNode
boolean expanded,
boolean leaf,
int row,
- boolean hasFocus)
+ boolean hasFocus)
{
if(_cellRenderer == null)
{
@@ -161,8 +158,7 @@ class Slave extends TreeNode
_cellRenderer.setLeafIcon(Utils.getIcon("/icons/16x16/registry.png"));
}
- return _cellRenderer.getTreeCellRendererComponent(
- tree, value, sel, expanded, leaf, row, hasFocus);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
Slave(TreeNode parent, RegistryInfo info, String instanceName)
@@ -170,7 +166,7 @@ class Slave extends TreeNode
super(parent, info.name);
_info = info;
_title = instanceName + " (" + info.name + ")";
- }
+ }
private final RegistryInfo _info;
private final String _title;
diff --git a/java/src/IceGridGUI/LiveDeployment/SlaveEditor.java b/java/src/IceGridGUI/LiveDeployment/SlaveEditor.java
index 7c18b50688a..ac42f781367 100644
--- a/java/src/IceGridGUI/LiveDeployment/SlaveEditor.java
+++ b/java/src/IceGridGUI/LiveDeployment/SlaveEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import javax.swing.JTextField;
diff --git a/java/src/IceGridGUI/LiveDeployment/TableField.java b/java/src/IceGridGUI/LiveDeployment/TableField.java
index 9e2c4c27cec..3e7291f5b98 100644
--- a/java/src/IceGridGUI/LiveDeployment/TableField.java
+++ b/java/src/IceGridGUI/LiveDeployment/TableField.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import IceGrid.*;
@@ -24,27 +25,19 @@ import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
-
//
// A special field used to show a map or list
//
public class TableField extends JTable
{
- public TableField(String headKey, String headValue)
- {
- _columnNames = new java.util.Vector(2);
- _columnNames.add(headKey);
- _columnNames.add(headValue);
- init();
- }
-
- public TableField(String headKey, String headValue1, String headValue2)
- {
- _columnNames = new java.util.Vector(3);
- _columnNames.add(headKey);
- _columnNames.add(headValue1);
- _columnNames.add(headValue2);
+ public TableField(String... columns)
+ {
+ _columnNames = new java.util.Vector<String>(columns.length);
+ for(String name : columns)
+ {
+ _columnNames.add(name);
+ }
init();
}
@@ -64,55 +57,45 @@ public class TableField extends JTable
setPreferredScrollableViewportSize(getPreferredSize());
}
- public void setProperties(java.util.List properties, Utils.Resolver resolver)
+ public void setProperties(java.util.List<PropertyDescriptor> properties, Utils.Resolver resolver)
{
- java.util.SortedMap map = new java.util.TreeMap();
- java.util.Iterator p = properties.iterator();
- while(p.hasNext())
+ java.util.SortedMap<String, String> map = new java.util.TreeMap<String, String>();
+ for(PropertyDescriptor p : properties)
{
- PropertyDescriptor pd = (PropertyDescriptor)p.next();
- map.put(resolver.substitute(pd.name), resolver.substitute(pd.value));
+ map.put(resolver.substitute(p.name), resolver.substitute(p.value));
}
setSortedMap(map);
}
- public void setObjects(java.util.List objects, Utils.Resolver resolver)
+ public void setObjects(java.util.List<ObjectDescriptor> objects, Utils.Resolver resolver)
{
- java.util.SortedMap map = new java.util.TreeMap();
- java.util.Iterator p = objects.iterator();
- while(p.hasNext())
+ java.util.SortedMap<String, String> map = new java.util.TreeMap<String, String>();
+ for(ObjectDescriptor p : objects)
{
- ObjectDescriptor od = (ObjectDescriptor)p.next();
- Ice.Identity id = new Ice.Identity(
- resolver.substitute(od.id.name),
- resolver.substitute(od.id.category));
-
- map.put(Ice.Util.identityToString(id), resolver.substitute(od.type));
+ Ice.Identity id = new Ice.Identity( resolver.substitute(p.id.name), resolver.substitute(p.id.category));
+ map.put(Ice.Util.identityToString(id), resolver.substitute(p.type));
}
setSortedMap(map);
}
- public void setObjects(java.util.SortedMap objects)
+ public void setObjects(java.util.SortedMap<String, ObjectInfo> objects)
{
- java.util.SortedMap map = new java.util.TreeMap();
- java.util.Iterator p = objects.values().iterator();
- while(p.hasNext())
+ java.util.SortedMap<String, String> map = new java.util.TreeMap<String, String>();
+ for(ObjectInfo p : objects.values())
{
- ObjectInfo oi = (ObjectInfo)p.next();
- map.put(oi.proxy.toString(), oi.type);
+ map.put(p.proxy.toString(), p.type);
}
setSortedMap(map);
}
- public void setEnvs(java.util.List envs, Utils.Resolver resolver)
+ public void setEnvs(java.util.List<String> envs, Utils.Resolver resolver)
{
- java.util.SortedMap map = new java.util.TreeMap();
+ java.util.SortedMap<String, String> map = new java.util.TreeMap<String, String>();
- java.util.Iterator p = envs.iterator();
- while(p.hasNext())
+ for(String p : envs)
{
- String env = resolver.substitute((String)p.next());
-
+ String env = resolver.substitute(p);
+
int equal = env.indexOf('=');
if(equal == -1 || equal == env.length() - 1)
{
@@ -120,25 +103,23 @@ public class TableField extends JTable
}
else
{
- map.put(env.substring(0, equal),
- env.substring(equal + 1));
+ map.put(env.substring(0, equal), env.substring(equal + 1));
}
}
setSortedMap(map);
}
- public void setAdapters(java.util.SortedMap adapters)
+ public void setAdapters(java.util.SortedMap<String, AdapterInfo> adapters)
{
- java.util.Vector vector = new java.util.Vector(adapters.size());
- java.util.Iterator p = adapters.entrySet().iterator();
- while(p.hasNext())
+ java.util.Vector<java.util.Vector<String>> vector =
+ new java.util.Vector<java.util.Vector<String>>(adapters.size());
+ for(java.util.Map.Entry<String, AdapterInfo> p : adapters.entrySet())
{
- java.util.Vector row = new java.util.Vector(3);
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- row.add((String)entry.getKey());
+ java.util.Vector<String> row = new java.util.Vector<String>(3);
+ row.add(p.getKey());
+
+ AdapterInfo ai = p.getValue();
- AdapterInfo ai = (AdapterInfo)entry.getValue();
-
if(ai.proxy == null)
{
row.add("");
@@ -163,42 +144,34 @@ public class TableField extends JTable
_model.setDataVector(vector, _columnNames);
- DefaultTableCellRenderer cr = (DefaultTableCellRenderer)
- getDefaultRenderer(String.class);
- cr.setOpaque(false);
+ DefaultTableCellRenderer cr = (DefaultTableCellRenderer)getDefaultRenderer(String.class);
+ cr.setOpaque(false);
}
-
- public void setSortedMap(java.util.SortedMap map)
+ public void setSortedMap(java.util.SortedMap<String, String> map)
{
- java.util.Vector vector = new java.util.Vector(map.size());
- java.util.Iterator p = map.entrySet().iterator();
- while(p.hasNext())
+ java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<java.util.Vector<String>>(map.size());
+ for(java.util.Map.Entry<String, String> p : map.entrySet())
{
- java.util.Vector row = new java.util.Vector(2);
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- row.add((String)entry.getKey());
- row.add((String)entry.getValue());
+ java.util.Vector<String> row = new java.util.Vector<String>(2);
+ row.add(p.getKey());
+ row.add(p.getValue());
vector.add(row);
}
_model.setDataVector(vector, _columnNames);
- DefaultTableCellRenderer cr = (DefaultTableCellRenderer)
- getDefaultRenderer(String.class);
- cr.setOpaque(false);
+ DefaultTableCellRenderer cr = (DefaultTableCellRenderer)getDefaultRenderer(String.class);
+ cr.setOpaque(false);
}
public void clear()
{
- _model.setDataVector(new java.util.Vector(), _columnNames);
- DefaultTableCellRenderer cr = (DefaultTableCellRenderer)
- getDefaultRenderer(String.class);
- cr.setOpaque(false);
+ _model.setDataVector(new java.util.Vector<java.util.Vector<String>>(), _columnNames);
+ DefaultTableCellRenderer cr = (DefaultTableCellRenderer)getDefaultRenderer(String.class);
+ cr.setOpaque(false);
}
private DefaultTableModel _model;
- private java.util.Vector _columnNames;
+ private java.util.Vector<String> _columnNames;
}
-
-
diff --git a/java/src/IceGridGUI/LiveDeployment/TreeNode.java b/java/src/IceGridGUI/LiveDeployment/TreeNode.java
index 858993dffd5..cf3264cc8a4 100644
--- a/java/src/IceGridGUI/LiveDeployment/TreeNode.java
+++ b/java/src/IceGridGUI/LiveDeployment/TreeNode.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import javax.swing.SwingUtilities;
@@ -36,7 +37,7 @@ public abstract class TreeNode extends TreeNodeBase
public static final int STOP = 1;
public static final int ENABLE = 2;
public static final int DISABLE = 3;
-
+
public static final int SIGHUP = 4;
public static final int SIGINT = 5;
public static final int SIGQUIT = 6;
@@ -50,7 +51,7 @@ public abstract class TreeNode extends TreeNodeBase
public static final int RETRIEVE_STDOUT = 12;
public static final int RETRIEVE_STDERR = 13;
public static final int RETRIEVE_LOG = 14;
-
+
public static final int SHUTDOWN_NODE = 15;
public static final int SHUTDOWN_REGISTRY = 16;
@@ -61,7 +62,7 @@ public abstract class TreeNode extends TreeNodeBase
public static final int OPEN_DEFINITION = 19;
static public final int ACTION_COUNT = 20;
-
+
public boolean[] getAvailableActions()
{
return new boolean[ACTION_COUNT];
@@ -125,9 +126,9 @@ public abstract class TreeNode extends TreeNodeBase
//
protected void amiSuccess(final String prefix)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
getCoordinator().getStatusBar().setText(prefix + "done.");
}
@@ -138,54 +139,44 @@ public abstract class TreeNode extends TreeNodeBase
{
if(e instanceof IceGrid.ServerNotExistException)
{
- IceGrid.ServerNotExistException sne =
- (IceGrid.ServerNotExistException)e;
+ IceGrid.ServerNotExistException sne = (IceGrid.ServerNotExistException)e;
- amiFailure(prefix, title,
- "Server '" + sne.id +
- "' was not registered with the IceGrid Registry");
+ amiFailure(prefix, title, "Server '" + sne.id + "' was not registered with the IceGrid Registry");
}
else if(e instanceof IceGrid.ServerStartException)
{
IceGrid.ServerStartException ste = (IceGrid.ServerStartException)e;
- amiFailure(prefix, title, "Server '" +
- ste.id + "' did not start: " + ste.reason);
+ amiFailure(prefix, title, "Server '" + ste.id + "' did not start: " + ste.reason);
}
else if(e instanceof IceGrid.ApplicationNotExistException)
{
- amiFailure(prefix, title,
- "This application was not registered with the IceGrid Registry");
+ amiFailure(prefix, title, "This application was not registered with the IceGrid Registry");
}
else if(e instanceof IceGrid.PatchException)
{
IceGrid.PatchException pe = (IceGrid.PatchException)e;
String message = "";
- for(int i = 0; i < pe.reasons.length; ++i)
+ for(String s : pe.reasons)
{
- if(message.length() == 0)
+ if(message.length() > 0)
{
message += "\n";
- message += pe.reasons[i];
}
+ message += s;
}
amiFailure(prefix, title, message);
}
else if(e instanceof IceGrid.NodeNotExistException)
{
- IceGrid.NodeNotExistException nnee =
- (IceGrid.NodeNotExistException)e;
+ IceGrid.NodeNotExistException nnee = (IceGrid.NodeNotExistException)e;
- amiFailure(prefix, title,
- "Node '" + nnee.name +
- " 'was not registered with the IceGrid Registry.");
+ amiFailure(prefix, title, "Node '" + nnee.name + " 'was not registered with the IceGrid Registry.");
}
else if(e instanceof IceGrid.NodeUnreachableException)
{
- IceGrid.NodeUnreachableException nue =
- (IceGrid.NodeUnreachableException)e;
- amiFailure(prefix, title, "Node '" +
- nue.name + "' is unreachable: " + nue.reason);
+ IceGrid.NodeUnreachableException nue = (IceGrid.NodeUnreachableException)e;
+ amiFailure(prefix, title, "Node '" + nue.name + "' is unreachable: " + nue.reason);
}
else if(e instanceof IceGrid.DeploymentException)
{
@@ -197,13 +188,12 @@ public abstract class TreeNode extends TreeNodeBase
amiFailure(prefix, title, e.toString());
}
}
-
- protected void amiFailure(final String prefix,
- final String title, final String message)
+
+ protected void amiFailure(final String prefix, final String title, final String message)
{
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
{
failure(prefix, title, message);
}
@@ -219,7 +209,7 @@ public abstract class TreeNode extends TreeNodeBase
message,
title,
JOptionPane.ERROR_MESSAGE);
- }
+ }
void reparent(TreeNode newParent)
{
diff --git a/java/src/IceGridGUI/LiveDeployment/WriteMessageDialog.java b/java/src/IceGridGUI/LiveDeployment/WriteMessageDialog.java
index 0f35c8f799b..069a7962478 100644
--- a/java/src/IceGridGUI/LiveDeployment/WriteMessageDialog.java
+++ b/java/src/IceGridGUI/LiveDeployment/WriteMessageDialog.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.LiveDeployment;
import java.awt.Cursor;
@@ -45,12 +46,11 @@ class WriteMessageDialog extends JDialog
{
WriteMessageDialog(final Root root)
{
- super(root.getCoordinator().getMainFrame(),
- "Write Message - IceGrid Admin", true);
+ super(root.getCoordinator().getMainFrame(), "Write Message - IceGrid Admin", true);
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
_mainFrame = root.getCoordinator().getMainFrame();
-
+
_stdOut = new JRadioButton("Write to stdout");
_stdOut.setSelected(true);
JRadioButton stdErr = new JRadioButton("Write to stderr");
@@ -64,7 +64,7 @@ class WriteMessageDialog extends JDialog
public void actionPerformed(ActionEvent e)
{
final Coordinator c = root.getCoordinator();
-
+
AdminPrx admin = c.getAdmin();
if(admin == null)
{
@@ -76,12 +76,12 @@ class WriteMessageDialog extends JDialog
}
else
{
-
+
Ice.Identity adminId = new Ice.Identity(_target, c.getServerAdminCategory());
-
+
final Ice.ProcessPrx process = Ice.ProcessPrxHelper.uncheckedCast(
admin.ice_identity(adminId).ice_facet("Process"));
-
+
final String prefix = "Writing message to server '" + _target + "'...";
c.getStatusBar().setText(prefix);
@@ -89,20 +89,20 @@ class WriteMessageDialog extends JDialog
{
public void ice_response()
{
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
{
c.getStatusBar().setText(prefix + "done.");
}
});
}
-
+
public void ice_exception(final Ice.LocalException e)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
handleFailure("Communication exception: " + e.toString());
}
@@ -112,7 +112,7 @@ class WriteMessageDialog extends JDialog
private void handleFailure(String message)
{
c.getStatusBar().setText(prefix + "failed!");
-
+
JOptionPane.showMessageDialog(
_mainFrame,
message,
@@ -120,7 +120,7 @@ class WriteMessageDialog extends JDialog
JOptionPane.ERROR_MESSAGE);
}
};
-
+
try
{
process.writeMessage_async(cb, _message.getText(), _stdOut.isSelected() ? 1 : 2);
@@ -133,17 +133,17 @@ class WriteMessageDialog extends JDialog
"Communication exception: " + ex.toString(),
"Writing message to server '" + _target + "' failed",
JOptionPane.ERROR_MESSAGE);
-
+
return;
}
}
-
+
setVisible(false);
}
};
okButton.addActionListener(okListener);
getRootPane().setDefaultButton(okButton);
-
+
JButton cancelButton = new JButton("Cancel");
ActionListener cancelListener = new ActionListener()
{
@@ -162,15 +162,14 @@ class WriteMessageDialog extends JDialog
_message.setLineWrap(true);
JScrollPane scrollPane = new JScrollPane(_message,
- JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
builder.append(scrollPane, 3);
builder.nextLine();
builder.append(_stdOut);
builder.append(stdErr);
builder.nextLine();
- JComponent buttonBar =
- ButtonBarFactory.buildOKCancelBar(okButton, cancelButton);
+ JComponent buttonBar = ButtonBarFactory.buildOKCancelBar(okButton, cancelButton);
buttonBar.setBorder(Borders.DIALOG_BORDER);
Container contentPane = getContentPane();
diff --git a/java/src/IceGridGUI/LiveDeploymentPane.java b/java/src/IceGridGUI/LiveDeploymentPane.java
index 3267f0b9bb2..27878eb7ee2 100644
--- a/java/src/IceGridGUI/LiveDeploymentPane.java
+++ b/java/src/IceGridGUI/LiveDeploymentPane.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import java.awt.*;
@@ -50,7 +51,7 @@ public class LiveDeploymentPane extends JSplitPane implements Tab
c.getSaveToRegistryAction().setEnabled(false);
c.getSaveToFileAction().setEnabled(false);
c.getDiscardUpdatesAction().setEnabled(false);
-
+
c.getBackAction().setEnabled(_previousNodes.size() > 0);
c.getForwardAction().setEnabled(_nextNodes.size() > 0);
c.showActions(_currentNode);
@@ -72,11 +73,10 @@ public class LiveDeploymentPane extends JSplitPane implements Tab
}
}
-
public void showNode(TreeNodeBase node)
{
TreeNode newNode = (TreeNode)node;
-
+
if(newNode != _currentNode)
{
if(newNode == null)
@@ -94,7 +94,7 @@ public class LiveDeploymentPane extends JSplitPane implements Tab
_previousNodes.removeFirst();
}
_root.getCoordinator().getBackAction().setEnabled(true);
- }
+ }
_nextNodes.clear();
_root.getCoordinator().getForwardAction().setEnabled(false);
_currentNode = newNode;
@@ -105,7 +105,6 @@ public class LiveDeploymentPane extends JSplitPane implements Tab
{
refresh();
}
-
}
public void back()
@@ -113,10 +112,9 @@ public class LiveDeploymentPane extends JSplitPane implements Tab
TreeNode previousNode = null;
do
{
- previousNode = (TreeNode)_previousNodes.removeLast();
- } while(_previousNodes.size() > 0
- && (previousNode == _currentNode || !_root.hasNode(previousNode)));
-
+ previousNode = _previousNodes.removeLast();
+ } while(_previousNodes.size() > 0 && (previousNode == _currentNode || !_root.hasNode(previousNode)));
+
if(_previousNodes.size() == 0)
{
_root.getCoordinator().getBackAction().setEnabled(false);
@@ -129,7 +127,7 @@ public class LiveDeploymentPane extends JSplitPane implements Tab
_nextNodes.addFirst(_currentNode);
_root.getCoordinator().getForwardAction().setEnabled(true);
}
-
+
_currentNode = previousNode;
_selectionListenerEnabled = false;
_root.setSelectedNode(_currentNode);
@@ -143,10 +141,9 @@ public class LiveDeploymentPane extends JSplitPane implements Tab
TreeNode nextNode = null;
do
{
- nextNode = (TreeNode)_nextNodes.removeFirst();
- } while(_nextNodes.size() > 0
- && (nextNode == _currentNode || !_root.hasNode(nextNode)));
-
+ nextNode = _nextNodes.removeFirst();
+ } while(_nextNodes.size() > 0 && (nextNode == _currentNode || !_root.hasNode(nextNode)));
+
if(_nextNodes.size() == 0)
{
_root.getCoordinator().getForwardAction().setEnabled(false);
@@ -159,7 +156,7 @@ public class LiveDeploymentPane extends JSplitPane implements Tab
_previousNodes.add(_currentNode);
_root.getCoordinator().getBackAction().setEnabled(true);
}
-
+
_currentNode = nextNode;
_selectionListenerEnabled = false;
_root.setSelectedNode(_currentNode);
@@ -168,34 +165,37 @@ public class LiveDeploymentPane extends JSplitPane implements Tab
}
}
-
public void save()
{
assert false;
}
+
public void saveToRegistry()
{
assert false;
}
+
public void saveToFile()
{
assert false;
}
+
public void discardUpdates()
{
assert false;
}
+
public boolean close()
{
return false;
}
-
+
LiveDeploymentPane(Root root)
{
super(JSplitPane.HORIZONTAL_SPLIT, true);
_root = root;
setBorder(new EmptyBorder(10, 10, 10, 10));
-
+
//
// Tree display
//
@@ -209,19 +209,18 @@ public class LiveDeploymentPane extends JSplitPane implements Tab
ToolTipManager.sharedInstance().registerComponent(tree);
tree.addMouseListener(popupListener);
- tree.getSelectionModel().setSelectionMode
- (TreeSelectionModel.SINGLE_TREE_SELECTION);
+ tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.addTreeSelectionListener(new SelectionListener());
-
+
tree.setRootVisible(false);
- JScrollPane leftScroll =
+ JScrollPane leftScroll =
new JScrollPane(tree,
- JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
leftScroll.setBorder(Borders.EMPTY_BORDER);
-
+
_leftPane = new SimpleInternalFrame("Runtime Components");
_leftPane.setContent(leftScroll);
_leftPane.setPreferredSize(new Dimension(280, 350));
@@ -263,14 +262,13 @@ public class LiveDeploymentPane extends JSplitPane implements Tab
private void setEmptyDividerBorder()
{
SplitPaneUI splitPaneUI = getUI();
- if(splitPaneUI instanceof BasicSplitPaneUI)
+ if(splitPaneUI instanceof BasicSplitPaneUI)
{
BasicSplitPaneUI basicUI = (BasicSplitPaneUI)splitPaneUI;
basicUI.getDivider().setBorder(BorderFactory.createEmptyBorder());
}
}
-
private class SelectionListener implements TreeSelectionListener
{
public void valueChanged(TreeSelectionEvent e)
@@ -295,27 +293,26 @@ public class LiveDeploymentPane extends JSplitPane implements Tab
}
}
-
private class PopupListener extends MouseAdapter
{
- public void mousePressed(MouseEvent e)
+ public void mousePressed(MouseEvent e)
{
maybeShowPopup(e);
}
- public void mouseReleased(MouseEvent e)
+ public void mouseReleased(MouseEvent e)
{
maybeShowPopup(e);
}
- private void maybeShowPopup(MouseEvent e)
+ private void maybeShowPopup(MouseEvent e)
{
- if (e.isPopupTrigger())
+ if (e.isPopupTrigger())
{
JTree tree = (JTree)e.getComponent();
TreePath path = tree.getPathForLocation(e.getX(), e.getY());
-
+
if(path != null)
{
TreeNode node = (TreeNode)path.getLastPathComponent();
@@ -333,14 +330,13 @@ public class LiveDeploymentPane extends JSplitPane implements Tab
private SimpleInternalFrame _leftPane;
private SimpleInternalFrame _propertiesFrame;
-
//
// back/forward navigation
//
- private java.util.LinkedList _previousNodes = new java.util.LinkedList();
- private java.util.LinkedList _nextNodes = new java.util.LinkedList();
+ private java.util.LinkedList<TreeNode> _previousNodes = new java.util.LinkedList<TreeNode>();
+ private java.util.LinkedList<TreeNode> _nextNodes = new java.util.LinkedList<TreeNode>();
private TreeNode _currentNode;
-
+
private boolean _selectionListenerEnabled = true;
static private final int HISTORY_MAX_SIZE = 20;
diff --git a/java/src/IceGridGUI/Logger.java b/java/src/IceGridGUI/Logger.java
index b5b87ac4722..3e4533458d2 100644
--- a/java/src/IceGridGUI/Logger.java
+++ b/java/src/IceGridGUI/Logger.java
@@ -15,7 +15,7 @@ import javax.swing.SwingUtilities;
public class Logger extends Ice.LoggerI
{
- public
+ public
Logger(JFrame mainFrame)
{
super("IceGrid Admin", "");
@@ -26,7 +26,7 @@ public class Logger extends Ice.LoggerI
public void
warning(final String message)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
@@ -42,7 +42,7 @@ public class Logger extends Ice.LoggerI
public void
error(final String message)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
diff --git a/java/src/IceGridGUI/Main.java b/java/src/IceGridGUI/Main.java
index 111f808de63..10a1827e6df 100644
--- a/java/src/IceGridGUI/Main.java
+++ b/java/src/IceGridGUI/Main.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import java.awt.Dimension;
@@ -24,11 +25,11 @@ import java.util.prefs.Preferences;
public class Main extends JFrame
{
- public static void main(final String[] args)
+ public static void main(final String[] args)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
createAndShowGUI(args);
}
@@ -37,7 +38,7 @@ public class Main extends JFrame
Main(String[] args)
{
- super("IceGrid Admin");
+ super("IceGrid Admin");
javax.swing.ImageIcon icon = Utils.getIcon("/icons/16x16/grid.png");
if(icon != null)
{
@@ -45,9 +46,9 @@ public class Main extends JFrame
}
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
- addWindowListener(new WindowAdapter()
+ addWindowListener(new WindowAdapter()
{
- public void windowClosing(WindowEvent e)
+ public void windowClosing(WindowEvent e)
{
if(_coordinator != null)
{
@@ -56,16 +57,14 @@ public class Main extends JFrame
}
});
- _coordinator =
- new Coordinator(this, new Ice.StringSeqHolder(args),
- Preferences.userNodeForPackage(getClass()));
-
+ _coordinator = new Coordinator(this, new Ice.StringSeqHolder(args), Preferences.userNodeForPackage(getClass()));
+
_coordinator.showMainFrame();
}
-
- private static void createAndShowGUI(String[] args)
+
+ private static void createAndShowGUI(String[] args)
{
- try
+ try
{
if(UIManager.getSystemLookAndFeelClassName().equals("apple.laf.AquaLookAndFeel"))
{
@@ -76,8 +75,8 @@ public class Main extends JFrame
{
UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
}
- }
- catch(Exception e)
+ }
+ catch(Exception e)
{
System.err.println(e.toString());
}
@@ -100,5 +99,3 @@ public class Main extends JFrame
private Coordinator _coordinator;
}
-
-
diff --git a/java/src/IceGridGUI/MainPane.java b/java/src/IceGridGUI/MainPane.java
index f27bfc8f9cc..5ced22bd39d 100644
--- a/java/src/IceGridGUI/MainPane.java
+++ b/java/src/IceGridGUI/MainPane.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import java.awt.Component;
@@ -20,8 +21,7 @@ public class MainPane extends JTabbedPane
public void addApplication(ApplicationPane application)
{
IceGridGUI.Application.Root root = application.getRoot();
- super.addTab(computeTitle(root.getId()),
- getIcon(root), application);
+ super.addTab(computeTitle(root.getId()), getIcon(root), application);
}
public void setTitleAt(int index, String title)
@@ -93,7 +93,7 @@ public class MainPane extends JTabbedPane
addChangeListener(new ChangeListener()
{
- public void stateChanged(ChangeEvent evt)
+ public void stateChanged(ChangeEvent evt)
{
Tab tab = (Tab)getSelectedComponent();
tab.selected();
@@ -102,13 +102,12 @@ public class MainPane extends JTabbedPane
_registryIcon = Utils.getIcon("/icons/16x16/registry_bound_application.png");
_fileIcon = Utils.getIcon("/icons/16x16/file_bound_application.png");
-
- addTab("Live Deployment",
+
+ addTab("Live Deployment",
Utils.getIcon("/icons/16x16/live_deployment.png"),
_coordinator.getLiveDeploymentPane());
}
-
private String computeTitle(String name)
{
String title = name;
@@ -149,7 +148,6 @@ public class MainPane extends JTabbedPane
}
}
-
private Coordinator _coordinator;
private ImageIcon _registryIcon;
private ImageIcon _fileIcon;
diff --git a/java/src/IceGridGUI/NodeObserverI.java b/java/src/IceGridGUI/NodeObserverI.java
index fe362f406c9..8d68957c84c 100644
--- a/java/src/IceGridGUI/NodeObserverI.java
+++ b/java/src/IceGridGUI/NodeObserverI.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import javax.swing.SwingUtilities;
@@ -18,7 +19,7 @@ class NodeObserverI extends _NodeObserverDisp
_coordinator = coordinator;
_trace = _coordinator.traceObservers();
}
-
+
public void nodeInit(final NodeDynamicInfo[] nodes, Ice.Current current)
{
if(_trace)
@@ -30,23 +31,21 @@ class NodeObserverI extends _NodeObserverDisp
else
{
String names = "";
- for(int i = 0; i < nodes.length; ++i)
+ for(NodeDynamicInfo node : nodes)
{
- names += " " + nodes[i].info.name;
+ names += " " + node.info.name;
}
- _coordinator.traceObserver("nodeInit for node"
- + (nodes.length == 1 ? "" : "s")
- + names);
+ _coordinator.traceObserver("nodeInit for node" + (nodes.length == 1 ? "" : "s") + names);
}
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
- for(int i = 0; i < nodes.length; ++i)
+ for(NodeDynamicInfo node : nodes)
{
- _coordinator.nodeUp(nodes[i]);
+ _coordinator.nodeUp(node);
}
}
});
@@ -58,14 +57,14 @@ class NodeObserverI extends _NodeObserverDisp
{
_coordinator.traceObserver("nodeUp for node " + nodeInfo.info.name);
}
-
- SwingUtilities.invokeLater(new Runnable()
+
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.nodeUp(nodeInfo);
}
- });
+ });
}
public void nodeDown(final String nodeName, Ice.Current current)
@@ -75,18 +74,17 @@ class NodeObserverI extends _NodeObserverDisp
_coordinator.traceObserver("nodeUp for node " + nodeName);
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.nodeDown(nodeName);
}
- });
+ });
}
- public void updateServer(final String node, final ServerDynamicInfo updatedInfo,
- Ice.Current current)
- {
+ public void updateServer(final String node, final ServerDynamicInfo updatedInfo, Ice.Current current)
+ {
if(_trace)
{
_coordinator.traceObserver("updateServer for server " + updatedInfo.id
@@ -94,35 +92,34 @@ class NodeObserverI extends _NodeObserverDisp
+ updatedInfo.state.toString());
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.updateServer(node, updatedInfo);
}
});
}
- public void updateAdapter(final String node, final AdapterDynamicInfo updatedInfo,
- Ice.Current current)
+ public void updateAdapter(final String node, final AdapterDynamicInfo updatedInfo, Ice.Current current)
{
if(_trace)
{
_coordinator.traceObserver("updateAdapter for adapter " + updatedInfo.id
+ " on node " + node + "; new proxy is "
- + (updatedInfo.proxy == null ? "null"
+ + (updatedInfo.proxy == null ? "null"
: updatedInfo.proxy.toString()));
}
-
- SwingUtilities.invokeLater(new Runnable()
+
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.updateAdapter(node, updatedInfo);
}
- });
+ });
}
private final Coordinator _coordinator;
private final boolean _trace;
-};
+}
diff --git a/java/src/IceGridGUI/ObjectObserverI.java b/java/src/IceGridGUI/ObjectObserverI.java
index cfa9eff5081..9a5189b68bf 100644
--- a/java/src/IceGridGUI/ObjectObserverI.java
+++ b/java/src/IceGridGUI/ObjectObserverI.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import javax.swing.SwingUtilities;
@@ -13,7 +14,6 @@ import IceGrid.*;
class ObjectObserverI extends _ObjectObserverDisp
{
-
ObjectObserverI(Coordinator coordinator)
{
_coordinator = coordinator;
@@ -31,18 +31,18 @@ class ObjectObserverI extends _ObjectObserverDisp
else
{
String names = "";
- for(int i = 0; i < objects.length; ++i)
+ for(ObjectInfo obj : objects)
{
- names += " " + objects[i].proxy.toString();
+ names += " " + obj.proxy.toString();
}
-
+
_coordinator.traceObserver("objectInit for objects" + names);
}
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.objectInit(objects);
}
@@ -56,14 +56,14 @@ class ObjectObserverI extends _ObjectObserverDisp
_coordinator.traceObserver("objectAdded for object " + info.proxy.toString());
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.objectAdded(info);
}
});
- }
+ }
public void objectUpdated(final ObjectInfo info, Ice.Current current)
{
@@ -72,14 +72,14 @@ class ObjectObserverI extends _ObjectObserverDisp
_coordinator.traceObserver("objectUpdated for object " + info.proxy.toString());
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.objectUpdated(info);
}
});
- }
+ }
public void objectRemoved(final Ice.Identity id, Ice.Current current)
{
@@ -88,15 +88,15 @@ class ObjectObserverI extends _ObjectObserverDisp
_coordinator.traceObserver("objectRemoved for object " + Ice.Util.identityToString(id));
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.objectRemoved(id);
}
});
}
- private final Coordinator _coordinator;
+ private final Coordinator _coordinator;
private final boolean _trace;
-};
+}
diff --git a/java/src/IceGridGUI/RegistryObserverI.java b/java/src/IceGridGUI/RegistryObserverI.java
index 2fcdcc98b90..b11d60ddf8f 100644
--- a/java/src/IceGridGUI/RegistryObserverI.java
+++ b/java/src/IceGridGUI/RegistryObserverI.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import javax.swing.SwingUtilities;
@@ -13,7 +14,6 @@ import IceGrid.*;
class RegistryObserverI extends _RegistryObserverDisp
{
-
RegistryObserverI(Coordinator coordinator)
{
_coordinator = coordinator;
@@ -31,23 +31,23 @@ class RegistryObserverI extends _RegistryObserverDisp
else
{
String names = "";
- for(int i = 0; i < registryInfos.length; ++i)
+ for(RegistryInfo info : registryInfos)
{
- names += " " + registryInfos[i].name;
+ names += " " + info.name;
}
- _coordinator.traceObserver("registryInit for registr" +
+ _coordinator.traceObserver("registryInit for registr" +
(registryInfos.length == 1 ? "y" : "ies")
+ names);
}
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
- for(int i = 0; i < registryInfos.length; ++i)
+ for(RegistryInfo info : registryInfos)
{
- _coordinator.registryUp(registryInfos[i]);
+ _coordinator.registryUp(info);
}
}
});
@@ -60,13 +60,13 @@ class RegistryObserverI extends _RegistryObserverDisp
_coordinator.traceObserver("registryUp for registry " + registryInfo.name);
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.registryUp(registryInfo);
}
- });
+ });
}
public void registryDown(final String registryName, Ice.Current current)
@@ -76,15 +76,15 @@ class RegistryObserverI extends _RegistryObserverDisp
_coordinator.traceObserver("registryDown for registry " + registryName);
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
_coordinator.registryDown(registryName);
}
- });
+ });
}
private final Coordinator _coordinator;
private final boolean _trace;
-};
+}
diff --git a/java/src/IceGridGUI/SessionKeeper.java b/java/src/IceGridGUI/SessionKeeper.java
index ed0ba62bd0d..8e5e9d3f2d8 100644
--- a/java/src/IceGridGUI/SessionKeeper.java
+++ b/java/src/IceGridGUI/SessionKeeper.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import javax.swing.*;
@@ -52,7 +53,7 @@ class SessionKeeper
Session(AdminSessionPrx session, long keepAliveperiod, boolean routed, Component parent)
{
_session = session;
-
+
try
{
_admin = _session.getAdmin();
@@ -77,12 +78,11 @@ class SessionKeeper
if(adminCallbackTemplate != null)
{
_adminCallbackCategory = adminCallbackTemplate.ice_getIdentity().category;
-
- Ice.Endpoint[] endpoints = adminCallbackTemplate.ice_getEndpoints();
+
String publishedEndpoints = null;
- for(int i = 0; i < endpoints.length; ++i)
+ for(Ice.Endpoint endpoint : adminCallbackTemplate.ice_getEndpoints())
{
- String endpointString = endpoints[i].toString();
+ String endpointString = endpoint.toString();
if(publishedEndpoints == null)
{
publishedEndpoints = endpointString;
@@ -97,7 +97,6 @@ class SessionKeeper
}
}
_serverAdminCategory = _admin.getServerAdminCategory();
-
}
catch(Ice.OperationNotExistException e)
{
@@ -124,7 +123,7 @@ class SessionKeeper
_thread = new Pinger(_session, keepAliveperiod);
_thread.setDaemon(true);
_thread.start();
-
+
try
{
registerObservers(routed);
@@ -140,7 +139,7 @@ class SessionKeeper
throw e;
}
}
-
+
void logout(boolean destroySession)
{
close(destroySession);
@@ -179,10 +178,10 @@ class SessionKeeper
//
Ice.ObjectAdapter adminRouterAdapter = _coordinator.getCommunicator().
createObjectAdapterWithEndpoints("IceGrid.AdminRouter", "tcp -h localhost");
-
+
_routedAdmin = AdminPrxHelper.uncheckedCast(
adminRouterAdapter.addWithUUID(new AdminRouter(_admin)));
-
+
adminRouterAdapter.activate();
}
return _routedAdmin;
@@ -219,7 +218,6 @@ class SessionKeeper
}
}
}
-
Ice.Object removeCallback(String name, String facet)
{
@@ -239,7 +237,7 @@ class SessionKeeper
{
_thread.done();
}
-
+
if(_adapter != null)
{
_adapter.destroy();
@@ -259,11 +257,11 @@ class SessionKeeper
// Create the object adapter for the observers
//
String category;
-
+
if(!routed)
{
category = "observer";
-
+
String adapterName = _adminCallbackCategory == null ? "" : "CallbackAdapter";
_adapter = _coordinator.getCommunicator().createObjectAdapter(adapterName);
@@ -280,7 +278,7 @@ class SessionKeeper
_adapter = _coordinator.getCommunicator().createObjectAdapterWithRouter("RoutedAdapter", router);
_adapter.activate();
}
-
+
//
// Create servants and proxies
//
@@ -294,30 +292,30 @@ class SessionKeeper
_registryObserverIdentity.category = category;
_nodeObserverIdentity.name = "node-" + java.util.UUID.randomUUID().toString();
_nodeObserverIdentity.category = category;
-
+
ApplicationObserverI applicationObserverServant = new ApplicationObserverI(
_admin.ice_getIdentity().category, _coordinator);
-
- ApplicationObserverPrx applicationObserver =
+
+ ApplicationObserverPrx applicationObserver =
ApplicationObserverPrxHelper.uncheckedCast(
_adapter.add(
applicationObserverServant, _applicationObserverIdentity));
- AdapterObserverPrx adapterObserver =
+ AdapterObserverPrx adapterObserver =
AdapterObserverPrxHelper.uncheckedCast(
_adapter.add(
new AdapterObserverI(_coordinator), _adapterObserverIdentity));
- ObjectObserverPrx objectObserver =
+ ObjectObserverPrx objectObserver =
ObjectObserverPrxHelper.uncheckedCast(
_adapter.add(
new ObjectObserverI(_coordinator), _objectObserverIdentity));
-
+
RegistryObserverPrx registryObserver =
RegistryObserverPrxHelper.uncheckedCast(
_adapter.add(
new RegistryObserverI(_coordinator), _registryObserverIdentity));
-
+
NodeObserverPrx nodeObserver =
NodeObserverPrxHelper.uncheckedCast(
_adapter.add(
@@ -327,17 +325,17 @@ class SessionKeeper
{
if(routed)
{
- _session.setObservers(registryObserver,
- nodeObserver,
- applicationObserver,
- adapterObserver,
- objectObserver);
+ _session.setObservers(registryObserver,
+ nodeObserver,
+ applicationObserver,
+ adapterObserver,
+ objectObserver);
}
else
{
_session.setObserversByIdentity(
_registryObserverIdentity,
- _nodeObserverIdentity,
+ _nodeObserverIdentity,
_applicationObserverIdentity,
_adapterObserverIdentity,
_objectObserverIdentity);
@@ -347,15 +345,14 @@ class SessionKeeper
{
assert false; // We use UUIDs for the observer identities.
}
-
+
applicationObserverServant.waitForInit();
}
-
private final AdminSessionPrx _session;
-
+
private Pinger _thread;
-
+
private Ice.ObjectAdapter _adapter;
private AdminPrx _admin;
private String _serverAdminCategory;
@@ -368,7 +365,6 @@ class SessionKeeper
private Ice.Identity _nodeObserverIdentity = new Ice.Identity();
}
-
static public class LoginInfo
{
LoginInfo(Preferences connectionPrefs, Coordinator coordinator)
@@ -396,25 +392,22 @@ class SessionKeeper
//
registryInstanceName = defaultLocatorProxy.ice_getIdentity().category;
registryEndpoints = "";
- Ice.Endpoint[] endpoints = defaultLocatorProxy.ice_getEndpoints();
- for(int i = 0; i < endpoints.length; ++i)
+ for(Ice.Endpoint endpoint : defaultLocatorProxy.ice_getEndpoints())
{
- if(i > 0)
+ if(registryEndpoints.length() > 0)
{
registryEndpoints += ":";
}
- registryEndpoints += endpoints[i].toString();
+ registryEndpoints += endpoint.toString();
}
}
else
{
- registryInstanceName =
- _connectionPrefs.get("registry.instanceName", registryInstanceName);
- registryEndpoints =
- _connectionPrefs.get("registry.endpoints", registryEndpoints);
+ registryInstanceName = _connectionPrefs.get("registry.instanceName", registryInstanceName);
+ registryEndpoints = _connectionPrefs.get("registry.endpoints", registryEndpoints);
}
connectToMaster = _connectionPrefs.getBoolean("registry.connectToMaster", connectToMaster);
-
+
//
// Glacier2 properties
//
@@ -434,14 +427,13 @@ class SessionKeeper
//
routerInstanceName = defaultRouterProxy.ice_getIdentity().category;
routerEndpoints = "";
- Ice.Endpoint[] endpoints = defaultRouterProxy.ice_getEndpoints();
- for(int i = 0; i < endpoints.length; ++i)
+ for(Ice.Endpoint endpoint : defaultRouterProxy.ice_getEndpoints())
{
- if(i > 0)
+ if(routerEndpoints.length() > 0)
{
routerEndpoints += ":";
}
- routerEndpoints += endpoints[i].toString();
+ routerEndpoints += endpoint.toString();
}
}
else
@@ -457,12 +449,13 @@ class SessionKeeper
registryUsername = _connectionPrefs.get("registry.username", registryUsername);
registryUsername = properties.getPropertyWithDefault("IceGridAdmin.Username", registryUsername);
registryPassword = properties.getProperty("IceGridAdmin.Password").toCharArray();
-
+
registryUseSSL = _connectionPrefs.getBoolean("registry.useSSL", registryUseSSL);
registryUseSSL = properties.getPropertyAsIntWithDefault("IceGridAdmin.AuthenticateUsingSSL",
registryUseSSL ? 1 : 0) > 0;
- registrySSLEnabled = registryUseSSL || _connectionPrefs.getBoolean("registry.sslEnabled", registrySSLEnabled);
+ registrySSLEnabled = registryUseSSL ||
+ _connectionPrefs.getBoolean("registry.sslEnabled", registrySSLEnabled);
routerUsername = _connectionPrefs.get("router.username", routerUsername);
routerUsername = properties.getPropertyWithDefault("IceGridAdmin.Username", routerUsername);
@@ -481,9 +474,8 @@ class SessionKeeper
//
final File defaultDir = new File(properties.getProperty("IceSSL.DefaultDir")).getAbsoluteFile();
-
- keystore = properties.getPropertyWithDefault("IceSSL.Keystore",
- _connectionPrefs.get("keystore", keystore));
+
+ keystore = properties.getPropertyWithDefault("IceSSL.Keystore", _connectionPrefs.get("keystore", keystore));
if(keystore != null && keystore.length() > 0)
{
@@ -499,21 +491,22 @@ class SessionKeeper
keyPassword = prop.toCharArray();
}
- prop = properties.getPropertyWithDefault("IceSSL.KeystorePassword", System.getProperty("java.net.ssl.keyStorePassword"));
+ prop = properties.getPropertyWithDefault("IceSSL.KeystorePassword",
+ System.getProperty("java.net.ssl.keyStorePassword"));
if(prop != null && prop.length() > 0)
{
keystorePassword = prop.toCharArray();
}
-
- prop = properties.getPropertyWithDefault("IceSSL.TruststorePassword", System.getProperty("java.net.ssl.trustStorePassword"));
+
+ prop = properties.getPropertyWithDefault("IceSSL.TruststorePassword",
+ System.getProperty("java.net.ssl.trustStorePassword"));
if(prop != null && prop.length() > 0)
{
truststorePassword = prop.toCharArray();
}
- alias = properties.getPropertyWithDefault("IceSSL.Alias",
- _connectionPrefs.get("alias", ""));
+ alias = properties.getPropertyWithDefault("IceSSL.Alias", _connectionPrefs.get("alias", ""));
truststore = properties.getPropertyWithDefault("IceSSL.Truststore",
_connectionPrefs.get("truststore", truststore));
@@ -594,12 +587,13 @@ class SessionKeeper
super(_coordinator.getMainFrame(), "Login - IceGrid Admin", true);
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
- final File defaultDir = new File(_coordinator.getProperties().getProperty("IceSSL.DefaultDir")).getAbsoluteFile();
+ final File defaultDir =
+ new File(_coordinator.getProperties().getProperty("IceSSL.DefaultDir")).getAbsoluteFile();
- _keystoreType =
- _coordinator.getProperties().getPropertyWithDefault("IceSSL.KeystoreType",
+ _keystoreType =
+ _coordinator.getProperties().getPropertyWithDefault("IceSSL.KeystoreType",
java.security.KeyStore.getDefaultType());
-
+
JButton okButton = new JButton("OK");
ActionListener okListener = new ActionListener()
{
@@ -619,7 +613,7 @@ class SessionKeeper
};
okButton.addActionListener(okListener);
getRootPane().setDefaultButton(okButton);
-
+
JButton cancelButton = new JButton("Cancel");
ActionListener cancelListener = new ActionListener()
{
@@ -632,17 +626,16 @@ class SessionKeeper
Action registryUseSSL = new AbstractAction("Use SSL for authentication")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
selectRegistryUseSSL(_registryUseSSL.isSelected());
}
};
_registryUseSSL = new JCheckBox(registryUseSSL);
-
Action routerUseSSL = new AbstractAction("Use SSL for authentication")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
selectRouterUseSSL(_routerUseSSL.isSelected());
}
@@ -651,28 +644,27 @@ class SessionKeeper
Action registrySSLEnabled = new AbstractAction("Enable IceSSL")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
selectRegistrySSLEnabled(_registrySSLEnabled.isSelected());
}
};
_registrySSLEnabled = new JCheckBox(registrySSLEnabled);
-
+
Action routerSSLEnabled = new AbstractAction("Enable IceSSL")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
selectRouterSSLEnabled(_routerSSLEnabled.isSelected());
}
};
_routerSSLEnabled = new JCheckBox(routerSSLEnabled);
-
_keystore.setEditable(true);
_advancedKeystore.setEditable(true);
Action chooseKeystore = new AbstractAction("...")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
String store = _keystore.getText();
if(store == null || store.length() == 0)
@@ -700,13 +692,13 @@ class SessionKeeper
updateAlias(file, _alias.getSelectedItem());
}
}
- private JFileChooser _fileChooser = new JFileChooser();
+ private JFileChooser _fileChooser = new JFileChooser();
};
_truststore.setEditable(true);
Action chooseTruststore = new AbstractAction("...")
{
- public void actionPerformed(ActionEvent e)
+ public void actionPerformed(ActionEvent e)
{
String store = _truststore.getText();
if(store == null || store.length() == 0)
@@ -734,17 +726,16 @@ class SessionKeeper
}
}
- private JFileChooser _fileChooser = new JFileChooser();
+ private JFileChooser _fileChooser = new JFileChooser();
};
-
_registryUsername.setToolTipText("Your username");
_registryPassword.setToolTipText("Your password in this IceGrid registry");
_registryUseSSL.setToolTipText("Do you want to use SSL instead of username/password for authentication?");
_registryInstanceName.setToolTipText("The instance name of your IceGrid registry. For example: DemoIceGrid");
_registryEndpoints.setToolTipText("<html>Corresponds to the client endpoints of this IceGrid registry.<br>"
+ "For example: tcp -h registry.domain.com -p 12000</html>");
-
+
_routerUsername.setToolTipText("Your username");
_routerPassword.setToolTipText("Your password in this Glacier2 router");
_routerUseSSL.setToolTipText("Do you want to use SSL instead of username/password for authentication?");
@@ -759,20 +750,19 @@ class SessionKeeper
_keystorePassword.setToolTipText("Password used to check the integrity of the keystore");
_alias.setToolTipText("Use this alias when authenticating IceGrid Admin with the IceGrid registry or Glacier2 router");
-
+
_truststore.setToolTipText("SSL truststore file");
_truststorePassword.setToolTipText("Password used to check the integrity of the truststore");
-
JPanel directPanel = null;
{
FormLayout layout = new FormLayout("right:pref, 3dlu, pref", "");
-
+
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.setDefaultDialogBorder();
builder.setRowGroupingEnabled(true);
builder.setLineGapSize(LayoutStyle.getCurrent().getLinePad());
-
+
_registryUsernameLabel = builder.append("Username", _registryUsername);
builder.nextLine();
_registryPasswordLabel = builder.append("Password", _registryPassword);
@@ -787,20 +777,19 @@ class SessionKeeper
builder.nextLine();
builder.append("", _connectToMaster);
builder.nextLine();
-
+
directPanel = builder.getPanel();
}
-
JPanel routedPanel = null;
{
FormLayout layout = new FormLayout("right:pref, 3dlu, pref", "");
-
+
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.setDefaultDialogBorder();
builder.setRowGroupingEnabled(true);
builder.setLineGapSize(LayoutStyle.getCurrent().getLinePad());
-
+
_routerUsernameLabel = builder.append("Username", _routerUsername);
builder.nextLine();
_routerPasswordLabel = builder.append("Password", _routerPassword);
@@ -813,10 +802,10 @@ class SessionKeeper
builder.nextLine();
builder.append("Glacier2 Router Endpoint(s)", _routerEndpoints);
builder.nextLine();
-
+
routedPanel = builder.getPanel();
}
-
+
_mainPane.addTab("Direct", null, directPanel, "Log directly into the IceGrid registry");
_mainPane.addTab("Routed", null, routedPanel, "Log into the IceGrid registry through a Glacier2 router");
_mainPane.setBorder(Borders.DIALOG_BORDER);
@@ -831,16 +820,15 @@ class SessionKeeper
}
else
{
- routedTabSelected();
+ routedTabSelected();
}
}
});
JPanel basicSSLPanel = null;
{
- FormLayout layout = new FormLayout(
- "right:pref, 3dlu, fill:pref:grow, 3dlu, pref", "");
-
+ FormLayout layout = new FormLayout("right:pref, 3dlu, fill:pref:grow, 3dlu, pref", "");
+
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.setDefaultDialogBorder();
builder.setRowGroupingEnabled(true);
@@ -853,20 +841,19 @@ class SessionKeeper
builder.append("Key Password");
builder.append(_keyPassword, 3);
builder.nextLine();
-
+
basicSSLPanel = builder.getPanel();
}
-
+
JPanel advancedSSLPanel = null;
{
- FormLayout layout = new FormLayout(
- "right:pref, 3dlu, fill:pref:grow, 3dlu, pref", "");
-
+ FormLayout layout = new FormLayout("right:pref, 3dlu, fill:pref:grow, 3dlu, pref", "");
+
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.setDefaultDialogBorder();
builder.setRowGroupingEnabled(true);
builder.setLineGapSize(LayoutStyle.getCurrent().getLinePad());
-
+
builder.appendSeparator("Keystore");
builder.append("File", _advancedKeystore);
builder.append(new JButton(chooseKeystore));
@@ -880,7 +867,7 @@ class SessionKeeper
builder.append("Alias");
builder.append(_alias, 3);
builder.nextLine();
-
+
builder.appendSeparator("Truststore");
builder.append("File", _truststore);
builder.append(new JButton(chooseTruststore));;
@@ -888,21 +875,18 @@ class SessionKeeper
builder.append("Integrity Password");
builder.append(_truststorePassword, 3);
builder.nextLine();
-
+
advancedSSLPanel = builder.getPanel();
}
-
_sslPane.addTab("Basic", basicSSLPanel);
_sslPane.addTab("Advanced", advancedSSLPanel);
- TitledBorder titledBorder = BorderFactory.createTitledBorder(Borders.DIALOG_BORDER,
- "SSL Configuration");
+ TitledBorder titledBorder = BorderFactory.createTitledBorder(Borders.DIALOG_BORDER, "SSL Configuration");
_sslPane.setBorder(titledBorder);
- JComponent buttonBar =
- ButtonBarFactory.buildOKCancelBar(okButton, cancelButton);
+ JComponent buttonBar = ButtonBarFactory.buildOKCancelBar(okButton, cancelButton);
buttonBar.setBorder(Borders.DIALOG_BORDER);
-
+
Container contentPane = getContentPane();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
contentPane.add(_mainPane);
@@ -912,7 +896,7 @@ class SessionKeeper
pack();
setResizable(false);
}
-
+
void showDialog()
{
if(isVisible() == false)
@@ -932,11 +916,11 @@ class SessionKeeper
_routerUsername.setText(_loginInfo.routerUsername);
_routerPassword.setText(new String(_loginInfo.routerPassword));
selectRouterUseSSL(_loginInfo.routerUseSSL);
-
+
_routerInstanceName.setText(_loginInfo.routerInstanceName);
_routerEndpoints.setText(_loginInfo.routerEndpoints);
_routerSSLEnabled.setSelected(_loginInfo.routerSSLEnabled);
-
+
_keystore.setText(_loginInfo.keystore);
if(_loginInfo.keystore == null)
{
@@ -946,7 +930,7 @@ class SessionKeeper
{
updateAlias(new File(_loginInfo.keystore), _loginInfo.alias);
}
-
+
if(_loginInfo.keyPassword != null)
{
_keyPassword.setText(new String(_loginInfo.keyPassword));
@@ -975,12 +959,12 @@ class SessionKeeper
setLocationRelativeTo(_coordinator.getMainFrame());
setVisible(true);
}
-
+
//
// Otherwise it was already on the screen!
//
}
-
+
private void writeInfo()
{
_loginInfo.routed = (_mainPane.getSelectedIndex() == 1);
@@ -992,7 +976,7 @@ class SessionKeeper
_loginInfo.registryInstanceName = _registryInstanceName.getText();
_loginInfo.registryEndpoints = _registryEndpoints.getText();
_loginInfo.connectToMaster = _connectToMaster.isSelected();
-
+
_loginInfo.routerUsername = _routerUsername.getText();
_loginInfo.routerPassword = _routerPassword.getPassword();
_loginInfo.routerUseSSL = _routerUseSSL.isSelected();
@@ -1000,10 +984,12 @@ class SessionKeeper
_loginInfo.routerInstanceName = _routerInstanceName.getText();
_loginInfo.routerEndpoints = _routerEndpoints.getText();
- final File defaultDir = new File(_coordinator.getProperties().getProperty("IceSSL.DefaultDir")).getAbsoluteFile();
+ final File defaultDir =
+ new File(_coordinator.getProperties().getProperty("IceSSL.DefaultDir")).getAbsoluteFile();
_loginInfo.keystore = _keystore.getText();
- if(_loginInfo.keystore != null && _loginInfo.keystore.length() > 0 && new File(_loginInfo.keystore).isAbsolute() == false)
+ if(_loginInfo.keystore != null && _loginInfo.keystore.length() > 0 &&
+ new File(_loginInfo.keystore).isAbsolute() == false)
{
_loginInfo.keystore = new File(defaultDir, _loginInfo.keystore).getAbsolutePath();
}
@@ -1019,7 +1005,8 @@ class SessionKeeper
_loginInfo.alias = _alias.getSelectedItem().toString();
}
_loginInfo.truststore = _truststore.getText();
- if(_loginInfo.truststore != null && _loginInfo.truststore.length() > 0 && new File(_loginInfo.truststore).isAbsolute() == false)
+ if(_loginInfo.truststore != null && _loginInfo.truststore.length() > 0 &&
+ new File(_loginInfo.truststore).isAbsolute() == false)
{
_loginInfo.truststore = new File(defaultDir, _loginInfo.truststore).getAbsolutePath();
}
@@ -1041,13 +1028,13 @@ class SessionKeeper
return;
}
- java.util.Vector aliasVector = new java.util.Vector();
+ java.util.Vector<String> aliasVector = new java.util.Vector<String>();
try
{
KeyStore ks = KeyStore.getInstance(_keystoreType);
ks.load(is, null);
- java.util.Enumeration p = ks.aliases();
+ java.util.Enumeration<String> p = ks.aliases();
while(p.hasMoreElements())
{
aliasVector.add(p.nextElement());
@@ -1091,13 +1078,13 @@ class SessionKeeper
_registryUsernameLabel.setEnabled(!selected);
_registryPassword.setEnabled(!selected);
_registryPasswordLabel.setEnabled(!selected);
-
+
if(selected && _registrySSLEnabled.isSelected() == false)
{
selectRegistrySSLEnabled(selected);
}
}
-
+
private void selectRouterUseSSL(boolean selected)
{
_routerUseSSL.setSelected(selected);
@@ -1105,13 +1092,13 @@ class SessionKeeper
_routerUsernameLabel.setEnabled(!selected);
_routerPassword.setEnabled(!selected);
_routerPasswordLabel.setEnabled(!selected);
-
+
if(selected && _routerSSLEnabled.isSelected() == false)
{
selectRouterSSLEnabled(selected);
}
}
-
+
private void selectRegistrySSLEnabled(boolean selected)
{
_registrySSLEnabled.setSelected(selected);
@@ -1180,11 +1167,9 @@ class SessionKeeper
private JTextField _keystore = new JTextField(30);
private JPasswordField _keyPassword = new JPasswordField(30);
- private JTextField _advancedKeystore = new JTextField(
- _keystore.getDocument(), null, 30);
- private JPasswordField _advancedKeyPassword = new JPasswordField(
- _keyPassword.getDocument(), null, 30);
-
+ private JTextField _advancedKeystore = new JTextField(_keystore.getDocument(), null, 30);
+ private JPasswordField _advancedKeyPassword = new JPasswordField(_keyPassword.getDocument(), null, 30);
+
private JPasswordField _keystorePassword = new JPasswordField(30);
private JComboBox _alias = new JComboBox();
@@ -1194,7 +1179,6 @@ class SessionKeeper
private String _keystoreType;
}
-
//
// We create a brand new Pinger thread for each session
//
@@ -1206,7 +1190,7 @@ class SessionKeeper
_session = session;
_period = period;
-
+
if(_period <= 0)
{
_period = 5000;
@@ -1237,21 +1221,21 @@ class SessionKeeper
done = _done;
_done = true;
}
-
+
if(!done)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
- public void run()
+ public void run()
{
- sessionLost("Failed to contact the IceGrid registry: "
+ sessionLost("Failed to contact the IceGrid registry: "
+ e.toString());
}
});
}
}
}
-
+
synchronized(this)
{
if(!_done)
@@ -1269,7 +1253,7 @@ class SessionKeeper
}
} while(!done);
}
-
+
public synchronized void done()
{
if(!_done)
@@ -1278,13 +1262,11 @@ class SessionKeeper
notify();
}
}
-
+
private AdminSessionPrx _session;
private long _period;
private boolean _done = false;
- }
-
-
+ }
SessionKeeper(Coordinator coordinator)
{
@@ -1301,7 +1283,7 @@ class SessionKeeper
_loginInfo = new LoginInfo(_loginPrefs, _coordinator);
_loginDialog.showDialog();
}
-
+
void relog(boolean showDialog)
{
if(_loginInfo == null)
@@ -1324,14 +1306,14 @@ class SessionKeeper
logout(true);
}
assert _session == null;
-
+
Cursor oldCursor = parent.getCursor();
try
{
parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-
+
Ice.LongHolder keepAlivePeriodHolder = new Ice.LongHolder();
-
+
AdminSessionPrx session = _coordinator.login(_loginInfo, parent, keepAlivePeriodHolder);
if(session == null)
{
@@ -1353,7 +1335,7 @@ class SessionKeeper
}
_coordinator.getStatusBar().setConnected(true);
-
+
_connectedToMaster = _replicaName.equals("Master");
if(_connectedToMaster)
{
@@ -1363,7 +1345,7 @@ class SessionKeeper
{
_coordinator.getStatusBar().setText("Logged into Slave Registry '" + _replicaName + "'");
}
-
+
try
{
_session = new Session(session, keepAlivePeriodHolder.value, _loginInfo.routed, parent);
@@ -1388,7 +1370,7 @@ class SessionKeeper
message,
"Session lost",
JOptionPane.ERROR_MESSAGE);
-
+
logout(false);
}
@@ -1400,12 +1382,12 @@ class SessionKeeper
_session = null;
}
}
-
+
AdminSessionPrx getSession()
{
return _session == null ? null : _session.getSession();
}
-
+
AdminPrx getAdmin()
{
return _session == null ? null : _session.getAdmin();
@@ -1420,13 +1402,12 @@ class SessionKeeper
{
return _session == null ? null : _session.addCallback(servant, name, facet);
}
-
+
Ice.ObjectPrx retrieveCallback(String name, String facet)
{
return _session == null ? null : _session.retrieveCallback(name, facet);
}
-
Ice.Object removeCallback(String name, String facet)
{
return _session == null ? null : _session.removeCallback(name, facet);
@@ -1446,13 +1427,13 @@ class SessionKeeper
{
return _replicaName;
}
-
+
private LoginDialog _loginDialog;
private LoginInfo _loginInfo;
private final Coordinator _coordinator;
private Preferences _loginPrefs;
-
+
private Session _session;
private boolean _connectedToMaster = false;
private String _replicaName = "";
diff --git a/java/src/IceGridGUI/SimpleInternalFrame.java b/java/src/IceGridGUI/SimpleInternalFrame.java
index cdda5cc2a1c..ee0331eadaf 100644
--- a/java/src/IceGridGUI/SimpleInternalFrame.java
+++ b/java/src/IceGridGUI/SimpleInternalFrame.java
@@ -1,31 +1,31 @@
/*
* Copyright (c) 2000-2005 JGoodies Karsten Lentzsch. All Rights Reserved.
*
- * Redistribution and use in source and binary forms, with or without
+ * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- *
- * o Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * o Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * o Neither the name of JGoodies Karsten Lentzsch nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * o Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * o Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * o Neither the name of JGoodies Karsten Lentzsch nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package IceGridGUI;
@@ -37,28 +37,28 @@ import javax.swing.border.AbstractBorder;
import com.jgoodies.looks.LookUtils;
-/**
- * A <code>JPanel</code> subclass that has a drop shadow border and
+/**
+ * A <code>JPanel</code> subclass that has a drop shadow border and
* that provides a header with icon, title and tool bar.<p>
- *
+ *
* This class can be used to replace the <code>JInternalFrame</code>,
- * for use outside of a <code>JDesktopPane</code>.
+ * for use outside of a <code>JDesktopPane</code>.
* The <code>SimpleInternalFrame</code> is less flexible but often
- * more usable; it avoids overlapping windows and scales well
+ * more usable; it avoids overlapping windows and scales well
* up to IDE size.
- * Several customers have reported that they and their clients feel
+ * Several customers have reported that they and their clients feel
* much better with both the appearance and the UI feel.<p>
- *
+ *
* The SimpleInternalFrame provides the following bound properties:
* <i>frameIcon, title, toolBar, content, selected.</i><p>
- *
+ *
* By default the SimpleInternalFrame is in <i>selected</i> state.
* If you don't do anything, multiple simple internal frames will
* be displayed as selected.
- *
+ *
* @author Karsten Lentzsch
* @version $Revision: 1.2 $
- *
+ *
* @see javax.swing.JInternalFrame
* @see javax.swing.JDesktopPane
*/
@@ -69,26 +69,26 @@ public class SimpleInternalFrame extends JPanel {
private GradientPanel gradientPanel;
private JPanel headerPanel;
private boolean selected;
-
-
+
+
// Instance Creation ****************************************************
/**
* Constructs a SimpleInternalFrame with the specified title.
* The title is intended to be non-blank, or in other words
* should contain non-space characters.
- *
+ *
* @param title the initial title
*/
public SimpleInternalFrame(String title) {
this(null, title, null, null);
}
-
-
+
+
/**
- * Constructs a SimpleInternalFrame with the specified
+ * Constructs a SimpleInternalFrame with the specified
* icon, and title.
- *
+ *
* @param icon the initial icon
* @param title the initial title
*/
@@ -96,11 +96,11 @@ public class SimpleInternalFrame extends JPanel {
this(icon, title, null, null);
}
-
+
/**
- * Constructs a SimpleInternalFrame with the specified
+ * Constructs a SimpleInternalFrame with the specified
* title, tool bar, and content panel.
- *
+ *
* @param title the initial title
* @param bar the initial tool bar
* @param content the initial content pane
@@ -108,12 +108,12 @@ public class SimpleInternalFrame extends JPanel {
public SimpleInternalFrame(String title, JToolBar bar, JComponent content) {
this(null, title, bar, content);
}
-
+
/**
- * Constructs a SimpleInternalFrame with the specified
+ * Constructs a SimpleInternalFrame with the specified
* icon, title, tool bar, and content panel.
- *
+ *
* @param icon the initial icon
* @param title the initial title
* @param bar the initial tool bar
@@ -138,22 +138,22 @@ public class SimpleInternalFrame extends JPanel {
updateHeader();
}
-
+
// Public API ***********************************************************
/**
* Returns the frame's icon.
- *
+ *
* @return the frame's icon
*/
public Icon getFrameIcon() {
return titleLabel.getIcon();
}
-
+
/**
* Sets a new frame icon.
- *
+ *
* @param newIcon the icon to be set
*/
public void setFrameIcon(Icon newIcon) {
@@ -161,7 +161,7 @@ public class SimpleInternalFrame extends JPanel {
titleLabel.setIcon(newIcon);
firePropertyChange("frameIcon", oldIcon, newIcon);
}
-
+
/**
* Returns the frame's title text.
@@ -169,13 +169,13 @@ public class SimpleInternalFrame extends JPanel {
public String getTitle() {
return titleLabel.getText();
}
-
+
public JLabel getTitleLabel() {
return titleLabel;
}
-
+
/**
* Sets a new title text.
* * @param newText the title text tp be set */
@@ -184,11 +184,11 @@ public class SimpleInternalFrame extends JPanel {
titleLabel.setText(newText);
firePropertyChange("title", oldText, newText);
}
-
-
+
+
/**
* Returns the current toolbar, null if none has been set before.
- *
+ *
* @return the current toolbar - if any
*/
public JToolBar getToolBar() {
@@ -196,11 +196,11 @@ public class SimpleInternalFrame extends JPanel {
? (JToolBar) headerPanel.getComponent(1)
: null;
}
-
+
/**
* Sets a new tool bar in the header.
- *
+ *
* @param newToolBar the tool bar to be set in the header
*/
public void setToolBar(JToolBar newToolBar) {
@@ -219,15 +219,15 @@ public class SimpleInternalFrame extends JPanel {
firePropertyChange("toolBar", oldToolBar, newToolBar);
}
-
+
/**
* Returns the content - null, if none has been set.
* * @return the current content */
public Component getContent() {
return hasContent() ? getComponent(1) : null;
}
-
-
+
+
/**
* Sets a new panel content; replaces any existing content, if existing.
* * @param newContent the panel's new content */
@@ -239,28 +239,28 @@ public class SimpleInternalFrame extends JPanel {
add(newContent, BorderLayout.CENTER);
firePropertyChange("content", oldContent, newContent);
}
-
+
/**
* Answers if the panel is currently selected (or in other words active)
* or not. In the selected state, the header background will be
* rendered differently.
- *
- * @return boolean a boolean, where true means the frame is selected
- * (currently active) and false means it is not
+ *
+ * @return boolean a boolean, where true means the frame is selected
+ * (currently active) and false means it is not
*/
public boolean isSelected() {
return selected;
}
-
-
+
+
/**
* This panel draws its title bar differently if it is selected,
* which may be used to indicate to the user that this panel
* has the focus, or should get more attention than other
* simple internal frames.
*
- * @param newValue a boolean, where true means the frame is selected
+ * @param newValue a boolean, where true means the frame is selected
* (currently active) and false means it is not
*/
public void setSelected(boolean newValue) {
@@ -269,14 +269,14 @@ public class SimpleInternalFrame extends JPanel {
updateHeader();
firePropertyChange("selected", oldValue, newValue);
}
-
+
// Building *************************************************************
/**
* Creates and answers the header panel, that consists of:
* an icon, a title label, a tool bar, and a gradient background.
- *
+ *
* @param label the label to paint the icon and text
* @param bar the panel's tool bar
* @return the panel's built header area
@@ -290,7 +290,7 @@ public class SimpleInternalFrame extends JPanel {
gradientPanel.setBorder(BorderFactory.createEmptyBorder(3, 4, 3, 1));
headerPanel = new JPanel(new BorderLayout());
-
+
Dimension prefSize = new Dimension(0, 24);
Dimension maxSize = new Dimension(Short.MAX_VALUE, 24);
headerPanel.setMinimumSize(prefSize);
@@ -313,7 +313,7 @@ public class SimpleInternalFrame extends JPanel {
titleLabel.setForeground(getTextForeground(isSelected()));
headerPanel.repaint();
}
-
+
/**
* Updates the UI. In addition to the superclass behavior, we need
@@ -331,7 +331,7 @@ public class SimpleInternalFrame extends JPanel {
/**
* Checks and answers if the panel has a content component set.
- *
+ *
* @return true if the panel has a content, false if it's empty
*/
private boolean hasContent() {
@@ -341,7 +341,7 @@ public class SimpleInternalFrame extends JPanel {
* Determines and answers the header's text foreground color.
* Tries to lookup a special color from the L&amp;F.
* In case it is absent, it uses the standard internal frame forground.
- *
+ *
* @param isSelected true to lookup the active color, false for the inactive
* @return the color of the foreground text
*/
@@ -355,8 +355,8 @@ public class SimpleInternalFrame extends JPanel {
return c;
}
return UIManager.getColor(
- isSelected
- ? "InternalFrame.activeTitleForeground"
+ isSelected
+ ? "InternalFrame.activeTitleForeground"
: "Label.foreground");
}
@@ -365,7 +365,7 @@ public class SimpleInternalFrame extends JPanel {
* Determines and answers the header's background color.
* Tries to lookup a special color from the L&amp;F.
* In case it is absent, it uses the standard internal frame background.
- *
+ *
* @return the color of the header's background
*/
protected Color getHeaderBackground() {
@@ -392,7 +392,7 @@ public class SimpleInternalFrame extends JPanel {
public void paintBorder(Component c, Graphics g,
int x, int y, int w, int h) {
-
+
g.translate(x, y);
g.setColor(UIManager.getColor("controlLtHighlight"));
g.fillRect(0, 0, w, 1);
@@ -412,21 +412,21 @@ public class SimpleInternalFrame extends JPanel {
public void paintBorder(Component c, Graphics g,
int x, int y, int w, int h) {
-
+
Color shadow = UIManager.getColor("controlShadow");
if (shadow == null) {
shadow = Color.GRAY;
}
- Color lightShadow = new Color(shadow.getRed(),
- shadow.getGreen(),
- shadow.getBlue(),
+ Color lightShadow = new Color(shadow.getRed(),
+ shadow.getGreen(),
+ shadow.getBlue(),
170);
Color lighterShadow = new Color(shadow.getRed(),
shadow.getGreen(),
shadow.getBlue(),
70);
g.translate(x, y);
-
+
g.setColor(shadow);
g.fillRect(0, 0, w - 3, 1);
g.fillRect(0, 0, 1, h - 3);
@@ -451,7 +451,7 @@ public class SimpleInternalFrame extends JPanel {
// A panel with a horizontal gradient background.
private static class GradientPanel extends JPanel {
-
+
private GradientPanel(LayoutManager lm, Color background) {
super(lm);
setBackground(background);
diff --git a/java/src/IceGridGUI/StatusBar.java b/java/src/IceGridGUI/StatusBar.java
index 459cdbad6db..07e4469ceb6 100644
--- a/java/src/IceGridGUI/StatusBar.java
+++ b/java/src/IceGridGUI/StatusBar.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
public interface StatusBar
diff --git a/java/src/IceGridGUI/Tab.java b/java/src/IceGridGUI/Tab.java
index bb0cd0bfc45..af8cd86cc5c 100644
--- a/java/src/IceGridGUI/Tab.java
+++ b/java/src/IceGridGUI/Tab.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
public interface Tab
diff --git a/java/src/IceGridGUI/TreeNodeBase.java b/java/src/IceGridGUI/TreeNodeBase.java
index 3a191236683..a08110939fe 100644
--- a/java/src/IceGridGUI/TreeNodeBase.java
+++ b/java/src/IceGridGUI/TreeNodeBase.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import java.util.Enumeration;
@@ -18,10 +19,10 @@ import javax.swing.tree.TreeCellRenderer;
import javax.swing.JPopupMenu;
//
-// This class behaves like a leaf; derived class that represent non-leaf nodes must
+// This class behaves like a leaf; derived class that represent non-leaf nodes must
// override various methods.
//
-public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
+public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
{
public Coordinator getCoordinator()
{
@@ -43,17 +44,17 @@ public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
}
};
}
-
+
public boolean getAllowsChildren()
{
return false;
}
-
+
public javax.swing.tree.TreeNode getChildAt(int childIndex)
{
return null;
}
-
+
public int getChildCount()
{
return 0;
@@ -63,7 +64,7 @@ public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
{
return -1;
}
-
+
public javax.swing.tree.TreeNode getParent()
{
return _parent;
@@ -81,7 +82,7 @@ public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
boolean expanded,
boolean leaf,
int row,
- boolean hasFocus)
+ boolean hasFocus)
{
return null;
}
@@ -100,7 +101,7 @@ public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
{
return _id;
}
-
+
public TreePath getPath()
{
if(_parent == null)
@@ -113,10 +114,10 @@ public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
}
}
- public java.util.LinkedList getFullId()
+ public java.util.LinkedList<String> getFullId()
{
- java.util.LinkedList result = _parent == null ?
- new java.util.LinkedList() :
+ java.util.LinkedList<String> result = _parent == null ?
+ new java.util.LinkedList<String>() :
_parent.getFullId();
result.add(_id);
@@ -157,14 +158,16 @@ public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
//
// Helper functions
//
- protected boolean insertSortedChild(TreeNodeBase newChild, java.util.List children,
- DefaultTreeModel treeModel)
+ protected boolean insertSortedChild(TreeNodeBase newChild, java.util.List c, DefaultTreeModel treeModel)
{
+ @SuppressWarnings("unchecked")
+ java.util.List<TreeNodeBase> children = (java.util.List<TreeNodeBase>)c;
+
String id = newChild.getId();
int i;
for(i = 0; i < children.size(); ++i)
{
- String otherId = ((TreeNodeBase)children.get(i)).getId();
+ String otherId = children.get(i).getId();
int cmp = id.compareTo(otherId);
if(cmp == 0)
@@ -185,13 +188,16 @@ public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
return true;
}
- protected String insertSortedChildren(java.util.List newChildren,
- java.util.List intoChildren,
- DefaultTreeModel treeModel)
+ protected String insertSortedChildren(java.util.List nc, java.util.List ic, DefaultTreeModel treeModel)
{
- TreeNodeBase[] children = (TreeNodeBase[])newChildren.toArray(new TreeNodeBase[0]);
+ @SuppressWarnings("unchecked")
+ java.util.List<TreeNodeBase> newChildren = (java.util.List<TreeNodeBase>)nc;
+ @SuppressWarnings("unchecked")
+ java.util.List<TreeNodeBase> intoChildren = (java.util.List<TreeNodeBase>)ic;
+
+ TreeNodeBase[] children = newChildren.toArray(new TreeNodeBase[0]);
java.util.Arrays.sort(children, _childComparator);
-
+
int[] indices = new int[children.length];
int offset = -1;
@@ -201,12 +207,12 @@ public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
for(int j = 0; j < children.length; ++j)
{
String id = children[j].getId();
-
+
if(checkInsert)
{
- while(i < intoChildren.size())
+ while(i < intoChildren.size())
{
- TreeNodeBase existingChild = (TreeNodeBase)intoChildren.get(i);
+ TreeNodeBase existingChild = intoChildren.get(i);
int cmp = id.compareTo(existingChild.getId());
if(cmp == 0)
{
@@ -218,49 +224,51 @@ public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
}
i++;
}
-
+
if(i < intoChildren.size())
- {
+ {
// Insert here, and increment i (since children is sorted)
intoChildren.add(i, children[j]);
if(offset == -1)
{
- offset = getIndex((TreeNodeBase)intoChildren.get(0));
+ offset = getIndex(intoChildren.get(0));
}
indices[j] = offset + i;
- i++; continue; // for
+ i++;
+ continue; // for
}
else
{
checkInsert = false;
}
}
-
+
//
// Append
//
intoChildren.add(children[j]);
if(offset == -1)
{
- offset = getIndex((TreeNodeBase)intoChildren.get(0));
+ offset = getIndex(intoChildren.get(0));
}
indices[j] = offset + i;
i++;
}
-
+
if(treeModel != null)
{
treeModel.nodesWereInserted(this, indices);
}
-
+
return null;
}
- protected void removeSortedChildren(String[] childIds,
- java.util.List fromChildren,
- DefaultTreeModel treeModel)
+ protected void removeSortedChildren(String[] childIds, java.util.List fc, DefaultTreeModel treeModel)
{
+ @SuppressWarnings("unchecked")
+ java.util.List<TreeNodeBase> fromChildren = (java.util.List<TreeNodeBase>)fc;
+
if(childIds.length == 0)
{
return; // nothing to do
@@ -269,17 +277,17 @@ public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
String[] ids = (String[])childIds.clone();
java.util.Arrays.sort(ids);
-
+
Object[] childrenToRemove = new Object[ids.length];
int[] indices = new int[ids.length];
-
- int i = getIndex((TreeNodeBase)fromChildren.get(0));
+
+ int i = getIndex(fromChildren.get(0));
int j = 0;
- java.util.Iterator p = fromChildren.iterator();
+ java.util.Iterator<TreeNodeBase> p = fromChildren.iterator();
while(p.hasNext() && j < ids.length)
{
- TreeNodeBase child = (TreeNodeBase)p.next();
+ TreeNodeBase child = p.next();
if(ids[j].equals(child.getId()))
{
childrenToRemove[j] = child;
@@ -289,7 +297,7 @@ public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
}
++i;
}
-
+
//
// Should be all removed
//
@@ -301,16 +309,17 @@ public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
}
}
- protected void childrenChanged(java.util.List children, DefaultTreeModel treeModel)
+ protected void childrenChanged(java.util.List c, DefaultTreeModel treeModel)
{
- java.util.Iterator p = children.iterator();
- while(p.hasNext())
+ @SuppressWarnings("unchecked")
+ java.util.List<TreeNodeBase> children = (java.util.List<TreeNodeBase>)c;
+
+ for(TreeNodeBase child : children)
{
- TreeNodeBase child = (TreeNodeBase)p.next();
treeModel.nodeStructureChanged(child);
}
}
-
+
public int[] resize(int[] array, int size)
{
int[] result = new int[size];
@@ -318,12 +327,13 @@ public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
return result;
}
- protected TreeNodeBase find(String id, java.util.List inList)
+ protected TreeNodeBase find(String id, java.util.List il)
{
- java.util.Iterator p = inList.iterator();
- while(p.hasNext())
+ @SuppressWarnings("unchecked")
+ java.util.List<TreeNodeBase> inList = (java.util.List<TreeNodeBase>)il;
+
+ for(TreeNodeBase node : inList)
{
- TreeNodeBase node = (TreeNodeBase)p.next();
if(node.getId().equals(id))
{
return node;
@@ -335,13 +345,11 @@ public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
protected TreeNodeBase _parent;
protected String _id;
- protected java.util.Comparator _childComparator = new java.util.Comparator()
+ protected java.util.Comparator<TreeNodeBase> _childComparator = new java.util.Comparator<TreeNodeBase>()
{
- public int compare(Object o1, Object o2)
+ public int compare(TreeNodeBase o1, TreeNodeBase o2)
{
- TreeNodeBase child1 = (TreeNodeBase)o1;
- TreeNodeBase child2 = (TreeNodeBase)o2;
- return child1.getId().compareTo(child2.getId());
+ return o1.getId().compareTo(o2.getId());
}
};
}
diff --git a/java/src/IceGridGUI/Utils.java b/java/src/IceGridGUI/Utils.java
index 6b7582cb987..7a3a0659171 100644
--- a/java/src/IceGridGUI/Utils.java
+++ b/java/src/IceGridGUI/Utils.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import javax.swing.ImageIcon;
@@ -41,7 +42,7 @@ public class Utils
try
{
int firstDotPos = version.indexOf('.');
-
+
if(firstDotPos == -1)
{
result = -1;
@@ -54,7 +55,6 @@ public class Utils
return -1;
}
result *= 100;
-
int secondDotPos = version.indexOf('.', firstDotPos + 1);
if(secondDotPos == -1)
@@ -78,7 +78,6 @@ public class Utils
return result;
}
-
static public interface Stringifier
{
public String toString(Object obj);
@@ -87,7 +86,7 @@ public class Utils
//
// Stringify helpers
//
- static public String stringify(java.util.Collection col,
+ static public String stringify(java.util.Collection<?> col,
Stringifier stringifier,
String separator,
Ice.StringHolder toolTipHolder)
@@ -97,9 +96,9 @@ public class Utils
{
toolTipHolder.value = null;
}
-
- java.util.Iterator p = col.iterator();
-
+
+ java.util.Iterator<?> p = col.iterator();
+
boolean firstElement = true;
while(p.hasNext())
{
@@ -122,7 +121,7 @@ public class Utils
toolTipHolder.value += "<br>";
}
}
-
+
if(elt.length() == 0)
{
result += "\"\"";
@@ -149,15 +148,13 @@ public class Utils
{
toolTipHolder.value += "</html>";
}
-
- return result;
+
+ return result;
}
-
- static public String stringify(java.util.Collection col,
- String separator,
- Ice.StringHolder toolTipHolder)
+
+ static public String stringify(java.util.Collection<?> col, String separator, Ice.StringHolder toolTipHolder)
{
-
+
Stringifier stringifier = new Stringifier()
{
public String toString(Object obj)
@@ -169,14 +166,13 @@ public class Utils
}
- static public String stringify(String[] stringSeq, String separator,
- Ice.StringHolder toolTipHolder)
+ static public String stringify(String[] stringSeq, String separator, Ice.StringHolder toolTipHolder)
{
return stringify(java.util.Arrays.asList(stringSeq), separator, toolTipHolder);
}
- static public String stringify(java.util.Map stringMap,
+ static public String stringify(java.util.Map<String, String> stringMap,
final String pairSeparator,
String separator,
Ice.StringHolder toolTipHolder)
@@ -185,8 +181,9 @@ public class Utils
{
public String toString(Object obj)
{
- java.util.Map.Entry entry = (java.util.Map.Entry)obj;
- return (String)entry.getKey() + pairSeparator + (String)entry.getValue();
+ @SuppressWarnings("unchecked")
+ java.util.Map.Entry<String, String> entry = (java.util.Map.Entry<String, String>)obj;
+ return entry.getKey() + pairSeparator + entry.getValue();
}
};
@@ -198,16 +195,18 @@ public class Utils
//
// Application-level resolver
//
- public Resolver(java.util.Map variables)
+ @SuppressWarnings("unchecked")
+ public Resolver(java.util.Map<String, String> variables)
{
+ //@SuppressWarnings("unchecked") - unchecked conversion
this(new java.util.Map[]{variables});
}
-
- public Resolver(java.util.Map[] variables)
+
+ public Resolver(java.util.Map<String, String>[] variables)
{
_variables = variables;
- _predefinedVariables = new java.util.HashMap();
-
+ _predefinedVariables = new java.util.HashMap<String, String>();
+
_parameters = null;
_subResolver = this;
}
@@ -215,8 +214,8 @@ public class Utils
//
// Resolver for instance; in-parameters are not yet substituted
//
- public Resolver(Resolver parent, java.util.Map parameters,
- java.util.Map defaults)
+ public Resolver(Resolver parent, java.util.Map<String, String> parameters,
+ java.util.Map<String, String> defaults)
{
_variables = parent._variables;
@@ -226,14 +225,14 @@ public class Utils
//
reset(parent, parameters, defaults);
}
-
+
//
// Resolver for plain server or service
//
public Resolver(Resolver parent)
{
_variables = parent._variables;
- _predefinedVariables = new java.util.HashMap(parent._predefinedVariables);
+ _predefinedVariables = new java.util.HashMap<String, String>(parent._predefinedVariables);
_parameters = parent._parameters;
if(_parameters == null)
{
@@ -245,39 +244,38 @@ public class Utils
}
}
- private Resolver(java.util.Map[] variables,
- java.util.Map predefinedVariables)
+ private Resolver(java.util.Map<String, String>[] variables, java.util.Map<String, String> predefinedVariables)
{
_variables = variables;
_predefinedVariables = _predefinedVariables;
_parameters = null;
_subResolver = this;
- }
+ }
public String find(String name)
{
if(_parameters != null)
{
- Object obj = _parameters.get(name);
- if(obj != null)
+ String val = _parameters.get(name);
+ if(val != null)
{
- return (String)obj;
+ return val;
}
}
- Object obj = _predefinedVariables.get(name);
- if(obj != null)
+ String val = _predefinedVariables.get(name);
+ if(val != null)
{
- return (String)obj;
+ return val;
}
-
- for(int i = 0; i < _variables.length; ++i)
+
+ for(java.util.Map<String, String> map : _variables)
{
- obj = _variables[i].get(name);
- if(obj != null)
+ val = map.get(name);
+ if(val != null)
{
- return _subResolver.substitute((String)obj);
+ return _subResolver.substitute(val);
}
}
return null;
@@ -288,7 +286,7 @@ public class Utils
//
public boolean put(String name, String value)
{
- String oldVal = (String)_predefinedVariables.get(name);
+ String oldVal = _predefinedVariables.get(name);
if(oldVal == null || !oldVal.equals(value))
{
_predefinedVariables.put(name, value);
@@ -303,12 +301,12 @@ public class Utils
//
// Reset parameters and pre-defined variables
//
- public void reset(Resolver parent, java.util.Map parameters,
- java.util.Map defaults)
+ public void reset(Resolver parent, java.util.Map<String, String> parameters,
+ java.util.Map<String, String> defaults)
{
assert _variables == parent._variables;
- _predefinedVariables = new java.util.HashMap(parent._predefinedVariables);
-
+ _predefinedVariables = new java.util.HashMap<String, String>(parent._predefinedVariables);
+
_parameters = parent.substituteParameterValues(parameters, defaults);
_subResolver = new Resolver(_variables, _predefinedVariables);
}
@@ -316,8 +314,8 @@ public class Utils
public void reset(Resolver parent)
{
assert _variables == parent._variables;
- _predefinedVariables = new java.util.HashMap(parent._predefinedVariables);
-
+ _predefinedVariables = new java.util.HashMap<String, String>(parent._predefinedVariables);
+
assert _parameters == parent._parameters;
if(_parameters == null)
{
@@ -332,7 +330,7 @@ public class Utils
//
// The sorted substituted parameters
//
- public java.util.Map getParameters()
+ public java.util.Map<String, String> getParameters()
{
return _parameters;
}
@@ -346,7 +344,7 @@ public class Utils
int beg = 0;
int end = 0;
-
+
while((beg = input.indexOf("${", beg)) != -1)
{
if(beg > 0 && input.charAt(beg - 1) == '$')
@@ -356,7 +354,7 @@ public class Utils
{
--escape;
}
-
+
input = input.substring(0, escape) + input.substring(beg - (beg - escape) / 2);
if((beg - escape) % 2 != 0)
{
@@ -368,7 +366,7 @@ public class Utils
beg -= (beg - escape) / 2;
}
}
-
+
end = input.indexOf('}', beg);
if(end == -1)
{
@@ -377,13 +375,13 @@ public class Utils
//
return input;
}
-
+
String name = input.substring(beg + 2, end);
-
+
//
// Resolve name
//
- String val = find(name);
+ String val = find(name);
if(val != null)
{
input = input.substring(0, beg) + val + input.substring(end + 1);
@@ -391,7 +389,7 @@ public class Utils
}
else
{
- //
+ //
// No substitution, keep ${name} in the result
//
++beg;
@@ -403,36 +401,31 @@ public class Utils
//
// Substitute all the values from the input map
//
- public java.util.Map substituteParameterValues(java.util.Map input,
- java.util.Map defaults)
+ public java.util.Map<String, String> substituteParameterValues(java.util.Map<String, String> input,
+ java.util.Map<String, String> defaults)
{
- java.util.Map result = new java.util.HashMap();
- java.util.Iterator p = input.entrySet().iterator();
- while(p.hasNext())
+ java.util.Map<String, String> result = new java.util.HashMap<String, String>();
+ for(java.util.Map.Entry<String, String> p : input.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- result.put(entry.getKey(), substitute((String)entry.getValue()));
+ result.put(p.getKey(), substitute(p.getValue()));
}
- p = defaults.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, String> p : defaults.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- if(!result.containsKey(entry.getKey()))
+ if(!result.containsKey(p.getKey()))
{
- result.put(entry.getKey(), substitute((String)entry.getValue()));
+ result.put(p.getKey(), substitute(p.getValue()));
}
}
return result;
}
- private java.util.Map[] _variables;
- private java.util.Map _parameters;
- private java.util.Map _predefinedVariables;
+ private java.util.Map<String, String>[] _variables;
+ private java.util.Map<String, String> _parameters;
+ private java.util.Map<String, String> _predefinedVariables;
private Resolver _subResolver;
}
-
static public String substitute(String input, Resolver resolver)
{
if(resolver != null)
@@ -451,50 +444,40 @@ public class Utils
static public class ExpandedPropertySet
{
public ExpandedPropertySet[] references;
- public java.util.List properties; // list of PropertyDescriptor
+ public java.util.List<PropertyDescriptor> properties; // list of PropertyDescriptor
}
- static public java.util.SortedMap propertySetsToMap(
- java.util.List propertySets,
+ static public java.util.SortedMap<String, String> propertySetsToMap(
+ java.util.List<ExpandedPropertySet> propertySets,
Resolver resolver)
{
- java.util.SortedMap toMap = new java.util.TreeMap();
- java.util.Iterator p = propertySets.iterator();
- while(p.hasNext())
+ java.util.SortedMap<String, String> toMap = new java.util.TreeMap<String, String>();
+ for(ExpandedPropertySet p : propertySets)
{
- ExpandedPropertySet propertySet = (ExpandedPropertySet)p.next();
- addSet(propertySet, resolver, toMap);
+ addSet(p, resolver, toMap);
}
return toMap;
}
- static public java.util.SortedMap propertySetToMap(
- ExpandedPropertySet propertySet,
- Resolver resolver)
+ static public java.util.SortedMap<String, String>
+ propertySetToMap(ExpandedPropertySet propertySet, Resolver resolver)
{
- java.util.List list = new java.util.LinkedList();
+ java.util.List<ExpandedPropertySet> list = new java.util.LinkedList<ExpandedPropertySet>();
list.add(propertySet);
return propertySetsToMap(list, resolver);
}
- static private void addSet(ExpandedPropertySet set, Resolver resolver,
- java.util.SortedMap toMap)
+ static private void addSet(ExpandedPropertySet set, Resolver resolver, java.util.SortedMap<String, String> toMap)
{
- for(int i = 0; i < set.references.length; ++i)
+ for(ExpandedPropertySet s : set.references)
{
- addSet(set.references[i], resolver, toMap);
+ addSet(s, resolver, toMap);
}
-
- java.util.Iterator p = set.properties.iterator();
- while(p.hasNext())
+
+ for(PropertyDescriptor p : set.properties)
{
- PropertyDescriptor pd = (PropertyDescriptor)p.next();
- String name = (String)pd.name;
- String val = (String)pd.value;
-
- name = substitute(pd.name, resolver);
- val = substitute(pd.value, resolver);
-
+ String name = substitute(p.name, resolver);
+ String val = substitute(p.value, resolver);
toMap.put(name, val);
}
}
diff --git a/java/src/IceGridGUI/XMLWriter.java b/java/src/IceGridGUI/XMLWriter.java
index edbdf665120..a54737d79fe 100644
--- a/java/src/IceGridGUI/XMLWriter.java
+++ b/java/src/IceGridGUI/XMLWriter.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI;
import java.io.*;
@@ -19,8 +20,7 @@ public class XMLWriter
{
try
{
- _writer = new BufferedWriter(
- new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
+ _writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
}
catch(UnsupportedEncodingException e)
{
@@ -30,7 +30,7 @@ public class XMLWriter
_writer.write("<!-- This file was written by IceGrid Admin -->" + _newline);
}
- public void writeElement(String name, java.util.List attributes)
+ public void writeElement(String name, java.util.List<String[]> attributes)
throws IOException
{
_writer.write(_indent);
@@ -41,17 +41,16 @@ public class XMLWriter
public void writeElement(String name) throws IOException
{
- writeElement(name, (java.util.List)null);
+ writeElement(name, (java.util.List<String[]>)null);
}
public void writeElement(String name, String content) throws IOException
{
_writer.write(_indent);
- _writer.write("<" + name + ">" + escape(content) +
- "</" + name + ">" + _newline);
+ _writer.write("<" + name + ">" + escape(content) + "</" + name + ">" + _newline);
}
- public void writeStartTag(String name, java.util.List attributes)
+ public void writeStartTag(String name, java.util.List<String[]> attributes)
throws IOException
{
_writer.write(_indent);
@@ -62,12 +61,14 @@ public class XMLWriter
increaseIndent();
}
- public void writeStartTag(String name) throws IOException
+ public void writeStartTag(String name)
+ throws IOException
{
writeStartTag(name, null);
}
- public void writeEndTag(String name) throws IOException
+ public void writeEndTag(String name)
+ throws IOException
{
decreaseIndent();
_writer.write(_indent);
@@ -84,16 +85,14 @@ public class XMLWriter
_writer.flush();
}
- private void writeAttributes(java.util.List attributes)
+ private void writeAttributes(java.util.List<String[]> attributes)
throws IOException
{
if(attributes != null)
{
- java.util.Iterator p = attributes.iterator();
- while(p.hasNext())
+ for(String[] p : attributes)
{
- String[] pair = (String[])p.next();
- _writer.write(" " + pair[0] + "=\"" + escape(pair[1]) + "\"");
+ _writer.write(" " + p[0] + "=\"" + escape(p[1]) + "\"");
}
}
}
@@ -123,9 +122,9 @@ public class XMLWriter
final String allReserved = "<>'\"&";
boolean hasReserved = false;
char[] arr = input.toCharArray();
- for(int i = 0; i < arr.length; i++)
+ for(char c : arr)
{
- if(allReserved.indexOf(arr[i]) != -1)
+ if(allReserved.indexOf(c) != -1)
{
hasReserved = true;
break;
@@ -164,7 +163,6 @@ public class XMLWriter
return v;
}
-
private Writer _writer;
private String _indent = "";
private static String _newline = System.getProperty("line.separator");
diff --git a/java/src/IceInternal/BasicStream.java b/java/src/IceInternal/BasicStream.java
index 9be9e9e533c..5c52413df4a 100644
--- a/java/src/IceInternal/BasicStream.java
+++ b/java/src/IceInternal/BasicStream.java
@@ -832,9 +832,9 @@ public class BasicStream
{
writeSize(v.length);
expand(v.length);
- for(int i = 0; i < v.length; i++)
+ for(boolean b : v)
{
- _buf.b.put(v[i] ? (byte)1 : (byte)0);
+ _buf.b.put(b ? (byte)1 : (byte)0);
}
}
}
@@ -1272,9 +1272,9 @@ public class BasicStream
else
{
writeSize(v.length);
- for(int i = 0; i < v.length; i++)
+ for(String e : v)
{
- writeString(v[i]);
+ writeString(e);
}
}
}
@@ -1697,8 +1697,7 @@ public class BasicStream
java.util.IdentityHashMap<Ice.Object, Integer> savedMap =
new java.util.IdentityHashMap<Ice.Object, Integer>(_writeEncapsStack.toBeMarshaledMap);
writeSize(savedMap.size());
- java.util.Iterator<java.util.Map.Entry<Ice.Object, Integer> > p = savedMap.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<Ice.Object, Integer> p : savedMap.entrySet())
{
//
// Add an instance from the old to-be-marshaled
@@ -1707,9 +1706,8 @@ public class BasicStream
// instances that are triggered by the classes
// marshaled are added to toBeMarshaledMap.
//
- java.util.Map.Entry<Ice.Object, Integer> e = p.next();
- _writeEncapsStack.marshaledMap.put(e.getKey(), e.getValue());
- writeInstance(e.getKey(), e.getValue());
+ _writeEncapsStack.marshaledMap.put(p.getKey(), p.getValue());
+ writeInstance(p.getKey(), p.getValue());
}
//
@@ -1717,10 +1715,9 @@ public class BasicStream
// substract what we have marshaled from the
// toBeMarshaledMap.
//
- java.util.Iterator<Ice.Object> q = savedMap.keySet().iterator();
- while(q.hasNext())
+ for(Ice.Object p : savedMap.keySet())
{
- _writeEncapsStack.toBeMarshaledMap.remove(q.next());
+ _writeEncapsStack.toBeMarshaledMap.remove(p);
}
}
}
@@ -1758,10 +1755,8 @@ public class BasicStream
//
if(_objectList != null)
{
- java.util.Iterator<Ice.Object> e = _objectList.iterator();
- while(e.hasNext())
+ for(Ice.Object obj : _objectList)
{
- Ice.Object obj = e.next();
try
{
obj.ice_postUnmarshal();
@@ -1857,9 +1852,8 @@ public class BasicStream
//
// Patch all references that refer to the instance.
//
- for(java.util.Iterator<Patcher> i = patchlist.iterator(); i.hasNext(); )
+ for(Patcher p : patchlist)
{
- Patcher p = i.next();
try
{
p.patch(v);
diff --git a/java/src/IceInternal/ConnectRequestHandler.java b/java/src/IceInternal/ConnectRequestHandler.java
index 3604ac8b5b8..45295eb9158 100644
--- a/java/src/IceInternal/ConnectRequestHandler.java
+++ b/java/src/IceInternal/ConnectRequestHandler.java
@@ -522,10 +522,8 @@ public class ConnectRequestHandler
void
flushRequestsWithException(Ice.LocalException ex)
{
- java.util.Iterator<Request> p = _requests.iterator();
- while(p.hasNext())
+ for(Request request : _requests)
{
- Request request = p.next();
if(request.out != null)
{
request.out.__finished(ex);
@@ -541,10 +539,8 @@ public class ConnectRequestHandler
void
flushRequestsWithException(LocalExceptionWrapper ex)
{
- java.util.Iterator<Request> p = _requests.iterator();
- while(p.hasNext())
+ for(Request request : _requests)
{
- Request request = p.next();
if(request.out != null)
{
request.out.__finished(ex);
diff --git a/java/src/IceInternal/ConnectionMonitor.java b/java/src/IceInternal/ConnectionMonitor.java
index 1d66123c06e..654a5ca46d7 100644
--- a/java/src/IceInternal/ConnectionMonitor.java
+++ b/java/src/IceInternal/ConnectionMonitor.java
@@ -80,14 +80,11 @@ public final class ConnectionMonitor implements IceInternal.TimerTask
// monitoring.
//
long now = IceInternal.Time.currentMonotonicTimeMillis();
- java.util.Iterator<Ice.ConnectionI> iter = connections.iterator();
- while(iter.hasNext())
+ for(Ice.ConnectionI conn : connections)
{
- Ice.ConnectionI connection = iter.next();
-
try
{
- connection.monitor(now);
+ conn.monitor(now);
}
catch(Ice.LocalException ex)
{
diff --git a/java/src/IceInternal/EndpointHostResolver.java b/java/src/IceInternal/EndpointHostResolver.java
index db943a2d560..450097c556e 100644
--- a/java/src/IceInternal/EndpointHostResolver.java
+++ b/java/src/IceInternal/EndpointHostResolver.java
@@ -101,10 +101,9 @@ public class EndpointHostResolver
}
}
- java.util.Iterator<ResolveEntry> p = _queue.iterator();
- while(p.hasNext())
+ for(ResolveEntry p : _queue)
{
- p.next().callback.exception(new Ice.CommunicatorDestroyedException());
+ p.callback.exception(new Ice.CommunicatorDestroyedException());
}
_queue.clear();
}
diff --git a/java/src/IceInternal/Incoming.java b/java/src/IceInternal/Incoming.java
index 28dd812dbbd..3e2419d1cdc 100644
--- a/java/src/IceInternal/Incoming.java
+++ b/java/src/IceInternal/Incoming.java
@@ -93,7 +93,7 @@ final public class Incoming extends IncomingBase implements Ice.Request
}
_current.operation = _is.readString();
- _current.mode = Ice.OperationMode.convert(_is.readByte());
+ _current.mode = Ice.OperationMode.values()[_is.readByte()];
_current.ctx = new java.util.HashMap<String, String>();
int sz = _is.readSize();
while(sz-- > 0)
diff --git a/java/src/IceInternal/IncomingAsync.java b/java/src/IceInternal/IncomingAsync.java
index d18b37d0a37..3938d47f67d 100644
--- a/java/src/IceInternal/IncomingAsync.java
+++ b/java/src/IceInternal/IncomingAsync.java
@@ -117,10 +117,8 @@ public class IncomingAsync extends IncomingBase
{
if(_interceptorAsyncCallbackList != null)
{
- java.util.Iterator<Ice.DispatchInterceptorAsyncCallback> p = _interceptorAsyncCallbackList.iterator();
- while(p.hasNext())
+ for(Ice.DispatchInterceptorAsyncCallback cb : _interceptorAsyncCallbackList)
{
- Ice.DispatchInterceptorAsyncCallback cb = p.next();
if(cb.response(ok) == false)
{
return false;
@@ -163,10 +161,8 @@ public class IncomingAsync extends IncomingBase
{
if(_interceptorAsyncCallbackList != null)
{
- java.util.Iterator<Ice.DispatchInterceptorAsyncCallback> p = _interceptorAsyncCallbackList.iterator();
- while(p.hasNext())
+ for(Ice.DispatchInterceptorAsyncCallback cb : _interceptorAsyncCallbackList)
{
- Ice.DispatchInterceptorAsyncCallback cb = p.next();
if(cb.exception(exc) == false)
{
return false;
diff --git a/java/src/IceInternal/IncomingConnectionFactory.java b/java/src/IceInternal/IncomingConnectionFactory.java
index 83012ac9578..e83805776bf 100644
--- a/java/src/IceInternal/IncomingConnectionFactory.java
+++ b/java/src/IceInternal/IncomingConnectionFactory.java
@@ -158,13 +158,11 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice
public void
flushBatchRequests()
{
- java.util.Iterator<Ice.ConnectionI> p =
- connections().iterator(); // connections() is synchronized, no need to synchronize here.
- while(p.hasNext())
+ for(Ice.ConnectionI p : connections()) // connections() is synchronized, no need to synchronize here.
{
try
{
- p.next().flushBatchRequests();
+ p.flushBatchRequests();
}
catch(Ice.LocalException ex)
{
diff --git a/java/src/IceInternal/Instance.java b/java/src/IceInternal/Instance.java
index fb5950c8041..952869183cc 100644
--- a/java/src/IceInternal/Instance.java
+++ b/java/src/IceInternal/Instance.java
@@ -391,18 +391,15 @@ public final class Instance
// Add all facets to OA
//
java.util.Map<String, Ice.Object> filteredFacets = new java.util.HashMap<String, Ice.Object>();
- java.util.Iterator<java.util.Map.Entry<String, Ice.Object> > p = _adminFacets.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, Ice.Object> p : _adminFacets.entrySet())
{
- java.util.Map.Entry<String, Ice.Object> entry = p.next();
-
- if(_adminFacetFilter.isEmpty() || _adminFacetFilter.contains(entry.getKey()))
+ if(_adminFacetFilter.isEmpty() || _adminFacetFilter.contains(p.getKey()))
{
- _adminAdapter.addFacet(entry.getValue(), _adminIdentity, entry.getKey());
+ _adminAdapter.addFacet(p.getValue(), _adminIdentity, p.getKey());
}
else
{
- filteredFacets.put(entry.getKey(), entry.getValue());
+ filteredFacets.put(p.getKey(), p.getValue());
}
}
_adminFacets = filteredFacets;
@@ -1071,10 +1068,9 @@ public final class Instance
if(unusedProperties.size() != 0)
{
String message = "The following properties were set but never read:";
- java.util.Iterator<String> p = unusedProperties.iterator();
- while(p.hasNext())
+ for(String p : unusedProperties)
{
- message += "\n " + p.next();
+ message += "\n " + p;
}
_initData.logger.warning(message);
}
@@ -1086,12 +1082,10 @@ public final class Instance
{
final String prefix = "Ice.Package.";
java.util.Map<String, String> map = _initData.properties.getPropertiesForPrefix(prefix);
- java.util.Iterator<java.util.Map.Entry<String, String> > p = map.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, String> p : map.entrySet())
{
- java.util.Map.Entry<String, String> e = p.next();
- String key = e.getKey();
- String pkg = e.getValue();
+ String key = p.getKey();
+ String pkg = p.getValue();
if(key.length() == prefix.length())
{
_initData.logger.warning("ignoring invalid property: " + key + "=" + pkg);
diff --git a/java/src/IceInternal/LocatorManager.java b/java/src/IceInternal/LocatorManager.java
index 61e3a4b9512..a5e90f0437b 100644
--- a/java/src/IceInternal/LocatorManager.java
+++ b/java/src/IceInternal/LocatorManager.java
@@ -19,10 +19,8 @@ public final class LocatorManager
synchronized void
destroy()
{
- java.util.Iterator<LocatorInfo> i = _table.values().iterator();
- while(i.hasNext())
+ for(LocatorInfo info : _table.values())
{
- LocatorInfo info = i.next();
info.destroy();
}
_table.clear();
diff --git a/java/src/IceInternal/Network.java b/java/src/IceInternal/Network.java
index f93ef8b4264..4da8ddc89f3 100644
--- a/java/src/IceInternal/Network.java
+++ b/java/src/IceInternal/Network.java
@@ -36,9 +36,9 @@ public final class Network
"remote host refused an attempted connect operation" // ECONNREFUSED (AIX JDK 1.4.2)
};
- for(int i = 0; i < msgs.length; i++)
+ for(String m : msgs)
{
- if(msg.indexOf(msgs[i]) != -1)
+ if(msg.indexOf(m) != -1)
{
return true;
}
@@ -63,9 +63,9 @@ public final class Network
"too many open files in system" // ENFILE
};
- for(int i = 0; i < msgs.length; i++)
+ for(String m : msgs)
{
- if(msg.indexOf(msgs[i]) != -1)
+ if(msg.indexOf(m) != -1)
{
return true;
}
@@ -815,11 +815,11 @@ public final class Network
addrs = java.net.InetAddress.getAllByName(host);
}
- for(int i = 0; i < addrs.length; ++i)
+ for(java.net.InetAddress addr : addrs)
{
- if(protocol == EnableBoth || isValidAddr(addrs[i], protocol))
+ if(protocol == EnableBoth || isValidAddr(addr, protocol))
{
- addresses.add(new java.net.InetSocketAddress(addrs[i], port));
+ addresses.add(new java.net.InetSocketAddress(addr, port));
}
}
}
@@ -940,14 +940,12 @@ public final class Network
if(wildcard)
{
java.util.ArrayList<java.net.InetAddress> addrs = getLocalAddresses(protocolSupport);
- java.util.Iterator<java.net.InetAddress> p = addrs.iterator();
- while(p.hasNext())
+ for(java.net.InetAddress addr : addrs)
{
//
// NOTE: We don't publish link-local IPv6 addresses as these addresses can only
// be accessed in general with a scope-id.
//
- java.net.InetAddress addr = p.next();
if(!addr.isLinkLocalAddress())
{
hosts.add(addr.getHostAddress());
@@ -1175,11 +1173,11 @@ public final class Network
addrs = java.net.InetAddress.getAllByName(host);
}
- for(int i = 0; i < addrs.length; ++i)
+ for(java.net.InetAddress addr : addrs)
{
- if(protocol == EnableBoth || isValidAddr(addrs[i], protocol))
+ if(protocol == EnableBoth || isValidAddr(addr, protocol))
{
- return new java.net.InetSocketAddress(addrs[i], port);
+ return new java.net.InetSocketAddress(addr, port);
}
}
}
diff --git a/java/src/IceInternal/ObjectAdapterFactory.java b/java/src/IceInternal/ObjectAdapterFactory.java
index b357ea6eb6f..8d88340d0b0 100644
--- a/java/src/IceInternal/ObjectAdapterFactory.java
+++ b/java/src/IceInternal/ObjectAdapterFactory.java
@@ -40,10 +40,8 @@ public final class ObjectAdapterFactory
//
if(adapters != null)
{
- java.util.Iterator<Ice.ObjectAdapterI> i = adapters.values().iterator();
- while(i.hasNext())
+ for(Ice.ObjectAdapterI adapter : adapters.values())
{
- Ice.ObjectAdapter adapter = i.next();
adapter.deactivate();
}
}
@@ -92,10 +90,8 @@ public final class ObjectAdapterFactory
//
if(adapters != null)
{
- java.util.Iterator<Ice.ObjectAdapterI> i = adapters.values().iterator();
- while(i.hasNext())
+ for(Ice.ObjectAdapterI adapter : adapters.values())
{
- Ice.ObjectAdapter adapter = i.next();
adapter.waitForDeactivate();
}
}
@@ -142,10 +138,8 @@ public final class ObjectAdapterFactory
//
if(adapters != null)
{
- java.util.Iterator<Ice.ObjectAdapterI> i = adapters.values().iterator();
- while(i.hasNext())
+ for(Ice.ObjectAdapterI adapter : adapters.values())
{
- Ice.ObjectAdapter adapter = i.next();
adapter.destroy();
}
}
@@ -200,12 +194,10 @@ public final class ObjectAdapterFactory
adapters = new java.util.ArrayList<Ice.ObjectAdapterI>(_adapters.values());
}
- java.util.Iterator<Ice.ObjectAdapterI> p = adapters.iterator();
- while(p.hasNext())
+ for(Ice.ObjectAdapterI adapter : adapters)
{
try
{
- Ice.ObjectAdapterI adapter = p.next();
if(adapter.isLocal(proxy))
{
return adapter;
@@ -245,10 +237,9 @@ public final class ObjectAdapterFactory
adapters = new java.util.ArrayList<Ice.ObjectAdapterI>(_adapters.values());
}
- java.util.Iterator<Ice.ObjectAdapterI> p = adapters.iterator();
- while(p.hasNext())
+ for(Ice.ObjectAdapterI adapter : adapters)
{
- p.next().flushBatchRequests();
+ adapter.flushBatchRequests();
}
}
diff --git a/java/src/IceInternal/ObjectFactoryManager.java b/java/src/IceInternal/ObjectFactoryManager.java
index 1658816b588..c2cb3d7a7de 100644
--- a/java/src/IceInternal/ObjectFactoryManager.java
+++ b/java/src/IceInternal/ObjectFactoryManager.java
@@ -69,14 +69,11 @@ public final class ObjectFactoryManager
_factoryMap = new java.util.HashMap<String, Ice.ObjectFactory>();
}
- java.util.Iterator<Ice.ObjectFactory> i = oldMap.values().iterator();
- while(i.hasNext())
+ for(Ice.ObjectFactory factory : oldMap.values())
{
- Ice.ObjectFactory factory = i.next();
factory.destroy();
}
}
- private java.util.Map<String, Ice.ObjectFactory> _factoryMap =
- new java.util.HashMap<String, Ice.ObjectFactory>();
+ private java.util.Map<String, Ice.ObjectFactory> _factoryMap = new java.util.HashMap<String, Ice.ObjectFactory>();
}
diff --git a/java/src/IceInternal/Outgoing.java b/java/src/IceInternal/Outgoing.java
index 0b99e6701ed..6413b7ab884 100644
--- a/java/src/IceInternal/Outgoing.java
+++ b/java/src/IceInternal/Outgoing.java
@@ -490,7 +490,7 @@ public final class Outgoing implements OutgoingMessageCallback
_os.writeString(operation);
- _os.writeByte((byte)mode.value());
+ _os.writeByte((byte)mode.ordinal());
if(context != null)
{
diff --git a/java/src/IceInternal/OutgoingAsync.java b/java/src/IceInternal/OutgoingAsync.java
index 820e2b4f49c..490b15a73ee 100644
--- a/java/src/IceInternal/OutgoingAsync.java
+++ b/java/src/IceInternal/OutgoingAsync.java
@@ -350,7 +350,7 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback
__os.writeString(operation);
- __os.writeByte((byte)mode.value());
+ __os.writeByte((byte)mode.ordinal());
if(context != null)
{
diff --git a/java/src/IceInternal/OutgoingConnectionFactory.java b/java/src/IceInternal/OutgoingConnectionFactory.java
index 563368f9f22..6ce51eac569 100644
--- a/java/src/IceInternal/OutgoingConnectionFactory.java
+++ b/java/src/IceInternal/OutgoingConnectionFactory.java
@@ -25,15 +25,10 @@ public final class OutgoingConnectionFactory
return;
}
- java.util.Iterator<java.util.List<Ice.ConnectionI> > p = _connections.values().iterator();
- while(p.hasNext())
+ for(java.util.List<Ice.ConnectionI> connectionList : _connections.values())
{
- java.util.List<Ice.ConnectionI> connectionList = p.next();
-
- java.util.Iterator<Ice.ConnectionI> q = connectionList.iterator();
- while(q.hasNext())
+ for(Ice.ConnectionI connection : connectionList)
{
- Ice.ConnectionI connection = q.next();
connection.destroy(Ice.ConnectionI.CommunicatorDestroyed);
}
}
@@ -72,23 +67,17 @@ public final class OutgoingConnectionFactory
//
if(_connections != null)
{
- connections =
- new java.util.HashMap<ConnectorInfo, java.util.List<Ice.ConnectionI> >(_connections);
+ connections = new java.util.HashMap<ConnectorInfo, java.util.List<Ice.ConnectionI> >(_connections);
}
}
-
+
//
// Now we wait until the destruction of each connection is finished.
//
- java.util.Iterator<java.util.List<Ice.ConnectionI> > p = connections.values().iterator();
- while(p.hasNext())
+ for(java.util.List<Ice.ConnectionI> connectionList : connections.values())
{
- java.util.List<Ice.ConnectionI> connectionList = p.next();
-
- java.util.Iterator<Ice.ConnectionI> q = connectionList.iterator();
- while(q.hasNext())
+ for(Ice.ConnectionI connection : connectionList)
{
- Ice.ConnectionI connection = q.next();
connection.waitUntilFinished();
}
}
@@ -143,7 +132,7 @@ public final class OutgoingConnectionFactory
{
java.util.List<Connector> cons = endpoint.connectors();
assert(cons.size() > 0);
-
+
//
// Shuffle connectors if endpoint selection type is Random.
//
@@ -151,11 +140,10 @@ public final class OutgoingConnectionFactory
{
java.util.Collections.shuffle(cons);
}
-
- java.util.Iterator<Connector> q = cons.iterator();
- while(q.hasNext())
+
+ for(Connector c : cons)
{
- connectors.add(new ConnectorInfo(q.next(), endpoint));
+ connectors.add(new ConnectorInfo(c, endpoint));
}
}
catch(Ice.LocalException ex)
@@ -164,13 +152,13 @@ public final class OutgoingConnectionFactory
handleException(exception, hasMore || p.hasNext());
}
}
-
+
if(connectors.isEmpty())
{
assert(exception != null);
throw exception;
}
-
+
//
// Try to get a connection to one of the connectors. A null result indicates that no
// connection was found and that we should try to establish the connection (and that
@@ -297,11 +285,8 @@ public final class OutgoingConnectionFactory
//
Ice.ObjectAdapter adapter = routerInfo.getAdapter();
DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
- EndpointI[] endpoints = routerInfo.getClientEndpoints();
- for(int i = 0; i < endpoints.length; i++)
+ for(EndpointI endpoint : routerInfo.getClientEndpoints())
{
- EndpointI endpoint = endpoints[i];
-
//
// Modify endpoints with overrides.
//
@@ -321,15 +306,10 @@ public final class OutgoingConnectionFactory
//
endpoint = endpoint.compress(false);
- java.util.Iterator<java.util.List<Ice.ConnectionI> > p = _connections.values().iterator();
- while(p.hasNext())
+ for(java.util.List<Ice.ConnectionI> connectionList : _connections.values())
{
- java.util.List<Ice.ConnectionI> connectionList = p.next();
-
- java.util.Iterator<Ice.ConnectionI> q = connectionList.iterator();
- while(q.hasNext())
+ for(Ice.ConnectionI connection : connectionList)
{
- Ice.ConnectionI connection = q.next();
if(connection.endpoint() == endpoint)
{
connection.setAdapter(adapter);
@@ -347,15 +327,10 @@ public final class OutgoingConnectionFactory
return;
}
- java.util.Iterator<java.util.List<Ice.ConnectionI> > p = _connections.values().iterator();
- while(p.hasNext())
+ for(java.util.List<Ice.ConnectionI> connectionList : _connections.values())
{
- java.util.List<Ice.ConnectionI> connectionList = p.next();
-
- java.util.Iterator<Ice.ConnectionI> q = connectionList.iterator();
- while(q.hasNext())
+ for(Ice.ConnectionI connection : connectionList)
{
- Ice.ConnectionI connection = q.next();
if(connection.getAdapter() == adapter)
{
connection.setAdapter(null);
@@ -371,22 +346,17 @@ public final class OutgoingConnectionFactory
synchronized(this)
{
- java.util.Iterator<java.util.List<Ice.ConnectionI> > p = _connections.values().iterator();
- while(p.hasNext())
+ for(java.util.List<Ice.ConnectionI> connectionList : _connections.values())
{
- java.util.List<Ice.ConnectionI> connectionList = p.next();
- java.util.Iterator<Ice.ConnectionI> q = connectionList.iterator();
- while(q.hasNext())
+ for(Ice.ConnectionI connection : connectionList)
{
- c.add(q.next());
+ c.add(connection);
}
}
}
- java.util.Iterator<Ice.ConnectionI> p = c.iterator();
- while(p.hasNext())
+ for(Ice.ConnectionI conn : c)
{
- Ice.ConnectionI conn = p.next();
try
{
conn.flushBatchRequests();
@@ -425,18 +395,18 @@ public final class OutgoingConnectionFactory
{
DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
java.util.List<EndpointI> endpoints = new java.util.ArrayList<EndpointI>();
- for(int i = 0; i < endpts.length; i++)
+ for(EndpointI endpoint : endpts)
{
//
// Modify endpoints with overrides.
//
if(defaultsAndOverrides.overrideTimeout)
{
- endpoints.add(endpts[i].timeout(defaultsAndOverrides.overrideTimeoutValue));
+ endpoints.add(endpoint.timeout(defaultsAndOverrides.overrideTimeoutValue));
}
else
{
- endpoints.add(endpts[i]);
+ endpoints.add(endpoint);
}
}
@@ -454,20 +424,16 @@ public final class OutgoingConnectionFactory
DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
assert(!endpoints.isEmpty());
- java.util.Iterator<EndpointI> p = endpoints.iterator();
- while(p.hasNext())
+ for(EndpointI endpoint : endpoints)
{
- EndpointI endpoint = p.next();
java.util.List<Ice.ConnectionI> connectionList = _connectionsByEndpoint.get(endpoint);
if(connectionList == null)
{
continue;
}
-
- java.util.Iterator<Ice.ConnectionI> q = connectionList.iterator();
- while(q.hasNext())
+
+ for(Ice.ConnectionI connection : connectionList)
{
- Ice.ConnectionI connection = q.next();
if(connection.isActiveOrHolding()) // Don't return destroyed or un-validated connections
{
if(defaultsAndOverrides.overrideCompress)
@@ -482,7 +448,7 @@ public final class OutgoingConnectionFactory
}
}
}
-
+
return null;
}
@@ -493,25 +459,21 @@ public final class OutgoingConnectionFactory
findConnection(java.util.List<ConnectorInfo> connectors, Ice.BooleanHolder compress)
{
DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
- java.util.Iterator<ConnectorInfo> p = connectors.iterator();
- while(p.hasNext())
+ for(ConnectorInfo ci : connectors)
{
- ConnectorInfo ci = p.next();
if(_pending.containsKey(ci))
{
continue;
}
-
+
java.util.List<Ice.ConnectionI> connectionList = _connections.get(ci);
if(connectionList == null)
{
continue;
}
-
- java.util.Iterator<Ice.ConnectionI> q = connectionList.iterator();
- while(q.hasNext())
+
+ for(Ice.ConnectionI connection : connectionList)
{
- Ice.ConnectionI connection = q.next();
if(connection.isActiveOrHolding()) // Don't return destroyed or un-validated connections
{
if(!connection.endpoint().equals(ci.endpoint))
@@ -524,7 +486,7 @@ public final class OutgoingConnectionFactory
}
conList.add(connection);
}
-
+
if(defaultsAndOverrides.overrideCompress)
{
compress.value = defaultsAndOverrides.overrideCompressValue;
@@ -537,7 +499,7 @@ public final class OutgoingConnectionFactory
}
}
}
-
+
return null;
}
@@ -545,7 +507,7 @@ public final class OutgoingConnectionFactory
incPendingConnectCount()
{
//
- // Keep track of the number of pending connects. The outgoing connection factory
+ // Keep track of the number of pending connects. The outgoing connection factory
// waitUntilFinished() method waits for all the pending connects to terminate before
// to return. This ensures that the communicator client thread pool isn't destroyed
// too soon and will still be available to execute the ice_exception() callbacks for
@@ -597,7 +559,7 @@ public final class OutgoingConnectionFactory
q.remove();
}
}
-
+
if(connectionList.isEmpty())
{
p.remove();
@@ -619,7 +581,7 @@ public final class OutgoingConnectionFactory
q.remove();
}
}
-
+
if(connectionList.isEmpty())
{
p.remove();
@@ -647,13 +609,13 @@ public final class OutgoingConnectionFactory
{
return connection;
}
-
+
if(addToPending(cb, connectors))
{
//
- // If a callback is not specified we wait until another thread notifies us about a
- // change to the pending list. Otherwise, if a callback is provided we're done:
- // when the pending list changes the callback will be notified and will try to
+ // If a callback is not specified we wait until another thread notifies us about a
+ // change to the pending list. Otherwise, if a callback is provided we're done:
+ // when the pending list changes the callback will be notified and will try to
// get the connection again.
//
if(cb == null)
@@ -684,7 +646,7 @@ public final class OutgoingConnectionFactory
}
//
- // At this point, we're responsible for establishing the connection to one of
+ // At this point, we're responsible for establishing the connection to one of
// the given connectors. If it's a non-blocking connect, calling nextConnector
// will start the connection establishment. Otherwise, we return null to get
// the caller to establish the connection.
@@ -747,8 +709,8 @@ public final class OutgoingConnectionFactory
}
private void
- finishGetConnection(java.util.List<ConnectorInfo> connectors,
- ConnectorInfo ci,
+ finishGetConnection(java.util.List<ConnectorInfo> connectors,
+ ConnectorInfo ci,
Ice.ConnectionI connection,
ConnectCallback cb)
{
@@ -761,10 +723,8 @@ public final class OutgoingConnectionFactory
java.util.Set<ConnectCallback> callbacks = new java.util.HashSet<ConnectCallback>();
synchronized(this)
{
- java.util.Iterator<ConnectorInfo> p = connectors.iterator();
- while(p.hasNext())
+ for(ConnectorInfo c : connectors)
{
- ConnectorInfo c = p.next();
java.util.Set<ConnectCallback> cbs = _pending.remove(c);
if(cbs != null)
{
@@ -793,7 +753,7 @@ public final class OutgoingConnectionFactory
}
notifyAll();
}
-
+
boolean compress;
DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
if(defaultsAndOverrides.overrideCompress)
@@ -827,10 +787,8 @@ public final class OutgoingConnectionFactory
java.util.Set<ConnectCallback> callbacks = new java.util.HashSet<ConnectCallback>();
synchronized(this)
{
- java.util.Iterator<ConnectorInfo> p = connectors.iterator();
- while(p.hasNext())
+ for(ConnectorInfo c : connectors)
{
- ConnectorInfo c = p.next();
java.util.Set<ConnectCallback> cbs = _pending.remove(c);
if(cbs != null)
{
@@ -855,7 +813,7 @@ public final class OutgoingConnectionFactory
}
notifyAll();
}
-
+
for(ConnectCallback cc : callbacks)
{
cc.getConnection();
@@ -872,11 +830,10 @@ public final class OutgoingConnectionFactory
//
// Add the callback to each connector pending list.
//
- java.util.Iterator<ConnectorInfo> p = connectors.iterator();
boolean found = false;
- while(p.hasNext())
+ for(ConnectorInfo p : connectors)
{
- java.util.Set<ConnectCallback> cbs = _pending.get(p.next());
+ java.util.Set<ConnectCallback> cbs = _pending.get(p);
if(cbs != null)
{
found = true;
@@ -886,24 +843,22 @@ public final class OutgoingConnectionFactory
}
}
}
-
+
if(found)
{
return true;
}
//
- // If there's no pending connection for the given connectors, we're
- // responsible for its establishment. We add empty pending lists,
+ // If there's no pending connection for the given connectors, we're
+ // responsible for its establishment. We add empty pending lists,
// other callbacks to the same connectors will be queued.
//
- p = connectors.iterator();
- while(p.hasNext())
+ for(ConnectorInfo p : connectors)
{
- ConnectorInfo obj = p.next();
- if(!_pending.containsKey(obj))
+ if(!_pending.containsKey(p))
{
- _pending.put(obj, new java.util.HashSet<ConnectCallback>());
+ _pending.put(p, new java.util.HashSet<ConnectCallback>());
}
}
@@ -913,10 +868,9 @@ public final class OutgoingConnectionFactory
private void
removeFromPending(ConnectCallback cb, java.util.List<ConnectorInfo> connectors)
{
- java.util.Iterator<ConnectorInfo> p = connectors.iterator();
- while(p.hasNext())
+ for(ConnectorInfo p : connectors)
{
- java.util.Set<ConnectCallback> cbs = _pending.get(p.next());
+ java.util.Set<ConnectCallback> cbs = _pending.get(p);
if(cbs != null)
{
cbs.remove(cb);
@@ -1020,7 +974,7 @@ public final class OutgoingConnectionFactory
endpoint = e;
}
- public boolean
+ public boolean
equals(Object obj)
{
ConnectorInfo r = (ConnectorInfo)obj;
@@ -1039,7 +993,7 @@ public final class OutgoingConnectionFactory
private static class ConnectCallback implements Ice.ConnectionI.StartCallback, EndpointI_connectors
{
- ConnectCallback(OutgoingConnectionFactory f, java.util.List<EndpointI> endpoints, boolean more,
+ ConnectCallback(OutgoingConnectionFactory f, java.util.List<EndpointI> endpoints, boolean more,
CreateConnectionCallback cb, Ice.EndpointSelectionType selType)
{
_factory = f;
@@ -1049,7 +1003,7 @@ public final class OutgoingConnectionFactory
_selType = selType;
_endpointsIter = _endpoints.iterator();
}
-
+
//
// Methods from ConnectionI.StartCallback
//
@@ -1093,11 +1047,10 @@ public final class OutgoingConnectionFactory
{
java.util.Collections.shuffle(cons);
}
-
- java.util.Iterator<Connector> q = cons.iterator();
- while(q.hasNext())
+
+ for(Connector p : cons)
{
- _connectors.add(new ConnectorInfo(q.next(), _currentEndpoint));
+ _connectors.add(new ConnectorInfo(p, _currentEndpoint));
}
if(_endpointsIter.hasNext())
@@ -1107,7 +1060,7 @@ public final class OutgoingConnectionFactory
else
{
assert(!_connectors.isEmpty());
-
+
//
// We now have all the connectors for the given endpoints. We can try to obtain the
// connection.
@@ -1116,7 +1069,7 @@ public final class OutgoingConnectionFactory
getConnection();
}
}
-
+
public void
exception(Ice.LocalException ex)
{
@@ -1151,7 +1104,7 @@ public final class OutgoingConnectionFactory
_callback.setConnection(connection, compress);
_factory.decPendingConnectCount(); // Must be called last.
}
-
+
public void
setException(Ice.LocalException ex)
{
@@ -1167,7 +1120,7 @@ public final class OutgoingConnectionFactory
{
return _connectors.contains(ci);
}
-
+
public boolean
removeConnectors(java.util.List<ConnectorInfo> connectors)
{
@@ -1181,8 +1134,8 @@ public final class OutgoingConnectionFactory
{
_factory.removeFromPending(this, _connectors);
}
-
- void
+
+ void
getConnectors()
{
try
@@ -1224,7 +1177,7 @@ public final class OutgoingConnectionFactory
try
{
//
- // If all the connectors have been created, we ask the factory to get a
+ // If all the connectors have been created, we ask the factory to get a
// connection.
//
Ice.BooleanHolder compress = new Ice.BooleanHolder();
@@ -1234,12 +1187,12 @@ public final class OutgoingConnectionFactory
//
// A null return value from getConnection indicates that the connection
// is being established and that everthing has been done to ensure that
- // the callback will be notified when the connection establishment is
+ // the callback will be notified when the connection establishment is
// done.
- //
+ //
return;
}
-
+
_callback.setConnection(connection, compress.value);
_factory.decPendingConnectCount(); // Must be called last.
}
diff --git a/java/src/IceInternal/ReferenceFactory.java b/java/src/IceInternal/ReferenceFactory.java
index 7b868f3642e..a3e1c6ec612 100644
--- a/java/src/IceInternal/ReferenceFactory.java
+++ b/java/src/IceInternal/ReferenceFactory.java
@@ -420,10 +420,9 @@ public final class ReferenceFactory
_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Endpoints", 1) > 0)
{
String msg = "Proxy contains unknown endpoints:";
- java.util.Iterator<String> iter = unknownEndpoints.iterator();
- while(iter.hasNext())
+ for(String e : unknownEndpoints)
{
- msg += " `" + iter.next() + "'";
+ msg += " `" + e + "'";
}
_instance.initializationData().logger.warning(msg);
}
@@ -667,16 +666,14 @@ public final class ReferenceFactory
java.util.ArrayList<String> unknownProps = new java.util.ArrayList<String>();
java.util.Map<String, String> props =
_instance.initializationData().properties.getPropertiesForPrefix(prefix + ".");
- java.util.Iterator<java.util.Map.Entry<String, String> > p = props.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, String> p : props.entrySet())
{
- java.util.Map.Entry<String, String> entry = p.next();
- String prop = entry.getKey();
+ String prop = p.getKey();
boolean valid = false;
- for(int i = 0; i < _suffixes.length; ++i)
+ for(String suffix : _suffixes)
{
- if(prop.equals(prefix + "." + _suffixes[i]))
+ if(prop.equals(prefix + "." + suffix))
{
valid = true;
break;
@@ -692,10 +689,9 @@ public final class ReferenceFactory
if(unknownProps.size() != 0)
{
String message = "found unknown properties for proxy '" + prefix + "':";
- java.util.Iterator<String> q = unknownProps.iterator();
- while(q.hasNext())
+ for(String s : unknownProps)
{
- message += "\n " + q.next();
+ message += "\n " + s;
}
_instance.initializationData().logger.warning(message);
}
diff --git a/java/src/IceInternal/RetryQueue.java b/java/src/IceInternal/RetryQueue.java
index 1647ff01573..44802e60dca 100644
--- a/java/src/IceInternal/RetryQueue.java
+++ b/java/src/IceInternal/RetryQueue.java
@@ -27,10 +27,8 @@ public class RetryQueue
synchronized public void
destroy()
{
- java.util.Iterator<RetryTask> p = _requests.iterator();
- while(p.hasNext())
+ for(RetryTask task : _requests)
{
- RetryTask task = p.next();
_instance.timer().cancel(task);
task.destroy();
}
diff --git a/java/src/IceInternal/RoutableReference.java b/java/src/IceInternal/RoutableReference.java
index 1f17b9cb854..c309e7d8298 100644
--- a/java/src/IceInternal/RoutableReference.java
+++ b/java/src/IceInternal/RoutableReference.java
@@ -259,9 +259,9 @@ public class RoutableReference extends Reference
if(_endpoints.length > 0)
{
assert(_adapterId.length() == 0);
- for(int i = 0; i < _endpoints.length; i++)
+ for(EndpointI endpoint : _endpoints)
{
- _endpoints[i].streamWrite(s);
+ endpoint.streamWrite(s);
}
}
else
@@ -284,9 +284,9 @@ public class RoutableReference extends Reference
s.append(super.toString());
if(_endpoints.length > 0)
{
- for(int i = 0; i < _endpoints.length; i++)
+ for(EndpointI endpoint : _endpoints)
{
- String endp = _endpoints[i].toString();
+ String endp = endpoint.toString();
if(endp != null && endp.length() > 0)
{
s.append(':');
@@ -650,11 +650,11 @@ public class RoutableReference extends Reference
//
// Filter out unknown endpoints.
//
- for(int i = 0; i < allEndpoints.length; i++)
+ for(EndpointI endpoint : allEndpoints)
{
- if(!allEndpoints[i].unknown())
+ if(!endpoint.unknown())
{
- endpoints.add(allEndpoints[i]);
+ endpoints.add(endpoint);
}
}
@@ -704,14 +704,14 @@ public class RoutableReference extends Reference
//
// Sort the endpoints according to the endpoint selection type.
//
- switch(getEndpointSelection().value())
+ switch(getEndpointSelection())
{
- case Ice.EndpointSelectionType._Random:
+ case Random:
{
java.util.Collections.shuffle(endpoints);
break;
}
- case Ice.EndpointSelectionType._Ordered:
+ case Ordered:
{
// Nothing to do.
break;
diff --git a/java/src/IceInternal/RouterInfo.java b/java/src/IceInternal/RouterInfo.java
index 404f7fa0568..002c076d7f9 100644
--- a/java/src/IceInternal/RouterInfo.java
+++ b/java/src/IceInternal/RouterInfo.java
@@ -291,16 +291,16 @@ public final class RouterInfo
//
// We also must remove whatever proxies the router evicted.
//
- for(int i = 0; i < evictedProxies.length; ++i)
+ for(Ice.ObjectPrx p : evictedProxies)
{
- if(!_identities.remove(evictedProxies[i].ice_getIdentity()))
+ if(!_identities.remove(p.ice_getIdentity()))
{
//
// It's possible for the proxy to not have been
// added yet in the local map if two threads
// concurrently call addProxies.
//
- _evictedIdentities.add(evictedProxies[i].ice_getIdentity());
+ _evictedIdentities.add(p.ice_getIdentity());
}
}
}
diff --git a/java/src/IceInternal/RouterManager.java b/java/src/IceInternal/RouterManager.java
index c817f4f8516..ce915148144 100644
--- a/java/src/IceInternal/RouterManager.java
+++ b/java/src/IceInternal/RouterManager.java
@@ -18,10 +18,8 @@ public final class RouterManager
synchronized void
destroy()
{
- java.util.Iterator<RouterInfo> i = _table.values().iterator();
- while(i.hasNext())
+ for(RouterInfo info : _table.values())
{
- RouterInfo info = i.next();
info.destroy();
}
_table.clear();
diff --git a/java/src/IceInternal/Selector.java b/java/src/IceInternal/Selector.java
index bbb642f09dd..de45ba303fa 100644
--- a/java/src/IceInternal/Selector.java
+++ b/java/src/IceInternal/Selector.java
@@ -248,10 +248,8 @@ public final class Selector
if(!_changes.isEmpty())
{
- java.util.Iterator<SelectorHandler> p = _changes.iterator();
- while(p.hasNext())
+ for(SelectorHandler handler : _changes)
{
- SelectorHandler handler = p.next();
if(handler._pendingStatus == SocketStatus.Finished)
{
removeImpl(handler);
diff --git a/java/src/IceInternal/SelectorThread.java b/java/src/IceInternal/SelectorThread.java
index c7a50688a1c..d01b3ad82e1 100644
--- a/java/src/IceInternal/SelectorThread.java
+++ b/java/src/IceInternal/SelectorThread.java
@@ -198,11 +198,9 @@ public class SelectorThread
}
}
- java.util.Iterator<SocketReadyCallback> iter = readyList.iterator();
- while(iter.hasNext())
+ for(SocketReadyCallback cb : readyList)
{
SocketStatus status = SocketStatus.Finished;
- SocketReadyCallback cb = iter.next();
try
{
if(cb._timeout >= 0)
diff --git a/java/src/IceInternal/ServantManager.java b/java/src/IceInternal/ServantManager.java
index 7fe206c0d14..072f8c8bd84 100644
--- a/java/src/IceInternal/ServantManager.java
+++ b/java/src/IceInternal/ServantManager.java
@@ -260,7 +260,7 @@ public final class ServantManager
// properly deactivated.
//
//IceUtilInternal.Assert.FinalizerAssert(_instance == null);
-
+
super.finalize();
}
@@ -273,15 +273,13 @@ public final class ServantManager
assert(_instance != null); // Must not be called after destruction.
_servantMapMap.clear();
-
- java.util.Iterator<java.util.Map.Entry<String, Ice.ServantLocator> > p = _locatorMap.entrySet().iterator();
- while(p.hasNext())
+
+ for(java.util.Map.Entry<String, Ice.ServantLocator> p : _locatorMap.entrySet())
{
- java.util.Map.Entry<String, Ice.ServantLocator> e = p.next();
- Ice.ServantLocator locator = e.getValue();
+ Ice.ServantLocator locator = p.getValue();
try
{
- locator.deactivate(e.getKey());
+ locator.deactivate(p.getKey());
}
catch(java.lang.Exception ex)
{
@@ -290,7 +288,7 @@ public final class ServantManager
ex.printStackTrace(pw);
pw.flush();
String s = "exception during locator deactivation:\n" + "object adapter: `" + _adapterName + "'\n" +
- "locator category: `" + e.getKey() + "'\n" + sw.toString();
+ "locator category: `" + p.getKey() + "'\n" + sw.toString();
_instance.initializationData().logger.error(s);
}
}
diff --git a/java/src/IceInternal/TcpEndpointI.java b/java/src/IceInternal/TcpEndpointI.java
index 51c65f34a71..d9c6e8f3373 100644
--- a/java/src/IceInternal/TcpEndpointI.java
+++ b/java/src/IceInternal/TcpEndpointI.java
@@ -399,10 +399,9 @@ final class TcpEndpointI extends EndpointI
}
else
{
- java.util.Iterator<String> p = hosts.iterator();
- while(p.hasNext())
+ for(String h : hosts)
{
- endps.add(new TcpEndpointI(_instance, p.next(), _port, _timeout, _connectionId, _compress));
+ endps.add(new TcpEndpointI(_instance, h, _port, _timeout, _connectionId, _compress));
}
}
return endps;
@@ -507,10 +506,9 @@ final class TcpEndpointI extends EndpointI
connectors(java.util.List<java.net.InetSocketAddress> addresses)
{
java.util.List<Connector> connectors = new java.util.ArrayList<Connector>();
- java.util.Iterator<java.net.InetSocketAddress> p = addresses.iterator();
- while(p.hasNext())
+ for(java.net.InetSocketAddress p : addresses)
{
- connectors.add(new TcpConnector(_instance, p.next(), _timeout, _connectionId));
+ connectors.add(new TcpConnector(_instance, p, _timeout, _connectionId));
}
return connectors;
}
diff --git a/java/src/IceInternal/ThreadPool.java b/java/src/IceInternal/ThreadPool.java
index 4a84278ab6c..1d6b645845c 100644
--- a/java/src/IceInternal/ThreadPool.java
+++ b/java/src/IceInternal/ThreadPool.java
@@ -267,11 +267,8 @@ public final class ThreadPool
// wouldn't be possible here anyway, because otherwise the
// other threads would never terminate.)
//
- java.util.Iterator<EventHandlerThread> i = _threads.iterator();
- while(i.hasNext())
+ for(EventHandlerThread thread : _threads)
{
- EventHandlerThread thread = i.next();
-
while(true)
{
try
@@ -865,10 +862,8 @@ public final class ThreadPool
if(_keys.size() > 0)
{
trace("after selectNow, there are " + _keys.size() + " selected keys:");
- java.util.Iterator<java.nio.channels.SelectionKey> i = _keys.iterator();
- while(i.hasNext())
+ for(java.nio.channels.SelectionKey key : _keys)
{
- java.nio.channels.SelectionKey key = i.next();
trace(" " + keyToString(key));
}
}
diff --git a/java/src/IceInternal/TraceUtil.java b/java/src/IceInternal/TraceUtil.java
index 13e447c9065..b5e43fb3dd8 100644
--- a/java/src/IceInternal/TraceUtil.java
+++ b/java/src/IceInternal/TraceUtil.java
@@ -305,21 +305,21 @@ public final class TraceUtil
{
byte mode = stream.readByte();
out.write("\nmode = " + (int)mode + ' ');
- switch(mode)
+ switch(Ice.OperationMode.values()[mode])
{
- case Ice.OperationMode._Normal:
+ case Normal:
{
out.write("(normal)");
break;
}
- case Ice.OperationMode._Nonmutating:
+ case Nonmutating:
{
out.write("(nonmutating)");
break;
}
- case Ice.OperationMode._Idempotent:
+ case Idempotent:
{
out.write("(idempotent)");
break;
diff --git a/java/src/IceInternal/UdpEndpointI.java b/java/src/IceInternal/UdpEndpointI.java
index 3869f783ba2..8d1131b7300 100644
--- a/java/src/IceInternal/UdpEndpointI.java
+++ b/java/src/IceInternal/UdpEndpointI.java
@@ -563,10 +563,9 @@ final class UdpEndpointI extends EndpointI
}
else
{
- java.util.Iterator<String> p = hosts.iterator();
- while(p.hasNext())
+ for(String host : hosts)
{
- endps.add(new UdpEndpointI(_instance, p.next(), _port, _mcastInterface, _mcastTtl,
+ endps.add(new UdpEndpointI(_instance, host, _port, _mcastInterface, _mcastTtl,
_protocolMajor, _protocolMinor, _encodingMajor, _encodingMinor,
_connect, _connectionId, _compress));
}
@@ -725,11 +724,10 @@ final class UdpEndpointI extends EndpointI
connectors(java.util.List<java.net.InetSocketAddress> addresses)
{
java.util.ArrayList<Connector> connectors = new java.util.ArrayList<Connector>();
- java.util.Iterator<java.net.InetSocketAddress> p = addresses.iterator();
- while(p.hasNext())
+ for(java.net.InetSocketAddress p : addresses)
{
connectors.add(
- new UdpConnector(_instance, p.next(), _mcastInterface, _mcastTtl, _protocolMajor, _protocolMinor,
+ new UdpConnector(_instance, p, _mcastInterface, _mcastTtl, _protocolMajor, _protocolMinor,
_encodingMajor, _encodingMinor, _connectionId));
}
return connectors;
diff --git a/java/src/IceInternal/ValueWriter.java b/java/src/IceInternal/ValueWriter.java
index e9d5fc76d44..edd34a8d0b6 100644
--- a/java/src/IceInternal/ValueWriter.java
+++ b/java/src/IceInternal/ValueWriter.java
@@ -106,71 +106,14 @@ public final class ValueWriter
writeFields(name, value, c, objectTable, out);
}
}
+ else if(value instanceof java.lang.Enum)
+ {
+ writeName(name, out);
+ out.print(((java.lang.Enum)value).name());
+ }
else
{
//
- // Check for enum characteristics.
- //
- while(true)
- {
- try
- {
- java.lang.reflect.Field __value = c.getDeclaredField("__value");
- if(!__value.getType().equals(Integer.TYPE) ||
- !java.lang.reflect.Modifier.isPrivate(__value.getModifiers()) ||
- java.lang.reflect.Modifier.isStatic(__value.getModifiers()))
- {
- break;
- }
- java.lang.reflect.Field __values = c.getDeclaredField("__values");
- if(!__values.getType().isArray() ||
- !__values.getType().getComponentType().equals(c) ||
- !java.lang.reflect.Modifier.isPrivate(__values.getModifiers()) ||
- !java.lang.reflect.Modifier.isStatic(__values.getModifiers()))
- {
- break;
- }
- java.lang.reflect.Method valueMethod = c.getDeclaredMethod("value", new Class<?>[0]);
- if(!valueMethod.getReturnType().equals(Integer.TYPE) ||
- !java.lang.reflect.Modifier.isPublic(valueMethod.getModifiers()) ||
- java.lang.reflect.Modifier.isStatic(valueMethod.getModifiers()))
- {
- break;
- }
-
- java.lang.Object val = valueMethod.invoke(value, new java.lang.Object[0]);
- assert(val instanceof Integer);
- java.lang.reflect.Field[] fields = c.getDeclaredFields();
- for(int i = 0; i < fields.length; i++)
- {
- if(java.lang.reflect.Modifier.isPublic(fields[i].getModifiers()) &&
- fields[i].getType().equals(Integer.TYPE) &&
- fields[i].getName().startsWith("_") &&
- fields[i].get(null).equals(val))
- {
- writeName(name, out);
- out.print(fields[i].getName().substring(1));
- return;
- }
- }
- }
- catch(NoSuchFieldException ex)
- {
- }
- catch(NoSuchMethodException ex)
- {
- }
- catch(IllegalAccessException eX)
- {
- }
- catch(java.lang.reflect.InvocationTargetException ex)
- {
- }
-
- break;
- }
-
- //
// Must be struct.
//
writeFields(name, value, c, objectTable, out);
@@ -212,19 +155,19 @@ public final class ValueWriter
}
}
assert(fields != null);
- for(int i = 0; i < fields.length; i++)
+ for(java.lang.reflect.Field field : fields)
{
//
// Only write public, non-static fields.
//
- int mods = fields[i].getModifiers();
+ int mods = field.getModifiers();
if(java.lang.reflect.Modifier.isPublic(mods) && !java.lang.reflect.Modifier.isStatic(mods))
{
- String fieldName = (name != null ? name + '.' + fields[i].getName() : fields[i].getName());
+ String fieldName = (name != null ? name + '.' + field.getName() : field.getName());
try
{
- java.lang.Object value = fields[i].get(obj);
+ java.lang.Object value = field.get(obj);
writeValue(fieldName, value, objectTable, out);
}
catch(IllegalAccessException ex)
diff --git a/java/src/IceSSL/EndpointI.java b/java/src/IceSSL/EndpointI.java
index ddccf88b05b..ed68233b0d1 100644
--- a/java/src/IceSSL/EndpointI.java
+++ b/java/src/IceSSL/EndpointI.java
@@ -400,10 +400,9 @@ final class EndpointI extends IceInternal.EndpointI
}
else
{
- java.util.Iterator<String> p = hosts.iterator();
- while(p.hasNext())
+ for(String host : hosts)
{
- endps.add(new EndpointI(_instance, p.next(), _port, _timeout, _connectionId, _compress));
+ endps.add(new EndpointI(_instance, host, _port, _timeout, _connectionId, _compress));
}
}
return endps;
@@ -508,10 +507,9 @@ final class EndpointI extends IceInternal.EndpointI
connectors(java.util.List<java.net.InetSocketAddress> addresses)
{
java.util.List<IceInternal.Connector> connectors = new java.util.ArrayList<IceInternal.Connector>();
- java.util.Iterator<java.net.InetSocketAddress> p = addresses.iterator();
- while(p.hasNext())
+ for(java.net.InetSocketAddress p : addresses)
{
- connectors.add(new ConnectorI(_instance, _host, p.next(), _timeout, _connectionId));
+ connectors.add(new ConnectorI(_instance, _host, p, _timeout, _connectionId));
}
return connectors;
}
diff --git a/java/src/IceSSL/Instance.java b/java/src/IceSSL/Instance.java
index 6954f235a74..e0af23f18f4 100644
--- a/java/src/IceSSL/Instance.java
+++ b/java/src/IceSSL/Instance.java
@@ -58,9 +58,9 @@ class Instance
if(protocols.length != 0)
{
java.util.ArrayList<String> l = new java.util.ArrayList<String>();
- for(int i = 0; i < protocols.length; ++i)
+ for(String prot : protocols)
{
- String s = protocols[i].toLowerCase();
+ String s = prot.toLowerCase();
if(s.equals("ssl3") || s.equals("sslv3"))
{
l.add("SSLv3");
@@ -72,7 +72,7 @@ class Instance
else
{
Ice.PluginInitializationException e = new Ice.PluginInitializationException();
- e.reason = "IceSSL: unrecognized protocol `" + protocols[i] + "'";
+ e.reason = "IceSSL: unrecognized protocol `" + prot + "'";
throw e;
}
}
@@ -205,15 +205,15 @@ class Instance
if(seedFiles.length() > 0)
{
final String[] arr = seedFiles.split(java.io.File.pathSeparator);
- for(int i = 0; i < arr.length; ++i)
+ for(String file : arr)
{
try
{
- java.io.InputStream seedStream = openResource(arr[i]);
+ java.io.InputStream seedStream = openResource(file);
if(seedStream == null)
{
Ice.PluginInitializationException e = new Ice.PluginInitializationException();
- e.reason = "IceSSL: random seed file not found:\n" + arr[i];
+ e.reason = "IceSSL: random seed file not found:\n" + file;
throw e;
}
@@ -222,7 +222,7 @@ class Instance
catch(java.io.IOException ex)
{
Ice.PluginInitializationException e = new Ice.PluginInitializationException();
- e.reason = "IceSSL: unable to access random seed file:\n" + arr[i];
+ e.reason = "IceSSL: unable to access random seed file:\n" + file;
e.initCause(ex);
throw e;
}
@@ -233,9 +233,8 @@ class Instance
{
byte[] seed = null;
int start = 0;
- for(java.util.Iterator<InputStream> p = _seeds.iterator(); p.hasNext();)
+ for(InputStream in : _seeds)
{
- InputStream in = p.next();
try
{
int num = in.available();
@@ -710,10 +709,10 @@ class Instance
{
StringBuilder s = new StringBuilder(128);
s.append("enabling SSL ciphersuites:");
- for(int i = 0; i < cipherSuites.length; ++i)
+ for(String suite : cipherSuites)
{
s.append("\n ");
- s.append(cipherSuites[i]);
+ s.append(suite);
}
_logger.trace(_securityTraceCategory, s.toString());
}
@@ -772,24 +771,23 @@ class Instance
java.util.LinkedList<String> result = new java.util.LinkedList<String>();
if(_allCiphers)
{
- for(int i = 0; i < supportedCiphers.length; ++i)
+ for(String cipher : supportedCiphers)
{
- result.add(supportedCiphers[i]);
+ result.add(cipher);
}
}
else if(!_noCiphers)
{
- for(int i = 0; i < defaultCiphers.length; ++i)
+ for(String cipher : defaultCiphers)
{
- result.add(defaultCiphers[i]);
+ result.add(cipher);
}
}
if(_ciphers != null)
{
- for(int i = 0; i < _ciphers.length; ++i)
+ for(CipherExpression ce : _ciphers)
{
- CipherExpression ce = (CipherExpression)_ciphers[i];
if(ce.not)
{
java.util.Iterator<String> e = result.iterator();
@@ -823,12 +821,12 @@ class Instance
else
{
assert(ce.re != null);
- for(int j = 0; j < supportedCiphers.length; ++j)
+ for(String cipher : supportedCiphers)
{
- java.util.regex.Matcher m = ce.re.matcher(supportedCiphers[j]);
+ java.util.regex.Matcher m = ce.re.matcher(cipher);
if(m.find())
{
- result.add(0, supportedCiphers[j]);
+ result.add(0, cipher);
}
}
}
@@ -890,10 +888,8 @@ class Instance
java.util.ArrayList<String> dnsNames = new java.util.ArrayList<String>();
if(subjectAltNames != null)
{
- java.util.Iterator<java.util.List<?> > i = subjectAltNames.iterator();
- while(i.hasNext())
+ for(java.util.List<?> l : subjectAltNames)
{
- java.util.List<?> l = i.next();
assert(!l.isEmpty());
Integer n = (Integer)l.get(0);
if(n.intValue() == 7)
diff --git a/java/src/IceSSL/TrustManager.java b/java/src/IceSSL/TrustManager.java
index 8ab71502a6a..fcf75a13c04 100644
--- a/java/src/IceSSL/TrustManager.java
+++ b/java/src/IceSSL/TrustManager.java
@@ -27,13 +27,11 @@ class TrustManager
key = "IceSSL.TrustOnly.Server";
_allServer = parse(properties.getProperty(key));
java.util.Map<String, String> dict = properties.getPropertiesForPrefix("IceSSL.TrustOnly.Server.");
- java.util.Iterator<java.util.Map.Entry<String, String> > p = dict.entrySet().iterator();
- while(p.hasNext())
+ for(java.util.Map.Entry<String, String> p : dict.entrySet())
{
- java.util.Map.Entry<String, String> entry = p.next();
- key = entry.getKey();
+ key = p.getKey();
String name = key.substring("IceSSL.TrustOnly.Server.".length());
- _server.put(name, parse(entry.getValue()));
+ _server.put(name, parse(p.getValue()));
}
}
catch(RFC2253.ParseException e)
@@ -122,33 +120,27 @@ class TrustManager
//
// Try matching against everything in the trust set.
//
- java.util.Iterator<java.util.List<java.util.List<RFC2253.RDNPair> > > p = trustset.iterator();
- while(p.hasNext())
+ for(java.util.List<java.util.List<RFC2253.RDNPair>> matchSet : trustset)
{
- java.util.List<java.util.List<RFC2253.RDNPair> > matchSet = p.next();
if(_traceLevel > 1)
{
String s = "trust manager matching PDNs:\n";
- java.util.Iterator<java.util.List<RFC2253.RDNPair> > q = matchSet.iterator();
boolean addSemi = false;
- while(q.hasNext())
+ for(java.util.List<RFC2253.RDNPair> rdnSet : matchSet)
{
if(addSemi)
{
s += ';';
}
addSemi = true;
- java.util.List<RFC2253.RDNPair> rdnSet = q.next();
- java.util.Iterator<RFC2253.RDNPair> r = rdnSet.iterator();
boolean addComma = false;
- while(r.hasNext())
+ for(RFC2253.RDNPair rdn : rdnSet)
{
if(addComma)
{
s += ',';
}
addComma = true;
- RFC2253.RDNPair rdn = r.next();
s += rdn.key;
s += '=';
s += rdn.value;
@@ -175,10 +167,9 @@ class TrustManager
private boolean
match(java.util.List<java.util.List<RFC2253.RDNPair> > matchSet, java.util.List<RFC2253.RDNPair> subject)
{
- java.util.Iterator<java.util.List<RFC2253.RDNPair> > r = matchSet.iterator();
- while(r.hasNext())
+ for(java.util.List<RFC2253.RDNPair> r : matchSet)
{
- if(matchRDNs(r.next(), subject))
+ if(matchRDNs(r, subject))
{
return true;
}
@@ -189,15 +180,11 @@ class TrustManager
private boolean
matchRDNs(java.util.List<RFC2253.RDNPair> match, java.util.List<RFC2253.RDNPair> subject)
{
- java.util.Iterator<RFC2253.RDNPair> p = match.iterator();
- while(p.hasNext())
+ for(RFC2253.RDNPair matchRDN : match)
{
- RFC2253.RDNPair matchRDN = p.next();
boolean found = false;
- java.util.Iterator<RFC2253.RDNPair> q = subject.iterator();
- while(q.hasNext())
+ for(RFC2253.RDNPair subjectRDN : subject)
{
- RFC2253.RDNPair subjectRDN = q.next();
if(matchRDN.key.equals(subjectRDN.key))
{
found = true;
@@ -261,21 +248,17 @@ class TrustManager
java.util.List<java.util.List<RFC2253.RDNPair> > l = RFC2253.parse(value);
java.util.List<java.util.List<RFC2253.RDNPair> > result =
new java.util.LinkedList<java.util.List<RFC2253.RDNPair> >();
- java.util.Iterator<java.util.List<RFC2253.RDNPair> > p = l.iterator();
- while(p.hasNext())
+ for(java.util.List<RFC2253.RDNPair> dn : l)
{
- java.util.List<RFC2253.RDNPair> dn = p.next();
String v = new String();
boolean first = true;
- java.util.Iterator<RFC2253.RDNPair> q = dn.iterator();
- while(q.hasNext())
+ for(RFC2253.RDNPair pair : dn)
{
if(!first)
{
v += ",";
}
first = false;
- RFC2253.RDNPair pair = q.next();
v += pair.key;
v += "=";
v += pair.value;
diff --git a/java/src/IceUtilInternal/Assert.java b/java/src/IceUtilInternal/Assert.java
index eb781c52c3f..f6607c95e57 100644
--- a/java/src/IceUtilInternal/Assert.java
+++ b/java/src/IceUtilInternal/Assert.java
@@ -31,9 +31,9 @@ public final class Assert
// Skip the first frame, which represents this method.
//
System.err.println("Assertion failure:");
- for(int i = 1; i < trace.length; ++i)
+ for(StackTraceElement e : trace)
{
- System.err.println("\tat " + trace[i]);
+ System.err.println("\tat " + e);
}
}
else
diff --git a/java/src/ant/Slice2FreezeJTask.java b/java/src/ant/Slice2FreezeJTask.java
index f1b6d405fa7..ea79220928e 100644
--- a/java/src/ant/Slice2FreezeJTask.java
+++ b/java/src/ant/Slice2FreezeJTask.java
@@ -88,7 +88,7 @@ public class Slice2FreezeJTask extends SliceTask
_indices.add(i);
return i;
}
-
+
public Dictindex
createDictindex()
{
@@ -109,26 +109,23 @@ public class Slice2FreezeJTask extends SliceTask
//
// Read the set of dependencies for this task.
//
- java.util.HashMap dependencies = readDependencies();
+ java.util.HashMap<String, SliceDependency> dependencies = readDependencies();
//
// Check if the set of slice files changed. If it changed we
// need to rebuild all the dictionnaries and indices.
//
boolean build = false;
- java.util.List sliceFiles = new java.util.LinkedList();
+ java.util.List<File> sliceFiles = new java.util.LinkedList<File>();
- java.util.Iterator p = _fileSets.iterator();
- while(p.hasNext())
+ for(FileSet fileset : _fileSets)
{
- FileSet fileset = (FileSet)p.next();
-
DirectoryScanner scanner = fileset.getDirectoryScanner(getProject());
String[] files = scanner.getIncludedFiles();
-
- for(int i = 0; i < files.length; i++)
+
+ for(String file : files)
{
- File slice = new File(fileset.getDir(getProject()), files[i]);
+ File slice = new File(fileset.getDir(getProject()), file);
sliceFiles.add(slice);
if(!build)
@@ -137,7 +134,7 @@ public class Slice2FreezeJTask extends SliceTask
// The dictionnaries need to be re-created since
// on dependency changed.
//
- SliceDependency depend = (SliceDependency)dependencies.get(getSliceTargetKey(slice.toString()));
+ SliceDependency depend = dependencies.get(getSliceTargetKey(slice.toString()));
if(depend == null || !depend.isUpToDate())
{
build = true;
@@ -152,10 +149,9 @@ public class Slice2FreezeJTask extends SliceTask
// Check that each dictionary has been built at least
// once.
//
- p = _dicts.iterator();
- while(p.hasNext())
+ for(Dict p : _dicts)
{
- SliceDependency depend = (SliceDependency)dependencies.get(getDictTargetKey((Dict)p.next()));
+ SliceDependency depend = dependencies.get(getDictTargetKey(p));
if(depend == null)
{
build = true;
@@ -166,10 +162,9 @@ public class Slice2FreezeJTask extends SliceTask
//
// Likewise for indices
//
- p = _indices.iterator();
- while(p.hasNext())
+ for(Index p : _indices)
{
- SliceDependency depend = (SliceDependency)dependencies.get(getIndexTargetKey((Index)p.next()));
+ SliceDependency depend = dependencies.get(getIndexTargetKey(p));
if(depend == null)
{
build = true;
@@ -177,16 +172,13 @@ public class Slice2FreezeJTask extends SliceTask
}
}
}
-
+
//
// Add the --dict options.
//
- p = _dicts.iterator();
StringBuilder dictString = new StringBuilder(128);
- while(p.hasNext())
+ for(Dict d : _dicts)
{
- Dict d = (Dict)p.next();
-
dictString.append(" --dict ");
dictString.append(d.getName());
dictString.append(",");
@@ -198,12 +190,9 @@ public class Slice2FreezeJTask extends SliceTask
//
// Add the --dict-index options.
//
- p = _dictIndices.iterator();
StringBuilder dictIndexString = new StringBuilder(128);
- while(p.hasNext())
+ for(Dictindex d : _dictIndices)
{
- Dictindex d = (Dictindex)p.next();
-
dictIndexString.append(" --dict-index ");
dictIndexString.append(d.getName());
if(d.getMember() != null)
@@ -216,16 +205,13 @@ public class Slice2FreezeJTask extends SliceTask
dictIndexString.append(",case-insensitive");
}
}
-
+
//
// Add the --index options.
//
- p = _indices.iterator();
StringBuilder indexString = new StringBuilder();
- while(p.hasNext())
+ for(Index i : _indices)
{
- Index i = (Index)p.next();
-
indexString.append(" --index ");
indexString.append(i.getName());
indexString.append(",");
@@ -280,16 +266,16 @@ public class Slice2FreezeJTask extends SliceTask
if(_includePath != null)
{
String[] dirs = _includePath.list();
- for(int i = 0; i < dirs.length; i++)
+ for(String dir : dirs)
{
cmd.append(" -I");
- if(dirs[i].indexOf(' ') != -1)
+ if(dir.indexOf(' ') != -1)
{
- cmd.append('"' + dirs[i] + '"');
+ cmd.append('"' + dir + '"');
}
else
{
- cmd.append(dirs[i]);
+ cmd.append(dir);
}
}
}
@@ -299,10 +285,8 @@ public class Slice2FreezeJTask extends SliceTask
//
if(!_defines.isEmpty())
{
- java.util.Iterator i = _defines.iterator();
- while(i.hasNext())
+ for(SliceDefine define : _defines)
{
- SliceDefine define = (SliceDefine)i.next();
cmd.append(" -D");
cmd.append(define.getName());
String value = define.getValue();
@@ -334,10 +318,8 @@ public class Slice2FreezeJTask extends SliceTask
//
if(!_meta.isEmpty())
{
- java.util.Iterator i = _meta.iterator();
- while(i.hasNext())
+ for(SliceMeta m : _meta)
{
- SliceMeta m = (SliceMeta)i.next();
cmd.append(" --meta " + m.getValue());
}
}
@@ -345,10 +327,8 @@ public class Slice2FreezeJTask extends SliceTask
//
// Add the slice files.
//
- p = sliceFiles.iterator();
- while(p.hasNext())
+ for(File f : sliceFiles)
{
- File f = (File)p.next();
cmd.append(" ");
String s = f.toString();
if(s.indexOf(' ') != -1)
@@ -370,7 +350,7 @@ public class Slice2FreezeJTask extends SliceTask
{
translator = _translator.toString();
}
-
+
//
// Execute.
//
@@ -382,15 +362,15 @@ public class Slice2FreezeJTask extends SliceTask
arg.setLine(cmd.toString());
task.setExecutable(translator);
task.execute();
-
+
//
// Update the dependencies.
- //
+ //
if(!sliceFiles.isEmpty())
{
cmd = new StringBuilder(256);
cmd.append("--depend");
-
+
//
// Add --ice
//
@@ -413,18 +393,18 @@ public class Slice2FreezeJTask extends SliceTask
if(_includePath != null)
{
String[] dirs = _includePath.list();
- for(int i = 0; i < dirs.length; i++)
+ for(String dir : dirs)
{
cmd.append(" -I");
- if(dirs[i].indexOf(' ') != -1)
+ if(dir.indexOf(' ') != -1)
{
cmd.append('"');
- cmd.append(dirs[i]);
+ cmd.append(dir);
cmd.append('"');
}
else
{
- cmd.append(dirs[i]);
+ cmd.append(dir);
}
}
}
@@ -447,10 +427,8 @@ public class Slice2FreezeJTask extends SliceTask
//
// Add the slice files.
//
- p = sliceFiles.iterator();
- while(p.hasNext())
+ for(File f : sliceFiles)
{
- File f = (File)p.next();
cmd.append(" ");
String s = f.toString();
if(s.indexOf(' ') != -1)
@@ -464,9 +442,9 @@ public class Slice2FreezeJTask extends SliceTask
cmd.append(s);
}
}
-
+
//
- // It's not possible anymore to re-use the same output property since Ant 1.5.x. so we use a
+ // It's not possible anymore to re-use the same output property since Ant 1.5.x. so we use a
// unique property name here. Perhaps we should output the dependencies to a file instead.
//
final String outputProperty = "slice2freezej.depend." + System.currentTimeMillis();
@@ -483,25 +461,22 @@ public class Slice2FreezeJTask extends SliceTask
//
// Update dependency file.
//
- java.util.List newDependencies = parseDependencies(getProject().getProperty(outputProperty));
- p = newDependencies.iterator();
- while(p.hasNext())
+ java.util.List<SliceDependency> newDependencies =
+ parseDependencies(getProject().getProperty(outputProperty));
+ for(SliceDependency dep : newDependencies)
{
- SliceDependency dep = (SliceDependency)p.next();
dependencies.put(getSliceTargetKey(dep._dependencies[0]), dep);
}
}
- p = _dicts.iterator();
- while(p.hasNext())
+ for(Dict d : _dicts)
{
- dependencies.put(getDictTargetKey((Dict)p.next()), new SliceDependency());
+ dependencies.put(getDictTargetKey(d), new SliceDependency());
}
- p = _indices.iterator();
- while(p.hasNext())
+ for(Index i : _indices)
{
- dependencies.put(getIndexTargetKey((Index)p.next()), new SliceDependency());
+ dependencies.put(getIndexTargetKey(i), new SliceDependency());
}
writeDependencies(dependencies);
@@ -520,11 +495,11 @@ public class Slice2FreezeJTask extends SliceTask
String name;
if(_dicts.size() > 0)
{
- name = ((Dict)_dicts.get(0)).getName();
+ name = (_dicts.get(0)).getName();
}
else
{
- name = ((Index)_indices.get(0)).getName();
+ name = (_indices.get(0)).getName();
}
return "slice2freezej " + _outputDir.toString() + name + slice;
}
@@ -615,7 +590,7 @@ public class Slice2FreezeJTask extends SliceTask
{
return _member;
}
-
+
public void
setCasesensitive(boolean caseSensitive)
{
@@ -629,7 +604,6 @@ public class Slice2FreezeJTask extends SliceTask
}
}
-
public class Index
{
private String _name;
@@ -672,7 +646,7 @@ public class Slice2FreezeJTask extends SliceTask
{
return _member;
}
-
+
public void
setCasesensitive(boolean caseSensitive)
{
@@ -686,7 +660,7 @@ public class Slice2FreezeJTask extends SliceTask
}
}
- private java.util.List _dicts = new java.util.LinkedList();
- private java.util.List _dictIndices = new java.util.LinkedList();
- private java.util.List _indices = new java.util.LinkedList();
+ private java.util.List<Dict> _dicts = new java.util.LinkedList<Dict>();
+ private java.util.List<Dictindex> _dictIndices = new java.util.LinkedList<Dictindex>();
+ private java.util.List<Index> _indices = new java.util.LinkedList<Index>();
}
diff --git a/java/src/ant/Slice2JavaTask.java b/java/src/ant/Slice2JavaTask.java
index 37dbdec062d..56720813545 100644
--- a/java/src/ant/Slice2JavaTask.java
+++ b/java/src/ant/Slice2JavaTask.java
@@ -108,7 +108,7 @@ public class Slice2JavaTask extends SliceTask
//
// Read the set of dependencies for this task.
//
- java.util.HashMap dependencies = readDependencies();
+ java.util.HashMap<String, SliceDependency> dependencies = readDependencies();
//
// Compose a list of the files that need to be translated. A
@@ -117,28 +117,25 @@ public class Slice2JavaTask extends SliceTask
// anymore (the slice file changed since the dependency was
// last updated or a slice file it depends on changed).
//
- java.util.Vector buildList = new java.util.Vector();
- java.util.Vector skipList = new java.util.Vector();
- java.util.Iterator p = _fileSets.iterator();
- while(p.hasNext())
+ java.util.ArrayList<File> buildList = new java.util.ArrayList<File>();
+ java.util.ArrayList<File> skipList = new java.util.ArrayList<File>();
+ for(FileSet fileset : _fileSets)
{
- FileSet fileset = (FileSet)p.next();
-
DirectoryScanner scanner = fileset.getDirectoryScanner(getProject());
scanner.scan();
String[] files = scanner.getIncludedFiles();
- for(int i = 0; i < files.length; i++)
+ for(String file : files)
{
- File slice = new File(fileset.getDir(getProject()), files[i]);
+ File slice = new File(fileset.getDir(getProject()), file);
- SliceDependency depend = (SliceDependency)dependencies.get(getTargetKey(slice.toString()));
+ SliceDependency depend = dependencies.get(getTargetKey(slice.toString()));
if(depend == null || !depend.isUpToDate())
{
- buildList.addElement(slice);
+ buildList.add(slice);
}
else
{
- skipList.addElement(slice);
+ skipList.add(slice);
}
}
@@ -151,10 +148,8 @@ public class Slice2JavaTask extends SliceTask
}
else
{
- java.util.Iterator i = skipList.iterator();
- while(i.hasNext())
+ for(File file : skipList)
{
- File file = (File)i.next();
log("skipping " + file.getName());
}
}
@@ -192,18 +187,18 @@ public class Slice2JavaTask extends SliceTask
if(_includePath != null)
{
String[] dirs = _includePath.list();
- for(int i = 0; i < dirs.length; i++)
+ for(String dir : dirs)
{
cmd.append(" -I");
- if(dirs[i].indexOf(' ') != -1)
+ if(dir.indexOf(' ') != -1)
{
cmd.append('"');
- cmd.append(dirs[i]);
+ cmd.append(dir);
cmd.append('"');
}
else
{
- cmd.append(dirs[i]);
+ cmd.append(dir);
}
}
}
@@ -213,10 +208,8 @@ public class Slice2JavaTask extends SliceTask
//
if(!_defines.isEmpty())
{
- java.util.Iterator i = _defines.iterator();
- while(i.hasNext())
+ for(SliceDefine define : _defines)
{
- SliceDefine define = (SliceDefine)i.next();
cmd.append(" -D");
cmd.append(define.getName());
String value = define.getValue();
@@ -258,10 +251,8 @@ public class Slice2JavaTask extends SliceTask
//
if(!_meta.isEmpty())
{
- java.util.Iterator i = _meta.iterator();
- while(i.hasNext())
+ for(SliceMeta m : _meta)
{
- SliceMeta m = (SliceMeta)i.next();
cmd.append(" --meta ");
cmd.append(m.getValue());
}
@@ -286,9 +277,8 @@ public class Slice2JavaTask extends SliceTask
//
// Add files to be translated
//
- for(int i = 0; i < buildList.size(); i++)
+ for(File f : buildList)
{
- File f = (File)buildList.elementAt(i);
cmd.append(" ");
String s = f.toString();
if(s.indexOf(' ') != -1)
@@ -343,18 +333,18 @@ public class Slice2JavaTask extends SliceTask
if(_includePath != null)
{
String[] dirs = _includePath.list();
- for(int i = 0; i < dirs.length; i++)
+ for(String dir : dirs)
{
cmd.append(" -I");
- if(dirs[i].indexOf(' ') != -1)
+ if(dir.indexOf(' ') != -1)
{
cmd.append('"');
- cmd.append(dirs[i]);
+ cmd.append(dir);
cmd.append('"');
}
else
{
- cmd.append(dirs[i]);
+ cmd.append(dir);
}
}
}
@@ -362,9 +352,8 @@ public class Slice2JavaTask extends SliceTask
//
// Add files for which we need to check dependencies.
//
- for(int i = 0; i < buildList.size(); i++)
+ for(File f : buildList)
{
- File f = (File)buildList.elementAt(i);
cmd.append(" ");
String s = f.toString();
if(s.indexOf(' ') != -1)
@@ -399,11 +388,10 @@ public class Slice2JavaTask extends SliceTask
//
// Update dependency file.
//
- java.util.List newDependencies = parseDependencies(getProject().getProperty(outputProperty));
- p = newDependencies.iterator();
- while(p.hasNext())
+ java.util.List<SliceDependency> newDependencies =
+ parseDependencies(getProject().getProperty(outputProperty));
+ for(SliceDependency dep : newDependencies)
{
- SliceDependency dep = (SliceDependency)p.next();
dependencies.put(getTargetKey(dep._dependencies[0]), dep);
}
diff --git a/java/src/ant/SliceTask.java b/java/src/ant/SliceTask.java
index a778eb6c13a..e2ed37ea8b6 100644
--- a/java/src/ant/SliceTask.java
+++ b/java/src/ant/SliceTask.java
@@ -96,7 +96,7 @@ public class SliceTask extends org.apache.tools.ant.Task
public Path
createIncludePath()
{
- if(_includePath == null)
+ if(_includePath == null)
{
_includePath = new Path(getProject());
}
@@ -114,7 +114,7 @@ public class SliceTask extends org.apache.tools.ant.Task
{
if(_includePath == null)
{
- _includePath = includePath;
+ _includePath = includePath;
}
else
{
@@ -129,7 +129,7 @@ public class SliceTask extends org.apache.tools.ant.Task
_fileSets.add(fileset);
return fileset;
- }
+ }
public void
addConfiguredDefine(SliceDefine define)
@@ -155,7 +155,8 @@ public class SliceTask extends org.apache.tools.ant.Task
//
// Read the dependency file.
//
- protected java.util.HashMap
+ @SuppressWarnings("unchecked")
+ protected java.util.HashMap<String, SliceDependency>
readDependencies()
{
if(_dependencyFile == null)
@@ -173,7 +174,8 @@ public class SliceTask extends org.apache.tools.ant.Task
try
{
java.io.ObjectInputStream in = new java.io.ObjectInputStream(new java.io.FileInputStream(_dependencyFile));
- java.util.HashMap dependencies = (java.util.HashMap)in.readObject();
+ java.util.HashMap<String, SliceDependency> dependencies =
+ (java.util.HashMap<String, SliceDependency>)in.readObject();
in.close();
return dependencies;
}
@@ -183,12 +185,12 @@ public class SliceTask extends org.apache.tools.ant.Task
catch(java.lang.ClassNotFoundException ex)
{
}
-
+
return new java.util.HashMap();
}
protected void
- writeDependencies(java.util.HashMap dependencies)
+ writeDependencies(java.util.HashMap<String, SliceDependency> dependencies)
{
try
{
@@ -206,10 +208,10 @@ public class SliceTask extends org.apache.tools.ant.Task
// Parse dependencies returned by the slice translator (Makefile
// dependencies).
//
- protected java.util.List
+ protected java.util.List<SliceDependency>
parseDependencies(String allDependencies)
{
- java.util.List dependencies = new java.util.LinkedList();
+ java.util.List<SliceDependency> dependencies = new java.util.LinkedList<SliceDependency>();
try
{
BufferedReader in = new BufferedReader(new StringReader(allDependencies));
@@ -260,7 +262,7 @@ public class SliceTask extends org.apache.tools.ant.Task
// spaces are escaped and the initial file may have escaped colons
// (e.g., "C\:/Program\ Files/...").
//
- java.util.ArrayList l = new java.util.ArrayList();
+ java.util.ArrayList<String> l = new java.util.ArrayList<String>();
StringBuilder file = new StringBuilder(128);
pos = 0;
while(pos < chars.length)
@@ -309,9 +311,8 @@ public class SliceTask extends org.apache.tools.ant.Task
{
throw new BuildException("Unable to read dependencies from slice translator: " + ex);
}
-
- return dependencies;
+ return dependencies;
}
protected String
@@ -369,7 +370,7 @@ public class SliceTask extends org.apache.tools.ant.Task
else if(os.startsWith("Windows"))
{
//
- // No need to change the PATH environment variable on Windows, the DLLs should be found
+ // No need to change the PATH environment variable on Windows, the DLLs should be found
// in the translator local directory.
//
//ldLibPathEnv = "PATH";
@@ -461,7 +462,7 @@ public class SliceTask extends org.apache.tools.ant.Task
{
_iceHome = (String)getProject().getProperties().get("ice.home");
}
- else
+ else
{
_iceHome = getEnvironment("ICE_HOME");
}
@@ -490,7 +491,7 @@ public class SliceTask extends org.apache.tools.ant.Task
out.writeLong(_timeStamp);
}
- private void readObject(java.io.ObjectInputStream in)
+ private void readObject(java.io.ObjectInputStream in)
throws java.io.IOException, java.lang.ClassNotFoundException
{
_dependencies = (String[])in.readObject();
@@ -500,9 +501,9 @@ public class SliceTask extends org.apache.tools.ant.Task
public boolean
isUpToDate()
{
- for(int i = 0; i < _dependencies.length; ++i)
+ for(String d : _dependencies)
{
- File dep = new File(_dependencies[i]);
+ File dep = new File(d);
if(!dep.exists() || _timeStamp < dep.lastModified())
{
return false;
@@ -538,8 +539,8 @@ public class SliceTask extends org.apache.tools.ant.Task
protected boolean _caseSensitive;
protected boolean _ice;
protected Path _includePath;
- protected java.util.List _fileSets = new java.util.LinkedList();
- protected java.util.List _defines = new java.util.LinkedList();
- protected java.util.List _meta = new java.util.LinkedList();
+ protected java.util.List<FileSet> _fileSets = new java.util.LinkedList<FileSet>();
+ protected java.util.List<SliceDefine> _defines = new java.util.LinkedList<SliceDefine>();
+ protected java.util.List<SliceMeta> _meta = new java.util.LinkedList<SliceMeta>();
private String _iceHome;
}