diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
commit | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (patch) | |
tree | da50d054f9c761c3f6a5923f6979e93306c56d68 /TAO/examples/Simple/echo | |
parent | 0e555b9150d38e3b3473ba325b56db2642e6352b (diff) | |
download | ATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/examples/Simple/echo')
-rw-r--r-- | TAO/examples/Simple/echo/Echo.idl | 27 | ||||
-rw-r--r-- | TAO/examples/Simple/echo/Echo_Client_i.cpp | 71 | ||||
-rw-r--r-- | TAO/examples/Simple/echo/Echo_Client_i.h | 51 | ||||
-rw-r--r-- | TAO/examples/Simple/echo/Echo_i.cpp | 106 | ||||
-rw-r--r-- | TAO/examples/Simple/echo/Echo_i.h | 68 | ||||
-rw-r--r-- | TAO/examples/Simple/echo/Makefile.am | 117 | ||||
-rw-r--r-- | TAO/examples/Simple/echo/README | 82 | ||||
-rw-r--r-- | TAO/examples/Simple/echo/client.cpp | 25 | ||||
-rw-r--r-- | TAO/examples/Simple/echo/echo.mpc | 36 | ||||
-rwxr-xr-x | TAO/examples/Simple/echo/run_test.pl | 44 | ||||
-rw-r--r-- | TAO/examples/Simple/echo/server.cpp | 45 |
11 files changed, 0 insertions, 672 deletions
diff --git a/TAO/examples/Simple/echo/Echo.idl b/TAO/examples/Simple/echo/Echo.idl deleted file mode 100644 index a396838f0bb..00000000000 --- a/TAO/examples/Simple/echo/Echo.idl +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#if !defined (_ECHO_IDL) -#define _ECHO_IDL - -interface Echo -{ - // = TITLE - // Defines an interface that encapsulates operations that return the - // mesg string to be displayed and shuts down the server. - - typedef sequence<Object> List; - - List echo_list (in string message); - // This operation returns the message as a sequence of Objects and - // displays it on the screen as a string. - - string echo_string (in string message); - // This operation returns the message as a string and displays it on - // the screen. - - oneway void shutdown (); - // This operation will shutdown the server. -}; - -#endif /* _ECHO_IDL */ diff --git a/TAO/examples/Simple/echo/Echo_Client_i.cpp b/TAO/examples/Simple/echo/Echo_Client_i.cpp deleted file mode 100644 index 67088738cf4..00000000000 --- a/TAO/examples/Simple/echo/Echo_Client_i.cpp +++ /dev/null @@ -1,71 +0,0 @@ -//$Id$ - -#include "Echo_Client_i.h" -#include "ace/Get_Opt.h" -#include "ace/Read_Buffer.h" -#include "ace/OS_NS_unistd.h" - -// This is the interface program that accesses the remote object - -// Constructor. -Echo_Client_i::Echo_Client_i (void) -{ - //no-op -} - -//Destructor. -Echo_Client_i::~Echo_Client_i (void) -{ - //no-op -} - -int -Echo_Client_i::run (const char *name, - int argc, - char *argv[]) -{ - // Initialize the client. - if (client.init (name,argc, argv) == -1) - return -1; - - ACE_DECLARE_NEW_CORBA_ENV; - - ACE_TRY - { - while (1) - { - char buf[BUFSIZ]; - - // Get the input message which has to be displayed. - ACE_DEBUG ((LM_DEBUG, - "ECHO? ")); - - if (ACE_OS::fgets (buf,sizeof buf, stdin) == 0) - break; - - CORBA::String_var s = client->echo_string (buf - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, - "\nString echoed by client \n%s\n", - s.in ())); - } - - if (client.shutdown () == 1) - client->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - - ACE_TRY_CHECK; - - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"\n Exception in RMI"); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - - return 0; -} - diff --git a/TAO/examples/Simple/echo/Echo_Client_i.h b/TAO/examples/Simple/echo/Echo_Client_i.h deleted file mode 100644 index c26927826a7..00000000000 --- a/TAO/examples/Simple/echo/Echo_Client_i.h +++ /dev/null @@ -1,51 +0,0 @@ -// -*- C++ -*- -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO/tests/Simple/echo -// -// = FILENAME -// Echo_Client_i.h -// -// = DESCRIPTION -// This class implements the interface calls for RMI. -// -// = AUTHOR -// -// Balachandran Natarajan <bala@cs.wustl.edu> -// -// ============================================================================ - -#ifndef ECHO_CLIENT_I_H -#define ECHO_CLIENT_I_H - -#include "../Simple_util.h" -#include "EchoC.h" - -class Echo_Client_i -{ - // = TITLE - // Echo_Client interface subclass. - // - // = DESCRIPTION - // This class implements the interface between the interface - // objects and the client . -public: - // = Initialization and termination methods. - Echo_Client_i (void); - // Constructor - - virtual ~Echo_Client_i (void); - // Destructor - - virtual int run (const char *, int, char **); - // Execute the methods - -private: - Client<Echo, Echo_var> client; - // Instantiate the client object. -}; - -#endif /* TIME_CLIENT_I_H */ diff --git a/TAO/examples/Simple/echo/Echo_i.cpp b/TAO/examples/Simple/echo/Echo_i.cpp deleted file mode 100644 index aeef101e78d..00000000000 --- a/TAO/examples/Simple/echo/Echo_i.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// $Id$ - -#include "Echo_i.h" - -ACE_RCSID(Echo, Echo_i, "$Id$") - -// Constructor. - -Echo_i::Echo_i (void) -{ -} - -// Destructor. - -Echo_i::~Echo_i (void) -{ -} - -// Set the ORB pointer. - -void -Echo_i::orb (CORBA::ORB_ptr o) -{ - this->orb_ = CORBA::ORB::_duplicate (o); -} - -// Return a list of object references. - -Echo::List * -Echo_i::echo_list (const char * - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - Echo::List_var list; - - { - Echo::List *tmp = 0; - ACE_NEW_RETURN (tmp, - Echo::List (3), - 0); - // Pass ownership to the _var, pitty that ACE_NEW_RETURN cannot - // assign to T_vars directly. - list = tmp; - } - - list->length (3); - - // Just do something to get a list of object references. - list[CORBA::ULong(0)] = - orb_->resolve_initial_references ("NameService" - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - list[CORBA::ULong(1)] = - orb_->resolve_initial_references ("NameService" - ACE_ENV_ARG_PARAMETER);; - ACE_CHECK_RETURN (0); - - list[CORBA::ULong(2)] = - orb_->resolve_initial_references ("NameService" - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - return list._retn (); -} - -// Return the mesg string from the server - -char * -Echo_i::echo_string (const char *mesg - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // The pointer mesg was NULL, return. - if (mesg == 0) - return 0; - - CORBA::String_var str = CORBA::string_dup (mesg); - - // if <CORBA::string_dup> returns a 0 pointer, an exception is - // raised. - - if (str.in () == 0) - ACE_THROW_RETURN (CORBA::NO_MEMORY (), 0); - - // Got thru! now, make a deep copy of the mesg string and send it - // back to the client. - - return str._retn (); - // The _retn is used as it allows the conversion of - // CORBA::String_var to char* without causing any compiler errors. -} - -// Shutdown the server application. - -void -Echo_i::shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_DEBUG ((LM_DEBUG, - "\n%s\n", - "The echo server is shutting down")); - - // Instruct the ORB to shutdown. - this->orb_->shutdown (); -} diff --git a/TAO/examples/Simple/echo/Echo_i.h b/TAO/examples/Simple/echo/Echo_i.h deleted file mode 100644 index 1b782cce796..00000000000 --- a/TAO/examples/Simple/echo/Echo_i.h +++ /dev/null @@ -1,68 +0,0 @@ -// -*- C++ -*- -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO/tests/Simple/echo -// -// = FILENAME -// Echo_i.h -// -// = DESCRIPTION -// This class implements the Echo IDL interface. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -#ifndef ECHO_I_H -#define ECHO_I_H - -#include "EchoS.h" - -class Echo_i : public POA_Echo -{ - // = TITLE - // Echo Object Implementation - // - // = DESCRIPTION - // The object implementation performs teh following functions: - // -- To return the string which needs to be displayed - // from the server. - // -- shuts down the server -public: - // = Initialization and termination methods. - Echo_i (void); - // Constructor. - - ~Echo_i (void); - // Destructor. - - virtual Echo::List *echo_list (const char *mesg - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Return the mesg string back from the server. - - virtual char *echo_string (const char *mesg - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Return the mesg string back from the server. - - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Shutdown the server. - - void orb (CORBA::ORB_ptr o); - // Set the ORB pointer. - -private: - CORBA::ORB_var orb_; - // ORB pointer. - - ACE_UNIMPLEMENTED_FUNC (void operator= (const Echo_i&)) - // Keeping g++ 2.7.2 happy.. -}; - -#endif /* ECHO_I_H */ diff --git a/TAO/examples/Simple/echo/Makefile.am b/TAO/examples/Simple/echo/Makefile.am deleted file mode 100644 index f712ee97a2c..00000000000 --- a/TAO/examples/Simple/echo/Makefile.am +++ /dev/null @@ -1,117 +0,0 @@ -## Process this file with automake to create Makefile.in -## -## $Id$ -## -## This file was generated by MPC. Any changes made directly to -## this file will be lost the next time it is generated. -## -## MPC Command: -## ../bin/mwc.pl -type automake -noreldefs TAO.mwc - -ACE_BUILDDIR = $(top_builddir)/.. -ACE_ROOT = $(top_srcdir)/.. -TAO_BUILDDIR = $(top_builddir) -TAO_IDL = ACE_ROOT=$(ACE_ROOT) TAO_ROOT=$(TAO_ROOT) $(TAO_BUILDDIR)/TAO_IDL/tao_idl -TAO_IDL_DEP = $(TAO_BUILDDIR)/TAO_IDL/tao_idl -TAO_IDLFLAGS = -Ge 1 -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -I$(srcdir) -g $(ACE_BUILDDIR)/apps/gperf/src/gperf -TAO_ROOT = $(top_srcdir) - -## Makefile.echo_IDL.am - -BUILT_SOURCES = \ - EchoC.cpp \ - EchoC.h \ - EchoC.inl \ - EchoS.cpp \ - EchoS.h \ - EchoS.inl - -CLEANFILES = \ - Echo-stamp \ - EchoC.cpp \ - EchoC.h \ - EchoC.inl \ - EchoS.cpp \ - EchoS.h \ - EchoS.inl - -EchoC.cpp EchoC.h EchoC.inl EchoS.cpp EchoS.h EchoS.inl: Echo-stamp - -Echo-stamp: $(srcdir)/Echo.idl $(TAO_IDL_DEP) - $(TAO_IDL) $(TAO_IDLFLAGS) -Sa -St $(srcdir)/Echo.idl - @touch $@ - - -noinst_HEADERS = \ - Echo.idl - -## Makefile.echo_client.am - -noinst_PROGRAMS = client - -client_CPPFLAGS = \ - -I$(ACE_ROOT) \ - -I$(ACE_BUILDDIR) \ - -I$(TAO_ROOT) \ - -I$(TAO_BUILDDIR) \ - -I$(TAO_ROOT)/orbsvcs \ - -I$(TAO_BUILDDIR)/orbsvcs - -client_SOURCES = \ - ../Simple_util.cpp \ - EchoC.cpp \ - Echo_Client_i.cpp \ - client.cpp \ - ../Simple_util.h \ - Echo_Client_i.h - -client_LDADD = \ - $(TAO_BUILDDIR)/tao/libTAO_Utils.la \ - $(TAO_BUILDDIR)/tao/libTAO_PI.la \ - $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \ - $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \ - $(TAO_BUILDDIR)/tao/libTAO_IORTable.la \ - $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \ - $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \ - $(TAO_BUILDDIR)/tao/libTAO.la \ - $(ACE_BUILDDIR)/ace/libACE.la - -## Makefile.echo_server.am - -noinst_PROGRAMS += server - -server_CPPFLAGS = \ - -I$(ACE_ROOT) \ - -I$(ACE_BUILDDIR) \ - -I$(TAO_ROOT) \ - -I$(TAO_BUILDDIR) \ - -I$(TAO_ROOT)/orbsvcs \ - -I$(TAO_BUILDDIR)/orbsvcs - -server_SOURCES = \ - ../Simple_util.cpp \ - EchoC.cpp \ - EchoS.cpp \ - Echo_i.cpp \ - server.cpp \ - ../Simple_util.h \ - Echo_i.h - -server_LDADD = \ - $(TAO_BUILDDIR)/tao/libTAO_Utils.la \ - $(TAO_BUILDDIR)/tao/libTAO_PI.la \ - $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \ - $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \ - $(TAO_BUILDDIR)/tao/libTAO_IORTable.la \ - $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \ - $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \ - $(TAO_BUILDDIR)/tao/libTAO.la \ - $(ACE_BUILDDIR)/ace/libACE.la - -## Clean up template repositories, etc. -clean-local: - -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.* - -rm -f gcctemp.c gcctemp so_locations *.ics - -rm -rf cxx_repository ptrepository ti_files - -rm -rf templateregistry ir.out - -rm -rf ptrepository SunWS_cache Templates.DB diff --git a/TAO/examples/Simple/echo/README b/TAO/examples/Simple/echo/README deleted file mode 100644 index 0420d5d5833..00000000000 --- a/TAO/examples/Simple/echo/README +++ /dev/null @@ -1,82 +0,0 @@ -$Id$ - -This is a simple CORBA example that has an object (Echo) with only two -methods, one that returns the message to be displayed and another that -shuts down the server. - -run_test.pl : This is a perl script to run the server and client as : ------------- - server -o ior_file - client -f ior_file - -This perl script runs the server and client and shuts down the server -when it is done. - -Passing the Server IOR to Clients: ---------------------------------- - -To keep this example simple, the server advertises its IOR in the -following manner - The server program writes its server object's IOR -to a ior_file. Later on, the client reads this IOR from the specified -ior_file and uses the <string_to_object> method to obtain a reference -to the server object. - -For this mechanism to work, the file must be readable and writable. If -it doesn't exist, a new file is created by the server. Moreover, the -file path must be accessible to both the client and server. - -If the client and server are on different machine, then there must be -a shared directory accessible by both. On UNIX system's this is -typically done via the NFS mount command. On Windows, the 'explorer' -application provides an option to share drives. - -In general if no such file sharing option is available, then using the -the Naming Service mechanism is the only alternative, as described by -the -n option below. - -server: -------- - -server [-d] [-o <ior_output_file>] [-n] - -Options: -------- --d Debug flag (It is additive more -d flags will give debugging). --o Outputs the ior to the file - The ior is the reference using which the client can interact with - the target server object. --n Use the naming service - -When the server is started, you should see as the first line of output -something that looks like - - iiop:1.0//danzon.cs.wustl.edu:10015/P35ad159600081a38/child_poa/server - (-ORBobjrefstyle url) -or - IOR:000000000000001649444c3a43756269745... - (-ORBobjrefstyle ior) - -Using -d turns on debugging messages. This option is additive, i.e., -the more -d options provided, the more debugging you can get. At the -moment, only 2 levels of debugging are implemented, and more than 2 -d -options are ignored. - -client: -------- - -client [-d] [-x] [-f <Server_ior_file>] [-k ior] [-n naming service] - -Options: -------- --d Debug flag --x Tells the server to shutdown at the end of the test. --f Reads the server ior from the file --k IOR or The IOR can also be given in the format like file://[file.ior] - with the full path - --n Use the naming service - -You can either cut and paste the IOR from the server to the client -(with the -k option), have the client read the IOR from a file using -the -f option (this file is produced using the -o option of the -server), or use the naming service (with the -n option). diff --git a/TAO/examples/Simple/echo/client.cpp b/TAO/examples/Simple/echo/client.cpp deleted file mode 100644 index f2aa863069b..00000000000 --- a/TAO/examples/Simple/echo/client.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//$Id$ - -# include "Echo_Client_i.h" - -// The client program for the application. - -int -main (int argc, char **argv) -{ - Echo_Client_i client; - - - ACE_DEBUG ((LM_DEBUG, - "\nEcho client\n\n")); - - if (client.run ("Echo", - argc, - argv) == -1) - return -1; - else - return 0; - -} - - diff --git a/TAO/examples/Simple/echo/echo.mpc b/TAO/examples/Simple/echo/echo.mpc deleted file mode 100644 index bf60819c91b..00000000000 --- a/TAO/examples/Simple/echo/echo.mpc +++ /dev/null @@ -1,36 +0,0 @@ -// -*- MPC -*- -// $Id$ - -project(*IDL): taoidldefaults { - IDL_Files { - Echo.idl - } - custom_only = 1 -} - -project(*server): namingexe, iortable, utils { - exename = server - after += *IDL - Source_Files { - Echo_i.cpp - ../Simple_util.cpp - server.cpp - EchoS.cpp - EchoC.cpp - } - IDL_Files { - } -} - -project(*client): namingexe, iortable, utils { - exename = client - after += *IDL - Source_Files { - Echo_Client_i.cpp - ../Simple_util.cpp - client.cpp - EchoC.cpp - } - IDL_Files { - } -} diff --git a/TAO/examples/Simple/echo/run_test.pl b/TAO/examples/Simple/echo/run_test.pl deleted file mode 100755 index f8a88e36242..00000000000 --- a/TAO/examples/Simple/echo/run_test.pl +++ /dev/null @@ -1,44 +0,0 @@ -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' - & eval 'exec perl -S $0 $argv:q' - if 0; - -# $Id$ -# -*- perl -*- - -use lib "../../../../bin"; -use PerlACE::Run_Test; - -$status = 0; -$iorfile = PerlACE::LocalFile ("echo.ior"); - -unlink $iorfile; - -$SV = new PerlACE::Process ("server", "-o $iorfile"); -$CL = new PerlACE::Process ("client", "-f $iorfile -x"); - -$SV->Spawn (); - -if (PerlACE::waitforfile_timed ($iorfile, 15) == -1) { - print STDERR "ERROR: Could not find file <$iorfile>\n"; - $SV->Kill (); - exit 1; -} - -$client = $CL->SpawnWaitKill (60); - -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; -} - -$server = $SV->WaitKill (5); - -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; - $status = 1; -} - -unlink $iorfile; - -exit $status; - diff --git a/TAO/examples/Simple/echo/server.cpp b/TAO/examples/Simple/echo/server.cpp deleted file mode 100644 index b74d5bc7af6..00000000000 --- a/TAO/examples/Simple/echo/server.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// $Id$ -#include "../Simple_util.h" -#include "Echo_i.h" - -// This is the main driver program for the time and date server. - -int -main (int argc, char *argv[]) -{ - Server<Echo_i> server; - - ACE_DEBUG ((LM_DEBUG, - "\n\tEcho server\n\n")); - - ACE_DECLARE_NEW_CORBA_ENV; - - ACE_TRY - { - if (server.init ("Echo", - argc, - argv - ACE_ENV_ARG_PARAMETER) == -1) - return 1; - else - { - server.run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCH (CORBA::UserException, userex) - { - ACE_PRINT_EXCEPTION (userex,"User Exception"); - return -1; - } - ACE_CATCH (CORBA::SystemException, sysex) - { - ACE_PRINT_EXCEPTION (sysex, "System Exception"); - return -1; - } - - ACE_ENDTRY; - - return 0; -} - |