TRootSniffer Sniffer of ROOT objects, data provider for THttpServer Provides methods to scan different structures like folders, directories, files, trees, collections Can locate objects (or its data member) per name Can be extended to application-specific classes
TRootSniffer(const char* name, const char* objpath = "Objects") | |
virtual | ~TRootSniffer() |
void | TObject::AbstractMethod(const char* method) const |
virtual void | TObject::AppendPad(Option_t* option = "") |
virtual void | TObject::Browse(TBrowser* b) |
Bool_t | CanDrawItem(const char* path) |
Bool_t | CanExploreItem(const char* path) |
Int_t | CheckRestriction(const char* item_name) |
static TClass* | Class() |
virtual const char* | TObject::ClassName() const |
virtual void | TNamed::Clear(Option_t* option = "") |
virtual TObject* | TNamed::Clone(const char* newname = "") const |
virtual Int_t | TNamed::Compare(const TObject* obj) const |
virtual void | TNamed::Copy(TObject& named) const |
Bool_t | CreateItem(const char* fullname, const char* title) |
virtual void | TObject::Delete(Option_t* option = "")MENU |
virtual Int_t | TObject::DistancetoPrimitive(Int_t px, Int_t py) |
virtual void | TObject::Draw(Option_t* option = "") |
virtual void | TObject::DrawClass() constMENU |
virtual TObject* | TObject::DrawClone(Option_t* option = "") constMENU |
virtual void | TObject::Dump() constMENU |
virtual void | TObject::Error(const char* method, const char* msgfmt) const |
virtual void | TObject::Execute(const char* method, const char* params, Int_t* error = 0) |
virtual void | TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) |
Bool_t | ExecuteCmd(const char* path, const char* options, TString& res) |
virtual void | TObject::ExecuteEvent(Int_t event, Int_t px, Int_t py) |
virtual void | TObject::Fatal(const char* method, const char* msgfmt) const |
virtual void | TNamed::FillBuffer(char*& buffer) |
virtual void* | FindInHierarchy(const char* path, TClass** cl = 0, TDataMember** member = 0, Int_t* chld = 0) |
virtual TObject* | TObject::FindObject(const char* name) const |
virtual TObject* | TObject::FindObject(const TObject* obj) const |
TObject* | FindTObjectInHierarchy(const char* path) |
const char* | GetAutoLoad() const |
virtual Option_t* | TObject::GetDrawOption() const |
static Long_t | TObject::GetDtorOnly() |
virtual const char* | TObject::GetIconName() const |
const char* | GetItemField(const char* fullname, const char* name) |
ULong_t | GetItemHash(const char* itemname) |
virtual const char* | TNamed::GetName() const |
virtual char* | TObject::GetObjectInfo(Int_t px, Int_t py) const |
static Bool_t | TObject::GetObjectStat() |
virtual Option_t* | TObject::GetOption() const |
ULong_t | GetStreamerInfoHash() |
virtual const char* | TNamed::GetTitle() const |
virtual UInt_t | TObject::GetUniqueID() const |
virtual Bool_t | TObject::HandleTimer(TTimer* timer) |
virtual ULong_t | TNamed::Hash() const |
Bool_t | HasRestriction(const char* item_name) |
virtual void | TObject::Info(const char* method, const char* msgfmt) const |
virtual Bool_t | TObject::InheritsFrom(const char* classname) const |
virtual Bool_t | TObject::InheritsFrom(const TClass* cl) const |
virtual void | TObject::Inspect() constMENU |
void | TObject::InvertBit(UInt_t f) |
virtual TClass* | IsA() const |
static Bool_t | IsDrawableClass(TClass* cl) |
virtual Bool_t | TObject::IsEqual(const TObject* obj) const |
virtual Bool_t | TObject::IsFolder() const |
Bool_t | TObject::IsOnHeap() const |
Bool_t | IsReadOnly() const |
Bool_t | IsScanGlobalDir() const |
virtual Bool_t | TNamed::IsSortable() const |
Bool_t | IsStreamerInfoItem(const char* itemname) |
Bool_t | TObject::IsZombie() const |
virtual void | TNamed::ls(Option_t* option = "") const |
void | TObject::MayNotUse(const char* method) const |
virtual Bool_t | TObject::Notify() |
void | TObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const |
static void | TObject::operator delete(void* ptr) |
static void | TObject::operator delete(void* ptr, void* vp) |
static void | TObject::operator delete[](void* ptr) |
static void | TObject::operator delete[](void* ptr, void* vp) |
void* | TObject::operator new(size_t sz) |
void* | TObject::operator new(size_t sz, void* vp) |
void* | TObject::operator new[](size_t sz) |
void* | TObject::operator new[](size_t sz, void* vp) |
TNamed& | TNamed::operator=(const TNamed& rhs) |
virtual void | TObject::Paint(Option_t* option = "") |
virtual void | TObject::Pop() |
virtual void | TNamed::Print(Option_t* option = "") const |
Bool_t | Produce(const char* path, const char* file, const char* options, void*& ptr, Long_t& length, TString& str) |
Bool_t | ProduceBinary(const char* path, const char* options, void*& ptr, Long_t& length) |
Bool_t | ProduceExe(const char* path, const char* options, Int_t reskind, TString* ret_str, void** ret_ptr = 0, Long_t* ret_length = 0) |
Bool_t | ProduceImage(Int_t kind, const char* path, const char* options, void*& ptr, Long_t& length) |
Bool_t | ProduceItem(const char* path, const char* options, TString& res, Bool_t asjson = kTRUE) |
Bool_t | ProduceJson(const char* path, const char* options, TString& res) |
Bool_t | ProduceMulti(const char* path, const char* options, void*& ptr, Long_t& length, TString& str, Bool_t asjson = kTRUE) |
Bool_t | ProduceXml(const char* path, const char* options, TString& res) |
virtual Int_t | TObject::Read(const char* name) |
virtual void | TObject::RecursiveRemove(TObject* obj) |
Bool_t | RegisterCommand(const char* cmdname, const char* method, const char* icon) |
Bool_t | RegisterObject(const char* subfolder, TObject* obj) |
void | TObject::ResetBit(UInt_t f) |
void | Restrict(const char* path, const char* options) |
virtual void | TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU |
virtual void | TObject::SavePrimitive(ostream& out, Option_t* option = "") |
void | ScanHierarchy(const char* topname, const char* path, TRootSnifferStore* store, Bool_t only_fields = kFALSE) |
void | SetAutoLoad(const char* scripts = "") |
void | TObject::SetBit(UInt_t f) |
void | TObject::SetBit(UInt_t f, Bool_t set) |
void | SetCurrentCallArg(THttpCallArg* arg) |
virtual void | TObject::SetDrawOption(Option_t* option = "")MENU |
static void | TObject::SetDtorOnly(void* obj) |
Bool_t | SetItemField(const char* fullname, const char* name, const char* value) |
virtual void | TNamed::SetName(const char* name)MENU |
virtual void | TNamed::SetNameTitle(const char* name, const char* title) |
static void | TObject::SetObjectStat(Bool_t stat) |
void | SetReadOnly(Bool_t on = kTRUE) |
void | SetScanGlobalDir(Bool_t on = kTRUE) |
virtual void | TNamed::SetTitle(const char* title = "")MENU |
virtual void | TObject::SetUniqueID(UInt_t uid) |
virtual void | ShowMembers(TMemberInspector&) |
virtual Int_t | TNamed::Sizeof() const |
virtual void | Streamer(TBuffer&) |
void | StreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b) |
virtual void | TObject::SysError(const char* method, const char* msgfmt) const |
Bool_t | TObject::TestBit(UInt_t f) const |
Int_t | TObject::TestBits(UInt_t f) const |
Bool_t | UnregisterObject(TObject* obj) |
virtual void | TObject::UseCurrentStyle() |
virtual void | TObject::Warning(const char* method, const char* msgfmt) const |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const |
Bool_t | AccessField(TFolder* parent, TObject* item, const char* name, const char* value, TNamed** only_get = 0) |
void | CreateMemFile() |
TString | DecodeUrlOptionValue(const char* value, Bool_t remove_quotes = kTRUE) |
virtual void | TObject::DoError(int level, const char* location, const char* fmt, va_list va) const |
TObject* | GetItem(const char* fullname, TFolder*& parent, Bool_t force = kFALSE, Bool_t within_objects = kTRUE) |
const char* | GetItemField(TFolder* parent, TObject* item, const char* name) |
TFolder* | GetSubFolder(const char* foldername, Bool_t force = kFALSE) |
Bool_t | IsItemField(TObject* obj) const |
void | TObject::MakeZombie() |
void | ScanCollection(TRootSnifferScanRec& rec, TCollection* lst, const char* foldername = 0, TCollection* keys_lst = 0) |
virtual void | ScanObjectChilds(TRootSnifferScanRec& rec, TObject* obj) |
void | ScanObjectMembers(TRootSnifferScanRec& rec, TClass* cl, char* ptr) |
virtual void | ScanObjectProperties(TRootSnifferScanRec& rec, TObject* obj) |
virtual void | ScanRoot(TRootSnifferScanRec& rec) |
Int_t | WithCurrentUserName(const char* option) |
enum { | kItemField | |
}; | ||
enum TObject::EStatusBits { | kCanDelete | |
kMustCleanup | ||
kObjInCanvas | ||
kIsReferenced | ||
kHasUUID | ||
kCannotPick | ||
kNoContextMenu | ||
kInvalidObject | ||
}; | ||
enum TObject::[unnamed] { | kIsOnHeap | |
kNotDeleted | ||
kZombie | ||
kBitMask | ||
kSingleKey | ||
kOverwrite | ||
kWriteDelete | ||
}; |
TString | fAutoLoad | ! scripts names, which are add as _autoload parameter to h.json request |
TString | fCurrentAllowedMethods | ! list of allowed methods, extracted when analyzed object restrictions |
THttpCallArg* | fCurrentArg | ! current http arguments (if any) |
Int_t | fCurrentRestrict | ! current restriction for last-found object |
TMemFile* | fMemFile | ! file used to manage streamer infos |
TString | TNamed::fName | object identifier |
TString | fObjectsPath | ! default path for registered objects |
Bool_t | fReadOnly | ! indicate if sniffer allowed to change ROOT structures - for instance, read objects from files |
TList | fRestrictions | ! list of restrictions for different locations |
Bool_t | fScanGlobalDir | ! when enabled (default), scan gROOT for histograms, canvases, open files |
TList* | fSinfo | ! last produced streamer info |
TString | TNamed::fTitle | object title |
set current http arguments, which then used in different process methods For instance, if user authorized with some user name, depending from restrictions some objects will be invisible or user get full access to the element
When specified, _autoload attribute will be always add to top element of h.json/h.hml requests Used to instruct browser automatically load special code
Restrict access to the specified location Hides or provides read-only access to different parts of the hierarchy Restriction done base on user-name specified with http requests Options can be specified in URL style (separated with &) Following parameters can be specified: visible = [all|user(s)] - make item visible for all users or only specified user hidden = [all|user(s)] - make item hidden from all users or only specified user readonly = [all|user(s)] - make item read-only for all users or only specified user allow = [all|user(s)] - make full access for all users or only specified user allow_method = method(s) - allow method(s) execution even when readonly flag specified for the object Like make command seen by all but can be executed only by admin sniff->Restrict("/CmdReset","allow=admin"); Or fully hide command from guest account sniff->Restrict("/CmdRebin","hidden=guest");
Made fast check if item with specified name is in restriction list If returns true, requires precise check with CheckRestriction() method
return 2 when option match to current user name return 1 when option==all return 0 when option does not match user name
Checked if restriction is applied to the item full_item_name should have full path to the item Returns -1 - object invisible, cannot be accessed or listed 0 - no explicit restrictions, use default 1 - read-only access 2 - full access
scan object data members some members like enum or static members will be excluded
scans object properties here such fields as _autoload or _icon properties depending on class or object name could be assigned By default properties, coded in the Class title are scanned. Example: ClassDef(UserClassName, 1) // class comments *SNIFF* _field1=value _field2="string value" Here *SNIFF* mark is important. After it all expressions like field=value are parsed One could use double quotes to code string values with spaces. Fields separated from each other with spaces
scans object childs (if any) here one scans collection, branches, trees and so on
scan collection content
scan ROOT hierarchy with provided store object
Search element with specified path Returns pointer on element Optionally one could obtain element class, member description and number of childs. When chld!=0, not only element is searched, but also number of childs are counted. When member!=0, any object will be scanned for its data members (disregard of extra options)
Search element in hierarchy, derived from TObject
Returns hash value for streamer infos At the moment - just number of items in streamer infos list.
Get hash function for specified item used to detect any changes in the specified object
Method returns true when object has childs or one could try to expand item
Creates TMemFile instance, which used for objects streaming One could not use TBufferFile directly, while one also require streamer infos list
produce JSON data for specified item For object conversion TBufferJSON is used
execute command marked as _kind=='Command'
produce JSON/XML for specified item contrary to h.json request, only fields for specified item are stored
produce XML data for specified item For object conversion TBufferXML is used
method replaces all kind of special symbols, which could appear in URL options
execute command for specified object options include method and extra list of parameters sniffer should be not-readonly to allow execution of the commands reskind defines kind of result 0 - debug, 1 - json, 2 - binary
Process several requests, packing all results into binary or JSON buffer Input parameters should be coded in the POST block and has individual request relative to current path, separated with '\n' symbol like item1/root.bin\n item2/exe.bin?method=GetList\n item3/exe.bin?method=GetTitle\n Request requires 'number' URL option which contains number of requested items In case of binary request output buffer looks like: 4bytes length + payload, 4bytes length + payload, ... In case of JSON request output is array with results for each item multi.json request do not support binary requests for the items
produce binary data for specified item
if "zipped" option specified in query, buffer will be compressed
Method to produce image from specified object Parameters: kind - image kind TImage::kPng, TImage::kJpeg, TImage::kGif path - path to object options - extra options By default, image 300x200 is produced In options string one could provide following parameters: w - image width h - image height opt - draw options For instance: http://localhost:8080/Files/hsimple.root/hpx/get.png?w=500&h=500&opt=lego1 Return is memory with produced image Memory must be released by user with free(ptr) call
Method produce different kind of data out of object Parameter 'path' specifies object or object member Supported 'file' (case sensitive): "root.bin" - binary data "root.png" - png image "root.jpeg" - jpeg image "root.gif" - gif image "root.xml" - xml representation "root.json" - json representation "exe.json" - method execution with json reply "exe.bin" - method execution with binary reply "exe.txt" - method execution with debug output "cmd.json" - execution of registered commands Result returned either as string or binary buffer, which should be released with free() call
return item from the subfolders structure
creates subfolder where objects can be registered
Register object in subfolder structure subfolder parameter can have many levels like: TRootSniffer* sniff = new TRootSniffer("sniff"); sniff->RegisterObject("my/sub/subfolder", h1); Such objects can be later found in "Objects" folder of sniffer like h1 = sniff->FindTObjectInHierarchy("/Objects/my/sub/subfolder/h1"); If subfolder name starts with '/', object will be registered starting from top folder. One could provide additional fields for registered objects For instance, setting "_more" field to true let browser explore objects members. For instance: TEvent* ev = new TEvent("ev"); sniff->RegisterObject("Events", ev); sniff->SetItemField("Events/ev", "_more", "true");
unregister (remove) object from folders structures folder itself will remain even when it will be empty
return true when object is TNamed with kItemField bit set such objects used to keep field values for item
set or get field for the child each field coded as TNamed object, placed after chld in the parent hierarchy
set field for specified item
return field for specified item
Register command which can be executed from web interface As method one typically specifies string, which is executed with gROOT->ProcessLine() method. For instance serv->RegisterCommand("Invoke","InvokeFunction()"); Or one could specify any method of the object which is already registered to the server. For instance: serv->Register("/", hpx); serv->RegisterCommand("/ResetHPX", "/hpx/->Reset()"); Here symbols '/->' separates item name from method to be executed One could specify additional arguments in the command with syntax like %arg1%, %arg2% and so on. For example: serv->RegisterCommand("/ResetHPX", "/hpx/->SetTitle(\"%arg1%\")"); serv->RegisterCommand("/RebinHPXPY", "/hpxpy/->Rebin2D(%arg1%,%arg2%)"); Such parameter(s) will be requested when command clicked in the browser. Once command is registered, one could specify icon which will appear in the browser: serv->SetIcon("/ResetHPX", "rootsys/icons/ed_execute.png"); One also can set extra property '_fastcmd', that command appear as tool button on the top of the browser tree: serv->SetItemField("/ResetHPX", "_fastcmd", "true"); Or it is equivalent to specifying extra argument when register command: serv->RegisterCommand("/ResetHPX", "/hpx/->Reset()", "button;rootsys/icons/ed_delete.png");
When readonly on (default), sniffer is not allowed to change ROOT structures For instance, it is not allowed to read new objects from files
When enabled (default), sniffer scans gROOT for files, canvases, histograms