diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2009-04-21 15:59:33 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2009-04-21 15:59:33 -0230 |
commit | ae58d9f09835de8d57e5ad27d9b33ffbcd0d5092 (patch) | |
tree | f96fbf2fd2643bf02c64931dedfd3b6772169705 | |
parent | Bug 2504 - added getPlugins method to PluginManager (diff) | |
download | ice-ae58d9f09835de8d57e5ad27d9b33ffbcd0d5092.tar.bz2 ice-ae58d9f09835de8d57e5ad27d9b33ffbcd0d5092.tar.xz ice-ae58d9f09835de8d57e5ad27d9b33ffbcd0d5092.zip |
Bug 3912 - added logger plugin demo
55 files changed, 2351 insertions, 5 deletions
diff --git a/cpp/demo/Ice/Makefile b/cpp/demo/Ice/Makefile index b4e3536725e..9f0d25cce8d 100644 --- a/cpp/demo/Ice/Makefile +++ b/cpp/demo/Ice/Makefile @@ -24,7 +24,8 @@ SUBDIRS = minimal \ converter \ async \ multicast \ - nrvo + nrvo \ + plugin $(EVERYTHING):: @for subdir in $(SUBDIRS); \ diff --git a/cpp/demo/Ice/Makefile.mak b/cpp/demo/Ice/Makefile.mak index 1ee00a3c859..af25298b889 100644 --- a/cpp/demo/Ice/Makefile.mak +++ b/cpp/demo/Ice/Makefile.mak @@ -24,7 +24,8 @@ SUBDIRS = minimal \ converter \
async \
multicast \
- nrvo
+ nrvo \
+ plugin
!if "$(BCPLUSPLUS)" != "yes" && "$(CPP_COMPILER)" != "VC80_EXPRESS" && "$(CPP_COMPILER)" != "VC90_EXPRESS"
SUBDIRS = $(SUBDIRS) MFC
diff --git a/cpp/demo/Ice/README b/cpp/demo/Ice/README index 0b9aee63862..83e434ba7bc 100644 --- a/cpp/demo/Ice/README +++ b/cpp/demo/Ice/README @@ -61,6 +61,10 @@ Demos in this directory: A demo that shows how Ice takes advantage of NRVO (Named Return Value Optimization) which is included in modern C++ compilers. +- plugin + + A demo to illustrate how to write and use Ice plugins. + - session This demo shows how to use sessions to clean up client-specific diff --git a/cpp/demo/Ice/plugin/.depend b/cpp/demo/Ice/plugin/.depend new file mode 100644 index 00000000000..5f1f5e7376e --- /dev/null +++ b/cpp/demo/Ice/plugin/.depend @@ -0,0 +1,7 @@ +Hello$(OBJEXT): Hello.cpp ./Hello.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/ScopedArray.h +Client$(OBJEXT): Client.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactoryF.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ./Hello.h +HelloI$(OBJEXT): HelloI.cpp $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/Config.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Exception.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/Functional.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/RWRecMutex.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/UUID.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/Ice/Handle.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/UserExceptionFactoryF.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ./HelloI.h ./Hello.h +Server$(OBJEXT): Server.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactoryF.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h ./HelloI.h ./Hello.h +LoggerI$(OBJEXT): LoggerI.cpp $(includedir)/Ice/Ice.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/IceUtil/StaticMutex.h $(includedir)/Ice/UserExceptionFactoryF.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h +Hello.cpp: Hello.ice +Hello.ice: $(SLICE2CPP) $(SLICEPARSERLIB) diff --git a/cpp/demo/Ice/plugin/.gitignore b/cpp/demo/Ice/plugin/.gitignore new file mode 100644 index 00000000000..da58f53bd2d --- /dev/null +++ b/cpp/demo/Ice/plugin/.gitignore @@ -0,0 +1,9 @@ +// Generated by makegitignore.py + +// IMPORTANT: Do not edit this file -- any edits made here will be lost! +client +server +libLoggerPlugin.so +libLoggerPlugin.so.33 +Hello.cpp +Hello.h diff --git a/cpp/demo/Ice/plugin/Client.cpp b/cpp/demo/Ice/plugin/Client.cpp new file mode 100644 index 00000000000..187674f44c1 --- /dev/null +++ b/cpp/demo/Ice/plugin/Client.cpp @@ -0,0 +1,140 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <Hello.h> + +using namespace std; +using namespace Demo; + +class HelloClient : public Ice::Application +{ +public: + + HelloClient(); + + virtual int run(int, char*[]); + +private: + + void menu(); +}; + +int +main(int argc, char* argv[]) +{ + HelloClient app; + return app.main(argc, argv, "config.client"); +} + +HelloClient::HelloClient() : + // + // Since this is an interactive demo we don't want any signal + // handling. + // + Ice::Application(Ice::NoSignalHandling) +{ +} + +int +HelloClient::run(int argc, char* argv[]) +{ + if(argc > 1) + { + cerr << appName() << ": too many arguments" << endl; + return EXIT_FAILURE; + } + + HelloPrx twoway = HelloPrx::checkedCast(communicator()->propertyToProxy("Hello.Proxy")); + if(!twoway) + { + cerr << argv[0] << ": invalid proxy" << endl; + return EXIT_FAILURE; + } + HelloPrx oneway = twoway->ice_oneway(); + HelloPrx batchOneway = twoway->ice_batchOneway(); + HelloPrx datagram = twoway->ice_datagram(); + HelloPrx batchDatagram = twoway->ice_batchDatagram(); + + 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') + { + datagram->sayHello(); + } + else if(c == 'D') + { + batchDatagram->sayHello(); + } + else if(c == 'f') + { + communicator()->flushBatchRequests(); + } + 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; +} + +void +HelloClient::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" + "s: shutdown server\n" + "x: exit\n" + "?: help\n"; +} diff --git a/cpp/demo/Ice/plugin/Hello.ice b/cpp/demo/Ice/plugin/Hello.ice new file mode 100644 index 00000000000..4b123a06908 --- /dev/null +++ b/cpp/demo/Ice/plugin/Hello.ice @@ -0,0 +1,24 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef HELLO_ICE +#define HELLO_ICE + +module Demo +{ + +interface Hello +{ + idempotent void sayHello(); + void shutdown(); +}; + +}; + +#endif diff --git a/cpp/demo/Ice/plugin/HelloI.cpp b/cpp/demo/Ice/plugin/HelloI.cpp new file mode 100644 index 00000000000..113e07e4413 --- /dev/null +++ b/cpp/demo/Ice/plugin/HelloI.cpp @@ -0,0 +1,27 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <IceUtil/IceUtil.h> +#include <Ice/Ice.h> +#include <HelloI.h> + +using namespace std; + +void +HelloI::sayHello(const Ice::Current& current) +{ + current.adapter->getCommunicator()->getLogger()->print("Hello World!"); +} + +void +HelloI::shutdown(const Ice::Current& current) +{ + current.adapter->getCommunicator()->getLogger()->print("Shutting down..."); + current.adapter->getCommunicator()->shutdown(); +} diff --git a/cpp/demo/Ice/plugin/HelloI.h b/cpp/demo/Ice/plugin/HelloI.h new file mode 100644 index 00000000000..a3bfb8e9787 --- /dev/null +++ b/cpp/demo/Ice/plugin/HelloI.h @@ -0,0 +1,23 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef HELLO_I_H +#define HELLO_I_H + +#include <Hello.h> + +class HelloI : public Demo::Hello +{ +public: + + virtual void sayHello(const Ice::Current&); + virtual void shutdown(const Ice::Current&); +}; + +#endif diff --git a/cpp/demo/Ice/plugin/Ice.plugin.client.dsp b/cpp/demo/Ice/plugin/Ice.plugin.client.dsp new file mode 100644 index 00000000000..d8aa9508281 --- /dev/null +++ b/cpp/demo/Ice/plugin/Ice.plugin.client.dsp @@ -0,0 +1,157 @@ +# Microsoft Developer Studio Project File - Name="Ice.plugin.client.exe" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Ice.plugin.client.exe - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "Ice.plugin.client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Ice.plugin.client.mak" CFG="Ice.plugin.client.exe - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Ice.plugin.client.exe - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Ice.plugin.client.exe - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Ice.plugin.client.exe - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /WX /GR /GX /O2 /I "." /I "../../../include" /I "../../../include/stlport" /D "_CONSOLE" /D "NDEBUG" /D "WIN32_LEAN_AND_MEAN" /FD /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 Ice.lib IceUtil.lib setargv.obj /nologo /subsystem:console /pdb:none /machine:I386 /out:"client.exe" /libpath:"../../../lib" /FIXED:no /IGNORE:4089
+# SUBTRACT LINK32 /debug /nodefaultlib
+
+!ELSEIF "$(CFG)" == "Ice.plugin.client.exe - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /WX /Gm /GR /GX /Zi /Od /I "." /I "../../../include" /I "../../../include/stlport" /D "_CONSOLE" /D "_DEBUG" /D "WIN32_LEAN_AND_MEAN" /FD /GZ /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 Iced.lib IceUtild.lib setargv.obj /nologo /subsystem:console /debug /machine:I386 /out:"client.exe" /pdbtype:sept /libpath:"../../../lib" /FIXED:no
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "Ice.plugin.client.exe - Win32 Release"
+# Name "Ice.plugin.client.exe - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Hello.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Hello.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Hello.ice
+
+!IF "$(CFG)" == "Ice.plugin.client.exe - Win32 Release"
+
+USERDEP__HELLO="..\..\..\bin\slice2cpp.exe" "..\..\..\lib\slice.lib"
+# Begin Custom Build
+InputPath=.\Hello.ice
+
+BuildCmds= \
+ ..\..\..\bin\slice2cpp.exe Hello.ice
+
+"Hello.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Hello.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Ice.plugin.client.exe - Win32 Debug"
+
+USERDEP__HELLO="..\..\..\bin\slice2cpp.exe" "..\..\..\lib\sliced.lib"
+# Begin Custom Build
+InputPath=.\Hello.ice
+
+BuildCmds= \
+ ..\..\..\bin\slice2cpp.exe Hello.ice
+
+"Hello.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Hello.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\README
+# End Source File
+# End Target
+# End Project
diff --git a/cpp/demo/Ice/plugin/Ice.plugin.logger.dsp b/cpp/demo/Ice/plugin/Ice.plugin.logger.dsp new file mode 100644 index 00000000000..ead32f43d7a --- /dev/null +++ b/cpp/demo/Ice/plugin/Ice.plugin.logger.dsp @@ -0,0 +1,119 @@ +# Microsoft Developer Studio Project File - Name="IceBox.plugin.logger.dll" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=IceBox.plugin.logger.dll - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "IceBox.plugin.logger.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "IceBox.plugin.logger.mak" CFG="IceBox.plugin.logger.dll - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "IceBox.plugin.logger.dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "IceBox.plugin.logger.dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "IceBox.plugin.logger.dll - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBRARY_EXPORTS" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MD /W3 /WX /GR /GX /O2 /I "." /I "../../../include" /I "../../../include/stlport" /D "_USRDLL" /D "_CONSOLE" /D "NDEBUG" /D "WIN32_LEAN_AND_MEAN" /FD /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 IceBox.lib Ice.lib IceUtil.lib setargv.obj /nologo /dll /pdb:none /machine:I386 /out:"loggerplugin.dll" /libpath:"../../../lib" /FIXED:no /IGNORE:4089
+
+!ELSEIF "$(CFG)" == "IceBox.plugin.logger.dll - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBRARY_EXPORTS" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /WX /Gm /GR /GX /Zi /Od /I "." /I "../../../include" /I "../../../include/stlport" /D "_USRDLL" /D "_CONSOLE" /D "_DEBUG" /D "WIN32_LEAN_AND_MEAN" /FD /GZ /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 IceBoxd.lib Iced.lib IceUtild.lib setargv.obj /nologo /dll /debug /machine:I386 /out:"loggerplugind.dll" /pdbtype:sept /libpath:"../../../lib" /FIXED:no
+# SUBTRACT LINK32 /pdb:none
+# Begin Special Build Tool
+OutDir=.\Debug
+SOURCE="$(InputPath)"
+PostBuild_Cmds=copy $(OutDir)\loggerplugind.* .
+# End Special Build Tool
+
+!ENDIF
+
+# Begin Target
+
+# Name "IceBox.plugin.logger.dll - Win32 Release"
+# Name "IceBox.plugin.logger.dll - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\LoggerI.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Source File
+
+SOURCE=.\README
+# End Source File
+# End Target
+# End Project
diff --git a/cpp/demo/Ice/plugin/Ice.plugin.server.dsp b/cpp/demo/Ice/plugin/Ice.plugin.server.dsp new file mode 100644 index 00000000000..d5b6ecac954 --- /dev/null +++ b/cpp/demo/Ice/plugin/Ice.plugin.server.dsp @@ -0,0 +1,165 @@ +# Microsoft Developer Studio Project File - Name="Ice.plugin.server.exe" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Ice.plugin.server.exe - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "Ice.plugin.server.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Ice.plugin.server.mak" CFG="Ice.plugin.server.exe - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Ice.plugin.server.exe - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Ice.plugin.server.exe - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Ice.plugin.server.exe - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /WX /GR /GX /O2 /I "." /I "../../../include" /I "../../../include/stlport" /D "_CONSOLE" /D "NDEBUG" /D "WIN32_LEAN_AND_MEAN" /FD /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 Ice.lib IceUtil.lib setargv.obj /nologo /subsystem:console /pdb:none /machine:I386 /out:"server.exe" /libpath:"../../../lib" /FIXED:no /IGNORE:4089
+# SUBTRACT LINK32 /debug /nodefaultlib
+
+!ELSEIF "$(CFG)" == "Ice.plugin.server.exe - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /WX /Gm /GR /GX /Zi /Od /I "." /I "../../../include" /I "../../../include/stlport" /D "_CONSOLE" /D "_DEBUG" /D "WIN32_LEAN_AND_MEAN" /FD /GZ /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 Iced.lib IceUtild.lib setargv.obj /nologo /subsystem:console /debug /machine:I386 /out:"server.exe" /pdbtype:sept /libpath:"../../../lib" /FIXED:no
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "Ice.plugin.server.exe - Win32 Release"
+# Name "Ice.plugin.server.exe - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Hello.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\HelloI.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Server.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Hello.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\HelloI.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Hello.ice
+
+!IF "$(CFG)" == "Ice.plugin.server.exe - Win32 Release"
+
+USERDEP__HELLO="..\..\..\bin\slice2cpp.exe" "..\..\..\lib\slice.lib"
+# Begin Custom Build
+InputPath=.\Hello.ice
+
+BuildCmds= \
+ ..\..\..\bin\slice2cpp.exe Hello.ice
+
+"Hello.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Hello.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Ice.plugin.server.exe - Win32 Debug"
+
+USERDEP__HELLO="..\..\..\bin\slice2cpp.exe" "..\..\..\lib\sliced.lib"
+# Begin Custom Build
+InputPath=.\Hello.ice
+
+BuildCmds= \
+ ..\..\..\bin\slice2cpp.exe Hello.ice
+
+"Hello.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Hello.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\README
+# End Source File
+# End Target
+# End Project
diff --git a/cpp/demo/Ice/plugin/LoggerI.cpp b/cpp/demo/Ice/plugin/LoggerI.cpp new file mode 100644 index 00000000000..d3eeefc4d01 --- /dev/null +++ b/cpp/demo/Ice/plugin/LoggerI.cpp @@ -0,0 +1,57 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <Ice/Ice.h> + +using namespace std; + +namespace +{ + +class LoggerI : public Ice::Logger +{ +public: + + virtual void + print(const string& message) + { + cout << "PRINT: " << message << endl; + } + + virtual void + trace(const string& category, const string& message) + { + cout << "TRACE(" << category << "): " << message << endl; + } + + virtual void + warning(const string& message) + { + cout << "WARNING: " << message << endl; + } + + virtual void + error(const string& message) + { + cout << "ERROR: " << message << endl; + } +}; + +}; + +extern "C" +{ + +ICE_DECLSPEC_EXPORT ::Ice::Plugin* +createLogger(const Ice::CommunicatorPtr& communicator, const string& name, const Ice::StringSeq& args) +{ + return new Ice::LoggerPlugin(communicator, new LoggerI); +} + +} diff --git a/cpp/demo/Ice/plugin/Makefile b/cpp/demo/Ice/plugin/Makefile new file mode 100644 index 00000000000..4fb77fdc315 --- /dev/null +++ b/cpp/demo/Ice/plugin/Makefile @@ -0,0 +1,55 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +top_srcdir = ../../.. + +CLIENT = client +SERVER = server + +LOGGERFILENAME = $(call mklibfilename,LoggerPlugin) +LOGGERSONAME = $(call mksoname,LoggerPlugin,$(SOVERSION)) + +TARGETS = $(CLIENT) $(SERVER) $(LOGGERFILENAME) $(LOGGERSONAME) + +OBJS = Hello.o + +COBJS = Client.o + +SOBJS = HelloI.o \ + Server.o + +LOBJS = LoggerI.o + +SRCS = $(OBJS:.o=.cpp) \ + $(COBJS:.o=.cpp) \ + $(SOBJS:.o=.cpp) \ + $(LOBJS:.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) + +$(SERVER): $(OBJS) $(SOBJS) + rm -f $@ + $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS) + +$(LOGGERFILENAME): $(LOBJS) + rm -f $@ + $(call mkshlib,$@,$(SONAME),$(LOBJS),$(LINKWITH)) + +$(LOGGERSONAME): $(LOGGERFILENAME) + rm -f $@ + ln -s $(LOGGERFILENAME) $@ +include .depend diff --git a/cpp/demo/Ice/plugin/Makefile.mak b/cpp/demo/Ice/plugin/Makefile.mak new file mode 100644 index 00000000000..e5eae0e2b93 --- /dev/null +++ b/cpp/demo/Ice/plugin/Makefile.mak @@ -0,0 +1,65 @@ +# **********************************************************************
+#
+# Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+top_srcdir = ..\..\..
+
+CLIENT = client.exe
+SERVER = server.exe
+
+LOGGERLIBNAME = loggerplugin$(LIBSUFFIX).lib
+LOGGERDLLNAME = loggerplugin$(LIBSUFFIX).dll
+
+TARGETS = $(CLIENT) $(SERVER) $(LOGGERDLLNAME)
+
+OBJS = Hello.obj
+
+COBJS = Client.obj
+
+SOBJS = HelloI.obj \
+ Server.obj
+
+LOBJS = LoggerI.obj
+
+SRCS = $(OBJS:.obj=.cpp) \
+ $(COBJS:.obj=.cpp) \
+ $(SOBJS:.obj=.cpp) \
+ $(LOBJS:.obj=.cpp)
+
+!include $(top_srcdir)/config/Make.rules.mak
+
+CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+
+!if "$(GENERATE_PDB)" == "yes"
+CPDBFLAGS = /pdb:$(CLIENT:.exe=.pdb)
+SPDBFLAGS = /pdb:$(SERVER:.exe=.pdb)
+LPDBFLAGS = /pdb:$(LOGGERDLLNAME:.dll=.pdb)
+!endif
+
+$(CLIENT): $(OBJS) $(COBJS)
+ $(LINK) $(LD_EXEFLAGS) $(CPDBFLAGS) $(SETARGV) $(OBJS) $(COBJS) $(PREOUT)$@ $(PRELIBS)$(LIBS)
+ @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \
+ $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest
+
+$(SERVER): $(OBJS) $(SOBJS)
+ $(LINK) $(LD_EXEFLAGS) $(SPDBFLAGS) $(SETARGV) $(OBJS) $(SOBJS) $(PREOUT)$@ $(PRELIBS)$(LIBS)
+ @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \
+ $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest
+
+$(LOGGERLIBNAME) : $(LOGGERDLLNAME)
+
+$(LOGGERDLLNAME): $(LOBJS)
+ $(LINK) $(LD_DLLFLAGS) $(PDBFLAGS) $(SETARGV) $(LOBJS) $(PREOUT)$@ $(PRELIBS)$(LINKWITH)
+ @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \
+ $(MT) -nologo -manifest $@.manifest -outputresource:$@;#2 && del /q $@.manifest
+ @if exist $(LOGGERDLLNAME:.dll=.exp) del /q $(LOGGERDLLNAME:.dll=.exp)
+
+clean::
+ del /q Hello.cpp Hello.h
+
+!include .depend
diff --git a/cpp/demo/Ice/plugin/README b/cpp/demo/Ice/plugin/README new file mode 100644 index 00000000000..57579706687 --- /dev/null +++ b/cpp/demo/Ice/plugin/README @@ -0,0 +1,14 @@ +This demo illustrates how to write and configure a simple Ice plugin +as well as a Ice Logger plugin. + +To run the demo, first start the server: + +$ server + +In a separate window, start the client: + +$ client + +Look in the client and sever config files to see the plugin +configuration. + diff --git a/cpp/demo/Ice/plugin/Server.cpp b/cpp/demo/Ice/plugin/Server.cpp new file mode 100644 index 00000000000..368183e76bb --- /dev/null +++ b/cpp/demo/Ice/plugin/Server.cpp @@ -0,0 +1,44 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <HelloI.h> + +using namespace std; + +class HelloServer : public Ice::Application +{ +public: + + virtual int run(int, char*[]); +}; + +int +main(int argc, char* argv[]) +{ + HelloServer app; + return app.main(argc, argv, "config.server"); +} + +int +HelloServer::run(int argc, char* argv[]) +{ + if(argc > 1) + { + cerr << appName() << ": too many arguments" << endl; + return EXIT_FAILURE; + } + + Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Hello"); + Demo::HelloPtr hello = new HelloI; + adapter->add(hello, communicator()->stringToIdentity("hello")); + adapter->activate(); + communicator()->waitForShutdown(); + return EXIT_SUCCESS; +} diff --git a/cpp/demo/Ice/plugin/config.client b/cpp/demo/Ice/plugin/config.client new file mode 100644 index 00000000000..5c209b36672 --- /dev/null +++ b/cpp/demo/Ice/plugin/config.client @@ -0,0 +1,38 @@ +# +# The client reads this property to create the reference to the +# "hello" object in the server. +# +Hello.Proxy=hello:tcp -p 10000:udp -p 10000 + +# +# Warn about connection exceptions +# +Ice.Warn.Connections=1 + +# +# Network Tracing +# +# 0 = no network tracing +# 1 = trace connection establishment and closure +# 2 = like 1, but more detailed +# 3 = like 2, but also trace data transfer +# +Ice.Trace.Network=1 + +# +# Protocol Tracing +# +# 0 = no protocol tracing +# 1 = trace protocol messages +# +#Ice.Trace.Protocol=1 + +# +# Logger Plugin Configuration +# +Ice.Plugin.Logger=LoggerPlugin:createLogger + +# +# Tracing Plugin Configuration +# +#Ice.Plugin.IceSSL=IceSSL:createIceSSL diff --git a/cpp/demo/Ice/plugin/config.server b/cpp/demo/Ice/plugin/config.server new file mode 100644 index 00000000000..d429c7f6603 --- /dev/null +++ b/cpp/demo/Ice/plugin/config.server @@ -0,0 +1,40 @@ +# +# The server creates one single object adapter with the name +# "Hello". The following line sets the endpoints for this +# adapter. +# +Hello.Endpoints=tcp -p 10000:udp -p 10000 + +# +# Warn about connection exceptions +# +Ice.Warn.Connections=1 + +# +# Network Tracing +# +# 0 = no network tracing +# 1 = trace connection establishment and closure +# 2 = like 1, but more detailed +# 3 = like 2, but also trace data transfer +# +Ice.Trace.Network=1 + +# +# Protocol Tracing +# +# 0 = no protocol tracing +# 1 = trace protocol messages +# +#Ice.Trace.Protocol=1 + +# +# Logger Plugin Configuration +# +Ice.Plugin.Logger=LoggerPlugin:createLogger + +# +# Tracing Plugin Configuration +# +#Ice.Plugin.IceSSL=IceSSL:createIceSSL + diff --git a/cpp/demo/Ice/plugin/expect.py b/cpp/demo/Ice/plugin/expect.py new file mode 100755 index 00000000000..f4da233e308 --- /dev/null +++ b/cpp/demo/Ice/plugin/expect.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +import sys, os + +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] +if len(path) == 0: + raise "can't find toplevel directory!" +sys.path.append(path[0]) + +from demoscript import * +from demoscript.Ice import plugin + +server = Util.spawn('./server --Ice.PrintAdapterReady --Ice.Warn.Connections=0') +server.expect('.* ready') +client = Util.spawn('./client --Ice.Warn.Connections=0') +client.expect('.*==>') + +plugin.run(client, server) diff --git a/cpp/test/Slice/parser/.gitignore b/cpp/test/Slice/parser/.gitignore index ff6e00c37ce..7732d7c018e 100644 --- a/cpp/test/Slice/parser/.gitignore +++ b/cpp/test/Slice/parser/.gitignore @@ -1,7 +1,9 @@ // Generated by makegitignore.py // IMPORTANT: Do not edit this file -- any edits made here will be lost! +CircularA.o +CircularB.o CircularA.cpp -CircularA.h CircularB.cpp +CircularA.h CircularB.h diff --git a/cs/demo/Ice/Makefile b/cs/demo/Ice/Makefile index 54df9abfa6b..08b5f4d746c 100644 --- a/cs/demo/Ice/Makefile +++ b/cs/demo/Ice/Makefile @@ -23,7 +23,8 @@ SUBDIRS = bidir \ value \ async \ multicast \ - serialize + serialize \ + plugin $(EVERYTHING):: @for subdir in $(SUBDIRS); \ diff --git a/cs/demo/Ice/Makefile.mak b/cs/demo/Ice/Makefile.mak index 63c87d8a567..9f7e2cb515a 100644 --- a/cs/demo/Ice/Makefile.mak +++ b/cs/demo/Ice/Makefile.mak @@ -23,7 +23,8 @@ SUBDIRS = bidir \ value \
async \
multicast \
- serialize
+ serialize \
+ plugin
$(EVERYTHING)::
@for %i in ( $(SUBDIRS) ) do \
diff --git a/cs/demo/Ice/README b/cs/demo/Ice/README index bfe64f01fe6..d0c64549201 100644 --- a/cs/demo/Ice/README +++ b/cs/demo/Ice/README @@ -47,6 +47,10 @@ Demos in this directory: A demo to illustrate how nested callbacks work, and how the size of the thread pool affects the maximum nesting depth. +- plugin + + A demo to illustrate how to write and use Ice plugins. + - serialize This demo illistrates how to transfer serializable .NET objects diff --git a/cs/demo/Ice/plugin/.depend b/cs/demo/Ice/plugin/.depend new file mode 100644 index 00000000000..d36db71ec3d --- /dev/null +++ b/cs/demo/Ice/plugin/.depend @@ -0,0 +1 @@ +Hello.cs: ./Hello.ice diff --git a/cs/demo/Ice/plugin/Client.cs b/cs/demo/Ice/plugin/Client.cs new file mode 100644 index 00000000000..de80abec160 --- /dev/null +++ b/cs/demo/Ice/plugin/Client.cs @@ -0,0 +1,134 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +using Demo; +using System; +using System.Reflection; + +[assembly: CLSCompliant(true)] + +[assembly: AssemblyTitle("IcePluginClient")] +[assembly: AssemblyDescription("Ice plugin demo client")] +[assembly: AssemblyCompany("ZeroC, Inc.")] + +public class Client +{ + public class App : Ice.Application + { + private static void menu() + { + Console.Write( + "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" + + "s: shutdown server\n" + + "x: exit\n" + + "?: help\n"); + } + + public override int run(string[] args) + { + if(args.Length > 0) + { + Console.Error.WriteLine(appName() + ": too many arguments"); + return 1; + } + + HelloPrx twoway = HelloPrxHelper.checkedCast(communicator().propertyToProxy("Hello.Proxy")); + if(twoway == null) + { + Console.Error.WriteLine("invalid proxy"); + return 1; + } + HelloPrx oneway = (HelloPrx)twoway.ice_oneway(); + HelloPrx batchOneway = (HelloPrx)twoway.ice_batchOneway(); + HelloPrx datagram = (HelloPrx)twoway.ice_datagram(); + HelloPrx batchDatagram =(HelloPrx)twoway.ice_batchDatagram(); + + menu(); + + string line = null; + do + { + try + { + Console.Out.Write("==> "); + Console.Out.Flush(); + line = Console.In.ReadLine(); + if(line == null) + { + break; + } + if(line.Equals("t")) + { + twoway.sayHello(); + } + else if(line.Equals("o")) + { + oneway.sayHello(); + } + else if(line.Equals("O")) + { + batchOneway.sayHello(); + } + else if(line.Equals("d")) + { + datagram.sayHello(); + } + else if(line.Equals("D")) + { + batchDatagram.sayHello(); + } + else if(line.Equals("f")) + { + communicator().flushBatchRequests(); + } + else if(line.Equals("s")) + { + twoway.shutdown(); + } + else if(line.Equals("x")) + { + // Nothing to do + } + else if(line.Equals("?")) + { + menu(); + } + else + { + Console.WriteLine("unknown command `" + line + "'"); + menu(); + } + } + catch(System.Exception ex) + { + Console.Error.WriteLine(ex); + } + } + while (!line.Equals("x")); + + return 0; + } + } + + public static void Main(string[] args) + { + App app = new App(); + int status = app.main(args, "config.client"); + if(status != 0) + { + System.Environment.Exit(status); + } + } +} diff --git a/cs/demo/Ice/plugin/Hello.ice b/cs/demo/Ice/plugin/Hello.ice new file mode 100644 index 00000000000..4b123a06908 --- /dev/null +++ b/cs/demo/Ice/plugin/Hello.ice @@ -0,0 +1,24 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef HELLO_ICE +#define HELLO_ICE + +module Demo +{ + +interface Hello +{ + idempotent void sayHello(); + void shutdown(); +}; + +}; + +#endif diff --git a/cs/demo/Ice/plugin/HelloI.cs b/cs/demo/Ice/plugin/HelloI.cs new file mode 100644 index 00000000000..963f5a5ffb5 --- /dev/null +++ b/cs/demo/Ice/plugin/HelloI.cs @@ -0,0 +1,24 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +using Demo; + +public class HelloI : HelloDisp_ +{ + public override void sayHello(Ice.Current current) + { + current.adapter.getCommunicator().getLogger().print("Hello World!"); + } + + public override void shutdown(Ice.Current current) + { + current.adapter.getCommunicator().getLogger().print("Shutting down..."); + current.adapter.getCommunicator().shutdown(); + } +} diff --git a/cs/demo/Ice/plugin/Ice.plugin.client.csproj b/cs/demo/Ice/plugin/Ice.plugin.client.csproj new file mode 100644 index 00000000000..67e13ce5606 --- /dev/null +++ b/cs/demo/Ice/plugin/Ice.plugin.client.csproj @@ -0,0 +1,117 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{228BEDFAC-57DC-4E1F-8335-D0CD657A987B}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>client</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>
+ </RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <OutputPath>.\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>true</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>false</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>full</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>.\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>false</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>true</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>none</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Ice">
+ <Name>Ice</Name>
+ <HintPath>..\..\..\bin\Ice.dll</HintPath>
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Client.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="generated\Hello.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="README" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+ <Target Name="CompileSlice" Inputs="Hello.ice" Outputs="generated\Hello.cs">
+ <Exec Condition="Exists('..\..\..\slice')" Command="..\..\..\bin\slice2cs.exe --output-dir generated Hello.ice" />
+ <Exec Condition="Exists('..\..\..\..\slice')" Command="..\..\..\..\cpp\bin\slice2cs.exe --output-dir generated Hello.ice" />
+ </Target>
+ <Target Name="AfterClean">
+ <Delete Files="generated\Hello.cs" />
+ </Target>
+ <PropertyGroup>
+ <CompileDependsOn>
+ CompileSlice;$(CompileDependsOn)
+ </CompileDependsOn>
+ </PropertyGroup>
+</Project>
diff --git a/cs/demo/Ice/plugin/Ice.plugin.logger.csproj b/cs/demo/Ice/plugin/Ice.plugin.logger.csproj new file mode 100644 index 00000000000..47701a31f5d --- /dev/null +++ b/cs/demo/Ice/plugin/Ice.plugin.logger.csproj @@ -0,0 +1,110 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{8D371651-BFA4-43C9-B143-77F0CCDEB310}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>LoggerPlugin</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Library</OutputType>
+ <RootNamespace>
+ </RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <OutputPath>.\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>true</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>false</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>full</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>.\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>false</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>true</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>none</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="IceBox">
+ <Name>IceBox</Name>
+ <HintPath>..\..\..\bin\IceBox.dll</HintPath>
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="Ice">
+ <Name>Ice</Name>
+ <HintPath>..\..\..\bin\Ice.dll</HintPath>
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="LoggerI.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="LoggerPluginFactoryI.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="README" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project>
diff --git a/cs/demo/Ice/plugin/Ice.plugin.server.csproj b/cs/demo/Ice/plugin/Ice.plugin.server.csproj new file mode 100644 index 00000000000..7bf23773647 --- /dev/null +++ b/cs/demo/Ice/plugin/Ice.plugin.server.csproj @@ -0,0 +1,120 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{0B41ADFF-7802-4A36-DDFB-C32DE33B0290}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>server</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>
+ </RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <OutputPath>.\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>true</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>false</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>full</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>.\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>false</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>true</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>none</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Ice">
+ <Name>Ice</Name>
+ <HintPath>..\..\..\bin\Ice.dll</HintPath>
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="generated\Hello.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="HelloI.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Server.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="README" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+ <Target Name="CompileSlice" Inputs="Hello.ice" Outputs="generated\Hello.cs">
+ <Exec Condition="Exists('..\..\..\slice')" Command="..\..\..\bin\slice2cs.exe --output-dir generated Hello.ice" />
+ <Exec Condition="Exists('..\..\..\..\slice')" Command="..\..\..\..\cpp\bin\slice2cs.exe --output-dir generated Hello.ice" />
+ </Target>
+ <Target Name="AfterClean">
+ <Delete Files="generated\Hello.cs" />
+ </Target>
+ <PropertyGroup>
+ <CompileDependsOn>
+ CompileSlice;$(CompileDependsOn)
+ </CompileDependsOn>
+ </PropertyGroup>
+</Project>
diff --git a/cs/demo/Ice/plugin/LoggerI.cs b/cs/demo/Ice/plugin/LoggerI.cs new file mode 100644 index 00000000000..9bd981845dc --- /dev/null +++ b/cs/demo/Ice/plugin/LoggerI.cs @@ -0,0 +1,31 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +public class LoggerI : Ice.Logger +{ + public void print(string message) + { + System.Console.WriteLine("PRINT: " + message); + } + + public void trace(string category, string message) + { + System.Console.WriteLine("TRACE(" + category + "): " + message); + } + + public void warning(string message) + { + System.Console.WriteLine("WARNING: " + message); + } + + public void error(string message) + { + System.Console.WriteLine("ERROR: " + message); + } +} diff --git a/cs/demo/Ice/plugin/LoggerPluginFactoryI.cs b/cs/demo/Ice/plugin/LoggerPluginFactoryI.cs new file mode 100644 index 00000000000..e781dd577ce --- /dev/null +++ b/cs/demo/Ice/plugin/LoggerPluginFactoryI.cs @@ -0,0 +1,16 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +public class LoggerPluginFactoryI : Ice.PluginFactory +{ + public Ice.Plugin create(Ice.Communicator communicator, string name, string[] args) + { + return new Ice.LoggerPlugin(communicator, new LoggerI()); + } +} diff --git a/cs/demo/Ice/plugin/Makefile b/cs/demo/Ice/plugin/Makefile new file mode 100644 index 00000000000..9dd9e3d8138 --- /dev/null +++ b/cs/demo/Ice/plugin/Makefile @@ -0,0 +1,39 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +top_srcdir = ../../.. + +TARGETS = client.exe server.exe LoggerPlugin.dll + +C_SRCS = Client.cs +S_SRCS = HelloI.cs Server.cs +L_SRCS = LoggerI.cs LoggerPluginFactoryI.cs + +SLICE_SRCS = $(SDIR)/Hello.ice + +SDIR = . + +GDIR = generated + +include $(top_srcdir)/config/Make.rules.cs + +MCSFLAGS := $(MCSFLAGS) -target:exe + +SLICE2CSFLAGS := $(SLICE2CSFLAGS) --ice -I. -I$(slicedir) + +client.exe: $(C_SRCS) $(GEN_SRCS) + $(MCS) $(MCSFLAGS) -out:$@ $(call ref,Ice) $(subst /,$(DSEP),$^) + +server.exe: $(S_SRCS) $(GEN_SRCS) + $(MCS) $(MCSFLAGS) -out:$@ $(call ref,Ice) $(subst /,$(DSEP),$^) + +LoggerPlugin.dll: $(L_SRCS) + $(MCS) $(MCSFLAGS) -target:library -out:$@ $(call ref,Ice) $(subst /,$(DSEP),$^) + +include .depend diff --git a/cs/demo/Ice/plugin/Makefile.mak b/cs/demo/Ice/plugin/Makefile.mak new file mode 100644 index 00000000000..a44a10994b6 --- /dev/null +++ b/cs/demo/Ice/plugin/Makefile.mak @@ -0,0 +1,40 @@ +# **********************************************************************
+#
+# Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+top_srcdir = ..\..\..
+
+TARGETS = client.exe server.exe LoggerPlugin.dll
+TARGETS_CONFIG = $(TARGETS:.exe=.exe.config)
+
+C_SRCS = Client.cs
+S_SRCS = HelloI.cs Server.cs
+L_SRCS = LoggerI.cs LoggerPluginFactoryI.cs
+
+GEN_SRCS = $(GDIR)\Hello.cs
+
+SDIR = .
+
+GDIR = generated
+
+!include $(top_srcdir)\config\Make.rules.mak.cs
+
+MCSFLAGS = $(MCSFLAGS) -target:exe
+
+SLICE2CSFLAGS = $(SLICE2CSFLAGS) --ice -I. -I$(slicedir)
+
+client.exe: $(C_SRCS) $(GEN_SRCS)
+ $(MCS) $(MCSFLAGS) -out:$@ -r:$(refdir)\Ice.dll $(C_SRCS) $(GEN_SRCS)
+
+server.exe: $(S_SRCS) $(GEN_SRCS)
+ $(MCS) $(MCSFLAGS) -out:$@ -r:$(refdir)\Ice.dll $(S_SRCS) $(GEN_SRCS)
+
+LoggerPlugin.dll: $(L_SRCS)
+ $(MCS) $(MCSFLAGS) -target:library -out:$@ -r:$(refdir)\Ice.dll $(L_SRCS)
+
+!include .depend
diff --git a/cs/demo/Ice/plugin/README b/cs/demo/Ice/plugin/README new file mode 100644 index 00000000000..420f54ede8e --- /dev/null +++ b/cs/demo/Ice/plugin/README @@ -0,0 +1,13 @@ +This demo illustrates how to write and configure a simple Ice plugin +as well as a Ice Logger plugin. + +To run the demo, first start the server: + +$ server.exe + +In a separate window, start the client: + +$ client.exe + +Look in the client and sever config files to see the plugin +configuration. diff --git a/cs/demo/Ice/plugin/Server.cs b/cs/demo/Ice/plugin/Server.cs new file mode 100644 index 00000000000..33b2415819a --- /dev/null +++ b/cs/demo/Ice/plugin/Server.cs @@ -0,0 +1,48 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +using System; +using System.Reflection; + +[assembly: CLSCompliant(true)] + +[assembly: AssemblyTitle("IcePluginServer")] +[assembly: AssemblyDescription("Ice plugin demo server")] +[assembly: AssemblyCompany("ZeroC, Inc.")] + +public class Server +{ + class App : Ice.Application + { + public override int run(string[] args) + { + if(args.Length > 0) + { + System.Console.Error.WriteLine(appName() + ": too many arguments"); + return 1; + } + + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello"); + adapter.add(new HelloI(), communicator().stringToIdentity("hello")); + adapter.activate(); + communicator().waitForShutdown(); + return 0; + } + } + + public static void Main(string[] args) + { + App app = new App(); + int status = app.main(args, "config.server"); + if(status != 0) + { + System.Environment.Exit(status); + } + } +} diff --git a/cs/demo/Ice/plugin/config.client b/cs/demo/Ice/plugin/config.client new file mode 100644 index 00000000000..71c9abda247 --- /dev/null +++ b/cs/demo/Ice/plugin/config.client @@ -0,0 +1,38 @@ +# +# The client reads this property to create the reference to the +# "hello" object in the server. +# +Hello.Proxy=hello:tcp -p 10000:udp -p 10000 + +# +# Warn about connection exceptions. +# +Ice.Warn.Connections=1 + +# +# Network Tracing +# +# 0 = no network tracing +# 1 = trace connection establishment and closure +# 2 = like 1, but more detailed +# 3 = like 2, but also trace data transfer +# +Ice.Trace.Network=1 + +# +# Protocol Tracing +# +# 0 = no protocol tracing +# 1 = trace protocol messages +# +#Ice.Trace.Protocol=1 + +# +# Logger Plugin Configuration +# +Ice.Plugin.Logger=LoggerPlugin:LoggerPluginFactoryI + +# +# Tracing Plugin Configuration +# +#Ice.Plugin.Logger=LoggerPlugin:LoggerPluginFactoryI diff --git a/cs/demo/Ice/plugin/config.server b/cs/demo/Ice/plugin/config.server new file mode 100644 index 00000000000..2c813a86482 --- /dev/null +++ b/cs/demo/Ice/plugin/config.server @@ -0,0 +1,39 @@ +# +# The server creates one single object adapter with the name +# "Hello". The following line sets the endpoints for this +# adapter. +# +Hello.Endpoints=tcp -p 10000:udp -p 10000 + +# +# Warn about connection exceptions. +# +Ice.Warn.Connections=1 + +# +# Network Tracing +# +# 0 = no network tracing +# 1 = trace connection establishment and closure +# 2 = like 1, but more detailed +# 3 = like 2, but also trace data transfer +# +Ice.Trace.Network=1 + +# +# Protocol Tracing +# +# 0 = no protocol tracing +# 1 = trace protocol messages +# +#Ice.Trace.Protocol=1 + +# +# Logger Plugin Configuration +# +Ice.Plugin.Logger=LoggerPlugin:LoggerPluginFactoryI + +# +# Tracing Plugin Configuration +# +#Ice.Plugin.Logger=LoggerPlugin:LoggerPluginFactoryI diff --git a/cs/demo/Ice/plugin/expect.py b/cs/demo/Ice/plugin/expect.py new file mode 100755 index 00000000000..319ed94db12 --- /dev/null +++ b/cs/demo/Ice/plugin/expect.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +import sys, os + +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] +if len(path) == 0: + raise "can't find toplevel directory!" +sys.path.append(path[0]) + +from demoscript import * +from demoscript.Ice import plugin + +server = Util.spawn('server.exe --Ice.PrintAdapterReady --Ice.Warn.Connections=0') +server.expect('.* ready') +client = Util.spawn('client.exe --Ice.Warn.Connections=0') +client.expect('.*==>') + +plugin.run(client, server) diff --git a/cs/demo/Ice/plugin/generated/.gitignore b/cs/demo/Ice/plugin/generated/.gitignore new file mode 100644 index 00000000000..39af5887579 --- /dev/null +++ b/cs/demo/Ice/plugin/generated/.gitignore @@ -0,0 +1 @@ +# Dummy file, so that git retains this otherwise empty directory. diff --git a/demoscript/Ice/plugin.py b/demoscript/Ice/plugin.py new file mode 100644 index 00000000000..ebdf614f9de --- /dev/null +++ b/demoscript/Ice/plugin.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +import sys +from demoscript import * +from scripts import Expect + +def run(client, server): + print "testing...", + sys.stdout.flush() + client.sendline('t') + server.expect('PRINT: Hello World!') + print "ok" + + client.sendline('s') + server.waitTestSuccess() + + client.sendline('x') + client.waitTestSuccess() diff --git a/java/demo/Ice/README b/java/demo/Ice/README index 5714a88aa20..4e430133137 100644 --- a/java/demo/Ice/README +++ b/java/demo/Ice/README @@ -52,6 +52,10 @@ Demos in this directory: A demo to illustrate how nested callbacks work, and how the size of the thread pool affects the maximum nesting depth. +- plugin + + A demo to illustrate how to write and use Ice plugins. + - serialize This demo illustrates how to transfer serializable Java classes diff --git a/java/demo/Ice/build.xml b/java/demo/Ice/build.xml index c101f7c9627..f6313e055bc 100644 --- a/java/demo/Ice/build.xml +++ b/java/demo/Ice/build.xml @@ -22,6 +22,7 @@ <ant dir="minimal"/> <ant dir="multicast"/> <ant dir="nested"/> + <ant dir="plugin"/> <ant dir="serialize"/> <ant dir="session"/> <ant dir="throughput"/> @@ -39,6 +40,7 @@ <ant dir="minimal" target="clean"/> <ant dir="multicast" target="clean"/> <ant dir="nested" target="clean"/> + <ant dir="plugin" target="clean"/> <ant dir="serialize" target="clean"/> <ant dir="session" target="clean"/> <ant dir="throughput" target="clean"/> diff --git a/java/demo/Ice/plugin/Client.java b/java/demo/Ice/plugin/Client.java new file mode 100644 index 00000000000..a0a2f4f2f10 --- /dev/null +++ b/java/demo/Ice/plugin/Client.java @@ -0,0 +1,153 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +import Demo.*; + +public class Client extends Ice.Application +{ + class ShutdownHook extends Thread + { + public void + run() + { + try + { + communicator().destroy(); + } + catch(Ice.LocalException ex) + { + ex.printStackTrace(); + } + } + } + + private static void + menu() + { + System.out.println( + "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" + + "s: shutdown server\n" + + "x: exit\n" + + "?: help\n"); + } + + public int + run(String[] args) + { + if(args.length > 0) + { + System.err.println(appName() + ": too many arguments"); + return 1; + } + + // + // Since this is an interactive demo we want to clear the + // Application installed interrupt callback and install our + // own shutdown hook. + // + setInterruptHook(new ShutdownHook()); + + HelloPrx twoway = HelloPrxHelper.checkedCast(communicator().propertyToProxy("Hello.Proxy")); + if(twoway == null) + { + System.err.println("invalid proxy"); + return 1; + } + HelloPrx oneway = (HelloPrx)twoway.ice_oneway(); + HelloPrx batchOneway = (HelloPrx)twoway.ice_batchOneway(); + HelloPrx datagram = (HelloPrx)twoway.ice_datagram(); + HelloPrx batchDatagram = (HelloPrx)twoway.ice_batchDatagram(); + + menu(); + + java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); + + String line = null; + do + { + try + { + System.out.print("==> "); + System.out.flush(); + line = in.readLine(); + if(line == null) + { + break; + } + if(line.equals("t")) + { + twoway.sayHello(); + } + else if(line.equals("o")) + { + oneway.sayHello(); + } + else if(line.equals("O")) + { + batchOneway.sayHello(); + } + else if(line.equals("d")) + { + datagram.sayHello(); + } + else if(line.equals("D")) + { + batchDatagram.sayHello(); + } + else if(line.equals("f")) + { + communicator().flushBatchRequests(); + } + else if(line.equals("s")) + { + twoway.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")); + + 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/Ice/plugin/Hello.ice b/java/demo/Ice/plugin/Hello.ice new file mode 100644 index 00000000000..4b123a06908 --- /dev/null +++ b/java/demo/Ice/plugin/Hello.ice @@ -0,0 +1,24 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef HELLO_ICE +#define HELLO_ICE + +module Demo +{ + +interface Hello +{ + idempotent void sayHello(); + void shutdown(); +}; + +}; + +#endif diff --git a/java/demo/Ice/plugin/HelloI.java b/java/demo/Ice/plugin/HelloI.java new file mode 100644 index 00000000000..9d49bf9a9bb --- /dev/null +++ b/java/demo/Ice/plugin/HelloI.java @@ -0,0 +1,26 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +import Demo.*; + +public class HelloI extends _HelloDisp +{ + public void + sayHello(Ice.Current current) + { + current.adapter.getCommunicator().getLogger().print("Hello World!"); + } + + public void + shutdown(Ice.Current current) + { + current.adapter.getCommunicator().getLogger().print("Shutting down..."); + current.adapter.getCommunicator().shutdown(); + } +} diff --git a/java/demo/Ice/plugin/LoggerI.java b/java/demo/Ice/plugin/LoggerI.java new file mode 100644 index 00000000000..b6fa5b2f637 --- /dev/null +++ b/java/demo/Ice/plugin/LoggerI.java @@ -0,0 +1,37 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +import Ice.Logger; + +public class LoggerI implements Ice.Logger +{ + public void + print(String message) + { + System.out.println("PRINT: " + message); + } + + public void + trace(String category, String message) + { + System.out.println("TRACE(" + category + "): " + message); + } + + public void + warning(String message) + { + System.out.println("WARNING: " + message); + } + + public void + error(String message) + { + System.out.println("ERROR: " + message); + } +} diff --git a/java/demo/Ice/plugin/LoggerPluginFactoryI.java b/java/demo/Ice/plugin/LoggerPluginFactoryI.java new file mode 100644 index 00000000000..b1d9052e048 --- /dev/null +++ b/java/demo/Ice/plugin/LoggerPluginFactoryI.java @@ -0,0 +1,20 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +import Ice.PluginFactory; +import Ice.LoggerPlugin; + +public class LoggerPluginFactoryI implements Ice.PluginFactory +{ + public Ice.Plugin + create(Ice.Communicator communicator, String name, String[] args) + { + return new Ice.LoggerPlugin(communicator, new LoggerI()); + } +} diff --git a/java/demo/Ice/plugin/README b/java/demo/Ice/plugin/README new file mode 100644 index 00000000000..277b14160d4 --- /dev/null +++ b/java/demo/Ice/plugin/README @@ -0,0 +1,13 @@ +This demo illustrates how to write and configure a simple Ice plugin +as well as a Ice Logger plugin. + +To run the demo, first start the server: + +$ java Server + +In a separate window, start the client: + +$ java Client + +Look in the client and sever config files to see the plugin +configuration. diff --git a/java/demo/Ice/plugin/Server.java b/java/demo/Ice/plugin/Server.java new file mode 100644 index 00000000000..c78c193ebca --- /dev/null +++ b/java/demo/Ice/plugin/Server.java @@ -0,0 +1,37 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +import Demo.*; + +public class Server extends Ice.Application +{ + public int + run(String[] args) + { + if(args.length > 0) + { + System.err.println(appName() + ": too many arguments"); + return 1; + } + + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello"); + adapter.add(new HelloI(), communicator().stringToIdentity("hello")); + adapter.activate(); + communicator().waitForShutdown(); + return 0; + } + + public static void + main(String[] args) + { + Server app = new Server(); + int status = app.main("Server", args, "config.server"); + System.exit(status); + } +} diff --git a/java/demo/Ice/plugin/build.xml b/java/demo/Ice/plugin/build.xml new file mode 100644 index 00000000000..6aeed05e14d --- /dev/null +++ b/java/demo/Ice/plugin/build.xml @@ -0,0 +1,44 @@ +<!-- + ********************************************************************** + + Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. + + This copy of Ice is licensed to you under the terms described in the + ICE_LICENSE file included in this distribution. + + ********************************************************************** +--> + +<project name="demo_Ice_plugin" 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}"> + <fileset dir="." includes="Hello.ice"/> + </slice2java> + </target> + + <target name="compile" depends="generate"> + <mkdir dir="${class.dir}"/> + <javac srcdir=".:${generated.dir}" destdir="${class.dir}" debug="${debug}"> + <exclude name="${generated.dir}/**"/> + <classpath refid="ice.classpath"/> + <compilerarg value="${javac.lint}"/> + </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/Ice/plugin/config.client b/java/demo/Ice/plugin/config.client new file mode 100644 index 00000000000..d86afc22228 --- /dev/null +++ b/java/demo/Ice/plugin/config.client @@ -0,0 +1,38 @@ +# +# The client reads this property to create the reference to the +# "hello" object in the server. +# +Hello.Proxy=hello:tcp -p 10000:udp -p 10000 + +# +# Warn about connection exceptions. +# +Ice.Warn.Connections=1 + +# +# Network Tracing +# +# 0 = no network tracing +# 1 = trace connection establishment and closure +# 2 = like 1, but more detailed +# 3 = like 2, but also trace data transfer +# +Ice.Trace.Network=1 + +# +# Protocol Tracing +# +# 0 = no protocol tracing +# 1 = trace protocol messages +# +#Ice.Trace.Protocol=1 + +# +# Logger Plugin Configuration +# +Ice.Plugin.Logger=LoggerPluginFactoryI + +# +# Tracing Plugin Configuration +# +#Ice.Plugin.Logger=Logger.PluginFactory diff --git a/java/demo/Ice/plugin/config.server b/java/demo/Ice/plugin/config.server new file mode 100644 index 00000000000..6cfd27dfc64 --- /dev/null +++ b/java/demo/Ice/plugin/config.server @@ -0,0 +1,39 @@ +# +# The server creates one single object adapter with the name +# "Hello". The following line sets the endpoints for this +# adapter. +# +Hello.Endpoints=tcp -p 10000:udp -p 10000 + +# +# Warn about connection exceptions +# +Ice.Warn.Connections=1 + +# +# Network Tracing +# +# 0 = no network tracing +# 1 = trace connection establishment and closure +# 2 = like 1, but more detailed +# 3 = like 2, but also trace data transfer +# +Ice.Trace.Network=1 + +# +# Protocol Tracing +# +# 0 = no protocol tracing +# 1 = trace protocol messages +# +#Ice.Trace.Protocol=1 + +# +# Logger Plugin Configuration +# +Ice.Plugin.Logger=LoggerPluginFactoryI + +# +# Tracing Plugin Configuration +# +#Ice.Plugin.Logger=Logger.PluginFactory diff --git a/java/demo/Ice/plugin/expect.py b/java/demo/Ice/plugin/expect.py new file mode 100755 index 00000000000..3d63fdba6ea --- /dev/null +++ b/java/demo/Ice/plugin/expect.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +import sys, os + +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] +if len(path) == 0: + raise "can't find toplevel directory!" +sys.path.append(path[0]) + +from demoscript import * +from demoscript.Ice import plugin + +server = Util.spawn('java Server --Ice.PrintAdapterReady --Ice.Warn.Connections=0') +server.expect('.* ready') +client = Util.spawn('java Client --Ice.Warn.Connections=0') +client.expect('.*==>') + +plugin.run(client, server) |