Search in sources :

Example 71 with KettleXMLException

use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.

the class JobExecutorMeta method loadXML.

@Override
public void loadXML(Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore) throws KettleXMLException {
    try {
        String method = XMLHandler.getTagValue(stepnode, "specification_method");
        specificationMethod = ObjectLocationSpecificationMethod.getSpecificationMethodByCode(method);
        String jobId = XMLHandler.getTagValue(stepnode, "job_object_id");
        jobObjectId = Utils.isEmpty(jobId) ? null : new StringObjectId(jobId);
        jobName = XMLHandler.getTagValue(stepnode, "job_name");
        fileName = XMLHandler.getTagValue(stepnode, "filename");
        directoryPath = XMLHandler.getTagValue(stepnode, "directory_path");
        groupSize = XMLHandler.getTagValue(stepnode, "group_size");
        groupField = XMLHandler.getTagValue(stepnode, "group_field");
        groupTime = XMLHandler.getTagValue(stepnode, "group_time");
        // Load the mapping parameters too..
        // 
        Node mappingParametersNode = XMLHandler.getSubNode(stepnode, JobExecutorParameters.XML_TAG);
        parameters = new JobExecutorParameters(mappingParametersNode);
        // The output side...
        // 
        executionResultTargetStep = XMLHandler.getTagValue(stepnode, "execution_result_target_step");
        executionTimeField = XMLHandler.getTagValue(stepnode, "execution_time_field");
        executionResultField = XMLHandler.getTagValue(stepnode, "execution_result_field");
        executionNrErrorsField = XMLHandler.getTagValue(stepnode, "execution_errors_field");
        executionLinesReadField = XMLHandler.getTagValue(stepnode, "execution_lines_read_field");
        executionLinesWrittenField = XMLHandler.getTagValue(stepnode, "execution_lines_written_field");
        executionLinesInputField = XMLHandler.getTagValue(stepnode, "execution_lines_input_field");
        executionLinesOutputField = XMLHandler.getTagValue(stepnode, "execution_lines_output_field");
        executionLinesRejectedField = XMLHandler.getTagValue(stepnode, "execution_lines_rejected_field");
        executionLinesUpdatedField = XMLHandler.getTagValue(stepnode, "execution_lines_updated_field");
        executionLinesDeletedField = XMLHandler.getTagValue(stepnode, "execution_lines_deleted_field");
        executionFilesRetrievedField = XMLHandler.getTagValue(stepnode, "execution_files_retrieved_field");
        executionExitStatusField = XMLHandler.getTagValue(stepnode, "execution_exit_status_field");
        executionLogTextField = XMLHandler.getTagValue(stepnode, "execution_log_text_field");
        executionLogChannelIdField = XMLHandler.getTagValue(stepnode, "execution_log_channelid_field");
        resultRowsTargetStep = XMLHandler.getTagValue(stepnode, "result_rows_target_step");
        int nrFields = XMLHandler.countNodes(stepnode, "result_rows_field");
        resultRowsField = new String[nrFields];
        resultRowsType = new int[nrFields];
        resultRowsLength = new int[nrFields];
        resultRowsPrecision = new int[nrFields];
        for (int i = 0; i < nrFields; i++) {
            Node fieldNode = XMLHandler.getSubNodeByNr(stepnode, "result_rows_field", i);
            resultRowsField[i] = XMLHandler.getTagValue(fieldNode, "name");
            resultRowsType[i] = ValueMetaFactory.getIdForValueMeta(XMLHandler.getTagValue(fieldNode, "type"));
            resultRowsLength[i] = Const.toInt(XMLHandler.getTagValue(fieldNode, "length"), -1);
            resultRowsPrecision[i] = Const.toInt(XMLHandler.getTagValue(fieldNode, "precision"), -1);
        }
        resultFilesTargetStep = XMLHandler.getTagValue(stepnode, "result_files_target_step");
        resultFilesFileNameField = XMLHandler.getTagValue(stepnode, "result_files_file_name_field");
    } catch (Exception e) {
        throw new KettleXMLException(BaseMessages.getString(PKG, "JobExecutorMeta.Exception.ErrorLoadingJobExecutorDetailsFromXML"), e);
    }
}
Also used : Node(org.w3c.dom.Node) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) StringObjectId(org.pentaho.di.repository.StringObjectId) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleStepException(org.pentaho.di.core.exception.KettleStepException) KettleException(org.pentaho.di.core.exception.KettleException) KettlePluginException(org.pentaho.di.core.exception.KettlePluginException)

Example 72 with KettleXMLException

use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.

the class MySQLBulkLoaderMeta method readData.

private void readData(Node stepnode, List<? extends SharedObjectInterface> databases) throws KettleXMLException {
    try {
        String con = XMLHandler.getTagValue(stepnode, "connection");
        databaseMeta = DatabaseMeta.findDatabase(databases, con);
        schemaName = XMLHandler.getTagValue(stepnode, "schema");
        tableName = XMLHandler.getTagValue(stepnode, "table");
        fifoFileName = XMLHandler.getTagValue(stepnode, "fifo_file_name");
        encoding = XMLHandler.getTagValue(stepnode, "encoding");
        enclosure = XMLHandler.getTagValue(stepnode, "enclosure");
        delimiter = XMLHandler.getTagValue(stepnode, "delimiter");
        escapeChar = XMLHandler.getTagValue(stepnode, "escape_char");
        bulkSize = XMLHandler.getTagValue(stepnode, "bulk_size");
        replacingData = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "replace"));
        ignoringErrors = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "ignore"));
        localFile = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "local"));
        int nrvalues = XMLHandler.countNodes(stepnode, "mapping");
        allocate(nrvalues);
        for (int i = 0; i < nrvalues; i++) {
            Node vnode = XMLHandler.getSubNodeByNr(stepnode, "mapping", i);
            fieldTable[i] = XMLHandler.getTagValue(vnode, "stream_name");
            fieldStream[i] = XMLHandler.getTagValue(vnode, "field_name");
            if (fieldStream[i] == null) {
                // default: the same name!
                fieldStream[i] = fieldTable[i];
            }
            fieldFormatType[i] = getFieldFormatType(XMLHandler.getTagValue(vnode, "field_format_ok"));
        }
    } catch (Exception e) {
        throw new KettleXMLException(BaseMessages.getString(PKG, "MySQLBulkLoaderMeta.Exception.UnableToReadStepInfoFromXML"), e);
    }
}
Also used : Node(org.w3c.dom.Node) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleValueException(org.pentaho.di.core.exception.KettleValueException) KettleStepException(org.pentaho.di.core.exception.KettleStepException)

Example 73 with KettleXMLException

use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.

the class NormaliserMeta method readData.

private void readData(Node stepnode) throws KettleXMLException {
    try {
        typeField = XMLHandler.getTagValue(stepnode, "typefield");
        Node fields = XMLHandler.getSubNode(stepnode, "fields");
        int nrfields = XMLHandler.countNodes(fields, "field");
        allocate(nrfields);
        for (int i = 0; i < nrfields; i++) {
            Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
            normaliserFields[i].setName(XMLHandler.getTagValue(fnode, "name"));
            normaliserFields[i].setValue(XMLHandler.getTagValue(fnode, "value"));
            normaliserFields[i].setNorm(XMLHandler.getTagValue(fnode, "norm"));
        }
    } catch (Exception e) {
        throw new KettleXMLException(BaseMessages.getString(PKG, "NormaliserMeta.Exception.UnableToLoadStepInfoFromXML"), e);
    }
}
Also used : Node(org.w3c.dom.Node) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleStepException(org.pentaho.di.core.exception.KettleStepException)

Example 74 with KettleXMLException

use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.

the class JoinRowsMeta method readData.

private void readData(Node stepnode) throws KettleXMLException {
    try {
        directory = XMLHandler.getTagValue(stepnode, "directory");
        prefix = XMLHandler.getTagValue(stepnode, "prefix");
        cacheSize = Const.toInt(XMLHandler.getTagValue(stepnode, "cache_size"), -1);
        mainStepname = XMLHandler.getTagValue(stepnode, "main");
        Node compare = XMLHandler.getSubNode(stepnode, "compare");
        Node condnode = XMLHandler.getSubNode(compare, "condition");
        // The new situation...
        if (condnode != null) {
            condition = new Condition(condnode);
        } else {
            condition = new Condition();
        }
    } catch (Exception e) {
        throw new KettleXMLException(BaseMessages.getString(PKG, "JoinRowsMeta.Exception.UnableToReadStepInfoFromXML"), e);
    }
}
Also used : Condition(org.pentaho.di.core.Condition) Node(org.w3c.dom.Node) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleStepException(org.pentaho.di.core.exception.KettleStepException)

Example 75 with KettleXMLException

use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.

the class LDAPInputMeta method readData.

private void readData(Node stepnode) throws KettleXMLException {
    try {
        usePaging = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "usepaging"));
        pagesize = XMLHandler.getTagValue(stepnode, "pagesize");
        useAuthentication = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "useauthentication"));
        includeRowNumber = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "rownum"));
        rowNumberField = XMLHandler.getTagValue(stepnode, "rownum_field");
        Host = XMLHandler.getTagValue(stepnode, "host");
        userName = XMLHandler.getTagValue(stepnode, "username");
        setPassword(Encr.decryptPasswordOptionallyEncrypted(XMLHandler.getTagValue(stepnode, "password")));
        port = XMLHandler.getTagValue(stepnode, "port");
        filterString = XMLHandler.getTagValue(stepnode, "filterstring");
        searchBase = XMLHandler.getTagValue(stepnode, "searchbase");
        Node fields = XMLHandler.getSubNode(stepnode, "fields");
        int nrFields = XMLHandler.countNodes(fields, "field");
        allocate(nrFields);
        for (int i = 0; i < nrFields; i++) {
            Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
            inputFields[i] = new LDAPInputField();
            inputFields[i].setName(XMLHandler.getTagValue(fnode, "name"));
            inputFields[i].setAttribute(XMLHandler.getTagValue(fnode, "attribute"));
            inputFields[i].setFetchAttributeAs(LDAPInputField.getFetchAttributeAsByCode(XMLHandler.getTagValue(fnode, "attribute_fetch_as")));
            String sortedkey = XMLHandler.getTagValue(fnode, "sorted_key");
            if (sortedkey != null) {
                inputFields[i].setSortedKey(YES.equalsIgnoreCase(sortedkey));
            } else {
                inputFields[i].setSortedKey(false);
            }
            inputFields[i].setType(ValueMetaFactory.getIdForValueMeta(XMLHandler.getTagValue(fnode, "type")));
            inputFields[i].setLength(Const.toInt(XMLHandler.getTagValue(fnode, "length"), -1));
            inputFields[i].setPrecision(Const.toInt(XMLHandler.getTagValue(fnode, "precision"), -1));
            String srepeat = XMLHandler.getTagValue(fnode, "repeat");
            if (srepeat != null) {
                inputFields[i].setRepeated(YES.equalsIgnoreCase(srepeat));
            } else {
                inputFields[i].setRepeated(false);
            }
            inputFields[i].setTrimType(ValueMetaString.getTrimTypeByCode(XMLHandler.getTagValue(fnode, "trim_type")));
            inputFields[i].setFormat(XMLHandler.getTagValue(fnode, "format"));
            inputFields[i].setCurrencySymbol(XMLHandler.getTagValue(fnode, "currency"));
            inputFields[i].setDecimalSymbol(XMLHandler.getTagValue(fnode, "decimal"));
            inputFields[i].setGroupSymbol(XMLHandler.getTagValue(fnode, "group"));
        }
        // Is there a limit on the number of rows we process?
        rowLimit = Const.toInt(XMLHandler.getTagValue(stepnode, "limit"), 0);
        timeLimit = Const.toInt(XMLHandler.getTagValue(stepnode, "timelimit"), 0);
        multiValuedSeparator = XMLHandler.getTagValue(stepnode, "multivaluedseparator");
        dynamicSearch = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "dynamicsearch"));
        dynamicSeachFieldName = XMLHandler.getTagValue(stepnode, "dynamicseachfieldname");
        dynamicFilter = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "dynamicfilter"));
        dynamicFilterFieldName = XMLHandler.getTagValue(stepnode, "dynamicfilterfieldname");
        searchScope = getSearchScopeByCode(Const.NVL(XMLHandler.getTagValue(stepnode, "searchScope"), getSearchScopeCode(LDAPConnection.SEARCH_SCOPE_SUBTREE_SCOPE)));
        protocol = XMLHandler.getTagValue(stepnode, "protocol");
        trustStorePath = XMLHandler.getTagValue(stepnode, "trustStorePath");
        trustStorePassword = Encr.decryptPasswordOptionallyEncrypted(XMLHandler.getTagValue(stepnode, "trustStorePassword"));
        trustAllCertificates = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "trustAllCertificates"));
        useCertificate = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "useCertificate"));
    } catch (Exception e) {
        throw new KettleXMLException(BaseMessages.getString(PKG, "LDAPInputMeta.UnableToLoadFromXML"), e);
    }
}
Also used : Node(org.w3c.dom.Node) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleStepException(org.pentaho.di.core.exception.KettleStepException)

Aggregations

KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)286 KettleException (org.pentaho.di.core.exception.KettleException)209 Node (org.w3c.dom.Node)164 KettleStepException (org.pentaho.di.core.exception.KettleStepException)150 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)25 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)23 KettlePluginException (org.pentaho.di.core.exception.KettlePluginException)20 Document (org.w3c.dom.Document)13 IOException (java.io.IOException)10 KettleValueException (org.pentaho.di.core.exception.KettleValueException)10 StringObjectId (org.pentaho.di.repository.StringObjectId)8 KettleFileException (org.pentaho.di.core.exception.KettleFileException)7 FileNotFoundException (java.io.FileNotFoundException)5 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)5 StreamInterface (org.pentaho.di.trans.step.errorhandling.StreamInterface)5 InputStream (java.io.InputStream)4 MalformedURLException (java.net.MalformedURLException)4 ParseException (java.text.ParseException)4 FileSystemException (org.apache.commons.vfs2.FileSystemException)4 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)4