diff options
author | elliott_c <elliott_c@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-01-25 18:17:52 +0000 |
---|---|---|
committer | elliott_c <elliott_c@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-01-25 18:17:52 +0000 |
commit | 2ee7b7eed4c0cc10f4ec25b186b04202af01b565 (patch) | |
tree | 08a8a649c90559cf5b2228c1caad15515902613e /TAO/examples/POA/Default_Servant | |
parent | c979767a00db4ea1299af482033a68829cc16675 (diff) | |
download | ATCD-2ee7b7eed4c0cc10f4ec25b186b04202af01b565.tar.gz |
ChangeLogTag: Thu Jan 25 17:39:59 UTC 2007 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'TAO/examples/POA/Default_Servant')
-rw-r--r-- | TAO/examples/POA/Default_Servant/File_i.cpp | 32 | ||||
-rw-r--r-- | TAO/examples/POA/Default_Servant/File_i.h | 12 | ||||
-rw-r--r-- | TAO/examples/POA/Default_Servant/client.cpp | 26 | ||||
-rw-r--r-- | TAO/examples/POA/Default_Servant/server.cpp | 35 |
4 files changed, 41 insertions, 64 deletions
diff --git a/TAO/examples/POA/Default_Servant/File_i.cpp b/TAO/examples/POA/Default_Servant/File_i.cpp index 2e3a609cd00..0728e000e67 100644 --- a/TAO/examples/POA/Default_Servant/File_i.cpp +++ b/TAO/examples/POA/Default_Servant/File_i.cpp @@ -28,9 +28,8 @@ FileImpl::System::System (PortableServer::POA_ptr poa) // Create the Default Descriptor Servant fd_servant_ (poa) { - ACE_DECLARE_NEW_CORBA_ENV; // set the default servant of the POA - poa->set_servant (&this->fd_servant_ ACE_ENV_ARG_PARAMETER); + poa->set_servant (&this->fd_servant_); } FileImpl::System::~System (void) @@ -45,8 +44,7 @@ FileImpl::System::_default_POA (void) File::Descriptor_ptr FileImpl::System::open (const char *file_name, - CORBA::Long flags - ACE_ENV_ARG_DECL) + CORBA::Long flags) ACE_THROW_SPEC ((CORBA::SystemException, File::IOError)) { @@ -75,12 +73,11 @@ FileImpl::System::open (const char *file_name, // from ACE_HANDLE string CORBA::Object_var obj = this->poa_->create_reference_with_id (oid.in (), - "IDL:File/Descriptor:1.0" - ACE_ENV_ARG_PARAMETER); + "IDL:File/Descriptor:1.0"); // Narrow the object reference to a File Descriptor File::Descriptor_var fd = - File::Descriptor::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); + File::Descriptor::_narrow (obj.in ()); return fd._retn (); @@ -115,31 +112,29 @@ FileImpl::Descriptor::fd (void) // Get the ObjectId from the reference PortableServer::ObjectId_var oid1 = - this->poa_->reference_to_id (me.in () ACE_ENV_ARG_PARAMETER); + this->poa_->reference_to_id (me.in ()); // // Another way of getting our id. // PortableServer::ObjectId_var oid2 = - this->poa_->servant_to_id (this ACE_ENV_ARG_PARAMETER); + this->poa_->servant_to_id (this); // // Yet another way of getting our id. // int argc = 0; - CORBA::ORB_var orb = CORBA::ORB_init (argc, 0, 0 ACE_ENV_ARG_PARAMETER); + CORBA::ORB_var orb = CORBA::ORB_init (argc, 0, 0); // Get the POA Current object reference CORBA::Object_var obj = - orb->resolve_initial_references ("POACurrent" - ACE_ENV_ARG_PARAMETER); + orb->resolve_initial_references ("POACurrent"); // Narrow the object reference to a POA Current reference PortableServer::Current_var poa_current = - PortableServer::Current::_narrow (obj.in () - ACE_ENV_ARG_PARAMETER); + PortableServer::Current::_narrow (obj.in ()); PortableServer::ObjectId_var oid3 = poa_current->get_object_id (); @@ -156,8 +151,7 @@ FileImpl::Descriptor::fd (void) } CORBA::Long -FileImpl::Descriptor::write (const File::Descriptor::DataBuffer &buffer - ACE_ENV_ARG_DECL) +FileImpl::Descriptor::write (const File::Descriptor::DataBuffer &buffer) ACE_THROW_SPEC ((CORBA::SystemException, File::IOError)) { @@ -175,8 +169,7 @@ FileImpl::Descriptor::write (const File::Descriptor::DataBuffer &buffer } File::Descriptor::DataBuffer * -FileImpl::Descriptor::read (CORBA::Long num_bytes - ACE_ENV_ARG_DECL) +FileImpl::Descriptor::read (CORBA::Long num_bytes) ACE_THROW_SPEC ((CORBA::SystemException, File::IOError)) { @@ -197,8 +190,7 @@ FileImpl::Descriptor::read (CORBA::Long num_bytes CORBA::ULong FileImpl::Descriptor::lseek (CORBA::ULong offset, - CORBA::Long whence - ACE_ENV_ARG_DECL) + CORBA::Long whence) ACE_THROW_SPEC ((CORBA::SystemException, File::IOError)) { diff --git a/TAO/examples/POA/Default_Servant/File_i.h b/TAO/examples/POA/Default_Servant/File_i.h index c77d5cdd66f..1a6ba088622 100644 --- a/TAO/examples/POA/Default_Servant/File_i.h +++ b/TAO/examples/POA/Default_Servant/File_i.h @@ -37,21 +37,18 @@ public: PortableServer::POA_ptr _default_POA (void); // Returns the default POA of this object - virtual CORBA::Long write (const File::Descriptor::DataBuffer &buffer - ACE_ENV_ARG_DECL) + virtual CORBA::Long write (const File::Descriptor::DataBuffer &buffer) ACE_THROW_SPEC ((CORBA::SystemException, File::IOError)); // write buffer to File corresponding to this Descriptor - virtual File::Descriptor::DataBuffer *read (CORBA::Long num_bytes - ACE_ENV_ARG_DECL) + virtual File::Descriptor::DataBuffer *read (CORBA::Long num_bytes) ACE_THROW_SPEC ((CORBA::SystemException, // Reads num_bytes from the file and returns it File::IOError)); virtual CORBA::ULong lseek (CORBA::ULong offset, - CORBA::Long whence - ACE_ENV_ARG_DECL) + CORBA::Long whence) ACE_THROW_SPEC ((CORBA::SystemException, File::IOError)); // seek to the offset in file from whence @@ -84,8 +81,7 @@ public: //Returns the default POA of this object File::Descriptor_ptr open (const char *file_name, - CORBA::Long flags - ACE_ENV_ARG_DECL) + CORBA::Long flags) ACE_THROW_SPEC ((CORBA::SystemException, File::IOError)); // Opens a file ,creates a Descriptor reference with the diff --git a/TAO/examples/POA/Default_Servant/client.cpp b/TAO/examples/POA/Default_Servant/client.cpp index 36ce17b1e8a..abf27200e44 100644 --- a/TAO/examples/POA/Default_Servant/client.cpp +++ b/TAO/examples/POA/Default_Servant/client.cpp @@ -73,12 +73,11 @@ parse_args (int argc, char **argv) int main (int argc, char **argv) { - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY + try { // Initialize the ORB - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0 ACE_ENV_ARG_PARAMETER); + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0); // Parse the command-line arguments to get the IOR parse_args (argc, argv); @@ -105,17 +104,14 @@ main (int argc, char **argv) ior_buffer.alloc ()-> free (data); ACE_OS::close (input_file); - CORBA::Object_var object = orb->string_to_object (ior.c_str () - ACE_ENV_ARG_PARAMETER); + CORBA::Object_var object = orb->string_to_object (ior.c_str ()); // Narrow the object reference to a File::System - File::System_var file_system = File::System::_narrow (object.in () - ACE_ENV_ARG_PARAMETER); + File::System_var file_system = File::System::_narrow (object.in ()); // Creat the file filename i.e "test" File::Descriptor_var fd = file_system->open (filename, - O_CREAT | O_RDWR - ACE_ENV_ARG_PARAMETER); + O_CREAT | O_RDWR); int message_length = ACE_OS::strlen (message) + 1; CORBA::Octet *buffer = File::Descriptor::DataBuffer::allocbuf (message_length); @@ -123,14 +119,13 @@ main (int argc, char **argv) File::Descriptor::DataBuffer data_sent (message_length, message_length, buffer, 1); // write the message to the file - fd->write (data_sent ACE_ENV_ARG_PARAMETER); + fd->write (data_sent); //seek to the beginning of the file - fd->lseek (0, SEEK_SET ACE_ENV_ARG_PARAMETER); + fd->lseek (0, SEEK_SET); // Read back the written message - File::Descriptor::DataBuffer_var data_received = fd->read (message_length - ACE_ENV_ARG_PARAMETER); + File::Descriptor::DataBuffer_var data_received = fd->read (message_length); char *result = (char *) &data_received[0]; @@ -141,12 +136,11 @@ main (int argc, char **argv) // close the file fd->destroy (); } - ACE_CATCHANY + catch (const CORBA::Exception& ex) { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught in main"); + ex._tao_print_exception ("Exception caught in main"); return -1; } - ACE_ENDTRY; return 0; } diff --git a/TAO/examples/POA/Default_Servant/server.cpp b/TAO/examples/POA/Default_Servant/server.cpp index 2d51d030612..9bfef6166d5 100644 --- a/TAO/examples/POA/Default_Servant/server.cpp +++ b/TAO/examples/POA/Default_Servant/server.cpp @@ -60,12 +60,11 @@ parse_args (int argc, char **argv) int main (int argc, char **argv) { - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY + try { // Initialize the ORB - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0 ACE_ENV_ARG_PARAMETER); + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0); int result = parse_args (argc, argv); if (result != 0) @@ -73,11 +72,10 @@ main (int argc, char **argv) // Obtain the RootPOA. CORBA::Object_var obj = - orb->resolve_initial_references ("RootPOA" - ACE_ENV_ARG_PARAMETER); + orb->resolve_initial_references ("RootPOA"); // Narrow the object reference to a POA reference - PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj.in ()); PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); @@ -86,29 +84,28 @@ main (int argc, char **argv) // ID Assignment Policy policies[0] = - root_poa->create_id_assignment_policy (PortableServer::USER_ID ACE_ENV_ARG_PARAMETER); + root_poa->create_id_assignment_policy (PortableServer::USER_ID); // Lifespan Policy policies[1] = - root_poa->create_lifespan_policy (PortableServer::PERSISTENT ACE_ENV_ARG_PARAMETER); + root_poa->create_lifespan_policy (PortableServer::PERSISTENT); // Request Processing Policy policies[2] = - root_poa->create_request_processing_policy (PortableServer::USE_DEFAULT_SERVANT ACE_ENV_ARG_PARAMETER); + root_poa->create_request_processing_policy (PortableServer::USE_DEFAULT_SERVANT); // Servant Retention Policy policies[3] = - root_poa->create_servant_retention_policy (PortableServer::RETAIN ACE_ENV_ARG_PARAMETER); + root_poa->create_servant_retention_policy (PortableServer::RETAIN); // Id Uniqueness Policy policies[4] = - root_poa->create_id_uniqueness_policy (PortableServer::MULTIPLE_ID ACE_ENV_ARG_PARAMETER); + root_poa->create_id_uniqueness_policy (PortableServer::MULTIPLE_ID); ACE_CString name = "firstPOA"; PortableServer::POA_var first_poa = root_poa->create_POA (name.c_str (), poa_manager.in (), - policies - ACE_ENV_ARG_PARAMETER); + policies); for (CORBA::ULong i = 0; i < policies.length (); @@ -125,15 +122,14 @@ main (int argc, char **argv) PortableServer::string_to_ObjectId ("FileSystem"); first_poa->activate_object_with_id (file_system_oid.in (), - &file_system_impl - ACE_ENV_ARG_PARAMETER); + &file_system_impl); CORBA::Object_var file_system = - first_poa->id_to_reference (file_system_oid.in () ACE_ENV_ARG_PARAMETER); + first_poa->id_to_reference (file_system_oid.in ()); // Get the IOR for the "FileSystem" object CORBA::String_var file_system_ior = - orb->object_to_string (file_system.in () ACE_ENV_ARG_PARAMETER); + orb->object_to_string (file_system.in ()); ACE_DEBUG ((LM_DEBUG,"%s\n", file_system_ior.in ())); @@ -154,12 +150,11 @@ main (int argc, char **argv) orb->run (); } - ACE_CATCHANY + catch (const CORBA::Exception& ex) { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "EXCEPTION CAUGHT"); + ex._tao_print_exception ("EXCEPTION CAUGHT"); return -1; } - ACE_ENDTRY; return 0; } |