Exemple #1
0
    def dumpBuf(self, ignoreUndefFields=0):
        """
        Dump contents of the object to a string buffer (to the extent
        possible).

        ignoreUndefFields:     Don't take fields, which have a length of 0
                               (integer/0|1).

        Returns:               String buffer with ASCII output (string).
        """
        format = prFormat1()
        buf = "Request Properties Object:\n"
        objStat = self.getObjStatus()
        for fieldName, val in objStat:
            if (not ignoreValue(ignoreUndefFields, val)):
                if (type(val) == types.DictType):
                    val2 = createSortDicDump(val)
                elif (type(val) == types.ListType):
                    val2 = str(val.sort())
                    val2 = copy.deepcopy(val)
                    val2.sort()
                else:
                    val2 = val
                buf += format % (fieldName + ":", str(val2))
        return buf
Exemple #2
0
    def dumpBuf(self, ignoreUndefFields=0):
        """
        Dump contents of object into a string buffer.

        ignoreUndefFields:     Don't take fields, which have a length of 0
                               (integer/0|1).

        Returns:               String buffer with contents of object (string).
        """
        format = prFormat1()
        buf = "HostStatus:\n"
        objStat = self.getObjStatus()
        for fieldName, val in objStat:
            if (not ignoreValue(ignoreUndefFields, val)):
                buf += format % (fieldName + ":", val)
        return buf
Exemple #3
0
    def dumpBuf(self, dumpCfg=0, dumpStates=1, ignoreUndefFields=0):
        """
        Dump information in object into a buffer in a (simple) ASCII
        format.

        dumpCfg:               If set to 1 the configuration is dumped
                               (integer/0|1).

        ignoreUndefFields:     Don't take fields, which have a length of 0
                               (integer/0|1).

        Returns:               Buffer with status information (string).
        """
        T = TRACE()

        format = prFormat1()
        buf = "Status:\n"
        buf += format % ("Date:", self.getDate())
        buf += format % ("Version:", self.getVersion())
        buf += format % ("HostId:", self.getHostId())
        if (dumpStates): buf += format % ("Status:", self.getStatus())
        buf += format % ("Message:", self.getMessage())
        if (dumpStates): buf += format % ("State:", self.getState())
        if (dumpStates): buf += format % ("SubState:", self.getSubState())
        if (self.getActualCount()):
            buf += format % ("ActualCount:", str(self.getActualCount()))
        if (self.getExpectedCount()):
            buf += format % ("ExpectedCount:", str(self.getExpectedCount()))

        # Dump NG/AMS Configuration.
        # TODO: Implement!

        # Dump Disk Status.
        for diskStatus in self.getDiskStatusList():
            buf += diskStatus.dumpBuf(1)

        # Dump File Lists.
        for fileList in self.getFileListList():
            buf += fileList.dumpBuf(ignoreUndefFields)

        return buf
Exemple #4
0
    def dumpBuf(self, dumpFileInfo=0, ignoreUndefFields=0):
        """
        Dump contents of object into a string buffer.

        dumpFileInfo:       Dump also possible file info in connection with the
                            object (integer\0|1).

        ignoreUndefFields:  Don't take fields, which have a length of 0
                            (integer/0|1).

        Returns:            String buffer with disk info (string).
        """
        format = prFormat1()
        buf = "DiskStatus:\n"
        objStat = self.getObjStatus()
        for fieldName, val in objStat:
            if (not ignoreValue(ignoreUndefFields, val)):
                buf += format % (fieldName + ":", str(val))
        if (dumpFileInfo):
            for fileInfoObj in self.getFileObjList():
                buf += fileInfoObj.dumpBuf(ignoreUndefFields)
        return buf
Exemple #5
0
    def dumpBuf(self):
        """
        Dump contents of object into a string buffer.

        Returns:    String buffer with disk info (string).
        """
        format = prFormat1()
        buf = "Subscriber Info:\n"
        buf += format % ("Host ID:", self.getHostId())
        if (self.getPortNo() > 0):
            buf += format % ("Port Number:", str(self.getPortNo()))
        buf += format % ("Priority:", str(self.getPriority()))
        buf += format % ("Subscriber ID:", self.getId())
        buf += format % ("Subscriber URL:", self.getUrl())
        if self.__startDate is not None:
            buf += format % ("Start Date:", toiso8601(self.__startDate))
        buf += format % ("Filter Plug-In:", self.getFilterPi())
        buf += format % ("Filter Plug-In Par.s:", self.getFilterPiPars())
        if self.__lastFileIngDate is not None:
            buf += format % ("Last File Ing. Date:",
                             toiso8601(self.__lastFileIngDate))
        return buf
Exemple #6
0
    def dumpBuf(self,
                ignoreUndefFields = 0):
        """
        Dump contents of the File List in a buffer and return this.

        ignoreUndefFields:  Don't take fields, which have a length of 0
                            (integer/0|1).

        Returns:            Buffer with an ASCII representation of the
                            contents of the object (string).
        """
        format = prFormat1()
        buf = "FileList:\n"
        if (not (ignoreUndefFields and not self.getId().strip())):
            buf += format % ("Id:", self.getId())
        if (not (ignoreUndefFields and not self.getComment().strip())):
            buf += format % ("Comment:", self.getComment())
        if (not (ignoreUndefFields and not self.getStatus().strip())):
            buf += format % ("Status:", self.getStatus())
        for fileInfoObj in self.getFileInfoObjList():
            buf += fileInfoObj.dumpBuf(ignoreUndefFields)
        for fileListObj in self.getFileListObjList():
            buf += fileListObj.dumpBuf(ignoreUndefFields)
        return buf