summaryrefslogtreecommitdiff
path: root/TAO/examples/POA/Reference_Counted_Servant
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2007-07-30 14:56:38 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2007-07-30 14:56:38 +0000
commita9f6fcdbb5fbba2adbe044e160e3c24f890e3903 (patch)
tree39d90eb6955cb4d0462a209e0237ec204b5e04d5 /TAO/examples/POA/Reference_Counted_Servant
parent50c729f6a63d449e729aa9030af55d0e0fb6712d (diff)
downloadATCD-a9f6fcdbb5fbba2adbe044e160e3c24f890e3903.tar.gz
Diffstat (limited to 'TAO/examples/POA/Reference_Counted_Servant')
-rw-r--r--TAO/examples/POA/Reference_Counted_Servant/Makefile.am49
-rw-r--r--TAO/examples/POA/Reference_Counted_Servant/README44
-rw-r--r--TAO/examples/POA/Reference_Counted_Servant/Reference_Counted_Servant.mpc16
-rwxr-xr-xTAO/examples/POA/Reference_Counted_Servant/run_test.pl87
-rw-r--r--TAO/examples/POA/Reference_Counted_Servant/server.cpp170
5 files changed, 0 insertions, 366 deletions
diff --git a/TAO/examples/POA/Reference_Counted_Servant/Makefile.am b/TAO/examples/POA/Reference_Counted_Servant/Makefile.am
deleted file mode 100644
index 827110dbc6e..00000000000
--- a/TAO/examples/POA/Reference_Counted_Servant/Makefile.am
+++ /dev/null
@@ -1,49 +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_ROOT = $(top_srcdir)
-
-
-## Makefile.Reference_Counted_Servant_Server.am
-
-if BUILD_EXCEPTIONS
-
-noinst_PROGRAMS = server
-
-server_CPPFLAGS = \
- -I$(ACE_ROOT) \
- -I$(ACE_BUILDDIR) \
- -I$(TAO_ROOT) \
- -I$(TAO_BUILDDIR) \
- -I$(srcdir)/../Generic_Servant \
- -I../Generic_Servant
-
-server_SOURCES = \
- server.cpp
-
-server_LDADD = \
- $(top_builddir)/examples/POA/Generic_Servant/libGeneric_Servant.la \
- $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
- $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
- $(TAO_BUILDDIR)/tao/libTAO.la \
- $(ACE_BUILDDIR)/ace/libACE.la
-
-endif BUILD_EXCEPTIONS
-
-## 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/POA/Reference_Counted_Servant/README b/TAO/examples/POA/Reference_Counted_Servant/README
deleted file mode 100644
index effa3c1cdd2..00000000000
--- a/TAO/examples/POA/Reference_Counted_Servant/README
+++ /dev/null
@@ -1,44 +0,0 @@
-// $Id$
-
-This application demostrates reference counted servants.
-
-The server program is available here. Use the Generic_Servant/client
-program to test this.
-
-________________________________________
-
-To test this example, type run_test.pl
-________________________________________
-
-Or
-________________________________________
-
-Run the server as follows:
-
-% ./server -f output
-
-This will produce a file named output which will contain the ior.
-
-Run the client as follows:
-
-% cd $TAO_ROOT/examples/POA/Generic_Servant
-% ./client -f ../Reference_Counted_Servant/output
-________________________________________
-
-Or
-________________________________________
-
-Run the server as follows:
-
-% ./server -ORBobjrefstyle URL &
-
-Run the client as follows:
-
-% cd $TAO_ROOT/examples/POA/Generic_Servant
-% ./client -k <IOR>
-
-Comments :
-=========
- - As soon as, the server prints out the IOR, cut it and use it for
-running the client.
-________________________________________
diff --git a/TAO/examples/POA/Reference_Counted_Servant/Reference_Counted_Servant.mpc b/TAO/examples/POA/Reference_Counted_Servant/Reference_Counted_Servant.mpc
deleted file mode 100644
index 117b2ce33da..00000000000
--- a/TAO/examples/POA/Reference_Counted_Servant/Reference_Counted_Servant.mpc
+++ /dev/null
@@ -1,16 +0,0 @@
-// -*- MPC -*-
-// $Id$
-
-project(*Server): taoexe, portableserver, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro {
- libs += Generic_Servant
- after += POA_Generic_Servant_Lib
-
- specific (automake) {
- includes += $(srcdir)/../Generic_Servant
- }
- includes += ../Generic_Servant
-
- Source_Files {
- server.cpp
- }
-}
diff --git a/TAO/examples/POA/Reference_Counted_Servant/run_test.pl b/TAO/examples/POA/Reference_Counted_Servant/run_test.pl
deleted file mode 100755
index 38c3a37edf3..00000000000
--- a/TAO/examples/POA/Reference_Counted_Servant/run_test.pl
+++ /dev/null
@@ -1,87 +0,0 @@
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
- & eval 'exec perl -S $0 $argv:q'
- if 0;
-
-# $Id$
-# -*- perl -*-
-
-use lib "$ENV{ACE_ROOT}/bin";
-use PerlACE::Run_Test;
-
-$iorbase = "poa.ior";
-$iorfile = PerlACE::LocalFile ("$iorbase");
-
-$oneway = "";
-$iterations = 100;
-
-$extra_args = "";
-
-# Parse the arguments
-for ($i = 0; $i <= $#ARGV; $i++) {
- if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") {
- print "run_test [-h] [-i iterations] [-o] [-f ior file]\n";
- print "\n";
- print "-h -- prints this information\n";
- print "-f -- ior file\n";
- print "-i iterations -- specifies iterations\n";
- print "-o -- call issued are oneways\n";
- exit;
- }
- elsif ($ARGV[$i] eq "-o") {
- $oneway = "-o";
- }
- elsif ($ARGV[$i] eq "-i") {
- $iterations = $ARGV[$i + 1];
- $i++;
- }
- elsif ($ARGV[$i] eq "-f") {
- $iorfile = $ARGV[$i + 1];
- $i++;
- }
- else {
- $extra_args .= " " . $ARGV[$i];
- }
-}
-
-unlink $iorfile;
-
-if (PerlACE::is_vxworks_test()) {
- $SV = new PerlACE::ProcessVX ("server", "-f $iorbase $extra_args");
-}
-else {
- $SV = new PerlACE::Process ("server", "-f $iorfile $extra_args");
-}
-$CL = new PerlACE::Process ("../Generic_Servant/client", "$extra_args $oneway -i $iterations -k file://$iorfile -x");
-
-$status = 0;
-
-$server = $SV->Spawn ();
-
-if ($server != 0) {
- print STDERR "ERROR: server returned $server\n";
- exit 1;
-}
-
-if (PerlACE::waitforfile_timed ($iorfile, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot 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/POA/Reference_Counted_Servant/server.cpp b/TAO/examples/POA/Reference_Counted_Servant/server.cpp
deleted file mode 100644
index 10b7e85057f..00000000000
--- a/TAO/examples/POA/Reference_Counted_Servant/server.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-// $Id$
-
-// ================================================================
-//
-// = LIBRARY
-// TAO/tests/POA/Reference_Counted_Servant
-//
-// = FILENAME
-// server.cpp
-//
-// = DESCRIPTION
-// This example shows how to use reference counted servants to
-// automatically manage dynamic memory for servants.
-// Stubs/Skeletons and client code is available in
-// ../Generic_Servant.
-//
-// = AUTHOR
-// Irfan Pyarali
-//
-// ================================================================
-
-#include "ace/Get_Opt.h"
-#include "test_i.h"
-#include "ace/OS_NS_stdio.h"
-#include "ace/OS_NS_string.h"
-
-ACE_RCSID(Reference_Counted_Servant, server, "$Id$")
-
- // This is to remove "inherits via dominance" warnings from MSVC.
- // MSVC is being a little too paranoid.
-#if defined (_MSC_VER)
-# pragma warning (disable : 4250)
-#endif /* _MSC_VER */
-
-class reference_counted_test_i :
- public virtual test_i
-{
-public:
- reference_counted_test_i (CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa);
- // Constructor - takes a POA and a value parameter
-};
-
-reference_counted_test_i::reference_counted_test_i (CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa)
- : test_i (orb,
- poa)
-{
-}
-
-static const char *ior_output_file = "ior";
-
-static int
-parse_args (int argc, char **argv)
-{
- ACE_Get_Opt get_opts (argc, argv, "f:");
- int c;
-
- while ((c = get_opts ()) != -1)
- switch (c)
- {
- case 'f':
- ior_output_file = get_opts.opt_arg ();
- break;
-
- case '?':
- default:
- ACE_ERROR_RETURN ((LM_ERROR,
- "usage: %s "
- "[-f ior_output_file]"
- "\n",
- argv [0]),
- -1);
- }
-
- // Indicates successful parsing of command line.
- return 0;
-}
-
-static int
-write_iors_to_file (const char *ior)
-{
- FILE *output_file = ACE_OS::fopen (ior_output_file, "w");
-
- if (output_file == 0)
- ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output files for writing IORs: %s, %s %s\n",
- ior_output_file),
- -1);
-
- u_int result = 0;
-
- result = ACE_OS::fprintf (output_file,
- "%s",
- ior);
- if (result != ACE_OS::strlen (ior))
- ACE_ERROR_RETURN ((LM_ERROR,
- "ACE_OS::fprintf failed while writing %s to %s\n",
- ior,
- ior_output_file),
- -1);
-
- ACE_OS::fclose (output_file);
-
- return 0;
-}
-
-int
-main (int argc, char **argv)
-{
-
- try
- {
- // Initialize the ORB first.
- CORBA::ORB_var orb = CORBA::ORB_init (argc,
- argv,
- 0);
-
- int result = parse_args (argc, argv);
- if (result != 0)
- return result;
-
- // Obtain the RootPOA.
- CORBA::Object_var obj =
- orb->resolve_initial_references ("RootPOA");
-
- // Get the POA_var object from Object_var.
- PortableServer::POA_var root_poa =
- PortableServer::POA::_narrow (obj.in ());
-
- // Get the POAManager of the RootPOA.
- PortableServer::POAManager_var poa_manager =
- root_poa->the_POAManager ();
-
- // Create a servant.
- reference_counted_test_i *servant = 0;
- ACE_NEW_RETURN (servant,
- reference_counted_test_i (orb.in (),
- root_poa.in ()),
- -1);
-
- // Get Object Reference for the servant object.
- test_var test = servant->_this ();
-
- // This means that the ownership of <servant> now belongs to
- // the POA.
- servant->_remove_ref ();
-
- // Stringyfy all the object references and print them out.
- CORBA::String_var ior = orb->object_to_string (test.in ());
-
- ACE_DEBUG ((LM_DEBUG,
- "%s\n",
- ior.in ()));
-
- int write_result = write_iors_to_file (ior.in ());
- if (write_result != 0)
- return write_result;
-
- poa_manager->activate ();
-
- orb->run ();
- }
- catch (const CORBA::Exception& ex)
- {
- ex._tao_print_exception ("Exception caught");
- return -1;
- }
-
- return 0;
-}