Package org.apache.uima.collection.metadata

Examples of org.apache.uima.collection.metadata.CasProcessorConfigurationParameterSettings


    checkForOutOfSyncFiles();

    // Collection Reader
    if (readerFileSelector.getSelected().length() > 0) {
      if (collectionReaderPanel.isModified()) {
        CasProcessorConfigurationParameterSettings crSettings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        currentCpeDesc.getAllCollectionCollectionReaders()[0]
                .setConfigurationParameterSettings(crSettings);
        createParameterOverrides(crSettings, collectionReaderPanel);
      } else {
        currentCpeDesc.getAllCollectionCollectionReaders()[0]
                .setConfigurationParameterSettings(null);
      }
    }

    // CAS Initializer
    if (casInitializerFileSelector.getSelected().length() > 0) {
      if (casInitializerPanel.isModified()) {
        CasProcessorConfigurationParameterSettings casIniSettings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        currentCpeDesc.getAllCollectionCollectionReaders()[0].getCasInitializer()
                .setConfigurationParameterSettings(casIniSettings);
        createParameterOverrides(casIniSettings, casInitializerPanel);
      } else {
        currentCpeDesc.getAllCollectionCollectionReaders()[0].getCasInitializer()
                .setConfigurationParameterSettings(null);
      }
    }
    // Analysis Engines
    for (int i = 0; i < aeSpecifiers.size(); i++) {
      CpeCasProcessor casProc = currentCpeDesc.getCpeCasProcessors().getCpeCasProcessor(i);
      AnalysisEnginePanel aePanel = (AnalysisEnginePanel) aeTabbedPane.getComponentAt(i);
      if (aePanel.isModified()) {
        CasProcessorConfigurationParameterSettings settings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        casProc.setConfigurationParameterSettings(settings);
        createParameterOverrides(settings, aePanel);
      } else {
        casProc.setConfigurationParameterSettings(null);
      }
    }
    // CAS Consumers
    for (int i = 0; i < consumerSpecifiers.size(); i++) {
      CpeCasProcessor casProc = currentCpeDesc.getCpeCasProcessors().getCpeCasProcessor(
              aeSpecifiers.size() + i);
      ConsumerPanel consumerPanel = (ConsumerPanel) consumerTabbedPane.getComponentAt(i);
      if (consumerPanel.isModified()) {
        CasProcessorConfigurationParameterSettings settings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        casProc.setConfigurationParameterSettings(settings);
        createParameterOverrides(settings, consumerPanel);
      } else {
        casProc.setConfigurationParameterSettings(null);
View Full Code Here


      CpeDescription cpeDesc = CpeDescriptorFactory.produceDescriptor();

      // add collection reader that will read input docs
      cpeDesc.addCollectionReader(FileSystemCollectionReader.getDescriptorURL().toString());
      // specify configuration parameters for collection reader
      CasProcessorConfigurationParameterSettings crSettings = CpeDescriptorFactory
              .produceCasProcessorConfigurationParameterSettings();
      CpeCollectionReader cpeCollRdr = cpeDesc.getAllCollectionCollectionReaders()[0];
      cpeCollRdr.setConfigurationParameterSettings(crSettings);
      crSettings.setParameterValue(FileSystemCollectionReader.PARAM_INPUTDIR, inputDir
              .getAbsolutePath());
      crSettings.setParameterValue(FileSystemCollectionReader.PARAM_ENCODING, encoding);
      crSettings.setParameterValue(FileSystemCollectionReader.PARAM_LANGUAGE, language);
      if (xcasInput) {
        crSettings.setParameterValue(FileSystemCollectionReader.PARAM_XCAS, "XCAS");
      } else if (xmiInput) {
        crSettings.setParameterValue(FileSystemCollectionReader.PARAM_XCAS, "XMI");
      }
      if (xLenient) {
        crSettings.setParameterValue(FileSystemCollectionReader.PARAM_LENIENT, "true");
      }

      // if XML tag was specified, configure XmlDetagger annotator and add to CPE
      CpeCasProcessor xmlDetaggerCasProc = null;
      if (xmlTagName != null && xmlTagName.length() > 0) {
        xmlDetaggerCasProc = CpeDescriptorFactory.produceCasProcessor("XmlDetagger");
        CpeComponentDescriptor cpeComponentDescriptor =
          CpeDescriptorFactory.produceComponentDescriptor(XmlDetagger.getDescriptorURL().toString());
        xmlDetaggerCasProc.setCpeComponentDescriptor(cpeComponentDescriptor);
        CasProcessorConfigurationParameterSettings detaggerSettings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        xmlDetaggerCasProc.setConfigurationParameterSettings(detaggerSettings);
        detaggerSettings.setParameterValue(XmlDetagger.PARAM_TEXT_TAG, xmlTagName);
        xmlDetaggerCasProc.setMaxErrorCount(0);
        cpeDesc.addCasProcessor(xmlDetaggerCasProc);
      }

      // add user's AE to CPE
      CpeCasProcessor casProc = CpeDescriptorFactory.produceCasProcessor("UserAE");
      CpeComponentDescriptor cpeComponentDescriptor =
        CpeDescriptorFactory.produceComponentDescriptor(aeSpecifierFile.getAbsolutePath());
      casProc.setCpeComponentDescriptor(cpeComponentDescriptor);
      casProc.setMaxErrorCount(0);
      cpeDesc.addCasProcessor(casProc);

      // add CAS Consumer that will write the output
      // create and configure CAS consumer that will write the output
      CpeCasProcessor casCon = null;
      if (outputDir != null) {
        casCon = CpeDescriptorFactory.produceCasProcessor("CasConsumer");
        cpeComponentDescriptor =
          CpeDescriptorFactory.produceComponentDescriptor(InlineXmlCasConsumer.getDescriptorURL().toString());
        casCon.setCpeComponentDescriptor(cpeComponentDescriptor);
        CasProcessorConfigurationParameterSettings consumerSettings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        casCon.setConfigurationParameterSettings(consumerSettings);
        consumerSettings.setParameterValue(InlineXmlCasConsumer.PARAM_OUTPUTDIR, outputDir
                .getAbsolutePath());
        if (xcasInput) {
          consumerSettings.setParameterValue(InlineXmlCasConsumer.PARAM_XCAS, "XCAS");
        } else if (xmiInput) {
          consumerSettings.setParameterValue(InlineXmlCasConsumer.PARAM_XCAS, "XMI");
        }
        casCon.setMaxErrorCount(0);
        cpeDesc.addCasProcessor(casCon);
      }
View Full Code Here

    checkForOutOfSyncFiles();

    // Collection Reader
    if (readerFileSelector.getSelected().length() > 0) {
      if (collectionReaderPanel.isModified()) {
        CasProcessorConfigurationParameterSettings crSettings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        currentCpeDesc.getAllCollectionCollectionReaders()[0]
                .setConfigurationParameterSettings(crSettings);
        createParameterOverrides(crSettings, collectionReaderPanel);
      } else {
        currentCpeDesc.getAllCollectionCollectionReaders()[0]
                .setConfigurationParameterSettings(null);
      }
    }

    // CAS Initializer
    if (casInitializerFileSelector.getSelected().length() > 0) {
      if (casInitializerPanel.isModified()) {
        CasProcessorConfigurationParameterSettings casIniSettings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        currentCpeDesc.getAllCollectionCollectionReaders()[0].getCasInitializer()
                .setConfigurationParameterSettings(casIniSettings);
        createParameterOverrides(casIniSettings, casInitializerPanel);
      } else {
        currentCpeDesc.getAllCollectionCollectionReaders()[0].getCasInitializer()
                .setConfigurationParameterSettings(null);
      }
    }
    // Analysis Engines
    for (int i = 0; i < aeSpecifiers.size(); i++) {
      CpeCasProcessor casProc = currentCpeDesc.getCpeCasProcessors().getCpeCasProcessor(i);
      AnalysisEnginePanel aePanel = (AnalysisEnginePanel) aeTabbedPane.getComponentAt(i);
      if (aePanel.isModified()) {
        CasProcessorConfigurationParameterSettings settings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        casProc.setConfigurationParameterSettings(settings);
        createParameterOverrides(settings, aePanel);
      } else {
        casProc.setConfigurationParameterSettings(null);
      }
    }
    // CAS Consumers
    for (int i = 0; i < consumerSpecifiers.size(); i++) {
      CpeCasProcessor casProc = currentCpeDesc.getCpeCasProcessors().getCpeCasProcessor(
              aeSpecifiers.size() + i);
      ConsumerPanel consumerPanel = (ConsumerPanel) consumerTabbedPane.getComponentAt(i);
      if (consumerPanel.isModified()) {
        CasProcessorConfigurationParameterSettings settings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        casProc.setConfigurationParameterSettings(settings);
        createParameterOverrides(settings, consumerPanel);
      } else {
        casProc.setConfigurationParameterSettings(null);
View Full Code Here

    checkForOutOfSyncFiles();

    // Collection Reader
    if (readerFileSelector.getSelected().length() > 0) {
      if (collectionReaderPanel.isModified()) {
        CasProcessorConfigurationParameterSettings crSettings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        currentCpeDesc.getAllCollectionCollectionReaders()[0]
                .setConfigurationParameterSettings(crSettings);
        createParameterOverrides(crSettings, collectionReaderPanel);
      } else {
        currentCpeDesc.getAllCollectionCollectionReaders()[0]
                .setConfigurationParameterSettings(null);
      }
    }

    // CAS Initializer
    if (casInitializerFileSelector.getSelected().length() > 0) {
      if (casInitializerPanel.isModified()) {
        CasProcessorConfigurationParameterSettings casIniSettings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        currentCpeDesc.getAllCollectionCollectionReaders()[0].getCasInitializer()
                .setConfigurationParameterSettings(casIniSettings);
        createParameterOverrides(casIniSettings, casInitializerPanel);
      } else {
        currentCpeDesc.getAllCollectionCollectionReaders()[0].getCasInitializer()
                .setConfigurationParameterSettings(null);
      }
    }
    // Analysis Engines
    for (int i = 0; i < aeSpecifiers.size(); i++) {
      CpeCasProcessor casProc = currentCpeDesc.getCpeCasProcessors().getCpeCasProcessor(i);
      AnalysisEnginePanel aePanel = (AnalysisEnginePanel) aeTabbedPane.getComponentAt(i);
      if (aePanel.isModified()) {
        CasProcessorConfigurationParameterSettings settings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        casProc.setConfigurationParameterSettings(settings);
        createParameterOverrides(settings, aePanel);
      } else {
        casProc.setConfigurationParameterSettings(null);
      }
    }
    // CAS Consumers
    for (int i = 0; i < consumerSpecifiers.size(); i++) {
      CpeCasProcessor casProc = currentCpeDesc.getCpeCasProcessors().getCpeCasProcessor(
              aeSpecifiers.size() + i);
      ConsumerPanel consumerPanel = (ConsumerPanel) consumerTabbedPane.getComponentAt(i);
      if (consumerPanel.isModified()) {
        CasProcessorConfigurationParameterSettings settings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        casProc.setConfigurationParameterSettings(settings);
        createParameterOverrides(settings, consumerPanel);
      } else {
        casProc.setConfigurationParameterSettings(null);
View Full Code Here

    checkForOutOfSyncFiles();

    // Collection Reader
    if (readerFileSelector.getSelected().length() > 0) {
      if (collectionReaderPanel.isModified()) {
        CasProcessorConfigurationParameterSettings crSettings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        currentCpeDesc.getAllCollectionCollectionReaders()[0]
                .setConfigurationParameterSettings(crSettings);
        createParameterOverrides(crSettings, collectionReaderPanel);
      } else {
        currentCpeDesc.getAllCollectionCollectionReaders()[0]
                .setConfigurationParameterSettings(null);
      }
    }

    // CAS Initializer
    if (casInitializerFileSelector.getSelected().length() > 0) {
      if (casInitializerPanel.isModified()) {
        CasProcessorConfigurationParameterSettings casIniSettings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        currentCpeDesc.getAllCollectionCollectionReaders()[0].getCasInitializer()
                .setConfigurationParameterSettings(casIniSettings);
        createParameterOverrides(casIniSettings, casInitializerPanel);
      } else {
        currentCpeDesc.getAllCollectionCollectionReaders()[0].getCasInitializer()
                .setConfigurationParameterSettings(null);
      }
    }
    // Analysis Engines
    for (int i = 0; i < aeSpecifiers.size(); i++) {
      CpeCasProcessor casProc = currentCpeDesc.getCpeCasProcessors().getCpeCasProcessor(i);
      AnalysisEnginePanel aePanel = (AnalysisEnginePanel) aeTabbedPane.getComponentAt(i);
      if (aePanel.isModified()) {
        CasProcessorConfigurationParameterSettings settings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        casProc.setConfigurationParameterSettings(settings);
        createParameterOverrides(settings, aePanel);
      } else {
        casProc.setConfigurationParameterSettings(null);
      }
    }
    // CAS Consumers
    for (int i = 0; i < consumerSpecifiers.size(); i++) {
      CpeCasProcessor casProc = currentCpeDesc.getCpeCasProcessors().getCpeCasProcessor(
              aeSpecifiers.size() + i);
      ConsumerPanel consumerPanel = (ConsumerPanel) consumerTabbedPane.getComponentAt(i);
      if (consumerPanel.isModified()) {
        CasProcessorConfigurationParameterSettings settings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        casProc.setConfigurationParameterSettings(settings);
        createParameterOverrides(settings, consumerPanel);
      } else {
        casProc.setConfigurationParameterSettings(null);
View Full Code Here

    checkForOutOfSyncFiles();

    // Collection Reader
    if (readerFileSelector.getSelected().length() > 0) {
      if (collectionReaderPanel.isModified()) {
        CasProcessorConfigurationParameterSettings crSettings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        currentCpeDesc.getAllCollectionCollectionReaders()[0]
                .setConfigurationParameterSettings(crSettings);
        createParameterOverrides(crSettings, collectionReaderPanel);
      } else {
        currentCpeDesc.getAllCollectionCollectionReaders()[0]
                .setConfigurationParameterSettings(null);
      }
    }

    // CAS Initializer
    if (casInitializerFileSelector.getSelected().length() > 0) {
      if (casInitializerPanel.isModified()) {
        CasProcessorConfigurationParameterSettings casIniSettings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        currentCpeDesc.getAllCollectionCollectionReaders()[0].getCasInitializer()
                .setConfigurationParameterSettings(casIniSettings);
        createParameterOverrides(casIniSettings, casInitializerPanel);
      } else {
        currentCpeDesc.getAllCollectionCollectionReaders()[0].getCasInitializer()
                .setConfigurationParameterSettings(null);
      }
    }
    // Analysis Engines
    for (int i = 0; i < aeSpecifiers.size(); i++) {
      CpeCasProcessor casProc = currentCpeDesc.getCpeCasProcessors().getCpeCasProcessor(i);
      AnalysisEnginePanel aePanel = (AnalysisEnginePanel) aeTabbedPane.getComponentAt(i);
      if (aePanel.isModified()) {
        CasProcessorConfigurationParameterSettings settings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        casProc.setConfigurationParameterSettings(settings);
        createParameterOverrides(settings, aePanel);
      } else {
        casProc.setConfigurationParameterSettings(null);
      }
    }
    // CAS Consumers
    for (int i = 0; i < consumerSpecifiers.size(); i++) {
      CpeCasProcessor casProc = currentCpeDesc.getCpeCasProcessors().getCpeCasProcessor(
              aeSpecifiers.size() + i);
      ConsumerPanel consumerPanel = (ConsumerPanel) consumerTabbedPane.getComponentAt(i);
      if (consumerPanel.isModified()) {
        CasProcessorConfigurationParameterSettings settings = CpeDescriptorFactory
                .produceCasProcessorConfigurationParameterSettings();
        casProc.setConfigurationParameterSettings(settings);
        createParameterOverrides(settings, consumerPanel);
      } else {
        casProc.setConfigurationParameterSettings(null);
View Full Code Here

        return cpeModel;
    } // createInstance
   
    static public void printCpeCasProcessor (CpeCasProcessor cpeCasProc)
    {
        CasProcessorConfigurationParameterSettings settings = cpeCasProc.getConfigurationParameterSettings();
        if (settings != null) {
            printNameValuePairs (settings.getParameterSettings());
        }
    }
View Full Code Here

            // Add Configuration Parameter Overrides for CPE
            UimaCollectionReader ucr = (UimaCollectionReader)list.get(0);
            if (ucr.getConfigParamsModel() != null) {
                List cpeOverrideList = ucr.getConfigParamsModel().getCpeParamModelList();
                if (cpeOverrideList != null && cpeOverrideList.size() > 0) {
                    CasProcessorConfigurationParameterSettings settings =
                        CpeDescriptorFactory.produceCasProcessorConfigurationParameterSettings();
                    cr.setConfigurationParameterSettings(settings);
                    for (int k=0; k<cpeOverrideList.size(); ++k) {
                        ConfigParameterModel m = (ConfigParameterModel) cpeOverrideList.get(k);
                        if (m.getCpeValue() != null) {
                            settings.setParameterValue (m.getName(), m.getCpeValue());
                        }
                    }
                }
            }
        }

        // Add CAS Initializer
        list = getUimaCasInitializers();
        if (list != null && list.size() > 0) {
            String aCasInitializerPath = "";
            CpeCollectionReaderCasInitializer ci = null;
            aCasInitializerPath = ((UimaCasInitializer)list.get(0)).getXmlDescriptor();
            if (resolve) {
                ci = cpeDesc.addCasInitializer(resolveUimaXmlDescriptor(aCasInitializerPath));
            } else {
                ci = cpeDesc.addCasInitializer(aCasInitializerPath);
            }
            // Trace.err("Add Cas Init: " + aCasInitializerPath);
            // Add Configuration Parameter Overrides for CPE
            UimaCasInitializer uci = (UimaCasInitializer)list.get(0);
            if (uci.getConfigParamsModel() != null) {
                List cpeOverrideList = uci.getConfigParamsModel().getCpeParamModelList();
                if (cpeOverrideList != null && cpeOverrideList.size() > 0) {
                    CasProcessorConfigurationParameterSettings settings =
                        CpeDescriptorFactory.produceCasProcessorConfigurationParameterSettings();
                    ci.setConfigurationParameterSettings(settings);
                    for (int k=0; k<cpeOverrideList.size(); ++k) {
                        ConfigParameterModel m = (ConfigParameterModel) cpeOverrideList.get(k);
                        if (m.getCpeValue() != null) {
                            settings.setParameterValue (m.getName(), m.getCpeValue());
                        }
                    }
                }
            }
        }

        // Add Cas Processors (AE, Cas Consumer)
        list = getUimaCasProcessors();
        for (int i=0; i<list.size(); ++i) {
            UimaCasProcessor u = (UimaCasProcessor) list.get(i);
            CpeCasProcessor casProc;
//            if (u.getCasProcessorCategory() == UimaCasProcessor.CASPROCESSOR_CAT_SERVICE) {
//                casProc = CpeDescriptorFactory.produceRemoteCasProcessor(u.getInstanceName());
//            } else {
//                casProc = CpeDescriptorFactory.produceCasProcessor(u.getInstanceName());
//            }
            casProc = CpeDescriptorFactory.produceCasProcessor(u.getInstanceName());

            if (resolve) {
                casProc.setDescriptor(resolveUimaXmlDescriptor(u.getXmlDescriptor()));
            } else {
                casProc.setDescriptor(u.getXmlDescriptor());
            }

            // Add Error Handlings
            if (u.getCasProcessorErrorHandling() != null) {
                setCasProcessorErrorHandling(casProc, u.getCasProcessorErrorHandling());
            } else {
                // Set values from default, if any
//              setCasProcessorErrorHandling(casProc, getDefaultCasProcessorSettings().getErrorHandling());                   
            }

            // Set <checkpoint batch="10000"/>
            if (u.getBatchSize() != -1) {
                casProc.setBatchSize(u.getBatchSize());
            } else {
                // Check if default value is defined
                if (getDefaultCasProcessorSettings().getCasProcBatchSize() != -1) {
                    casProc.setBatchSize(getDefaultCasProcessorSettings().getCasProcBatchSize());
                }
            }

            // Add Configuration Parameter Overrides for CPE
            List cpeOverrideList = u.getConfigParamsModel().getCpeParamModelList();
            if (cpeOverrideList != null && cpeOverrideList.size() > 0) {
                CasProcessorConfigurationParameterSettings settings =
                    CpeDescriptorFactory.produceCasProcessorConfigurationParameterSettings();
                casProc.setConfigurationParameterSettings(settings);
                for (int k=0; k<cpeOverrideList.size(); ++k) {
                    ConfigParameterModel m = (ConfigParameterModel) cpeOverrideList.get(k);
                    if (m.getCpeValue() != null) {
                        settings.setParameterValue (m.getName(), m.getCpeValue());
                    }
                }
            }

//          // Add Error Handlings
View Full Code Here

            if (cpeOverrideList != null && cpeOverrideList.size() > 0) {
                // <configurationParameterSettings>
                aContentHandler.startElement(getXmlizationInfo().namespace,
                        "","configurationParameterSettings",attrs);       
               
                CasProcessorConfigurationParameterSettings settings =
                    CpeDescriptorFactory.produceCasProcessorConfigurationParameterSettings();
                // casProc.setConfigurationParameterSettings(settings);
                for (int k=0; k<cpeOverrideList.size(); ++k) {
                    ConfigParameterModel m = (ConfigParameterModel) cpeOverrideList.get(k);
                    if (m.getCpeValue() != null) {
                        settings.setParameterValue (m.getName(), m.getCpeValue());
                        m.toXML(aContentHandler, aWriteDefaultNamespaceAttribute);
                    }
                }
               
                // </configurationParameterSettings>
View Full Code Here

                if (cpeOverrideList != null && cpeOverrideList.size() > 0) {
                    // <configurationParameterSettings>
                    aContentHandler.startElement(getXmlizationInfo().namespace,
                            "", "configurationParameterSettings", attrs);       
                   
                    CasProcessorConfigurationParameterSettings settings =
                        CpeDescriptorFactory.produceCasProcessorConfigurationParameterSettings();
                    // casProc.setConfigurationParameterSettings(settings);
                    for (int k=0; k<cpeOverrideList.size(); ++k) {
                        ConfigParameterModel m = (ConfigParameterModel) cpeOverrideList.get(k);
                        if (m.getCpeValue() != null) {
                            settings.setParameterValue (m.getName(), m.getCpeValue());
                            m.toXML(aContentHandler, aWriteDefaultNamespaceAttribute);
                        }
                    }
                   
                    // </configurationParameterSettings>
View Full Code Here

TOP

Related Classes of org.apache.uima.collection.metadata.CasProcessorConfigurationParameterSettings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.