Search in sources :

Example 86 with KettleXMLException

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

the class DenormaliserMeta method readData.

private void readData(Node stepnode) throws KettleXMLException {
    try {
        keyField = XMLHandler.getTagValue(stepnode, "key_field");
        Node groupn = XMLHandler.getSubNode(stepnode, "group");
        Node fields = XMLHandler.getSubNode(stepnode, "fields");
        int sizegroup = XMLHandler.countNodes(groupn, "field");
        int nrfields = XMLHandler.countNodes(fields, "field");
        allocate(sizegroup, nrfields);
        for (int i = 0; i < sizegroup; i++) {
            Node fnode = XMLHandler.getSubNodeByNr(groupn, "field", i);
            groupField[i] = XMLHandler.getTagValue(fnode, "name");
        }
        for (int i = 0; i < nrfields; i++) {
            Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
            denormaliserTargetField[i] = new DenormaliserTargetField();
            denormaliserTargetField[i].setFieldName(XMLHandler.getTagValue(fnode, "field_name"));
            denormaliserTargetField[i].setKeyValue(XMLHandler.getTagValue(fnode, "key_value"));
            denormaliserTargetField[i].setTargetName(XMLHandler.getTagValue(fnode, "target_name"));
            denormaliserTargetField[i].setTargetType(XMLHandler.getTagValue(fnode, "target_type"));
            denormaliserTargetField[i].setTargetFormat(XMLHandler.getTagValue(fnode, "target_format"));
            denormaliserTargetField[i].setTargetLength(Const.toInt(XMLHandler.getTagValue(fnode, "target_length"), -1));
            denormaliserTargetField[i].setTargetPrecision(Const.toInt(XMLHandler.getTagValue(fnode, "target_precision"), -1));
            denormaliserTargetField[i].setTargetDecimalSymbol(XMLHandler.getTagValue(fnode, "target_decimal_symbol"));
            denormaliserTargetField[i].setTargetGroupingSymbol(XMLHandler.getTagValue(fnode, "target_grouping_symbol"));
            denormaliserTargetField[i].setTargetCurrencySymbol(XMLHandler.getTagValue(fnode, "target_currency_symbol"));
            denormaliserTargetField[i].setTargetNullString(XMLHandler.getTagValue(fnode, "target_null_string"));
            denormaliserTargetField[i].setTargetAggregationType(XMLHandler.getTagValue(fnode, "target_aggregation_type"));
        }
    } catch (Exception e) {
        throw new KettleXMLException(BaseMessages.getString(PKG, "DenormaliserMeta.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 87 with KettleXMLException

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

the class GetFileNamesMeta method readData.

private void readData(Node stepnode) throws KettleXMLException {
    try {
        Node filternode = XMLHandler.getSubNode(stepnode, "filter");
        Node filterfiletypenode = XMLHandler.getSubNode(filternode, "filterfiletype");
        fileTypeFilter = FileInputList.FileTypeFilter.getByName(XMLHandler.getNodeValue(filterfiletypenode));
        doNotFailIfNoFile = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "doNotFailIfNoFile"));
        includeRowNumber = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "rownum"));
        isaddresult = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "isaddresult"));
        filefield = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "filefield"));
        rowNumberField = XMLHandler.getTagValue(stepnode, "rownum_field");
        dynamicFilenameField = XMLHandler.getTagValue(stepnode, "filename_Field");
        dynamicWildcardField = XMLHandler.getTagValue(stepnode, "wildcard_Field");
        dynamicExcludeWildcardField = XMLHandler.getTagValue(stepnode, "exclude_wildcard_Field");
        dynamicIncludeSubFolders = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "dynamic_include_subfolders"));
        // Is there a limit on the number of rows we process?
        rowLimit = Const.toLong(XMLHandler.getTagValue(stepnode, "limit"), 0L);
        Node filenode = XMLHandler.getSubNode(stepnode, "file");
        int nrfiles = XMLHandler.countNodes(filenode, "name");
        allocate(nrfiles);
        for (int i = 0; i < nrfiles; i++) {
            Node filenamenode = XMLHandler.getSubNodeByNr(filenode, "name", i);
            Node filemasknode = XMLHandler.getSubNodeByNr(filenode, "filemask", i);
            Node excludefilemasknode = XMLHandler.getSubNodeByNr(filenode, "exclude_filemask", i);
            Node fileRequirednode = XMLHandler.getSubNodeByNr(filenode, "file_required", i);
            Node includeSubFoldersnode = XMLHandler.getSubNodeByNr(filenode, "include_subfolders", i);
            fileName[i] = XMLHandler.getNodeValue(filenamenode);
            fileMask[i] = XMLHandler.getNodeValue(filemasknode);
            excludeFileMask[i] = XMLHandler.getNodeValue(excludefilemasknode);
            fileRequired[i] = XMLHandler.getNodeValue(fileRequirednode);
            includeSubFolders[i] = XMLHandler.getNodeValue(includeSubFoldersnode);
        }
    } catch (Exception e) {
        throw new KettleXMLException("Unable to load step info from XML", 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 88 with KettleXMLException

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

the class GetFilesRowsCountMeta method readData.

private void readData(Node stepnode) throws KettleXMLException {
    try {
        includeFilesCount = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "files_count"));
        filesCountFieldName = XMLHandler.getTagValue(stepnode, "files_count_fieldname");
        rowsCountFieldName = XMLHandler.getTagValue(stepnode, "rows_count_fieldname");
        RowSeparator_format = scrubOldRowSeparator(XMLHandler.getTagValue(stepnode, "rowseparator_format"));
        RowSeparator = XMLHandler.getTagValue(stepnode, "row_separator");
        smartCount = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "smartCount"));
        String addresult = XMLHandler.getTagValue(stepnode, "isaddresult");
        if (Utils.isEmpty(addresult)) {
            isaddresult = true;
        } else {
            isaddresult = "Y".equalsIgnoreCase(addresult);
        }
        filefield = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "filefield"));
        outputFilenameField = XMLHandler.getTagValue(stepnode, "filename_Field");
        Node filenode = XMLHandler.getSubNode(stepnode, "file");
        int nrFiles = XMLHandler.countNodes(filenode, "name");
        allocate(nrFiles);
        for (int i = 0; i < nrFiles; i++) {
            Node filenamenode = XMLHandler.getSubNodeByNr(filenode, "name", i);
            Node filemasknode = XMLHandler.getSubNodeByNr(filenode, "filemask", i);
            Node excludefilemasknode = XMLHandler.getSubNodeByNr(filenode, "exclude_filemask", i);
            Node fileRequirednode = XMLHandler.getSubNodeByNr(filenode, "file_required", i);
            Node includeSubFoldersnode = XMLHandler.getSubNodeByNr(filenode, "include_subfolders", i);
            fileName[i] = XMLHandler.getNodeValue(filenamenode);
            fileMask[i] = XMLHandler.getNodeValue(filemasknode);
            excludeFileMask[i] = XMLHandler.getNodeValue(excludefilemasknode);
            fileRequired[i] = XMLHandler.getNodeValue(fileRequirednode);
            includeSubFolders[i] = XMLHandler.getNodeValue(includeSubFoldersnode);
        }
    } catch (Exception e) {
        throw new KettleXMLException("Unable to load step info from XML", 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 89 with KettleXMLException

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

the class GetSlaveSequenceMeta method readData.

private void readData(Node stepnode, List<? extends SharedObjectInterface> databases) throws KettleXMLException {
    try {
        valuename = XMLHandler.getTagValue(stepnode, "valuename");
        slaveServerName = XMLHandler.getTagValue(stepnode, "slave");
        sequenceName = XMLHandler.getTagValue(stepnode, "seqname");
        increment = XMLHandler.getTagValue(stepnode, "increment");
    } catch (Exception e) {
        throw new KettleXMLException(BaseMessages.getString(PKG, "GetSequenceMeta.Exception.ErrorLoadingStepInfo"), e);
    }
}
Also used : 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 90 with KettleXMLException

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

the class GetTableNamesMeta method readData.

private void readData(Node stepnode, List<? extends SharedObjectInterface> databases) throws KettleXMLException {
    try {
        this.databases = databases;
        String con = XMLHandler.getTagValue(stepnode, "connection");
        database = DatabaseMeta.findDatabase(databases, con);
        schemaname = XMLHandler.getTagValue(stepnode, "schemaname");
        tablenamefieldname = XMLHandler.getTagValue(stepnode, "tablenamefieldname");
        objecttypefieldname = XMLHandler.getTagValue(stepnode, "objecttypefieldname");
        sqlcreationfieldname = XMLHandler.getTagValue(stepnode, "sqlcreationfieldname");
        issystemobjectfieldname = XMLHandler.getTagValue(stepnode, "issystemobjectfieldname");
        includeCatalog = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "includeCatalog"));
        includeSchema = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "includeSchema"));
        includeTable = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "includeTable"));
        includeView = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "includeView"));
        includeProcedure = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "includeProcedure"));
        includeSynonym = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "includeSynonym"));
        addSchemaInOutput = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "addSchemaInOutput"));
        dynamicSchema = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "dynamicSchema"));
        schemaNameField = XMLHandler.getTagValue(stepnode, "schemaNameField");
        if (XMLHandler.getTagValue(stepnode, "schenameNameField") != null) {
            /*
         * Fix for wrong field name in the 7.0. Can be removed if we don't want to keep backward compatibility with 7.0
         * tranformations.
         */
            schemaNameField = XMLHandler.getTagValue(stepnode, "schenameNameField");
        }
    } catch (Exception e) {
        throw new KettleXMLException(BaseMessages.getString(PKG, "GetTableNamesMeta.Exception.UnableToReadStepInfo"), e);
    }
}
Also used : 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