00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef ARCHON_X3D_SAI_LISTENER_H
00020 #define ARCHON_X3D_SAI_LISTENER_H
00021
00022 #include <archon/util/time.H>
00023
00024 #include <archon/x3d/server/server.H>
00025
00026 #include <archon/x3d/sai/exception.H>
00027 #include <archon/x3d/sai/session.H>
00028
00029 namespace Archon
00030 {
00031 namespace X3D
00032 {
00033 namespace SAI
00034 {
00035 using namespace Utilities;
00036
00037 struct Listener: Server::Listener
00038 {
00039 Listener(Ref<Server> server,
00040 Time applicationHeartbeat,
00041 int corbaEndpointPort);
00042
00043 ~Listener();
00044
00045 Orb &getOrb() { return orb; }
00046
00047 struct NameServerException: Exception
00048 {
00049 NameServerException(string l, string m): Exception(l, m) {}
00050 };
00051
00052 void startServingClientRequests(Ref<GroupingNode> applicationContainer)
00053 throw(NameServerException);
00054
00055 void removeSession(Ref<Session>);
00056
00057 const BackRef<Server> server;
00058
00059 Ref<GroupingNode> getApplicationContainer()
00060 {
00061 Mutex::Lock lock(mutex);
00062 return applicationContainer;
00063 }
00064
00065 private:
00066 void refForwardDestroy();
00067
00068 Mutex mutex;
00069
00070 const Time applicationHeartbeat;
00071
00079 Ref<GroupingNode> applicationContainer;
00080
00081 Orb orb;
00082
00083 struct Servant;
00084 PortableServer::ObjectId_var servantId;
00085 bool active;
00086
00090 void activate() throw(NameServerException);
00091
00095 void deactivate();
00096
00097 CORBA::ULong getNodeTypeBitsInId();
00098 CORBA::ULong getNodeType(const char *);
00099 CORBA::ULong getImmediateField(CORBA::ULong, const char *);
00100 x3d::sai::Session_ptr createSession(x3d::sai::Application_ptr);
00101
00102 list<Ref<Session> > sessions;
00103 };
00104 }
00105 }
00106 }
00107
00108 #endif