예제 #1
0
파일: dlsXmlParser.py 프로젝트: dmwm/DLSAPI
    def endElement(self, name):
        if name == "error":
            self.inError = False
            raise DlsErrorWithServer(self.error.strip())

        elif name == "block":
            self.mapping.append(DlsFileBlock(self.fbName, self.fbAttrs))
예제 #2
0
파일: dlsXmlParser.py 프로젝트: dmwm/DLSAPI
    def endElement(self, name):
        if name == "error":
            self.inError = False
            raise DlsErrorWithServer(self.error.strip())

        elif name == "node":
            #      if self.host and (self.host not in self.list):
            #            self.list.append(self.host)
            self.list.append(DlsLocation(self.host, self.seAttrs))
예제 #3
0
파일: dlsXmlParser.py 프로젝트: dmwm/DLSAPI
    def endElement(self, name):
        if name == "error":
            self.inError = False
            raise DlsErrorWithServer(self.error.strip())

        elif name == "file":
            self.files[DlsFile(self.fileName)] = self.locs
#       self.files[ self.fileName ] = self.ses

        elif name == "block":
            self.mapping.append(
                [DlsFileBlock(self.fbName, self.fbAttrs), self.files])
예제 #4
0
파일: dlsXmlParser.py 프로젝트: dmwm/DLSAPI
    def xmlToBlocks(self, xmlSource):
        """
    Returns a list of DlsFileBlock objects holding the FileBlock information
    contained in the specified XML source (in PhEDEx's blockReplicas format)

    @param xmlSource: XML source file in URL format (e.g. http://...) or file object

    @return: a list of DlsFileBlock objects with FileBlock information
    """
        parser = make_parser()
        handler = BlockPageHandler()
        parser.setContentHandler(handler)
        parser.parse(xmlSource)
        if not handler.phedexReply:
            raise DlsErrorWithServer(
                "No valid server response (no phedex entry). Check DLS endpoint"
            )
        return handler.mapping
예제 #5
0
파일: dlsXmlParser.py 프로젝트: dmwm/DLSAPI
    def xmlToFileLocs(self, xmlSource):
        """
    Returns a list of dict objects holding a DlsFile as key and a list of 
    DlsLocation objects as values for each DlsFile.
    contained in the specified XML source (in PhEDEx's "fileReplicas" format)

    @param xmlSource: XML source file in URL format (e.g. http://...) or file object

    @return: a list of dicts associating DlsFile objects and locations 
    """
        parser = make_parser()
        handler = FilePageHandler()
        parser.setContentHandler(handler)
        parser.parse(xmlSource)
        if not handler.phedexReply:
            raise DlsErrorWithServer(
                "No valid server response (no phedex entry). Check DLS endpoint"
            )
        return handler.mapping
예제 #6
0
파일: dlsXmlParser.py 프로젝트: dmwm/DLSAPI
    def xmlToLocations(self, xmlSource):
        """
    Returns a list of DlsLocation objects holding the location information
    contained in the specified XML source (in PhEDEx's "nodes" format)

    @param xmlSource: XML source file in URL format (e.g. http://...) or file object

    @return: a list of DlsLocation objects with location information
    """
        parser = make_parser()
        handler = NodePageHandler()
        parser.setContentHandler(handler)
        parser.parse(xmlSource)
        if not handler.phedexReply:
            raise DlsErrorWithServer(
                "No valid server response (no phedex entry). Check DLS endpoint"
            )


#    hostList = handler.list
#    hostList.sort()
#    return map(DlsLocation, hostList)
        return handler.list