def setPluginInput(self, _edPlugin):
     EDApplicationMXv1Characterisation.setPluginInput(self, _edPlugin)
     if (not self.__strGeneratedTemplateFileMXv2 is None):
         _edPlugin.setDataInput(XSDataString(self.__strGeneratedTemplateFileMXv2), "generatedTemplateFileMXv2")
     if self.__bTemplateModeMXv2:
         # Delete the existing entry if any
         if _edPlugin.hasDataInput("templateMode"):
             _edPlugin.setDataInput(None, "templateMode")
         _edPlugin.setDataInput(XSDataBoolean(self.__bTemplateModeMXv2), "templateMode")
     if self.__strDataCollectionMXv2File:
         xsDataCollectionMXv2 = XSDataCollection_v2.parseFile(self.__strDataCollectionMXv2File)
         _edPlugin.setDataInput(xsDataCollectionMXv2, "mxv2DataCollection")
 def processCommandLineItems(self, _strCommandLineItem, _bFoundImageToken):
     bFoundImageToken = EDApplicationMXv1Characterisation.processCommandLineItems(
         self, _strCommandLineItem, _bFoundImageToken)
     if _strCommandLineItem == EDApplicationMXv2Characterisation.TEMPLATE_MXV2_PARAM_LABEL:
         self.__strGeneratedTemplateFileMXv2 = self.getCommandLineArgument(
             EDApplicationMXv2Characterisation.TEMPLATE_MXV2_PARAM_LABEL)
         if (self.__strGeneratedTemplateFileMXv2 == None):
             strErrorMessage = EDMessage.ERROR_MANDATORY_PARAM_MISSING_02 % ("EDApplicationMXv2Characterisation.processCommandLineItems", "No argument for command line %s key word found!" % \
                                                                           EDApplicationMXv2Characterisation.TEMPLATE_MXV2_PARAM_LABEL)
             EDVerbose.error(strErrorMessage)
         else:
             if (not os.path.isabs(self.__strGeneratedTemplateFileMXv2)):
                 self.__strGeneratedTemplateFileMXv2 = os.path.abspath(
                     os.path.join(self.getCurrentWorkingDirectory(),
                                  self.__strGeneratedTemplateFileMXv2))
             self.__bTemplateModeMXv2 = True
     if _strCommandLineItem == EDApplicationMXv2Characterisation.MXV2_DATACOLLECTION_FILE_LABEL:
         self.__strDataCollectionMXv2File = self.getCommandLineArgument(
             EDApplicationMXv2Characterisation.
             MXV2_DATACOLLECTION_FILE_LABEL)
         if (self.__strDataCollectionMXv2File == None):
             strErrorMessage = EDMessage.ERROR_MANDATORY_PARAM_MISSING_02 % ("EDApplicationMXv2Characterisation.processCommandLineItems", "No argument for command line %s key word found!" % \
                                                                           EDApplicationMXv2Characterisation.MXV2_DATACOLLECTION_FILE_LABEL)
             EDVerbose.error(strErrorMessage)
         else:
             if (not os.path.isabs(self.__strDataCollectionMXv2File)):
                 self.__strDataCollectionMXv2File = os.path.abspath(
                     os.path.join(self.getCurrentWorkingDirectory(),
                                  self.__strDataCollectionMXv2File))
     return bFoundImageToken
 def setPluginInput(self, _edPlugin):
     EDApplicationMXv1Characterisation.setPluginInput(self, _edPlugin)
     if (not self.__strGeneratedTemplateFileMXv2 is None):
         _edPlugin.setDataInput(
             XSDataString(self.__strGeneratedTemplateFileMXv2),
             "generatedTemplateFileMXv2")
     if self.__bTemplateModeMXv2:
         # Delete the existing entry if any
         if _edPlugin.hasDataInput("templateMode"):
             _edPlugin.setDataInput(None, "templateMode")
         _edPlugin.setDataInput(XSDataBoolean(self.__bTemplateModeMXv2),
                                "templateMode")
     if self.__strDataCollectionMXv2File:
         xsDataCollectionMXv2 = XSDataCollection_v2.parseFile(
             self.__strDataCollectionMXv2File)
         _edPlugin.setDataInput(xsDataCollectionMXv2, "mxv2DataCollection")
 def processCommandLineItems(self, _strCommandLineItem, _bFoundImageToken):
     bFoundImageToken = EDApplicationMXv1Characterisation.processCommandLineItems(self, _strCommandLineItem, _bFoundImageToken)
     if _strCommandLineItem == EDApplicationMXv2Characterisation.TEMPLATE_MXV2_PARAM_LABEL:
         self.__strGeneratedTemplateFileMXv2 = self.getCommandLineArgument(EDApplicationMXv2Characterisation.TEMPLATE_MXV2_PARAM_LABEL)
         if (self.__strGeneratedTemplateFileMXv2 == None):
             strErrorMessage = EDMessage.ERROR_MANDATORY_PARAM_MISSING_02 % ("EDApplicationMXv2Characterisation.processCommandLineItems", "No argument for command line %s key word found!" % \
                                                                           EDApplicationMXv2Characterisation.TEMPLATE_MXV2_PARAM_LABEL)
             EDVerbose.error(strErrorMessage)
         else:
             if (not os.path.isabs(self.__strGeneratedTemplateFileMXv2)):
                 self.__strGeneratedTemplateFileMXv2 = os.path.abspath(os.path.join(self.getCurrentWorkingDirectory(), self.__strGeneratedTemplateFileMXv2))
             self.__bTemplateModeMXv2 = True
     if _strCommandLineItem == EDApplicationMXv2Characterisation.MXV2_DATACOLLECTION_FILE_LABEL:
         self.__strDataCollectionMXv2File = self.getCommandLineArgument(EDApplicationMXv2Characterisation.MXV2_DATACOLLECTION_FILE_LABEL)
         if (self.__strDataCollectionMXv2File == None):
             strErrorMessage = EDMessage.ERROR_MANDATORY_PARAM_MISSING_02 % ("EDApplicationMXv2Characterisation.processCommandLineItems", "No argument for command line %s key word found!" % \
                                                                           EDApplicationMXv2Characterisation.MXV2_DATACOLLECTION_FILE_LABEL)
             EDVerbose.error(strErrorMessage)
         else:
             if (not os.path.isabs(self.__strDataCollectionMXv2File)):
                 self.__strDataCollectionMXv2File = os.path.abspath(os.path.join(self.getCurrentWorkingDirectory(), self.__strDataCollectionMXv2File))
     return bFoundImageToken
Exemplo n.º 5
0
import sys, os.path
pyStrProgramPath = sys.argv[0]
pyStrBinPath = os.path.split(pyStrProgramPath)[0]
pyStrMXv1Path = os.path.split(pyStrBinPath)[0]
pyStrEdnaHomePath = os.path.split(pyStrMXv1Path)[0]
os.environ["EDNA_HOME"] = pyStrEdnaHomePath
if (not "EDNA_SITE" in os.environ.keys()):
    print "Cannot start the EDNA MXv1 characterisation application:"
    print "Make sure that $EDNA_SITE is set up before running edna-mxv1-characterisation."
    print "Example:"
    print "$ export EDNA_SITE=<SUFFIX> (should be the configuration file suffix XSConfiguration_<SUFFIX>.xml)"
    print "Please read the INSTALL.txt file under the \"$EDNA_HOME/mxv1\" directory for more details"
    print ""
    sys.exit(1)
strConfigurationFilePath = os.path.join(
    pyStrEdnaHomePath, "mxv1", "conf",
    "XSConfiguration_" + os.environ["EDNA_SITE"] + ".xml")
#
# Then add kernel/src and mxv1/src to PYTHONPATH
#
sys.path.append(os.path.join(pyStrEdnaHomePath, "kernel", "src"))
sys.path.append(os.path.join(pyStrEdnaHomePath, "mxv1", "src"))

#
# Now the edApplicationMXv1Characterisation can be imported and started
#
from EDApplicationMXv1Characterisation import EDApplicationMXv1Characterisation
edApplicationMXv1Characterisation = EDApplicationMXv1Characterisation(_strPluginName="EDPluginControlInterfacev1_2", \
                               _strConfigurationFileName=strConfigurationFilePath)
edApplicationMXv1Characterisation.execute()
 def __init__(self, _strPluginName=None, _strConfigurationFileName=None):
     EDApplicationMXv1Characterisation.__init__(self, _strPluginName, _strConfigurationFileName)
     self.__strGeneratedTemplateFileMXv2 = None
     self.__strDataCollectionMXv2File = None
     self.__bTemplateModeMXv2 = None
 def __init__(self, _strPluginName=None, _strConfigurationFileName=None):
     EDApplicationMXv1Characterisation.__init__(self, _strPluginName,
                                                _strConfigurationFileName)
     self.__strGeneratedTemplateFileMXv2 = None
     self.__strDataCollectionMXv2File = None
     self.__bTemplateModeMXv2 = None
Exemplo n.º 8
0
def runMXv1Pipeline():
    strLogFileName = os.path.join(returnWorkingDirectory(), "wsgi-server.log")
    EDVerbose.setLogFileName(strLogFileName)
    strInput = str(request['wsgi.input'].read(int(request['CONTENT_LENGTH'])))
    if strInput:
        # Take the parameters string, split off the title and run the bash script to generate the input char. XML
        listParams = shlex.split(strInput)
        strComments = listParams[0]  # the 1st item
        strShortComments = listParams[1]  # the 2nd item
        strWorkingDir = listParams[2]  # the 3rd item
        strHTMLResultDir = listParams[3]  # the 4th item

        os.chdir(strWorkingDir)

        strParamString = " ".join(
            listParams[4:])  # all but the first four items
        edPluginMxv1ParamsToXML = EDFactoryPluginStatic.loadPlugin(
            'EDPluginMxv1ParamsToXMLv1_0')
        edPluginMxv1ParamsToXML.setDataInput(XSDataString(strParamString),
                                             "paramString")
        edPluginMxv1ParamsToXML.executeSynchronous()
        xsDataFile = edPluginMxv1ParamsToXML.getDataOutput()

        # Read the XML and parse it into an object hierarchy
        strXMLFile = xsDataFile.getPath().getValue()
        f = open(strXMLFile, 'r')
        xml = f.read()
        f.close()
        xsDataInputCharacterisation = XSDataInputCharacterisation.parseString(
            xml)

        # Run the MXv1 application pipeline
        edApplicationMXv1Characterisation = EDApplicationMXv1Characterisation(_strPluginName="EDPluginControlInterfacev1_2", \
                               _strConfigurationFileName=strConfigurationFilePath, \
                               _xsDataInputCharacterisation=xsDataInputCharacterisation, \
                               _strComments=strComments, \
                               _strShortComments=strShortComments)
        edApplicationMXv1Characterisation.execute()

        # Run the EDNA2HTML generator on the output from the MXv1 application
        edPluginExecOutputHTML = EDFactoryPluginStatic.loadPlugin(
            'EDPluginExecOutputHTMLv1_0')
        edPluginExecOutputHTML.setDataInput(XSDataString(strComments), "title")
        strWorkingDir = os.path.join(
            strWorkingDir, edApplicationMXv1Characterisation.getWorkingDir())
        edPluginExecOutputHTML.setDataInput(XSDataString(strWorkingDir),
                                            "workingDir")
        #strBaseDir = os.path.join(strHTMLResultDir, "edna")
        #edPluginExecOutputHTML.setDataInput(XSDataString(strBaseDir), "basename")
        edPluginExecOutputHTML.setDataInput(XSDataString(strHTMLResultDir),
                                            "basename")

        edPluginExecOutputHTML.executeSynchronous()

        strPathToHTMLFile = ""
        if (edPluginExecOutputHTML.hasDataOutput("htmlFile")):
            strPathToHTMLFile = edPluginExecOutputHTML.getDataOutput(
                "htmlFile")[0].getPath().getValue()
        else:
            EDVerbose.ERROR(
                "edna-mxv1-wsgi-server: edPluginExecOutputHTML has no dataOutput htmlFile!"
            )

        if strPathToHTMLFile == "":
            EDVerbose.ERROR("edna-mxv1-wsgi-server: Returning empty string")
        return strPathToHTMLFile
    else:
        return strInput