summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2004-02-20 21:32:15 +0000
committerBenoit Foucher <benoit@zeroc.com>2004-02-20 21:32:15 +0000
commit69a05e28e0702e5fd96ff012c64dcf72847818fa (patch)
treed560b8285964520c820ca29b2dd1f7600d5ea725
parentmore ami (diff)
downloadice-69a05e28e0702e5fd96ff012c64dcf72847818fa.tar.bz2
ice-69a05e28e0702e5fd96ff012c64dcf72847818fa.tar.xz
ice-69a05e28e0702e5fd96ff012c64dcf72847818fa.zip
Fixed IcePack node bug and IcePack hello demo, added simple demo.
-rw-r--r--cpp/CHANGES8
-rw-r--r--cpp/demo/IcePack/Makefile3
-rw-r--r--cpp/demo/IcePack/hello/HelloServiceI.cpp2
-rw-r--r--cpp/demo/IcePack/hello/application.xml2
-rw-r--r--cpp/demo/IcePack/hello/icebox.xml4
-rw-r--r--cpp/demo/IcePack/hello/server.xml1
-rw-r--r--cpp/demo/IcePack/simple/.depend7
-rw-r--r--cpp/demo/IcePack/simple/Client.cpp212
-rw-r--r--cpp/demo/IcePack/simple/Hello.ice24
-rw-r--r--cpp/demo/IcePack/simple/HelloI.cpp31
-rw-r--r--cpp/demo/IcePack/simple/HelloI.h28
-rw-r--r--cpp/demo/IcePack/simple/HelloServiceI.cpp60
-rw-r--r--cpp/demo/IcePack/simple/HelloServiceI.h42
-rw-r--r--cpp/demo/IcePack/simple/Makefile66
-rw-r--r--cpp/demo/IcePack/simple/README15
-rw-r--r--cpp/demo/IcePack/simple/Server.cpp47
-rw-r--r--cpp/demo/IcePack/simple/application.xml15
-rw-r--r--cpp/demo/IcePack/simple/config28
-rw-r--r--cpp/demo/IcePack/simple/db/.dummy0
-rw-r--r--cpp/demo/IcePack/simple/icebox.xml3
-rw-r--r--cpp/demo/IcePack/simple/server.xml27
-rw-r--r--cpp/demo/IcePack/simple/service.xml28
-rw-r--r--cpp/src/IcePack/ServerBuilder.cpp11
-rw-r--r--cpp/src/IcePack/ServerBuilder.h1
-rw-r--r--cpp/src/IcePack/ServerI.cpp9
25 files changed, 669 insertions, 5 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES
index c6fea29c497..669c9896004 100644
--- a/cpp/CHANGES
+++ b/cpp/CHANGES
@@ -1,6 +1,14 @@
Changes since version 1.2.0
---------------------------
+- Added the demo/IcePack/simple demo.
+
+- Fixed a bug in IcePack that could cause the node to crash if a
+ server failed to start.
+
+- IceBox services deployed with IcePack are now loaded in the order
+ they appear in the XML IceBox descriptor.
+
- Connections are now not closed anymore when that last proxy using
the connection is destroyed. Doing so is error prone:
diff --git a/cpp/demo/IcePack/Makefile b/cpp/demo/IcePack/Makefile
index 70ab1b3ede2..687a0d06c24 100644
--- a/cpp/demo/IcePack/Makefile
+++ b/cpp/demo/IcePack/Makefile
@@ -16,7 +16,8 @@ top_srcdir = ../..
include $(top_srcdir)/config/Make.rules
-SUBDIRS = hello
+SUBDIRS = simple \
+ hello
$(EVERYTHING)::
@for subdir in $(SUBDIRS); \
diff --git a/cpp/demo/IcePack/hello/HelloServiceI.cpp b/cpp/demo/IcePack/hello/HelloServiceI.cpp
index a09d4e8aca3..48f52f6ce81 100644
--- a/cpp/demo/IcePack/hello/HelloServiceI.cpp
+++ b/cpp/demo/IcePack/hello/HelloServiceI.cpp
@@ -45,7 +45,7 @@ HelloServiceI::start(const string& name,
const ::Ice::CommunicatorPtr& communicator,
const ::Ice::StringSeq& args)
{
- _adapter = communicator->createObjectAdapter("Hello");
+ _adapter = communicator->createObjectAdapter(name);
string id = communicator->getProperties()->getProperty("Identity");
diff --git a/cpp/demo/IcePack/hello/application.xml b/cpp/demo/IcePack/hello/application.xml
index 0b4d2662b0f..c0bb3d25be5 100644
--- a/cpp/demo/IcePack/hello/application.xml
+++ b/cpp/demo/IcePack/hello/application.xml
@@ -4,7 +4,7 @@
<!-- Deploy two servers, the first one is defined in the -->
<!-- server.xml file and is a regular C++ server, the second one -->
<!-- is defined in the icebox.xml file and is a C++ IceBox -->
- <!-- server. The servers are deployed on the node named 'mynode' -->
+ <!-- server. The servers are deployed on the node named 'node' -->
<!-- =========================================================== -->
<node name="node" basedir="${basedir}">
diff --git a/cpp/demo/IcePack/hello/icebox.xml b/cpp/demo/IcePack/hello/icebox.xml
index 0a2a976b6df..df1fad8373d 100644
--- a/cpp/demo/IcePack/hello/icebox.xml
+++ b/cpp/demo/IcePack/hello/icebox.xml
@@ -6,4 +6,8 @@
<!-- =========================================================== -->
<service name="Service1" descriptor="service.xml"/>
+ <properties>
+ <property name="Ice.ThreadPool.Server.Size" value="5"/>
+ </properties>
+
</server> \ No newline at end of file
diff --git a/cpp/demo/IcePack/hello/server.xml b/cpp/demo/IcePack/hello/server.xml
index bf1f5e09f3c..9b638f36c6c 100644
--- a/cpp/demo/IcePack/hello/server.xml
+++ b/cpp/demo/IcePack/hello/server.xml
@@ -17,6 +17,7 @@
<!-- ============================================================= -->
<properties>
<property name="Identity" value="${name}"/>
+ <property name="Ice.ThreadPool.Server.Size" value="5"/>
</properties>
<target name="debug">
diff --git a/cpp/demo/IcePack/simple/.depend b/cpp/demo/IcePack/simple/.depend
new file mode 100644
index 00000000000..827f9924e6e
--- /dev/null
+++ b/cpp/demo/IcePack/simple/.depend
@@ -0,0 +1,7 @@
+Hello.o: Hello.cpp Hello.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Facet.h ../../../include/Ice/Object.h ../../../include/IceUtil/GCShared.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/Direct.h ../../../include/Ice/LocalException.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/ObjectFactory.h
+Client.o: Client.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Facet.h ../../../include/Ice/Object.h ../../../include/IceUtil/GCShared.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/Direct.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Application.h ../../../include/IcePack/Query.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/FactoryTable.h ../../../include/Ice/FactoryTableDef.h ../../../include/IceUtil/StaticMutex.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/IcePack/Exception.h Hello.h
+HelloI.o: HelloI.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Facet.h ../../../include/Ice/Object.h ../../../include/IceUtil/GCShared.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/Direct.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Application.h HelloI.h Hello.h
+Server.o: Server.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Facet.h ../../../include/Ice/Object.h ../../../include/IceUtil/GCShared.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/Direct.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Application.h HelloI.h Hello.h
+HelloServiceI.o: HelloServiceI.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Facet.h ../../../include/Ice/Object.h ../../../include/IceUtil/GCShared.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/Direct.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Application.h HelloServiceI.h ../../../include/IceBox/IceBox.h HelloI.h Hello.h
+HelloI.o: HelloI.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Facet.h ../../../include/Ice/Object.h ../../../include/IceUtil/GCShared.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/Direct.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Application.h HelloI.h Hello.h
+Hello.cpp: Hello.ice
diff --git a/cpp/demo/IcePack/simple/Client.cpp b/cpp/demo/IcePack/simple/Client.cpp
new file mode 100644
index 00000000000..4e6ab941b42
--- /dev/null
+++ b/cpp/demo/IcePack/simple/Client.cpp
@@ -0,0 +1,212 @@
+// **********************************************************************
+//
+// Copyright (c) 2003
+// ZeroC, Inc.
+// Billerica, MA, USA
+//
+// All Rights Reserved.
+//
+// Ice is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <IcePack/Query.h>
+#include <Hello.h>
+
+using namespace std;
+
+void
+menu()
+{
+ cout <<
+ "usage:\n"
+ "t: send greeting as twoway\n"
+ "o: send greeting as oneway\n"
+ "O: send greeting as batch oneway\n"
+ "d: send greeting as datagram\n"
+ "D: send greeting as batch datagram\n"
+ "f: flush all batch requests\n"
+ "T: set a timeout\n"
+ "S: switch secure mode on/off\n"
+ "s: shutdown server\n"
+ "x: exit\n"
+ "?: help\n";
+}
+
+int
+run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
+{
+ Ice::PropertiesPtr properties = communicator->getProperties();
+
+ IcePack::QueryPrx query = IcePack::QueryPrx::checkedCast(communicator->stringToProxy("IcePack/Query"));
+
+ Ice::ObjectPrx base = query->findObjectByType("::Hello");
+ HelloPrx twoway = HelloPrx::checkedCast(base->ice_twoway()->ice_timeout(-1)->ice_secure(false));
+ if(!twoway)
+ {
+ cerr << argv[0] << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
+ }
+ HelloPrx oneway = HelloPrx::uncheckedCast(twoway->ice_oneway());
+ HelloPrx batchOneway = HelloPrx::uncheckedCast(twoway->ice_batchOneway());
+ HelloPrx datagram = HelloPrx::uncheckedCast(twoway->ice_datagram());
+ HelloPrx batchDatagram = HelloPrx::uncheckedCast(twoway->ice_batchDatagram());
+
+ bool secure = false;
+ int timeout = -1;
+
+ menu();
+
+ char c;
+ do
+ {
+ try
+ {
+ cout << "==> ";
+ cin >> c;
+ if(c == 't')
+ {
+ twoway->sayHello();
+ }
+ else if(c == 'o')
+ {
+ oneway->sayHello();
+ }
+ else if(c == 'O')
+ {
+ batchOneway->sayHello();
+ }
+ else if(c == 'd')
+ {
+ if(secure)
+ {
+ cout << "secure datagrams are not supported" << endl;
+ }
+ else
+ {
+ datagram->sayHello();
+ }
+ }
+ else if(c == 'D')
+ {
+ if(secure)
+ {
+ cout << "secure datagrams are not supported" << endl;
+ }
+ else
+ {
+ batchDatagram->sayHello();
+ }
+ }
+ else if(c == 'f')
+ {
+ communicator->flushBatchRequests();
+ }
+ else if(c == 'T')
+ {
+ if(timeout == -1)
+ {
+ timeout = 2000;
+ }
+ else
+ {
+ timeout = -1;
+ }
+
+ twoway = HelloPrx::uncheckedCast(twoway->ice_timeout(timeout));
+ oneway = HelloPrx::uncheckedCast(oneway->ice_timeout(timeout));
+ batchOneway = HelloPrx::uncheckedCast(batchOneway->ice_timeout(timeout));
+
+ if(timeout == -1)
+ {
+ cout << "timeout is now switched off" << endl;
+ }
+ else
+ {
+ cout << "timeout is now set to 2000ms" << endl;
+ }
+ }
+ else if(c == 'S')
+ {
+ secure = !secure;
+
+ twoway = HelloPrx::uncheckedCast(twoway->ice_secure(secure));
+ oneway = HelloPrx::uncheckedCast(oneway->ice_secure(secure));
+ batchOneway = HelloPrx::uncheckedCast(batchOneway->ice_secure(secure));
+ datagram = HelloPrx::uncheckedCast(datagram->ice_secure(secure));
+ batchDatagram = HelloPrx::uncheckedCast(batchDatagram->ice_secure(secure));
+
+ if(secure)
+ {
+ cout << "secure mode is now on" << endl;
+ }
+ else
+ {
+ cout << "secure mode is now off" << endl;
+ }
+ }
+ else if(c == 's')
+ {
+ twoway->shutdown();
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ cout << "unknown command `" << c << "'" << endl;
+ menu();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ }
+ }
+ while(cin.good() && c != 'x');
+
+ return EXIT_SUCCESS;
+}
+
+int
+main(int argc, char* argv[])
+{
+ int status;
+ Ice::CommunicatorPtr communicator;
+
+ try
+ {
+ Ice::PropertiesPtr properties = Ice::createProperties(argc, argv);
+ properties->load("config");
+ communicator = Ice::initializeWithProperties(argc, argv, properties);
+ status = run(argc, argv, communicator);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
+
+ if(communicator)
+ {
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
+ }
+
+ return status;
+}
diff --git a/cpp/demo/IcePack/simple/Hello.ice b/cpp/demo/IcePack/simple/Hello.ice
new file mode 100644
index 00000000000..84604c30680
--- /dev/null
+++ b/cpp/demo/IcePack/simple/Hello.ice
@@ -0,0 +1,24 @@
+// **********************************************************************
+//
+// Copyright (c) 2003
+// ZeroC, Inc.
+// Billerica, MA, USA
+//
+// All Rights Reserved.
+//
+// Ice is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation.
+//
+// **********************************************************************
+
+#ifndef HELLO_ICE
+#define HELLO_ICE
+
+class Hello
+{
+ nonmutating void sayHello();
+ idempotent void shutdown();
+};
+
+#endif
diff --git a/cpp/demo/IcePack/simple/HelloI.cpp b/cpp/demo/IcePack/simple/HelloI.cpp
new file mode 100644
index 00000000000..880603c5f46
--- /dev/null
+++ b/cpp/demo/IcePack/simple/HelloI.cpp
@@ -0,0 +1,31 @@
+// **********************************************************************
+//
+// Copyright (c) 2003
+// ZeroC, Inc.
+// Billerica, MA, USA
+//
+// All Rights Reserved.
+//
+// Ice is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <HelloI.h>
+
+using namespace std;
+
+void
+HelloI::sayHello(const Ice::Current&) const
+{
+ cout << "Hello World!" << endl;
+}
+
+void
+HelloI::shutdown(const Ice::Current& c)
+{
+ cout << "Shutting down..." << endl;
+ c.adapter->getCommunicator()->shutdown();
+}
diff --git a/cpp/demo/IcePack/simple/HelloI.h b/cpp/demo/IcePack/simple/HelloI.h
new file mode 100644
index 00000000000..e57da289476
--- /dev/null
+++ b/cpp/demo/IcePack/simple/HelloI.h
@@ -0,0 +1,28 @@
+// **********************************************************************
+//
+// Copyright (c) 2003
+// ZeroC, Inc.
+// Billerica, MA, USA
+//
+// All Rights Reserved.
+//
+// Ice is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation.
+//
+// **********************************************************************
+
+#ifndef HELLO_I_H
+#define HELLO_I_H
+
+#include <Hello.h>
+
+class HelloI : public Hello
+{
+public:
+
+ virtual void sayHello(const Ice::Current&) const;
+ virtual void shutdown(const Ice::Current&);
+};
+
+#endif
diff --git a/cpp/demo/IcePack/simple/HelloServiceI.cpp b/cpp/demo/IcePack/simple/HelloServiceI.cpp
new file mode 100644
index 00000000000..bdaa3193fbd
--- /dev/null
+++ b/cpp/demo/IcePack/simple/HelloServiceI.cpp
@@ -0,0 +1,60 @@
+// **********************************************************************
+//
+// Copyright (c) 2003
+// ZeroC, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved.
+//
+// Ice is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <HelloServiceI.h>
+#include <HelloI.h>
+
+using namespace std;
+
+extern "C"
+{
+
+//
+// Factory function
+//
+HELLO_API ::IceBox::Service*
+create(::Ice::CommunicatorPtr communicator)
+{
+ return new HelloServiceI;
+}
+
+}
+
+HelloServiceI::HelloServiceI()
+{
+}
+
+HelloServiceI::~HelloServiceI()
+{
+}
+
+void
+HelloServiceI::start(const string& name,
+ const ::Ice::CommunicatorPtr& communicator,
+ const ::Ice::StringSeq& args)
+{
+ string id = communicator->getProperties()->getProperty("Identity");
+
+ _adapter = communicator->createObjectAdapter(name);
+ ::Ice::ObjectPtr object = new HelloI;
+ _adapter->add(object, Ice::stringToIdentity(id));
+ _adapter->activate();
+}
+
+void
+HelloServiceI::stop()
+{
+ _adapter->deactivate();
+}
diff --git a/cpp/demo/IcePack/simple/HelloServiceI.h b/cpp/demo/IcePack/simple/HelloServiceI.h
new file mode 100644
index 00000000000..f6f0c816d9c
--- /dev/null
+++ b/cpp/demo/IcePack/simple/HelloServiceI.h
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003
+// ZeroC, Inc.
+// Billerica, MA, USA
+//
+// All Rights Reserved.
+//
+// Ice is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation.
+//
+// **********************************************************************
+
+#ifndef HELLO_SERVICE_I_H
+#define HELLO_SERVICE_I_H
+
+#include <IceBox/IceBox.h>
+
+#ifndef HELLO_API
+# define HELLO_API ICE_DECLSPEC_EXPORT
+#endif
+
+class HELLO_API HelloServiceI : public ::IceBox::Service
+{
+public:
+
+ HelloServiceI();
+ virtual ~HelloServiceI();
+
+ virtual void start(const ::std::string&,
+ const ::Ice::CommunicatorPtr&,
+ const ::Ice::StringSeq&);
+
+ virtual void stop();
+
+private:
+
+ ::Ice::ObjectAdapterPtr _adapter;
+};
+
+#endif
diff --git a/cpp/demo/IcePack/simple/Makefile b/cpp/demo/IcePack/simple/Makefile
new file mode 100644
index 00000000000..de61fe3c70a
--- /dev/null
+++ b/cpp/demo/IcePack/simple/Makefile
@@ -0,0 +1,66 @@
+# **********************************************************************
+#
+# Copyright (c) 2003
+# ZeroC, Inc.
+# Billerica, MA, USA
+#
+# All Rights Reserved.
+#
+# Ice is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License version 2 as published by
+# the Free Software Foundation.
+#
+# **********************************************************************
+
+top_srcdir = ../../..
+
+CLIENT = client
+SERVER = server
+LIBFILENAME = $(call mklibfilename,HelloService,$(VERSION))
+SONAME = $(call mksoname,HelloService,$(SOVERSION))
+LIBNAME = $(call mklibname,HelloService)
+
+TARGETS = $(CLIENT) $(SERVER) $(LIBFILENAME) $(SONAME) $(LIBNAME)
+
+OBJS = Hello.o
+
+COBJS = Client.o
+
+SOBJS = HelloI.o \
+ Server.o
+
+SVCOBJS = HelloServiceI.o \
+ HelloI.o
+
+SRCS = $(OBJS:.o=.cpp) \
+ $(COBJS:.o=.cpp) \
+ $(SOBJS:.o=.cpp) \
+ $(SVCOBJS:.o=.cpp)
+
+SLICE_SRCS = Hello.ice
+
+include $(top_srcdir)/config/Make.rules
+
+CPPFLAGS := -I. $(CPPFLAGS)
+
+$(CLIENT): $(OBJS) $(COBJS)
+ rm -f $@
+ $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) -lIcePack
+
+$(SERVER): $(OBJS) $(SOBJS)
+ rm -f $@
+ $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS)
+
+$(LIBFILENAME): $(OBJS) $(SVCOBJS)
+ rm -f $@
+ $(call mkshlib,$@,$(SONAME),$(OBJS) $(SVCOBJS),$(LINKWITH))
+
+$(SONAME): $(LIBFILENAME)
+ rm -f $@
+ ln -s $(LIBFILENAME) $@
+
+$(LIBNAME): $(SONAME)
+ rm -f $@
+ ln -s $(SONAME) $@
+
+include .depend
diff --git a/cpp/demo/IcePack/simple/README b/cpp/demo/IcePack/simple/README
new file mode 100644
index 00000000000..646432dfd7f
--- /dev/null
+++ b/cpp/demo/IcePack/simple/README
@@ -0,0 +1,15 @@
+To run the demo:
+
+Start the IcePack service:
+
+$ ../../../bin/icepacknode --Ice.Config=config --warn
+
+In a separate window:
+
+$ ../../../bin/icepackadmin --Ice.Config=config -e 'application add "application.xml"'
+$ ./client
+
+This will deploy the servers described in the "application.xml"
+descriptor and start the client.
+
+Messages will be displayed in the IcePack service window.
diff --git a/cpp/demo/IcePack/simple/Server.cpp b/cpp/demo/IcePack/simple/Server.cpp
new file mode 100644
index 00000000000..ab9d956d157
--- /dev/null
+++ b/cpp/demo/IcePack/simple/Server.cpp
@@ -0,0 +1,47 @@
+// **********************************************************************
+//
+// Copyright (c) 2003
+// ZeroC, Inc.
+// Billerica, MA, USA
+//
+// All Rights Reserved.
+//
+// Ice is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <HelloI.h>
+
+using namespace std;
+
+class Server : public Ice::Application
+{
+public:
+
+ virtual int run(int argc, char* argv[]);
+
+};
+
+int
+Server::run(int argc, char* argv[])
+{
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Hello");
+ string id = communicator()->getProperties()->getProperty("Identity");
+
+ Ice::ObjectPtr object = new HelloI;
+ adapter->add(object, Ice::stringToIdentity(id));
+ adapter->activate();
+ communicator()->waitForShutdown();
+ return EXIT_SUCCESS;
+}
+
+int
+main(int argc, char* argv[])
+{
+ Server app;
+ int status = app.main(argc, argv);
+ return status;
+}
diff --git a/cpp/demo/IcePack/simple/application.xml b/cpp/demo/IcePack/simple/application.xml
new file mode 100644
index 00000000000..c0bb3d25be5
--- /dev/null
+++ b/cpp/demo/IcePack/simple/application.xml
@@ -0,0 +1,15 @@
+<application>
+
+ <!-- =========================================================== -->
+ <!-- Deploy two servers, the first one is defined in the -->
+ <!-- server.xml file and is a regular C++ server, the second one -->
+ <!-- is defined in the icebox.xml file and is a C++ IceBox -->
+ <!-- server. The servers are deployed on the node named 'node' -->
+ <!-- =========================================================== -->
+
+ <node name="node" basedir="${basedir}">
+ <server name="Server1" binpath="./server" descriptor="server.xml"/>
+ <server name="IceBox1" binpath="../../../bin/icebox" descriptor="icebox.xml"/>
+ </node>
+
+</application> \ No newline at end of file
diff --git a/cpp/demo/IcePack/simple/config b/cpp/demo/IcePack/simple/config
new file mode 100644
index 00000000000..bd6f8bca114
--- /dev/null
+++ b/cpp/demo/IcePack/simple/config
@@ -0,0 +1,28 @@
+#
+# The IcePack locator proxy.
+#
+Ice.Default.Locator=IcePack/Locator:default -p 12000
+
+#
+# IcePack registry configuration.
+#
+IcePack.Registry.Client.Endpoints=default -p 12000
+IcePack.Registry.Server.Endpoints=default
+IcePack.Registry.Internal.Endpoints=default
+IcePack.Registry.Admin.Endpoints=default
+IcePack.Registry.Data=db/registry
+
+#
+# IcePack node configuration.
+#
+IcePack.Node.Name=node
+IcePack.Node.Endpoints=default
+IcePack.Node.Data=db/node
+IcePack.Node.CollocateRegistry=1
+
+#
+# Trace properties.
+#
+IcePack.Node.Trace.Activator=3
+IcePack.Node.Trace.Adapter=2
+IcePack.Node.Trace.Server=3
diff --git a/cpp/demo/IcePack/simple/db/.dummy b/cpp/demo/IcePack/simple/db/.dummy
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/cpp/demo/IcePack/simple/db/.dummy
diff --git a/cpp/demo/IcePack/simple/icebox.xml b/cpp/demo/IcePack/simple/icebox.xml
new file mode 100644
index 00000000000..1d35f0f5160
--- /dev/null
+++ b/cpp/demo/IcePack/simple/icebox.xml
@@ -0,0 +1,3 @@
+<server kind="cpp-icebox" endpoints="default">
+ <service name="Hello" descriptor="service.xml"/>
+</server> \ No newline at end of file
diff --git a/cpp/demo/IcePack/simple/server.xml b/cpp/demo/IcePack/simple/server.xml
new file mode 100644
index 00000000000..8e633e8ca5f
--- /dev/null
+++ b/cpp/demo/IcePack/simple/server.xml
@@ -0,0 +1,27 @@
+<server kind="cpp">
+
+ <adapters>
+ <adapter name="Hello" endpoints="tcp:udp:ssl">
+ <object identity="${name}" type="::Hello"/>
+ </adapter>
+ </adapters>
+
+ <properties>
+ <!-- The identity of the hello object will be the name of the server -->
+ <property name="Identity" value="${name}"/>
+
+ <property name="Ice.Plugin.IceSSL" value="IceSSL:create"/>
+ <property name="IceSSL.Client.CertPath" value="../../../certs"/>
+ <property name="IceSSL.Client.Config" value="sslconfig.xml"/>
+ <property name="IceSSL.Server.CertPath" value="../../../certs"/>
+ <property name="IceSSL.Server.Config" value="sslconfig.xml"/>
+ </properties>
+
+ <target name="debug">
+ <properties>
+ <property name="Ice.Network.Trace" value="1"/>
+ <property name="Ice.Network.Protocol" value="1"/>
+ </properties>
+ </target>
+
+</server> \ No newline at end of file
diff --git a/cpp/demo/IcePack/simple/service.xml b/cpp/demo/IcePack/simple/service.xml
new file mode 100644
index 00000000000..69dd637dada
--- /dev/null
+++ b/cpp/demo/IcePack/simple/service.xml
@@ -0,0 +1,28 @@
+<service kind="standard" entry="HelloService:create">
+
+ <adapters>
+ <adapter name="${name}" endpoints="tcp:udp:ssl">
+ <object identity="${name}" type="::Hello"/>
+ </adapter>
+ </adapters>
+
+ <properties>
+
+ <!-- The identity of the hello object will be the name of the server -->
+ <property name="Identity" value="${name}"/>
+
+ <property name="Ice.Plugin.IceSSL" value="IceSSL:create"/>
+ <property name="IceSSL.Client.CertPath" location="../../../certs"/>
+ <property name="IceSSL.Client.Config" value="sslconfig.xml"/>
+ <property name="IceSSL.Server.CertPath" location="../../../certs"/>
+ <property name="IceSSL.Server.Config" value="sslconfig.xml"/>
+ </properties>
+
+ <target name="debug">
+ <properties>
+ <property name="Ice.Network.Trace" value="1"/>
+ <property name="Ice.Network.Protocol" value="1"/>
+ </properties>
+ </target>
+
+</service> \ No newline at end of file
diff --git a/cpp/src/IcePack/ServerBuilder.cpp b/cpp/src/IcePack/ServerBuilder.cpp
index 1b9827f04c3..1d0283daaea 100644
--- a/cpp/src/IcePack/ServerBuilder.cpp
+++ b/cpp/src/IcePack/ServerBuilder.cpp
@@ -19,6 +19,8 @@
#include <IcePack/AdapterFactory.h>
#include <IcePack/ServerFactory.h>
+#include <iterator>
+
using namespace std;
using namespace IcePack;
@@ -381,6 +383,13 @@ IcePack::ServerBuilder::parse(const std::string& descriptor)
}
}
+ if(_kind == ServerKindCppIceBox || _kind == ServerKindJavaIceBox)
+ {
+ ostringstream os;
+ copy(_serviceNames.begin(), _serviceNames.end(), ostream_iterator<string>(os," "));
+ addProperty("IceBox.LoadOrder", os.str());
+ }
+
_description.args.push_back("--Ice.Config=" + _configFile);
}
@@ -600,6 +609,8 @@ IcePack::ServerBuilder::addService(const string& name, const string& descriptor,
TaskPtr t = task;
task->parse(toLocation(descriptor));
_tasks.push_back(t);
+
+ _serviceNames.push_back(name);
}
void
diff --git a/cpp/src/IcePack/ServerBuilder.h b/cpp/src/IcePack/ServerBuilder.h
index ba5723c3128..a82296b451a 100644
--- a/cpp/src/IcePack/ServerBuilder.h
+++ b/cpp/src/IcePack/ServerBuilder.h
@@ -68,6 +68,7 @@ private:
std::string _className;
std::string _libraryPath;
std::vector<std::string> _javaOptions;
+ std::vector<std::string> _serviceNames;
ServerPrx _server;
std::map<std::string, ServerAdapterPrx> _serverAdapters;
diff --git a/cpp/src/IcePack/ServerI.cpp b/cpp/src/IcePack/ServerI.cpp
index 71c90c13028..218c8d5bd88 100644
--- a/cpp/src/IcePack/ServerI.cpp
+++ b/cpp/src/IcePack/ServerI.cpp
@@ -242,16 +242,20 @@ void
IcePack::ServerI::terminated(const Ice::Current&)
{
ServerState newState = Inactive; // Initialize to keep the compiler happy.
-
+ while(true)
{
IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this);
switch(_state)
{
case Inactive:
- case Activating:
{
assert(false);
}
+ case Activating:
+ {
+ wait(); // TODO: Timeout?
+ continue;
+ }
case Active:
{
_state = Deactivating;
@@ -286,6 +290,7 @@ IcePack::ServerI::terminated(const Ice::Current&)
}
assert(_state == Deactivating || _state == Destroying);
+ break;
}
if(newState != Destroyed)