summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2007-12-04 19:04:37 -0500
committerBernard Normier <bernard@zeroc.com>2007-12-04 19:04:37 -0500
commit8acb2a1032ace3e07f4939e9c7ef7b449f8b50b3 (patch)
treeeb8d43058cb47b13693880e622715f6ff13e0318 /java
parentFix to not retry batch requests (even idempotent ones) (diff)
downloadice-8acb2a1032ace3e07f4939e9c7ef7b449f8b50b3.tar.bz2
ice-8acb2a1032ace3e07f4939e9c7ef7b449f8b50b3.tar.xz
ice-8acb2a1032ace3e07f4939e9c7ef7b449f8b50b3.zip
New IceGrid/icebox demos and various IceBox fixes
Diffstat (limited to 'java')
-rw-r--r--java/config/build.properties2
-rw-r--r--java/demo/IceGrid/README4
-rw-r--r--java/demo/IceGrid/icebox/Client.java43
-rw-r--r--java/demo/IceGrid/icebox/Hello.ice23
-rw-r--r--java/demo/IceGrid/icebox/HelloI.java26
-rw-r--r--java/demo/IceGrid/icebox/HelloServiceI.java29
-rw-r--r--java/demo/IceGrid/icebox/README30
-rw-r--r--java/demo/IceGrid/icebox/application.xml37
-rw-r--r--java/demo/IceGrid/icebox/build.xml50
-rw-r--r--java/demo/IceGrid/icebox/config.client6
-rw-r--r--java/demo/IceGrid/icebox/config.grid43
-rw-r--r--java/demo/IceGrid/icebox/db/node/.gitignore1
-rw-r--r--java/demo/IceGrid/icebox/db/registry/.gitignore1
-rw-r--r--java/src/IceBox/ServiceManagerI.java4
14 files changed, 296 insertions, 3 deletions
diff --git a/java/config/build.properties b/java/config/build.properties
index 3232d4194f1..dc65269ca21 100644
--- a/java/config/build.properties
+++ b/java/config/build.properties
@@ -17,7 +17,7 @@ debug = on
# Set to "java2" or "java5" to select the Ice for Java mapping
# version to build. The default value is "java5".
#
-ice.mapping = java2
+ice.mapping = java5
ice.version = 3.3
diff --git a/java/demo/IceGrid/README b/java/demo/IceGrid/README
index 2586cd2df62..904deef7881 100644
--- a/java/demo/IceGrid/README
+++ b/java/demo/IceGrid/README
@@ -1,5 +1,9 @@
Demos in this directory:
+- icebox
+
+ This demo shows a simple IceGrid deployment with an IceBox server.
+
- simple
This demo illustrates the basics of using IceGrid, including the
diff --git a/java/demo/IceGrid/icebox/Client.java b/java/demo/IceGrid/icebox/Client.java
new file mode 100644
index 00000000000..2acd581c25a
--- /dev/null
+++ b/java/demo/IceGrid/icebox/Client.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2007 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.
+//
+// **********************************************************************
+
+import Demo.*;
+
+public class Client extends Ice.Application
+{
+ public int
+ run(String[] args)
+ {
+ if(args.length > 0)
+ {
+ System.err.println(appName() + ": too many arguments");
+ return 1;
+ }
+
+ HelloPrx hello = HelloPrxHelper.uncheckedCast(communicator().propertyToProxy("Hello.Proxy"));
+
+ if(hello == null)
+ {
+ System.err.println(appName() + ": Hello.Proxy not set");
+ return 1;
+ }
+
+ hello.sayHello();
+
+ return 0;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Client app = new Client();
+ int status = app.main("Client", args, "config.client");
+ System.exit(status);
+ }
+}
diff --git a/java/demo/IceGrid/icebox/Hello.ice b/java/demo/IceGrid/icebox/Hello.ice
new file mode 100644
index 00000000000..4c1331f637c
--- /dev/null
+++ b/java/demo/IceGrid/icebox/Hello.ice
@@ -0,0 +1,23 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2007 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.
+//
+// **********************************************************************
+
+#ifndef HELLO_ICE
+#define HELLO_ICE
+
+module Demo
+{
+
+interface Hello
+{
+ void sayHello();
+};
+
+};
+
+#endif
diff --git a/java/demo/IceGrid/icebox/HelloI.java b/java/demo/IceGrid/icebox/HelloI.java
new file mode 100644
index 00000000000..cf4ff4d8cbc
--- /dev/null
+++ b/java/demo/IceGrid/icebox/HelloI.java
@@ -0,0 +1,26 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2007 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.
+//
+// **********************************************************************
+
+import Demo.*;
+
+public class HelloI extends _HelloDisp
+{
+ HelloI(String serviceName)
+ {
+ _serviceName = serviceName;
+ }
+
+ public void
+ sayHello(Ice.Current current)
+ {
+ System.out.println("Hello from " + _serviceName);
+ }
+
+ private String _serviceName;
+}
diff --git a/java/demo/IceGrid/icebox/HelloServiceI.java b/java/demo/IceGrid/icebox/HelloServiceI.java
new file mode 100644
index 00000000000..5e4f933401c
--- /dev/null
+++ b/java/demo/IceGrid/icebox/HelloServiceI.java
@@ -0,0 +1,29 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2007 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.
+//
+// **********************************************************************
+
+public class HelloServiceI implements IceBox.Service
+{
+ public void
+ start(String name, Ice.Communicator communicator, String[] args)
+ {
+ _adapter = communicator.createObjectAdapter("Hello-" + name);
+
+ String helloIdentity = communicator.getProperties().getProperty("Hello.Identity");
+ _adapter.add(new HelloI(name), communicator.stringToIdentity(helloIdentity));
+ _adapter.activate();
+ }
+
+ public void
+ stop()
+ {
+ _adapter.destroy();
+ }
+
+ private Ice.ObjectAdapter _adapter;
+}
diff --git a/java/demo/IceGrid/icebox/README b/java/demo/IceGrid/icebox/README
new file mode 100644
index 00000000000..0be40a323c5
--- /dev/null
+++ b/java/demo/IceGrid/icebox/README
@@ -0,0 +1,30 @@
+This demo shows a very simple IceGrid deployment, with a single
+IceBox server hosting a number of IceBox services.
+
+Setup
+-----
+
+Start the IceGrid registry and node with:
+ $ icegridnode --Ice.Config=config.grid
+
+Deploy the 'HelloSimpsons' application (in file application.xml) with
+the IceGrid Admin graphical tool. If you prefer to use the
+command-line utility, use:
+ $ icegridadmin --Ice.Config=config.grid -e \
+ "application add 'application.xml'"
+
+Running the Client
+------------------
+
+$ java Client
+
+The client simply calls 'sayHello' on the replicated 'hello' object.
+
+Stopping and restarting IceBox services
+---------------------------------------
+
+You may use the IceGrid Admin graphical tool to stop and later
+restart IceBox services. You can do the same with the command-line
+utility; for example to stop and restart the 'Lisa' service:
+
+<TBD>
diff --git a/java/demo/IceGrid/icebox/application.xml b/java/demo/IceGrid/icebox/application.xml
new file mode 100644
index 00000000000..e2eae6d4c32
--- /dev/null
+++ b/java/demo/IceGrid/icebox/application.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- This file was written by IceGrid Admin -->
+<icegrid>
+ <application name="HelloSimpsons">
+ <service-template id="HelloService">
+ <parameter name="name"/>
+ <service name="${name}" entry="HelloServiceI">
+ <description>A very simple service named after ${name}</description>
+ <properties>
+ <property name="Hello.Identity" value="hello"/>
+ </properties>
+ <adapter name="Hello-${name}" endpoints="default" id="Hello-${name}" replica-group="HelloGroup" server-lifetime="false"/>
+ </service>
+ </service-template>
+ <replica-group id="HelloGroup">
+ <load-balancing type="round-robin" n-replicas="1"/>
+ <object identity="hello" type="::Demo::Hello"/>
+ </replica-group>
+ <node name="localhost">
+ <icebox id="IceBox" activation="on-demand" exe="java">
+ <description>A sample IceBox server</description>
+ <option>IceBox.Server</option>
+ <env>CLASSPATH=$CLASSPATH:classes</env>
+ <properties>
+ <property name="IceBox.InstanceName" value="${server}"/>
+ <property name="Ice.Admin.Endpoints" value="tcp -h 127.0.0.1"/>
+ <property name="IceBox.Trace.ServiceObserver" value="1"/>
+ </properties>
+ <service-instance template="HelloService" name="Homer"/>
+ <service-instance template="HelloService" name="Marge"/>
+ <service-instance template="HelloService" name="Bart"/>
+ <service-instance template="HelloService" name="Lisa"/>
+ <service-instance template="HelloService" name="Maggie"/>
+ </icebox>
+ </node>
+ </application>
+</icegrid>
diff --git a/java/demo/IceGrid/icebox/build.xml b/java/demo/IceGrid/icebox/build.xml
new file mode 100644
index 00000000000..7421f88d068
--- /dev/null
+++ b/java/demo/IceGrid/icebox/build.xml
@@ -0,0 +1,50 @@
+<!--
+ **********************************************************************
+
+ Copyright (c) 2003-2007 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.
+
+ **********************************************************************
+-->
+
+<project name="demo_IceGrid_icebox" default="all" basedir=".">
+
+ <!-- set global properties for this build -->
+ <property name="top.dir" value="../../.."/>
+
+ <!-- import common definitions -->
+ <import file="${top.dir}/config/common.xml"/>
+
+ <target name="generate" depends="init">
+ <!-- Create the output directory for generated code -->
+ <mkdir dir="${generated.dir}"/>
+ <slice2java outputdir="${generated.dir}">
+ <meta value="${java2metadata}"/>
+ <fileset dir="." includes="Hello.ice"/>
+ </slice2java>
+ </target>
+
+ <target name="compile" depends="generate">
+ <mkdir dir="${class.dir}"/>
+ <javac srcdir="${generated.dir}" destdir="${class.dir}"
+ source="${jdk.version}" debug="${debug}">
+ <classpath refid="ice.classpath"/>
+ <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/>
+ </javac>
+ <javac srcdir="." destdir="${class.dir}" source="${jdk.version}"
+ excludes="generated/**" debug="${debug}">
+ <classpath refid="ice.classpath"/>
+ <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/>
+ </javac>
+ </target>
+
+ <target name="all" depends="compile"/>
+
+ <target name="clean">
+ <delete dir="${generated.dir}"/>
+ <delete dir="${class.dir}"/>
+ </target>
+
+</project>
diff --git a/java/demo/IceGrid/icebox/config.client b/java/demo/IceGrid/icebox/config.client
new file mode 100644
index 00000000000..98bd1ac6b22
--- /dev/null
+++ b/java/demo/IceGrid/icebox/config.client
@@ -0,0 +1,6 @@
+Hello.Proxy=hello
+
+#
+# The IceGrid locator proxy.
+#
+Ice.Default.Locator=DemoIceGrid/Locator:default -p 4061
diff --git a/java/demo/IceGrid/icebox/config.grid b/java/demo/IceGrid/icebox/config.grid
new file mode 100644
index 00000000000..4766cfe7a6a
--- /dev/null
+++ b/java/demo/IceGrid/icebox/config.grid
@@ -0,0 +1,43 @@
+IceGrid.InstanceName=DemoIceGrid
+
+#
+# The IceGrid locator proxy.
+#
+Ice.Default.Locator=DemoIceGrid/Locator:default -p 4061
+
+#
+# IceGrid registry configuration.
+#
+IceGrid.Registry.Client.Endpoints=default -p 4061
+IceGrid.Registry.Server.Endpoints=default
+IceGrid.Registry.Internal.Endpoints=default
+IceGrid.Registry.AdminCallbackRouter.Endpoints=default
+IceGrid.Registry.Data=db/registry
+IceGrid.Registry.PermissionsVerifier=DemoIceGrid/NullPermissionsVerifier
+IceGrid.Registry.AdminPermissionsVerifier=DemoIceGrid/NullPermissionsVerifier
+IceGrid.Registry.SSLPermissionsVerifier=DemoIceGrid/NullSSLPermissionsVerifier
+IceGrid.Registry.AdminSSLPermissionsVerifier=DemoIceGrid/NullSSLPermissionsVerifier
+
+#
+# IceGrid node configuration.
+#
+IceGrid.Node.Name=localhost
+IceGrid.Node.Endpoints=default
+IceGrid.Node.Data=db/node
+IceGrid.Node.CollocateRegistry=1
+#IceGrid.Node.Output=db
+#IceGrid.Node.RedirectErrToOut=1
+
+#
+# Trace properties.
+#
+IceGrid.Node.Trace.Activator=1
+IceGrid.Node.Trace.Patch=1
+#IceGrid.Node.Trace.Adapter=2
+#IceGrid.Node.Trace.Server=3
+
+#
+# Dummy username and password for icegridadmin.
+#
+IceGridAdmin.Username=foo
+IceGridAdmin.Password=bar
diff --git a/java/demo/IceGrid/icebox/db/node/.gitignore b/java/demo/IceGrid/icebox/db/node/.gitignore
new file mode 100644
index 00000000000..39af5887579
--- /dev/null
+++ b/java/demo/IceGrid/icebox/db/node/.gitignore
@@ -0,0 +1 @@
+# Dummy file, so that git retains this otherwise empty directory.
diff --git a/java/demo/IceGrid/icebox/db/registry/.gitignore b/java/demo/IceGrid/icebox/db/registry/.gitignore
new file mode 100644
index 00000000000..39af5887579
--- /dev/null
+++ b/java/demo/IceGrid/icebox/db/registry/.gitignore
@@ -0,0 +1 @@
+# Dummy file, so that git retains this otherwise empty directory.
diff --git a/java/src/IceBox/ServiceManagerI.java b/java/src/IceBox/ServiceManagerI.java
index ff930bf77f4..f9a0b88abe8 100644
--- a/java/src/IceBox/ServiceManagerI.java
+++ b/java/src/IceBox/ServiceManagerI.java
@@ -164,7 +164,7 @@ public class ServiceManagerI extends _ServiceManagerDisp
if(_traceServiceObserver >= 1)
{
_logger.trace("IceBox.ServiceObserver",
- "Added service observer: " + _server.communicator().proxyToString(observer));
+ "Added service observer " + _server.communicator().proxyToString(observer));
}
@@ -834,7 +834,7 @@ public class ServiceManagerI extends _ServiceManagerDisp
if(_traceServiceObserver >= 1)
{
_logger.trace("IceBox.ServiceObserver",
- "Removed service observer: " + _server.communicator().proxyToString(observer)
+ "Removed service observer " + _server.communicator().proxyToString(observer)
+ "\nafter catching " + ex.toString());
}
}