Inheritance diagram for python::GBSObject::GBSObject:
Public Member Functions | |
def | __init__ |
def | GetType |
def | __repr__ |
def | GetName |
def | GetModel |
def | GetParent |
def | GetStoreLocation |
def | MakeChildDirectory |
def | Read |
def | Write |
def | WriteFamily |
def | Rename |
Private Member Functions | |
def | __DoIO |
def | _DoMemberIO |
Private Attributes | |
__name | |
__parent | |
__model |
Base for all "role playing" objects. This class the basis for persistancy. This class provides no (directly) user callable methods although they can be used via the classes that inherit from it.
Definition at line 7 of file GBSObject.py.
def python::GBSObject::GBSObject::__DoIO | ( | self, | ||
mode | ||||
) | [private] |
Definition at line 71 of file GBSObject.py.
00071 : self.__DoIO("w") 00072 def WriteFamily(self): self.Write() 00073 00074 ###### Private Methods (not user callable) ###### 00075 00076 def __DoIO(self,mode):
def python::GBSObject::GBSObject::__init__ | ( | self, | ||
name, | ||||
parent, | ||||
model | ||||
) |
Definition at line 10 of file GBSObject.py.
00015 : 00016 self.__name = name # Object name, must be unique within scope of parent 00017 self.__parent = parent # Parent (None for Manager) 00018 self.__model = model # Model name 00019 Log(self,logger.SYNOPSIS,"Creating a " + self.GetType() + " named " + self.__name) 00020 00021 # After creation, either read current state from disk, if state file exists, 00022 # or create state file (and if necessary supporting directory) if it doesn't. 00023 00024 if os.path.isfile(self.GetStoreLocation()): 00025 self.Read() else:
def python::GBSObject::GBSObject::__repr__ | ( | self | ) |
Reimplemented in python::GBSJob::GBSJob, python::GBSManager::GBSManager, and python::GBSTask::GBSTask.
Definition at line 28 of file GBSObject.py.
00028 : os.mkdir(parentDir,0770) 00029 self.Write() 00030 00031 def GetType(self): return "GBSObject" 00032 00033 def __repr__(self) :
def python::GBSObject::GBSObject::_DoMemberIO | ( | self, | ||
ioh | ||||
) | [private] |
Reimplemented in python::GBSJob::GBSJob, python::GBSManager::GBSManager, and python::GBSTask::GBSTask.
Definition at line 77 of file GBSObject.py.
00077 :" + str(mode) + " on " + GBSObject.__repr__(self)) 00078 ioh = GBSIOHelper(self.GetStoreLocation(),mode) 00079 self._DoMemberIO(ioh) 00080 ioh.Close() 00081
def python::GBSObject::GBSObject::GetModel | ( | self | ) |
def python::GBSObject::GBSObject::GetName | ( | self | ) |
def python::GBSObject::GBSObject::GetParent | ( | self | ) |
def python::GBSObject::GBSObject::GetStoreLocation | ( | self, | ||
type = "self" | ||||
) |
Return storage location: parent directory, self or child directory. type is one of "parent_dir" parent's child directory "self" object's state file "child_dir" directory for own children
Definition at line 38 of file GBSObject.py.
00039 : return self.__name 00040 def GetModel(self): return self.__model 00041 def GetParent(self): return self.__parent 00042 00043 def GetStoreLocation(self,type="self"): 00044 00045 """Return storage location: parent directory, self or child directory. 00046 00047 type is one of "parent_dir" parent's child directory 00048 "self" object's state file 00049 "child_dir" directory for own children""" 00050 00051 loc = "" 00052 if self.__parent == None : loc = GBSConfig.GetConfig().GetValue("DataDirectory") 00053 else : loc = self.__parent.GetStoreLocation("parent_dir") + "/" + self.__parent.GetName() 00054 if type != "parent_dir": loc += "/" + self.GetName()
def python::GBSObject::GBSObject::GetType | ( | self | ) |
Reimplemented in python::GBSJob::GBSJob, python::GBSManager::GBSManager, and python::GBSTask::GBSTask.
Definition at line 26 of file GBSObject.py.
00026 : 00027 parentDir = self.GetStoreLocation("parent_dir") if not os.path.isdir(parentDir): os.mkdir(parentDir,0770)
def python::GBSObject::GBSObject::MakeChildDirectory | ( | self | ) |
If directory used to store child objects does not exist, create it
Definition at line 55 of file GBSObject.py.
00055 : loc += ".state" 00056 return loc 00057 00058 # I/O 00059 00060 def MakeChildDirectory(self): 00061 00062 """If directory used to store child objects does not exist, create it""" 00063 00064 child_dir = self.GetStoreLocation("child_dir")
def python::GBSObject::GBSObject::Read | ( | self | ) |
Definition at line 65 of file GBSObject.py.
00065 : Log(self,logger.SYNOPSIS,"Creating directory for child objects:" + str(child_dir))
def python::GBSObject::GBSObject::Rename | ( | self, | ||
new_name | ||||
) |
Rename to new_name (does not perform I/O - that must be done by caller).
Definition at line 82 of file GBSObject.py.
00082 : 00083 self.__model = ioh("Model Name","s",self.__model) 00084 self.__name = ioh("Object Name","s",self.__name) 00085 00086 00087 def Rename(self,new_name): 00088 """Rename to new_name (does not perform I/O - that must be done by caller).""" self.__name = new_name
def python::GBSObject::GBSObject::Write | ( | self | ) |
def python::GBSObject::GBSObject::WriteFamily | ( | self | ) |
Reimplemented in python::GBSManager::GBSManager, and python::GBSTask::GBSTask.
Definition at line 67 of file GBSObject.py.
00067 : 00068 Log(self,logger.ERROR,"Failed to create directory for child objects:" + str(child_dir))
python::GBSObject::GBSObject::__model [private] |
Definition at line 13 of file GBSObject.py.
python::GBSObject::GBSObject::__name [private] |
Definition at line 11 of file GBSObject.py.
python::GBSObject::GBSObject::__parent [private] |
Definition at line 12 of file GBSObject.py.