summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2006-04-03 18:46:24 +0000
committerBernard Normier <bernard@zeroc.com>2006-04-03 18:46:24 +0000
commit5f5af262326ddf51074f78182d8b0b09f8343d44 (patch)
treede49a7b753f131a7f52674f04983932708bb9fbf /java/src
parentFix bug 874 (diff)
downloadice-5f5af262326ddf51074f78182d8b0b09f8343d44.tar.bz2
ice-5f5af262326ddf51074f78182d8b0b09f8343d44.tar.xz
ice-5f5af262326ddf51074f78182d8b0b09f8343d44.zip
Added support for import-default-templates in parsed files
Diffstat (limited to 'java/src')
-rwxr-xr-xjava/src/IceGridGUI/AdminRouter.java55
-rwxr-xr-xjava/src/IceGridGUI/Application/AdapterEditor.java2
-rwxr-xr-xjava/src/IceGridGUI/Application/Communicator.java6
-rwxr-xr-xjava/src/IceGridGUI/Application/ServerTemplates.java8
-rwxr-xr-xjava/src/IceGridGUI/Application/ServiceTemplates.java8
-rwxr-xr-xjava/src/IceGridGUI/Coordinator.java62
-rwxr-xr-xjava/src/IceGridGUI/MainPane.java2
7 files changed, 125 insertions, 18 deletions
diff --git a/java/src/IceGridGUI/AdminRouter.java b/java/src/IceGridGUI/AdminRouter.java
new file mode 100755
index 00000000000..69ec2a7f99a
--- /dev/null
+++ b/java/src/IceGridGUI/AdminRouter.java
@@ -0,0 +1,55 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 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;
+
+import IceGrid.*;
+
+class AdminRouter extends Ice.Blobject
+{
+ 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);
+ }
+ else if(current.operation.equals("ice_id") ||
+ current.operation.equals("ice_ids") ||
+ current.operation.equals("ice_isA") ||
+ current.operation.equals("ice_ping") ||
+ current.operation.equals("getDefaultApplicationDescriptor"))
+ {
+
+ 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);
+ }
+ }
+
+ synchronized void setAdmin(AdminPrx admin)
+ {
+ _admin = admin;
+ }
+
+ private AdminPrx _admin;
+}
diff --git a/java/src/IceGridGUI/Application/AdapterEditor.java b/java/src/IceGridGUI/Application/AdapterEditor.java
index d4059a79d06..c75d66c5c6a 100755
--- a/java/src/IceGridGUI/Application/AdapterEditor.java
+++ b/java/src/IceGridGUI/Application/AdapterEditor.java
@@ -61,7 +61,7 @@ class AdapterEditor extends CommunicatorChildEditor
else
{
String replicaGroupId =
- adapter.getResolver().substitute(obj.toString());
+ Utils.substitute(obj.toString(), adapter.getResolver());
rg = adapter.getRoot().findReplicaGroup(replicaGroupId);
}
diff --git a/java/src/IceGridGUI/Application/Communicator.java b/java/src/IceGridGUI/Application/Communicator.java
index 741cc63d487..c3065cdb32a 100755
--- a/java/src/IceGridGUI/Application/Communicator.java
+++ b/java/src/IceGridGUI/Application/Communicator.java
@@ -590,7 +590,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
TreeNode createChild(Object descriptor)
{
AdapterDescriptor ad = (AdapterDescriptor)descriptor;
- String name = getResolver().substitute(ad.name);
+ String name = Utils.substitute(ad.name, getResolver());
return new Adapter(Communicator.this, name, ad, false);
}
@@ -637,7 +637,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
TreeNode createChild(Object descriptor)
{
DbEnvDescriptor dd = (DbEnvDescriptor)descriptor;
- String name = getResolver().substitute(dd.name);
+ String name = Utils.substitute(dd.name, getResolver());
return new DbEnv(Communicator.this, name, dd, false);
}
@@ -777,7 +777,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
if(Communicator.this instanceof Server)
{
serviceResolver = new Utils.Resolver(getResolver());
- serviceName = getResolver().substitute(serviceDescriptor.name);
+ serviceName = serviceResolver.substitute(serviceDescriptor.name);
serviceResolver.put("service", serviceName);
}
else
diff --git a/java/src/IceGridGUI/Application/ServerTemplates.java b/java/src/IceGridGUI/Application/ServerTemplates.java
index 3056bc13002..735fe38218c 100755
--- a/java/src/IceGridGUI/Application/ServerTemplates.java
+++ b/java/src/IceGridGUI/Application/ServerTemplates.java
@@ -103,6 +103,14 @@ class ServerTemplates extends Templates
}
}
+ //
+ // Variable resolution does not make sense for templates / template children
+ //
+ Utils.Resolver getResolver()
+ {
+ return null;
+ }
+
java.util.Map getUpdates()
{
java.util.Map updates = new java.util.HashMap();
diff --git a/java/src/IceGridGUI/Application/ServiceTemplates.java b/java/src/IceGridGUI/Application/ServiceTemplates.java
index b94ae2b920f..2c8386f89d6 100755
--- a/java/src/IceGridGUI/Application/ServiceTemplates.java
+++ b/java/src/IceGridGUI/Application/ServiceTemplates.java
@@ -105,6 +105,14 @@ class ServiceTemplates extends Templates
}
}
+ //
+ // Variable resolution does not make sense for templates / template children
+ //
+ Utils.Resolver getResolver()
+ {
+ return null;
+ }
+
void newServiceTemplate(TemplateDescriptor descriptor)
{
String id = makeNewChildId("NewServiceTemplate");
diff --git a/java/src/IceGridGUI/Coordinator.java b/java/src/IceGridGUI/Coordinator.java
index 7dc5bf58a82..259a5df50f5 100755
--- a/java/src/IceGridGUI/Coordinator.java
+++ b/java/src/IceGridGUI/Coordinator.java
@@ -558,7 +558,6 @@ public class Coordinator
try
{
_writeSerial = _sessionKeeper.getSession().startUpdate();
- System.err.println("Write serial is: " + _writeSerial);
}
finally
{
@@ -594,7 +593,6 @@ public class Coordinator
{
if(--_writeAccessCount == 0)
{
- System.err.println("finishUpdate");
try
{
_writeSerial = -1;
@@ -656,7 +654,7 @@ public class Coordinator
_writeSerial = -1;
_writeAccessCount = 0;
_onExclusiveWrite = null;
- _admin = null;
+ setAdmin(null);
_liveDeploymentRoot.clear();
//
@@ -812,7 +810,7 @@ public class Coordinator
//
try
{
- _admin = session.getAdmin();
+ setAdmin(session.getAdmin());
}
catch(Ice.LocalException e)
{
@@ -1011,15 +1009,9 @@ public class Coordinator
}
}
- //
- // TODO: create a local admin object (with a direct proxy) that routes
- // getDefaultApplicationDescriptor() to the real admin
- //
- AdminPrx admin = null;
-
try
{
- return _fileParser.parse(file.getAbsolutePath(), admin);
+ return _fileParser.parse(file.getAbsolutePath(), getRoutedAdmin());
}
catch(ParseException e)
{
@@ -1057,6 +1049,48 @@ public class Coordinator
}
}
+ private AdminPrx getRoutedAdmin()
+ {
+ if(_admin == null)
+ {
+ return null;
+ }
+ else
+ {
+ if(_routedAdmin == null)
+ {
+ //
+ // Create a local Admin object used to route some operations to the real
+ // Admin.
+ // Routing admin calls is even necessary when we don't through Glacier
+ // since the Admin object provided by the Registry is a well-known object
+ // (indirect, locator-dependent).
+ //
+ _adminRouterAdapter = _communicator.
+ createObjectAdapterWithEndpoints("IceGrid.AdminRouter", "tcp -h localhost");
+
+ _adminRouter = new AdminRouter();
+ _adminRouter.setAdmin(_admin);
+
+ _routedAdmin = AdminPrxHelper.uncheckedCast(
+ _adminRouterAdapter.addWithUUID(_adminRouter));
+
+ _adminRouterAdapter.activate();
+ }
+ }
+ return _routedAdmin;
+ }
+
+ private void setAdmin(AdminPrx admin)
+ {
+ _admin = admin;
+ if(_adminRouter != null)
+ {
+ _adminRouter.setAdmin(admin);
+ }
+ }
+
+
public File saveToFile(boolean ask, IceGridGUI.Application.Root root,
File file)
{
@@ -1485,7 +1519,7 @@ public class Coordinator
_liveDeploymentPane = new LiveDeploymentPane(_liveDeploymentRoot);
_mainPane = new MainPane(this);
- _mainFrame.getContentPane().add(_mainPane, BorderLayout.CENTER);
+ _mainFrame.getContentPane().add(_mainPane, BorderLayout.CENTER);
}
JComponent getLiveDeploymentPane()
@@ -1823,6 +1857,10 @@ public class Coordinator
private Ice.ObjectAdapter _localAdapter;
private Ice.ObjectAdapter _routedAdapter;
+ private Ice.ObjectAdapter _adminRouterAdapter;
+ private AdminPrx _routedAdmin;
+ private AdminRouter _adminRouter;
+
private IceGridGUI.LiveDeployment.Root _liveDeploymentRoot;
private LiveDeploymentPane _liveDeploymentPane;
diff --git a/java/src/IceGridGUI/MainPane.java b/java/src/IceGridGUI/MainPane.java
index 0384fe3f92c..2a6835e8a8f 100755
--- a/java/src/IceGridGUI/MainPane.java
+++ b/java/src/IceGridGUI/MainPane.java
@@ -31,11 +31,9 @@ public class MainPane extends JTabbedPane
public void resetTitle(IceGridGUI.Application.Root root)
{
- System.err.println("Reset title");
int i = findIndex(root);
if(i > 0)
{
- System.err.println("New title:" + root.getId());
setTitleAt(i, root.getId());
}
}