OmniEvents
|
00001 // Package : omniEvents 00002 // ProxyManager.h Created : 2003/12/04 00003 // Author : Alex Tingle 00004 // 00005 // Copyright (C) 2003-2005 Alex Tingle. 00006 // 00007 // This file is part of the omniEvents application. 00008 // 00009 // omniEvents is free software; you can redistribute it and/or 00010 // modify it under the terms of the GNU Lesser General Public 00011 // License as published by the Free Software Foundation; either 00012 // version 2.1 of the License, or (at your option) any later version. 00013 // 00014 // omniEvents is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 // Lesser General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU Lesser General Public 00020 // License along with this library; if not, write to the Free Software 00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 // 00023 00024 #ifndef OMNIEVENTS__PROXYMANAGER_H 00025 #define OMNIEVENTS__PROXYMANAGER_H 00026 00027 #ifdef HAVE_CONFIG_H 00028 # include "config.h" 00029 #endif 00030 00031 #include <set> 00032 #include <string> 00033 00034 #ifdef HAVE_IOSTREAM 00035 # include <iostream> 00036 #else 00037 # include <iostream.h> 00038 #endif 00039 00040 #include "Servant.h" 00041 00042 #ifdef HAVE_STD_IOSTREAM 00043 using namespace std; 00044 #endif 00045 00046 namespace OmniEvents { 00047 00048 class Proxy; 00049 class PersistNode; 00050 00057 class ProxyManager 00058 : public virtual POA_PortableServer::ServantActivator, 00059 public Servant 00060 { 00061 public: // CORBA interface methods 00063 void etherealize( 00064 const PortableServer::ObjectId& oid, 00065 PortableServer::POA_ptr adapter, 00066 PortableServer::Servant serv, 00067 CORBA::Boolean cleanup_in_progress, 00068 CORBA::Boolean remaining_activations 00069 ); 00070 00071 public: 00073 void reincarnate(const PersistNode& node); 00075 void output(ostream& os); 00076 00077 protected: 00079 ProxyManager(PortableServer::POA_ptr poa); 00080 virtual ~ProxyManager(); 00081 00087 void activate(const char* name); 00088 00090 set<Proxy*> _servants; 00095 PortableServer::POA_var _managedPoa; 00096 }; 00097 00098 00104 class Proxy 00105 : public virtual PortableServer::ServantBase, 00106 public Servant 00107 { 00108 public: 00109 virtual ~Proxy(); 00111 virtual void reincarnate(const string& oid, const PersistNode& node)=0; 00113 virtual void output(ostream &os)=0; 00114 protected: 00115 Proxy(PortableServer::POA_ptr poa); 00116 00118 void keyOutput(ostream& os, const char* name); 00120 void eraseKey(const char* name); 00122 void basicOutput( 00123 ostream& os, const char* name, 00124 CORBA::Object_ptr target=CORBA::Object::_nil(), 00125 const char* extraAttributes=NULL 00126 ); 00127 00128 CORBA::Request_var _req; 00129 private: 00130 Proxy(const Proxy&); 00131 }; 00132 00133 00134 }; // end namespace OmniEvents 00135 00136 #endif // OMNIEVENTS__PROXYMANAGER_H