当前位置: 首页>>代码示例>>Python>>正文


Python api.PluginManager类代码示例

本文整理汇总了Python中au.edu.usq.fascinator.api.PluginManager的典型用法代码示例。如果您正苦于以下问题:Python PluginManager类的具体用法?Python PluginManager怎么用?Python PluginManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PluginManager类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getStoragePlugins

 def getStoragePlugins(self):
     return PluginManager.getStoragePlugins()
开发者ID:kiranba,项目名称:the-fascinator,代码行数:2,代码来源:settings.py

示例2: getTransformerPlugins

 def getTransformerPlugins(self):
     return PluginManager.getTransformerPlugins()
开发者ID:kiranba,项目名称:the-fascinator,代码行数:2,代码来源:settings.py

示例3: getIndexerPlugins

 def getIndexerPlugins(self):
     return PluginManager.getIndexerPlugins()
开发者ID:kiranba,项目名称:the-fascinator,代码行数:2,代码来源:settings.py

示例4: getHarvester

 def getHarvester(self, type):
     return PluginManager.getHarvester(type)
开发者ID:kiranba,项目名称:the-fascinator,代码行数:2,代码来源:harvest.py

示例5: getHarvesterPlugins

 def getHarvesterPlugins(self):
     return PluginManager.getHarvesterPlugins()
开发者ID:kiranba,项目名称:the-fascinator,代码行数:2,代码来源:settings.py

示例6: __processRequest

    def __processRequest(self):
        baseUrl = "http://%s:%s%s/%s" % (request.serverName, serverPort, contextPath, portalId)
        depositUrl = "%s/sword/deposit.post" % baseUrl
        sword = SwordSimpleServer(depositUrl)
        try:
            p =  request.path.split(portalId+"/"+pageName+"/")[1]  # portalPath
        except:
            p = ""
        if p=="post":
            print "\n--- post ---"
            c = sword.getClient()
            c.clearProxy()
            c.clearCredentials()
            postMsg = sword.getPostMessage();
            postMsg.filetype = "application/zip"
            postMsg.filepath = "/home/ward/Desktop/Test.zip"
            depositResponse = c.postFile(postMsg)
            return str(depositResponse)
        elif p=="servicedocument":
            #print "\n--- servicedocument ---"
            sdr = sword.getServiceDocumentRequest()
            sdr.username = formData.get("username", "test")
            sdr.password = formData.get("password", "test")
            if formData.get("test"):
                depositUrl += "?test=1"
            sd = sword.doServiceDocument(sdr)  # get a serviceDocument
            out = response.getPrintWriter("text/xml")
            out.println(str(sd))
            out.close()
            bindings["pageName"] = "-noTemplate-"
            return sd
        elif p=="deposit.post":
            #print "\n--- deposit ---  formData='%s'" % str(formData)
            inputStream = formData.getInputStream()
            headers = {}
            for x in formData.getHeaders().entrySet():
                headers[x.getKey()] = x.getValue()
            deposit = sword.getDeposit()
            noOp = headers.get("X-No-Op") or "false"
            deposit.noOp = (noOp.lower()=="true") or \
                (formData.get("test") is not None)
            contentDisposition = headers.get("Content-Disposition", "")
            filename = ""
            if contentDisposition!="":
                try:
                    filename = contentDisposition.split("filename=")[1]
                    deposit.filename = filename
                except: pass
            slug = headers.get("Slug")
            if slug is not None and slug!="":
                deposit.slug = slug
            #elif filename!="":
            #    deposit.slug = filename

            deposit.username = "SwordUser"
            deposit.password = deposit.username
            try:
                file = File.createTempFile("tmptf", ".zip")
                file.deleteOnExit()
                fos = FileOutputStream(file.getAbsolutePath())
                IOUtils.copy(inputStream, fos)
                fos.close()
                print "copied posted data to '%s'" % file.getAbsolutePath()
            except Exception, e:
                print "--- Exception - '%s'" % str(e)
            deposit.contentDisposition = file.getAbsolutePath()         #????
            deposit.file = inputStream
            depositResponse = sword.doDeposit(deposit)
            id = str(depositResponse.getEntry().id)
            try:
                print
                #imsPlugin = PluginManager.getTransformer("ims")
                jsonConfig = JsonConfig()
                #imsPlugin.init(jsonConfig.getSystemFile())
                #harvestClient = HarvestClient(jsonConfig.getSystemFile());
                storagePlugin = PluginManager.getStorage(jsonConfig.get("storage/type"))
                #storagePlugin.init(jsonConfig.getSystemFile())

                setConfigUri = self.__getPortal().getClass().getResource("/swordRule.json").toURI()
                configFile = File(setConfigUri)
                harvestConfig = JsonConfigHelper(configFile);
                tFile = File.createTempFile("harvest", ".json")
                tFile.deleteOnExit()
                harvestConfig.set("configDir", configFile.getParent())
                harvestConfig.set("sourceFile", file.getAbsolutePath())
                harvestConfig.store(FileWriter(tFile))

                zipObject = GenericDigitalObject(id)
                zipObject.addPayload(FilePayload(file, id))
                #digitalObject = imsPlugin.transform(zipObject, file)
                qStorage = QueueStorage(storagePlugin, tFile)
                qStorage.init(jsonConfig.getSystemFile())
                qStorage.addObject(zipObject)
                if deposit.noOp:
                    print "-- Testing noOp='true' --"
                else:
                    # deposit the content
                    pass
            except Exception, e:
                print "---"
#.........这里部分代码省略.........
开发者ID:kiranba,项目名称:the-fascinator,代码行数:101,代码来源:sword.py

示例7: getAccessControlPlugins

 def getAccessControlPlugins(self):
     return PluginManager.getAccessControlPlugins()
开发者ID:kiranba,项目名称:the-fascinator,代码行数:2,代码来源:about.py

示例8: getRolesPlugins

 def getRolesPlugins(self):
     return PluginManager.getRolesPlugins()
开发者ID:kiranba,项目名称:the-fascinator,代码行数:2,代码来源:about.py

示例9: getSubscriberPlugins

 def getSubscriberPlugins(self):
     return PluginManager.getSubscriberPlugins()
开发者ID:kiranba,项目名称:the-fascinator,代码行数:2,代码来源:about.py

示例10: getAuthenticationPlugins

 def getAuthenticationPlugins(self):
     return PluginManager.getAuthenticationPlugins()
开发者ID:kiranba,项目名称:the-fascinator,代码行数:2,代码来源:about.py


注:本文中的au.edu.usq.fascinator.api.PluginManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。