Package org.apache.uima.cpe.model

Examples of org.apache.uima.cpe.model.ConfigParameterModel


        if (updateOverrides) {
            // Add Configuration Parameter Overrides for CPE
            List overrideList = getConfigParamsModel().getParamModelList();
            if (overrideList != null && overrideList.size() > 0) {
                for (int k=0; k<overrideList.size(); ++k) {
                    ConfigParameterModel m = (ConfigParameterModel) overrideList.get(k);
                    configParamSettings.setParameterValue (m.getName(), m.getValue());
                    if (m.getCpeValue() != null) {
                        configParamSettings.setParameterValue (m.getName(), m.getCpeValue());
//                      Trace.trace("Set value of " + m.getName() + " to " + m.getCpeValue());
//                      } else {
//                      Trace.trace("Value of " + m.getName() + " is " + m.getValue());                 
                    }
                }
View Full Code Here


                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

               
                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>
                aContentHandler.endElement(getXmlizationInfo().namespace,
View Full Code Here

        if (paramList != null && paramList.size() > 0) {
            List        cpeParamModelList = new ArrayList();
           
            // For each override, set its name with "Default" value
            for (int k=0; k<paramList.size(); ++k) {
                ConfigParameterModel m = (ConfigParameterModel) paramList.get(k);
               
                Object cpeValue = null;
                if (cpeSettings != null) {
                    cpeValue = cpeSettings.getParameterValue(m.getName());
                    if (cpeValue == null) {
                        // Use Default Value
                        cpeValue = model.getParamSettings().getParameterValue(m.getName());              
                    }                   
                    m.setCpeValue(cpeValue);
                }
                cpeParamModelList.add(m);
            }
            model.setCpeParamModelList(cpeParamModelList.size() > 0 ? cpeParamModelList:null);
        }
View Full Code Here

                   
                    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>
                    aContentHandler.endElement(getXmlizationInfo().namespace,
View Full Code Here

        mConfigParametersModel = aParam; // save
       
        // Set paramater value from CasProcessorConfigurationParameterSettings
        NameValuePair[] nvps = mConfigurationParameterSettings.getParameterSettings();
        for (int i=0; i<nvps.length; ++i) {
            ConfigParameterModel paramModel = aParam.getConfigParameterModel (nvps[i].getName());
            Trace.trace("Set cpeValue for:" + nvps[i].getName());
            paramModel.setCpeValue(nvps[i].getValue());
        }
       
    }
View Full Code Here

TOP

Related Classes of org.apache.uima.cpe.model.ConfigParameterModel

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.