00001
00030
#ifndef _SERVANTFACTORY_GUARD
00031
#define _SERVANTFACTORY_GUARD
00032
00033
#include "BP_CORBA.h"
00034
00035
#include <string>
00036
#include <exception>
00037
#include <map>
00038
00039
00049 class ServantFactory
00050 {
00051
00052
public:
00053
00058 class ServantBuildException :
public virtual std::exception
00059 {
00060
private:
00061
const std::string _msg;
00062
00063
public:
00067
ServantBuildException(std::string theMsg);
00068
00072 ServantBuildException():_msg() {};
00073
00079
ServantBuildException(
const ServantBuildException& sbx);
00080
00081
00085
virtual ~ServantBuildException() throw();
00086
00094 virtual const
char* what() const throw() ;
00095
00096
00106 virtual const
char* what_nc() const throw();
00107 };
00108
00109
00117 explicit
ServantFactory(std::string the_name);
00118
00126 explicit
ServantFactory(const
char* the_name);
00127
00128
00152 virtual
void
00153 build(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa
00154 ) throw(
ServantBuildException) = 0;
00155
00156
00166 PortableServer::POA_ptr local_poa_nc();
00167 virtual ~
ServantFactory();
00168
00169
00179 virtual const std::string poa_name_string()
const
00180
{
00181
return(_poa_name);
00182 };
00183
00194 virtual const char*
poa_name()
const
00195
{
00196
return(CORBA::string_dup(_poa_name.c_str()));
00197 }
00198
00204
void setNsServantIdMap( ConfMap& _n);
00205
00206
protected:
00207
00217 ConfMap nsServantIdMap;
00218
00219
00230
void local_poa(PortableServer::POA_ptr poa);
00231
00232
00241
const PortableServer::POA_ptr
parent_poa_nc();
00242
00247
void parent_poa(PortableServer::POA_ptr poa);
00248
00258
const CORBA::ORB_ptr
local_orb_nc();
00259
00266
void local_orb(CORBA::ORB_ptr orb);
00267
00268
00269
00270
private:
00271 CORBA::ORB_var _orb;
00272 PortableServer::POA_var _parent_poa;
00273 PortableServer::POA_var _poa;
00274
const std::string _poa_name;
00275
00276
00277 };
00278
00279
#endif