summaryrefslogtreecommitdiff
path: root/java/demo
diff options
context:
space:
mode:
Diffstat (limited to 'java/demo')
-rw-r--r--java/demo/IceGrid/README8
-rw-r--r--java/demo/IceGrid/allocate/.gitignore2
-rw-r--r--java/demo/IceGrid/allocate/Client.java271
-rw-r--r--java/demo/IceGrid/allocate/Hello.ice24
-rw-r--r--java/demo/IceGrid/allocate/HelloI.java33
-rw-r--r--java/demo/IceGrid/allocate/README35
-rw-r--r--java/demo/IceGrid/allocate/Server.java31
-rw-r--r--java/demo/IceGrid/allocate/application-multiple.xml33
-rw-r--r--java/demo/IceGrid/allocate/application-single.xml27
-rw-r--r--java/demo/IceGrid/allocate/build.xml54
-rw-r--r--java/demo/IceGrid/allocate/config.client4
-rw-r--r--java/demo/IceGrid/allocate/config.grid42
-rw-r--r--java/demo/IceGrid/allocate/db/node/.gitignore1
-rw-r--r--java/demo/IceGrid/allocate/db/registry/.gitignore1
-rw-r--r--java/demo/IceGrid/build.xml4
-rw-r--r--java/demo/IceGrid/sessionActivation/.gitignore2
-rw-r--r--java/demo/IceGrid/sessionActivation/Client.java256
-rw-r--r--java/demo/IceGrid/sessionActivation/Hello.ice23
-rw-r--r--java/demo/IceGrid/sessionActivation/HelloI.java26
-rw-r--r--java/demo/IceGrid/sessionActivation/README18
-rw-r--r--java/demo/IceGrid/sessionActivation/Server.java31
-rw-r--r--java/demo/IceGrid/sessionActivation/application.xml27
-rw-r--r--java/demo/IceGrid/sessionActivation/build.xml54
-rw-r--r--java/demo/IceGrid/sessionActivation/config.client4
-rw-r--r--java/demo/IceGrid/sessionActivation/config.grid42
-rw-r--r--java/demo/IceGrid/sessionActivation/db/node/.gitignore1
-rw-r--r--java/demo/IceGrid/sessionActivation/db/registry/.gitignore1
-rw-r--r--java/demo/README3
28 files changed, 3 insertions, 1055 deletions
diff --git a/java/demo/IceGrid/README b/java/demo/IceGrid/README
index da1160e9052..2586cd2df62 100644
--- a/java/demo/IceGrid/README
+++ b/java/demo/IceGrid/README
@@ -1,13 +1,5 @@
Demos in this directory:
-- allocate
-
- This demo shows how to use the allocation feature of IceGrid.
-
-- sessionActivation
-
- This demo shows the use of the session activation mode.
-
- simple
This demo illustrates the basics of using IceGrid, including the
diff --git a/java/demo/IceGrid/allocate/.gitignore b/java/demo/IceGrid/allocate/.gitignore
deleted file mode 100644
index 3e9f78f05d8..00000000000
--- a/java/demo/IceGrid/allocate/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-db/registry/*
-db/node/*
diff --git a/java/demo/IceGrid/allocate/Client.java b/java/demo/IceGrid/allocate/Client.java
deleted file mode 100644
index 806f95b6f73..00000000000
--- a/java/demo/IceGrid/allocate/Client.java
+++ /dev/null
@@ -1,271 +0,0 @@
-// **********************************************************************
-//
-// 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
-{
- class ShutdownHook extends Thread
- {
- public void
- run()
- {
- cleanup();
- try
- {
- communicator().destroy();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
- }
- }
-
- static private class SessionKeepAliveThread extends Thread
- {
- SessionKeepAliveThread(IceGrid.SessionPrx session, long timeout)
- {
- _session = session;
- _timeout = timeout;
- _terminated = false;
- }
-
- synchronized public void
- run()
- {
- while(!_terminated)
- {
- try
- {
- wait(_timeout);
- }
- catch(InterruptedException e)
- {
- }
- if(_terminated)
- {
- break;
- }
- try
- {
- _session.keepAlive();
- }
- catch(Ice.LocalException ex)
- {
- break;
- }
- }
- }
-
- synchronized private void
- terminate()
- {
- _terminated = true;
- notify();
- }
-
- final private IceGrid.SessionPrx _session;
- final private long _timeout;
- private boolean _terminated;
- }
-
- private void
- menu()
- {
- System.out.println(
- "usage:\n" +
- "t: send greeting\n" +
- "s: shutdown server\n" +
- "x: exit\n" +
- "?: help\n");
- }
-
- public int
- run(String[] args)
- {
- //
- // Since this is an interactive demo we want to clear the
- // Application installed interrupt callback and install our
- // own shutdown hook.
- //
- setInterruptHook(new ShutdownHook());
-
- int status = 0;
- IceGrid.RegistryPrx registry =
- IceGrid.RegistryPrxHelper.checkedCast(communicator().stringToProxy("DemoIceGrid/Registry"));
- if(registry == null)
- {
- System.err.println("could not contact registry");
- return 1;
- }
-
- java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
- while(true)
- {
- System.out.println("This demo accepts any user-id / password combination.");
-
- try
- {
- String id;
- System.out.print("user id: ");
- System.out.flush();
- id = in.readLine();
-
- String pw;
- System.out.print("password: ");
- System.out.flush();
- pw = in.readLine();
-
- try
- {
- synchronized(this)
- {
- _session = registry.createSession(id, pw);
- }
- break;
- }
- catch(IceGrid.PermissionDeniedException ex)
- {
- System.out.println("permission denied:\n" + ex.reason);
- }
- }
- catch(java.io.IOException ex)
- {
- ex.printStackTrace();
- }
- }
-
- synchronized(this)
- {
- _keepAlive = new SessionKeepAliveThread(_session, registry.getSessionTimeout() / 2);
- _keepAlive.start();
- }
-
- try
- {
- //
- // First try to retrieve object by identity, which will
- // work if the application-single.xml descriptor is
- // used. Otherwise we retrieve object by type, which will
- // succeed if the application-multiple.xml descriptor is
- // used.
- //
- HelloPrx hello;
- try
- {
- hello = HelloPrxHelper.checkedCast(
- _session.allocateObjectById(communicator().stringToIdentity("hello")));
- }
- catch(IceGrid.ObjectNotRegisteredException ex)
- {
- hello = HelloPrxHelper.checkedCast(_session.allocateObjectByType("::Demo::Hello"));
- }
-
- menu();
-
- String line = null;
- do
- {
- try
- {
- System.out.print("==> ");
- System.out.flush();
- line = in.readLine();
- if(line == null)
- {
- break;
- }
- if(line.equals("t"))
- {
- hello.sayHello();
- }
- else if(line.equals("s"))
- {
- hello.shutdown();
- }
- else if(line.equals("x"))
- {
- // Nothing to do
- }
- else if(line.equals("?"))
- {
- menu();
- }
- else
- {
- System.out.println("unknown command `" + line + "'");
- menu();
- }
- }
- catch(java.io.IOException ex)
- {
- ex.printStackTrace();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
- }
- while(!line.equals("x"));
- }
- catch(IceGrid.AllocationException ex)
- {
- System.err.println("could not allocate object: " + ex.reason);
- status = 1;
- }
- catch(Exception ex)
- {
- System.err.println("expected exception: " + ex);
- status = 1;
- }
-
- cleanup();
-
- return status;
- }
-
- synchronized void
- cleanup()
- {
- //
- // Destroy the keepAlive thread and the sesion object otherwise
- // the session will be kept allocated until the timeout occurs.
- // Destroying the session will release all allocated objects.
- //
- if(_keepAlive != null)
- {
- _keepAlive.terminate();
- try
- {
- _keepAlive.join();
- }
- catch(InterruptedException e)
- {
- }
- _keepAlive = null;
- }
- if(_session != null)
- {
- _session.destroy();
- _session = null;
- }
- }
-
- public static void
- main(String[] args)
- {
- Client app = new Client();
- int status = app.main("Client", args, "config.client");
- System.exit(status);
- }
-
- SessionKeepAliveThread _keepAlive;
- IceGrid.SessionPrx _session;
-}
diff --git a/java/demo/IceGrid/allocate/Hello.ice b/java/demo/IceGrid/allocate/Hello.ice
deleted file mode 100644
index f6e0682d2a6..00000000000
--- a/java/demo/IceGrid/allocate/Hello.ice
+++ /dev/null
@@ -1,24 +0,0 @@
-// **********************************************************************
-//
-// 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
-{
- idempotent void sayHello();
- void shutdown();
-};
-
-};
-
-#endif
diff --git a/java/demo/IceGrid/allocate/HelloI.java b/java/demo/IceGrid/allocate/HelloI.java
deleted file mode 100644
index 39bfae4682d..00000000000
--- a/java/demo/IceGrid/allocate/HelloI.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// **********************************************************************
-//
-// 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
-{
- public HelloI(String name)
- {
- _name = name;
- }
-
- public void
- sayHello(Ice.Current current)
- {
- System.out.println(_name + " says Hello World!");
- }
-
- public void
- shutdown(Ice.Current current)
- {
- System.out.println(_name + " shutting down...");
- current.adapter.getCommunicator().shutdown();
- }
-
- private final String _name;
-}
diff --git a/java/demo/IceGrid/allocate/README b/java/demo/IceGrid/allocate/README
deleted file mode 100644
index 06178e8ae5f..00000000000
--- a/java/demo/IceGrid/allocate/README
+++ /dev/null
@@ -1,35 +0,0 @@
-To run the demo, first start the IceGrid service:
-
-$ icegridnode --Ice.Config=config.grid
-
-This demo contains two application descriptor files. The first
-descriptor, application-single.xml, contains a single server and
-object. This object is allocated by the client using the
-allocateObjectById operation. Only one client can access this object
-at a time. All other clients will hang until the object is released.
-Use the following command to deploy this descriptor:
-
-$ icegridadmin --Ice.Config=config.grid -e \
- "application add 'application-single.xml'"
-
-The second descriptor, application-multiple.xml, contains two servers,
-each with an object. The clients retrieve these objects using
-allocateObjectByType. Since there are two objects available, two
-clients can get access simultaneously. Additional clients will hang
-until one of the clients with an allocated object releases it. Use the
-following command to deploy this descriptor:
-
-$ icegridadmin --Ice.Config=config.grid -e \
- "application add 'application-multiple.xml'"
-
-To run the client type:
-
-$ java Client
-
-If you have already deployed the application, you can update it to try
-a different set of descriptors, for example:
-
-$ icegridadmin --Ice.Config=config.grid -e \
- "application update 'application-multiple.xml'"
-
-Messages will be displayed in the IceGrid service window.
diff --git a/java/demo/IceGrid/allocate/Server.java b/java/demo/IceGrid/allocate/Server.java
deleted file mode 100644
index 1c7722e7a71..00000000000
--- a/java/demo/IceGrid/allocate/Server.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// **********************************************************************
-//
-// 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 Server extends Ice.Application
-{
- public int
- run(String[] args)
- {
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello");
- Ice.Properties properties = communicator().getProperties();
- Ice.Identity id = communicator().stringToIdentity(properties.getProperty("Identity"));
- adapter.add(new HelloI(properties.getProperty("Ice.ServerId")), id);
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
- }
-
- static public void
- main(String[] args)
- {
- Server app = new Server();
- int status = app.main("Server", args);
- System.exit(status);
- }
-}
diff --git a/java/demo/IceGrid/allocate/application-multiple.xml b/java/demo/IceGrid/allocate/application-multiple.xml
deleted file mode 100644
index 1ccd203b3b2..00000000000
--- a/java/demo/IceGrid/allocate/application-multiple.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!--
- **********************************************************************
-
- 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.
-
- **********************************************************************
--->
-
-<icegrid>
-
- <application name="Allocate">
-
- <server-template id="AllocateServer">
- <parameter name="index"/>
- <server id="AllocateServer-${index}" exe="java" activation="on-demand">
- <option>Server</option>
- <adapter name="Hello" endpoints="tcp" register-process="true">
- <allocatable identity="hello-${index}" type="::Demo::Hello" property="Identity"/>
- </adapter>
- </server>
- </server-template>
-
- <node name="localhost">
- <server-instance template="AllocateServer" index="1"/>
- <server-instance template="AllocateServer" index="2"/>
- </node>
-
- </application>
-
-</icegrid>
diff --git a/java/demo/IceGrid/allocate/application-single.xml b/java/demo/IceGrid/allocate/application-single.xml
deleted file mode 100644
index f830d38132d..00000000000
--- a/java/demo/IceGrid/allocate/application-single.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<!--
- **********************************************************************
-
- 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.
-
- **********************************************************************
--->
-
-<icegrid>
-
- <application name="Allocate">
-
- <node name="localhost">
- <server id="AllocateServer" exe="java" activation="on-demand">
- <option>Server</option>
- <adapter name="Hello" endpoints="tcp" register-process="true">
- <allocatable identity="hello" type="::Demo::Hello" property="Identity"/>
- </adapter>
- </server>
- </node>
-
- </application>
-
-</icegrid>
diff --git a/java/demo/IceGrid/allocate/build.xml b/java/demo/IceGrid/allocate/build.xml
deleted file mode 100644
index 6619ade4480..00000000000
--- a/java/demo/IceGrid/allocate/build.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<!--
- **********************************************************************
-
- 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_allocate" 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}"/>
- <delete quiet="true" includeEmptyDirs="true">
- <fileset dir="db/node" excludes=".gitignore"/>
- <fileset dir="db/registry" excludes=".gitignore"/>
- </delete>
- </target>
-
-</project>
diff --git a/java/demo/IceGrid/allocate/config.client b/java/demo/IceGrid/allocate/config.client
deleted file mode 100644
index 78100695847..00000000000
--- a/java/demo/IceGrid/allocate/config.client
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-# The IceGrid locator proxy.
-#
-Ice.Default.Locator=DemoIceGrid/Locator:default -p 12000
diff --git a/java/demo/IceGrid/allocate/config.grid b/java/demo/IceGrid/allocate/config.grid
deleted file mode 100644
index 3ca2082ddfb..00000000000
--- a/java/demo/IceGrid/allocate/config.grid
+++ /dev/null
@@ -1,42 +0,0 @@
-IceGrid.InstanceName=DemoIceGrid
-
-#
-# The IceGrid locator proxy.
-#
-Ice.Default.Locator=DemoIceGrid/Locator:default -p 12000
-
-#
-# IceGrid registry configuration.
-#
-IceGrid.Registry.Client.Endpoints=default -p 12000
-IceGrid.Registry.Server.Endpoints=default
-IceGrid.Registry.Internal.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/allocate/db/node/.gitignore b/java/demo/IceGrid/allocate/db/node/.gitignore
deleted file mode 100644
index 39af5887579..00000000000
--- a/java/demo/IceGrid/allocate/db/node/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-# Dummy file, so that git retains this otherwise empty directory.
diff --git a/java/demo/IceGrid/allocate/db/registry/.gitignore b/java/demo/IceGrid/allocate/db/registry/.gitignore
deleted file mode 100644
index 39af5887579..00000000000
--- a/java/demo/IceGrid/allocate/db/registry/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-# Dummy file, so that git retains this otherwise empty directory.
diff --git a/java/demo/IceGrid/build.xml b/java/demo/IceGrid/build.xml
index e23f90bbb80..e6e86ab4fda 100644
--- a/java/demo/IceGrid/build.xml
+++ b/java/demo/IceGrid/build.xml
@@ -13,14 +13,10 @@
<target name="all">
<ant dir="simple"/>
- <ant dir="sessionActivation"/>
- <ant dir="allocate"/>
</target>
<target name="clean">
<ant dir="simple" target="clean"/>
- <ant dir="sessionActivation" target="clean"/>
- <ant dir="allocate" target="clean"/>
</target>
</project>
diff --git a/java/demo/IceGrid/sessionActivation/.gitignore b/java/demo/IceGrid/sessionActivation/.gitignore
deleted file mode 100644
index 3e9f78f05d8..00000000000
--- a/java/demo/IceGrid/sessionActivation/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-db/registry/*
-db/node/*
diff --git a/java/demo/IceGrid/sessionActivation/Client.java b/java/demo/IceGrid/sessionActivation/Client.java
deleted file mode 100644
index f16c19c13a0..00000000000
--- a/java/demo/IceGrid/sessionActivation/Client.java
+++ /dev/null
@@ -1,256 +0,0 @@
-// **********************************************************************
-//
-// 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
-{
- class ShutdownHook extends Thread
- {
- public void
- run()
- {
- cleanup();
- try
- {
- communicator().destroy();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
- }
- }
-
- static private class SessionKeepAliveThread extends Thread
- {
- SessionKeepAliveThread(IceGrid.SessionPrx session, long timeout)
- {
- _session = session;
- _timeout = timeout;
- _terminated = false;
- }
-
- synchronized public void
- run()
- {
- while(!_terminated)
- {
- try
- {
- wait(_timeout);
- }
- catch(InterruptedException e)
- {
- }
- if(_terminated)
- {
- break;
- }
- try
- {
- _session.keepAlive();
- }
- catch(Ice.LocalException ex)
- {
- break;
- }
- }
- }
-
- synchronized private void
- terminate()
- {
- _terminated = true;
- notify();
- }
-
- final private IceGrid.SessionPrx _session;
- final private long _timeout;
- private boolean _terminated;
- }
-
- private void
- menu()
- {
- System.out.println(
- "usage:\n" +
- "t: send greeting\n" +
- "x: exit\n" +
- "?: help\n");
- }
-
- public int
- run(String[] args)
- {
- //
- // Since this is an interactive demo we want to clear the
- // Application installed interrupt callback and install our
- // own shutdown hook.
- //
- setInterruptHook(new ShutdownHook());
-
- int status = 0;
- IceGrid.RegistryPrx registry =
- IceGrid.RegistryPrxHelper.checkedCast(communicator().stringToProxy("DemoIceGrid/Registry"));
- if(registry == null)
- {
- System.err.println("could not contact registry");
- return 1;
- }
-
- java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
- while(true)
- {
- System.out.println("This demo accepts any user-id / password combination.");
-
- try
- {
- String id;
- System.out.print("user id: ");
- System.out.flush();
- id = in.readLine();
-
- String pw;
- System.out.print("password: ");
- System.out.flush();
- pw = in.readLine();
-
- try
- {
- synchronized(this)
- {
- _session = registry.createSession(id, pw);
- }
- break;
- }
- catch(IceGrid.PermissionDeniedException ex)
- {
- System.out.println("permission denied:\n" + ex.reason);
- }
- }
- catch(java.io.IOException ex)
- {
- ex.printStackTrace();
- }
- }
-
- synchronized(this)
- {
- _keepAlive = new SessionKeepAliveThread(_session, registry.getSessionTimeout() / 2);
- _keepAlive.start();
- }
-
- try
- {
- HelloPrx hello = HelloPrxHelper.checkedCast(
- _session.allocateObjectById(communicator().stringToIdentity("hello")));
-
- menu();
-
- String line = null;
- do
- {
- try
- {
- System.out.print("==> ");
- System.out.flush();
- line = in.readLine();
- if(line == null)
- {
- break;
- }
- if(line.equals("t"))
- {
- hello.sayHello();
- }
- else if(line.equals("x"))
- {
- // Nothing to do
- }
- else if(line.equals("?"))
- {
- menu();
- }
- else
- {
- System.out.println("unknown command `" + line + "'");
- menu();
- }
- }
- catch(java.io.IOException ex)
- {
- ex.printStackTrace();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
- }
- while(!line.equals("x"));
- }
- catch(IceGrid.AllocationException ex)
- {
- System.err.println("could not allocate object: " + ex.reason);
- status = 1;
- }
- catch(IceGrid.ObjectNotRegisteredException ex)
- {
- System.err.println("object not registered with registry");
- status = 1;
- }
- catch(Exception ex)
- {
- System.err.println("expected exception: " + ex);
- status = 1;
- }
-
- cleanup();
-
- return status;
- }
-
- synchronized void
- cleanup()
- {
- //
- // Destroy the keepAlive thread and the sesion object otherwise
- // the session will be kept allocated until the timeout occurs.
- // Destroying the session will release all allocated objects.
- //
- if(_keepAlive != null)
- {
- _keepAlive.terminate();
- try
- {
- _keepAlive.join();
- }
- catch(InterruptedException e)
- {
- }
- _keepAlive = null;
- }
- if(_session != null)
- {
- _session.destroy();
- _session = null;
- }
- }
-
- public static void
- main(String[] args)
- {
- Client app = new Client();
- int status = app.main("Client", args, "config.client");
- System.exit(status);
- }
-
- SessionKeepAliveThread _keepAlive;
- IceGrid.SessionPrx _session;
-}
diff --git a/java/demo/IceGrid/sessionActivation/Hello.ice b/java/demo/IceGrid/sessionActivation/Hello.ice
deleted file mode 100644
index 5bc96c90c7b..00000000000
--- a/java/demo/IceGrid/sessionActivation/Hello.ice
+++ /dev/null
@@ -1,23 +0,0 @@
-// **********************************************************************
-//
-// 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
-{
- idempotent void sayHello();
-};
-
-};
-
-#endif
diff --git a/java/demo/IceGrid/sessionActivation/HelloI.java b/java/demo/IceGrid/sessionActivation/HelloI.java
deleted file mode 100644
index 9d24965de41..00000000000
--- a/java/demo/IceGrid/sessionActivation/HelloI.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// **********************************************************************
-//
-// 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
-{
- public HelloI(String name)
- {
- _name = name;
- }
-
- public void
- sayHello(Ice.Current current)
- {
- System.out.println(_name + " says Hello World!");
- }
-
- private final String _name;
-}
diff --git a/java/demo/IceGrid/sessionActivation/README b/java/demo/IceGrid/sessionActivation/README
deleted file mode 100644
index b66bd5e8f08..00000000000
--- a/java/demo/IceGrid/sessionActivation/README
+++ /dev/null
@@ -1,18 +0,0 @@
-This demo demonstrates the use of the session activation mode where
-the server is activated on demand once it is allocated by the client
-and deactivated when the client releases the server.
-
-To run the demo, first start the IceGrid service:
-
-$ icegridnode --Ice.Config=config.grid
-
-In a separate window:
-
-$ icegridadmin --Ice.Config=config.grid -e \
- "application add 'application.xml'"
-$ java Client
-
-This will deploy the application described in the file
-"application.xml" and start the client.
-
-Messages will be displayed in the IceGrid service window.
diff --git a/java/demo/IceGrid/sessionActivation/Server.java b/java/demo/IceGrid/sessionActivation/Server.java
deleted file mode 100644
index 1c7722e7a71..00000000000
--- a/java/demo/IceGrid/sessionActivation/Server.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// **********************************************************************
-//
-// 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 Server extends Ice.Application
-{
- public int
- run(String[] args)
- {
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello");
- Ice.Properties properties = communicator().getProperties();
- Ice.Identity id = communicator().stringToIdentity(properties.getProperty("Identity"));
- adapter.add(new HelloI(properties.getProperty("Ice.ServerId")), id);
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
- }
-
- static public void
- main(String[] args)
- {
- Server app = new Server();
- int status = app.main("Server", args);
- System.exit(status);
- }
-}
diff --git a/java/demo/IceGrid/sessionActivation/application.xml b/java/demo/IceGrid/sessionActivation/application.xml
deleted file mode 100644
index f768c84413a..00000000000
--- a/java/demo/IceGrid/sessionActivation/application.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<!--
- **********************************************************************
-
- 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.
-
- **********************************************************************
--->
-
-<icegrid>
-
- <application name="Session">
-
- <node name="localhost">
- <server id="SessionServer" exe="java" activation="session">
- <option>Server</option>
- <adapter name="Hello" endpoints="tcp" register-process="true">
- <allocatable identity="hello" property="Identity"/>
- </adapter>
- </server>
- </node>
-
- </application>
-
-</icegrid>
diff --git a/java/demo/IceGrid/sessionActivation/build.xml b/java/demo/IceGrid/sessionActivation/build.xml
deleted file mode 100644
index a607346b336..00000000000
--- a/java/demo/IceGrid/sessionActivation/build.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<!--
- **********************************************************************
-
- 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_sessionActivation" 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}"/>
- <delete quiet="true" includeEmptyDirs="true">
- <fileset dir="db/node" excludes=".gitignore"/>
- <fileset dir="db/registry" excludes=".gitignore"/>
- </delete>
- </target>
-
-</project>
diff --git a/java/demo/IceGrid/sessionActivation/config.client b/java/demo/IceGrid/sessionActivation/config.client
deleted file mode 100644
index 78100695847..00000000000
--- a/java/demo/IceGrid/sessionActivation/config.client
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-# The IceGrid locator proxy.
-#
-Ice.Default.Locator=DemoIceGrid/Locator:default -p 12000
diff --git a/java/demo/IceGrid/sessionActivation/config.grid b/java/demo/IceGrid/sessionActivation/config.grid
deleted file mode 100644
index 3ca2082ddfb..00000000000
--- a/java/demo/IceGrid/sessionActivation/config.grid
+++ /dev/null
@@ -1,42 +0,0 @@
-IceGrid.InstanceName=DemoIceGrid
-
-#
-# The IceGrid locator proxy.
-#
-Ice.Default.Locator=DemoIceGrid/Locator:default -p 12000
-
-#
-# IceGrid registry configuration.
-#
-IceGrid.Registry.Client.Endpoints=default -p 12000
-IceGrid.Registry.Server.Endpoints=default
-IceGrid.Registry.Internal.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/sessionActivation/db/node/.gitignore b/java/demo/IceGrid/sessionActivation/db/node/.gitignore
deleted file mode 100644
index 39af5887579..00000000000
--- a/java/demo/IceGrid/sessionActivation/db/node/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-# Dummy file, so that git retains this otherwise empty directory.
diff --git a/java/demo/IceGrid/sessionActivation/db/registry/.gitignore b/java/demo/IceGrid/sessionActivation/db/registry/.gitignore
deleted file mode 100644
index 39af5887579..00000000000
--- a/java/demo/IceGrid/sessionActivation/db/registry/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-# Dummy file, so that git retains this otherwise empty directory.
diff --git a/java/demo/README b/java/demo/README
index c30fbcec28e..d82f6443815 100644
--- a/java/demo/README
+++ b/java/demo/README
@@ -5,3 +5,6 @@ on the demos.
The book directory contains demos for some of the code examples in
"Distributed Programming with Ice".
+
+For more examples of the features of the Ice services (Glacier2, IceGrid,
+IceStorm) please see the demos in the Ice for C++ distibution.