00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 #include "TGo4ComSetProtections.h"
00017 
00018 #include "TGo4Log.h"
00019 #include "TGo4AnalysisClientImp.h"
00020 #include "TGo4AnalysisImp.h"
00021 #include "TGo4RemoteCommand.h"
00022 
00023 TGo4ComSetProtections::TGo4ComSetProtections(const char* obname, const char* flags)
00024 :TGo4AnalysisObjectCommand("ANSetProtect","Set protection properties for object",obname)
00025 {
00026    TRACE((12,"TGo4ComSetProtections::TGo4ComSetProtections(const Text_t*) ctor",__LINE__, __FILE__));
00027    SetReceiverName("AnalysisClient");  
00028                                       
00029    SetFlags(flags);
00030    SetProtection(kGo4ComModeController);
00031 }
00032 
00033 TGo4ComSetProtections::TGo4ComSetProtections()
00034 :TGo4AnalysisObjectCommand()
00035 {
00036    TRACE((12,"TGo4ComSetProtections::TGo4ComSetProtections() ctor",__LINE__, __FILE__));
00037    SetReceiverName("AnalysisClient");  
00038    SetName("ANSetProtect");
00039    SetDescription("Set protection properties for object");
00040    SetProtection(kGo4ComModeController);
00041 }
00042 
00043 TGo4ComSetProtections::~TGo4ComSetProtections()
00044 {
00045    TRACE((12,"TGo4ComSetProtections::~TGo4ComSetProtections() dtor",__LINE__, __FILE__));
00046 }
00047 
00048 void TGo4ComSetProtections::Set(TGo4RemoteCommand* remcom)
00049 {
00050 if(remcom==0) return;
00051 TGo4AnalysisObjectCommand::Set(remcom);
00052 SetFlags(remcom->GetString(2));
00053 }
00054 
00055 
00056 
00057 Int_t TGo4ComSetProtections::ExeCom()
00058 {
00059    TGo4AnalysisClient* cli=dynamic_cast<TGo4AnalysisClient*> (fxReceiverBase);
00060    if (cli!=0)
00061       {
00062          TGo4Analysis* ana=TGo4Analysis::Instance();
00063          if(ana->ProtectObjects(GetObjectName(),(const Option_t*) fxFlags.Data()))
00064             {
00065                cli->SendStatusMessage(1, kFALSE,"Changed object or folder %s protections: %s ",
00066                                                GetObjectName(),fxFlags.Data());
00067             }
00068          else
00069             {
00070                 cli->SendStatusMessage(2, kFALSE,"Could not change object/folder %s protections, no such object",
00071                                                GetObjectName());
00072             }
00073       }
00074    else
00075 
00076        {
00077          TGo4Log::Debug(" !!! %s : NO RECEIVER ERROR!!!",GetName());
00078          return 1;
00079       }
00080 
00081    return -1;
00082 }
00083 
00084