/****************************************************************************** * TMClientUser.cpp - description * ------------------- * begin : 2005/04/20 * copyright : (C) 2005 by Harald K. Strack * copyright : (C) 2005 by Trymedia Inc. * email : hstrack@trymedia.com, strack@fhm.edu ****************************************************************************** * changes name date comment * hks 2005/05/24 Constructor improved for more flexiblility. * hks 2005/05/25 Added ap4 integrate handler * hks 2005/07/01 Message() added. */ /* TMClientUser: Trymedia Client User. * * This user hooks all FileSys calls (see TMFSHook.cpp). * * It also hooks the OutputStat() method to get attributes from the server * (see TMBOSync.cpp). * * Derivied classes have to assign a handler to itself. This class takes * every handler. * */ #include "TMClientUser.h" //Do not use this TMClientUser::TMClientUser ():ClientUser () { } //Use this TMClientUser::TMClientUser (ClientApi * ca, TMBOType tt):ClientUser () { this->ca = ca; this->tmbo = NULL; SetTMBO (tt); } TMClientUser::~TMClientUser () { } /* Assigns a handler to the user */ void TMClientUser::SetTMBO (TMBOType tt) { this->tmbo = TMBO::Create (this->ca, tt); } /* Assigns a new FileSys * to the user */ FileSys * TMClientUser::File (FileSysType type) { TMFSHook *tmfsh = TMFSHook::Create (type); //FileSys * tmfsh = FileSys::Create(type); tmfsh->SetTMBO (this->tmbo); return tmfsh; } /* Handle arguments for specific commands */ void TMClientUser::HandleArguments ( int argc, char **argv ) { if (tmbo != NULL) { Error * e = new Error(); tmbo->HandleArguments (argc, argv, e); } } // // OutputStat is only called when we run our "p4 fstat"(internally), // not when we run // the command itself (from command line). // void TMClientUser::OutputStat (StrDict * varList) { StrPtr *path = varList->GetVar ("clientFile"); if (this->tmbo == NULL) { cerr << "TRYMEDIA ClientUser: No Handler (BO) set. Giving up." << endl; exit (1); } if (this->tmbo->GetType () == SYNC_HANDLER || this->tmbo->GetType () == REVERT_HANDLER || this->tmbo->GetType () == INTEG_HANDLER) { /*Set the path, but not for ap4 integrate, since its the path of the * new branch (allready set)!! */ if (this->tmbo->GetType () != INTEG_HANDLER) tmbo->SetPath (tmbo->GetTmpNode (), path); //Set the permissions tmbo->SetPerm (tmbo->GetTmpNode (), varList->GetVar (TM_PERMISSION_ATTR_GET)); //Set uid tmbo->SetUid (tmbo->GetTmpNode (), varList->GetVar (TM_USER_ATTR_GET)); //Set gid tmbo->SetGid (tmbo->GetTmpNode (), varList->GetVar (TM_GROUP_ATTR_GET)); } } /* For Developing: here you see all available variables. * FIXME: This maybe is the solution to get for every * operation path and vpath!! No need for fs hooks and * and string parsing. Why havn't I see this earlier?? */ void TMClientUser::Message (Error * err) { ClientUser::Message (err); return; int i; StrBuf msg; StrRef var, val; // Dump out the variables, using the GetVar( x ) interface. // Don't display the function, which is only relevant to rpc. for (i = 0; varList->GetVar (i, var, val); i++) { //if( var == "func" ) continue; // otherAction and otherOpen go at level 2, as per 99.1 + earlier msg.Clear (); msg << var << " " << val; char level = strncmp (var.Text (), "other", 5) ? '1' : '2'; OutputInfo (level, msg.Text ()); } // blank line OutputInfo ('0', ""); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#6 | 5069 | harald_strack |
ADDITIONAL command parameter handling introduced. ap4 sync -n is handled. Usually there is no need for handling any command specific parameters. Tests improved. |
||
#5 | 5056 | harald_strack |
Directory support. Serious bug concerned to not unzipped binaries removed. Some other small bugfixes. |
||
#4 | 4980 | harald_strack |
Since I am maintaining the stuff in a local repository, I did some copy errors in the last revisions. Fixed. |
||
#3 | 4978 | harald_strack |
ap4 integrate implemented. Octal format is now used to save permissions. NOT backwards compatible anymore!!! |
||
#2 | 4975 | harald_strack |
Permissions are now masked to 555, so no write is possible. If you edit the Makefile and give the parameter -DFULL_PERMS, you have the old behaviour. Bugfix in ap4 revert: Edited and changed files were not reverted correctly. |
||
#1 | 4948 | harald_strack | Initial revision. |