AndroMeta  2.0.0
AndroMeta/include/AndroMeta/MBroker.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2009-2012 AndroMeta LLC. All rights reserved.
00003  *
00004  * AndroMeta LLC retains all intellectual property and proprietary 
00005  * rights to this software and related documentation and any modifications 
00006  * thereto.  Any use, reproduction, disclosure, or distribution of this 
00007  * software and related documentation without an express license agreement 
00008  * from AndroMeta LLC is strictly prohibited.
00009  * 
00010  */
00011 
00019 #ifndef ANDROMETA_M_BROKER_H
00020 #define ANDROMETA_M_BROKER_H
00021 
00022 #include <AndroMeta/MObject.h>
00023 #include <AndroMeta/MBrokerBase.h>
00024 
00025 namespace Meta{
00026   
00027   class MProcTask;
00028   class MAuth;
00029   
00047   class MBroker : public MBrokerBase{
00048   public:
00049     
00059     MBroker(MProcTask* task, MAuth* auth);
00060     
00064     virtual ~MBroker();
00065     
00069     mnode process(MObject* object, mnode n, bool block);
00070     
00074     MProcTask* task();
00075     
00081     bool listen(int port);
00082     
00086     bool isListening() const;
00087     
00091     MAuth* auth();
00092     
00096     const MAuth* auth() const;
00097     
00109     mstr distribute(MObject* object,
00110                     const mstr& className,
00111                     const mstr& objectName="");
00112     
00116     bool revoke(MObject* object);
00117     
00138     MObject* obtain(const mstr& host,
00139                     int port,
00140                     const mstr& objectName,
00141                     const mstr& user="",
00142                     const mstr& key="",
00143                     const mvar& session=0);
00144     
00154     virtual bool onObtain(MObject* object);
00155     
00164     bool release(MObject* object, bool disconnect=false);
00165     
00170     mvar& session(MObject* object);
00171     
00172   private:  
00173     MBroker& operator=(const MBroker&);
00174     MBroker(const MBroker&);
00175     
00176     class MBroker_* x_;
00177   };
00178   
00179 } // end namespace Meta
00180 
00181 #endif // ANDROMETA_M_BROKER_H