Search in sources :

Example 91 with KettleXMLException

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

the class GetVariableMeta method readData.

private void readData(Node stepnode) throws KettleXMLException {
    try {
        Node fields = XMLHandler.getSubNode(stepnode, "fields");
        int count = XMLHandler.countNodes(fields, "field");
        allocate(count);
        for (int i = 0; i < count; i++) {
            Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
            fieldDefinitions[i].setFieldName(XMLHandler.getTagValue(fnode, "name"));
            fieldDefinitions[i].setVariableString(XMLHandler.getTagValue(fnode, "variable"));
            fieldDefinitions[i].setFieldType(ValueMetaFactory.getIdForValueMeta(XMLHandler.getTagValue(fnode, "type")));
            fieldDefinitions[i].setFieldFormat(XMLHandler.getTagValue(fnode, "format"));
            fieldDefinitions[i].setCurrency(XMLHandler.getTagValue(fnode, "currency"));
            fieldDefinitions[i].setDecimal(XMLHandler.getTagValue(fnode, "decimal"));
            fieldDefinitions[i].setGroup(XMLHandler.getTagValue(fnode, "group"));
            fieldDefinitions[i].setFieldLength(Const.toInt(XMLHandler.getTagValue(fnode, "length"), -1));
            fieldDefinitions[i].setFieldPrecision(Const.toInt(XMLHandler.getTagValue(fnode, "precision"), -1));
            fieldDefinitions[i].setTrimType(ValueMetaString.getTrimTypeByCode(XMLHandler.getTagValue(fnode, "trim_type")));
            // 
            if (fieldDefinitions[i].getFieldType() == ValueMetaInterface.TYPE_NONE) {
                fieldDefinitions[i].setFieldType(ValueMetaInterface.TYPE_STRING);
            }
        }
    } catch (Exception e) {
        throw new KettleXMLException("Unable to read step information 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) KettlePluginException(org.pentaho.di.core.exception.KettlePluginException) KettleStepException(org.pentaho.di.core.exception.KettleStepException)

Example 92 with KettleXMLException

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

the class GPBulkLoaderMeta 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);
        String serror = XMLHandler.getTagValue(stepnode, "errors");
        // default to 50.
        maxErrors = Const.toInt(serror, 50);
        schemaName = XMLHandler.getTagValue(stepnode, "schema");
        tableName = XMLHandler.getTagValue(stepnode, "table");
        loadMethod = XMLHandler.getTagValue(stepnode, "load_method");
        loadAction = XMLHandler.getTagValue(stepnode, "load_action");
        PsqlPath = XMLHandler.getTagValue(stepnode, "PsqlPath");
        controlFile = XMLHandler.getTagValue(stepnode, "control_file");
        dataFile = XMLHandler.getTagValue(stepnode, "data_file");
        logFile = XMLHandler.getTagValue(stepnode, "log_file");
        eraseFiles = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "erase_files"));
        encoding = XMLHandler.getTagValue(stepnode, "encoding");
        dbNameOverride = XMLHandler.getTagValue(stepnode, "dbname_override");
        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];
            }
            String locDateMask = XMLHandler.getTagValue(vnode, "date_mask");
            if (locDateMask == null) {
                dateMask[i] = "";
            } else {
                if (GPBulkLoaderMeta.DATE_MASK_DATE.equals(locDateMask) || GPBulkLoaderMeta.DATE_MASK_DATETIME.equals(locDateMask)) {
                    dateMask[i] = locDateMask;
                } else {
                    dateMask[i] = "";
                }
            }
        }
    } catch (Exception e) {
        throw new KettleXMLException(BaseMessages.getString(PKG, "GPBulkLoaderMeta.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) KettleStepException(org.pentaho.di.core.exception.KettleStepException)

Example 93 with KettleXMLException

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

the class OpenERPObjectOutputMeta method readData.

private void readData(final Node stepnode, final List<? extends SharedObjectInterface> databases) throws KettleXMLException {
    try {
        this.databaseMeta = DatabaseMeta.findDatabase(databases, XMLHandler.getTagValue(stepnode, "connection"));
        this.modelName = XMLHandler.getTagValue(stepnode, "modelName");
        this.commitBatchSize = Integer.parseInt(XMLHandler.getTagValue(stepnode, "readBatchSize"));
        this.outputIDField = XMLHandler.getTagValue(stepnode, "outputIDField").equals("Y") ? true : false;
        this.outputIDFieldName = XMLHandler.getTagValue(stepnode, "outputIDFieldName");
        Node mappings = XMLHandler.getSubNode(stepnode, "mappings");
        int nrLevels = XMLHandler.countNodes(mappings, "mapping");
        allocate(nrLevels);
        for (int i = 0; i < nrLevels; i++) {
            Node fnode = XMLHandler.getSubNodeByNr(mappings, "mapping", i);
            modelFields[i] = XMLHandler.getTagValue(fnode, "model_field");
            streamFields[i] = XMLHandler.getTagValue(fnode, "stream_field");
        }
        Node keyMappings = XMLHandler.getSubNode(stepnode, "key_mappings");
        nrLevels = XMLHandler.countNodes(keyMappings, "key_map");
        keyLookups.clear();
        for (int i = 0; i < nrLevels; i++) {
            String[] key_maps = new String[3];
            Node fnode = XMLHandler.getSubNodeByNr(keyMappings, "key_map", i);
            key_maps[0] = XMLHandler.getTagValue(fnode, "model_key_field");
            key_maps[1] = XMLHandler.getTagValue(fnode, "comparitor");
            key_maps[2] = XMLHandler.getTagValue(fnode, "stream_key_field");
            keyLookups.add(key_maps);
        }
    } 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 94 with KettleXMLException

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

the class PaloCubeCreate method loadXML.

public void loadXML(Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers, Repository rep, IMetaStore metaStore) throws KettleXMLException {
    try {
        super.loadXML(entrynode, databases, slaveServers);
        this.setDatabaseMeta(DatabaseMeta.findDatabase(databases, XMLHandler.getTagValue(entrynode, "connection")));
        this.setCubeName(XMLHandler.getTagValue(entrynode, "cubeName"));
        Node dimensionNode = XMLHandler.getSubNode(entrynode, "dimensions");
        int nrDimensions = XMLHandler.countNodes(dimensionNode, "dimensionname");
        for (int i = 0; i < nrDimensions; i++) {
            String dimensionName = XMLHandler.getNodeValue(XMLHandler.getSubNodeByNr(dimensionNode, "dimensionname", i));
            this.dimensionNames.add(dimensionName);
        }
    } catch (KettleXMLException xe) {
        throw new KettleXMLException("Unable to load file exists job entry from XML node", xe);
    }
}
Also used : Node(org.w3c.dom.Node) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException)

Example 95 with KettleXMLException

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

the class PaloCubeDelete method loadXML.

public void loadXML(Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers, Repository rep, IMetaStore metaStore) throws KettleXMLException {
    try {
        super.loadXML(entrynode, databases, slaveServers);
        this.setDatabaseMeta(DatabaseMeta.findDatabase(databases, XMLHandler.getTagValue(entrynode, "connection")));
        this.setCubeName(XMLHandler.getTagValue(entrynode, "cubeName"));
    } catch (KettleXMLException xe) {
        throw new KettleXMLException("Unable to load file exists job entry from XML node", xe);
    }
}
Also used : KettleXMLException(org.pentaho.di.core.exception.KettleXMLException)

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