Search in sources :

Example 31 with KettleXMLException

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

the class JobEntryMailValidator 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);
        smtpCheck = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "smtpCheck"));
        timeout = XMLHandler.getTagValue(entrynode, "timeout");
        defaultSMTP = XMLHandler.getTagValue(entrynode, "defaultSMTP");
        emailSender = XMLHandler.getTagValue(entrynode, "emailSender");
        emailAddress = XMLHandler.getTagValue(entrynode, "emailAddress");
    } catch (Exception e) {
        throw new KettleXMLException(BaseMessages.getString(PKG, "JobEntryMailValidator.Meta.UnableToLoadFromXML"), e);
    }
}
Also used : KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleException(org.pentaho.di.core.exception.KettleException) KettleDatabaseException(org.pentaho.di.core.exception.KettleDatabaseException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException)

Example 32 with KettleXMLException

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

the class JobEntryMysqlBulkFile 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);
        schemaname = XMLHandler.getTagValue(entrynode, "schemaname");
        tablename = XMLHandler.getTagValue(entrynode, "tablename");
        filename = XMLHandler.getTagValue(entrynode, "filename");
        separator = XMLHandler.getTagValue(entrynode, "separator");
        enclosed = XMLHandler.getTagValue(entrynode, "enclosed");
        lineterminated = XMLHandler.getTagValue(entrynode, "lineterminated");
        limitlines = XMLHandler.getTagValue(entrynode, "limitlines");
        listcolumn = XMLHandler.getTagValue(entrynode, "listcolumn");
        highpriority = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "highpriority"));
        optionenclosed = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "optionenclosed"));
        outdumpvalue = Const.toInt(XMLHandler.getTagValue(entrynode, "outdumpvalue"), -1);
        iffileexists = Const.toInt(XMLHandler.getTagValue(entrynode, "iffileexists"), -1);
        String dbname = XMLHandler.getTagValue(entrynode, "connection");
        connection = DatabaseMeta.findDatabase(databases, dbname);
        addfiletoresult = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "addfiletoresult"));
    } catch (KettleException e) {
        throw new KettleXMLException("Unable to load job entry of type 'table exists' from XML node", e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException)

Example 33 with KettleXMLException

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

the class JobEntryMysqlBulkLoad 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);
        schemaname = XMLHandler.getTagValue(entrynode, "schemaname");
        tablename = XMLHandler.getTagValue(entrynode, "tablename");
        filename = XMLHandler.getTagValue(entrynode, "filename");
        separator = XMLHandler.getTagValue(entrynode, "separator");
        enclosed = XMLHandler.getTagValue(entrynode, "enclosed");
        escaped = XMLHandler.getTagValue(entrynode, "escaped");
        linestarted = XMLHandler.getTagValue(entrynode, "linestarted");
        lineterminated = XMLHandler.getTagValue(entrynode, "lineterminated");
        replacedata = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "replacedata"));
        ignorelines = XMLHandler.getTagValue(entrynode, "ignorelines");
        listattribut = XMLHandler.getTagValue(entrynode, "listattribut");
        localinfile = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "localinfile"));
        prorityvalue = Const.toInt(XMLHandler.getTagValue(entrynode, "prorityvalue"), -1);
        String dbname = XMLHandler.getTagValue(entrynode, "connection");
        addfiletoresult = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "addfiletoresult"));
        connection = DatabaseMeta.findDatabase(databases, dbname);
    } catch (KettleException e) {
        throw new KettleXMLException("Unable to load job entry of type 'Mysql bulk load' from XML node", e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException)

Example 34 with KettleXMLException

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

the class JobEntryPGPDecryptFiles 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);
        gpglocation = XMLHandler.getTagValue(entrynode, "gpglocation");
        arg_from_previous = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "arg_from_previous"));
        include_subfolders = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "include_subfolders"));
        add_result_filesname = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "add_result_filesname"));
        destination_is_a_file = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "destination_is_a_file"));
        create_destination_folder = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "create_destination_folder"));
        add_date = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "add_date"));
        add_time = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "add_time"));
        SpecifyFormat = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "SpecifyFormat"));
        AddDateBeforeExtension = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "AddDateBeforeExtension"));
        DoNotKeepFolderStructure = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "DoNotKeepFolderStructure"));
        date_time_format = XMLHandler.getTagValue(entrynode, "date_time_format");
        nr_errors_less_than = XMLHandler.getTagValue(entrynode, "nr_errors_less_than");
        success_condition = XMLHandler.getTagValue(entrynode, "success_condition");
        iffileexists = XMLHandler.getTagValue(entrynode, "iffileexists");
        destinationFolder = XMLHandler.getTagValue(entrynode, "destinationFolder");
        ifmovedfileexists = XMLHandler.getTagValue(entrynode, "ifmovedfileexists");
        moved_date_time_format = XMLHandler.getTagValue(entrynode, "moved_date_time_format");
        AddMovedDateBeforeExtension = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "AddMovedDateBeforeExtension"));
        create_move_to_folder = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "create_move_to_folder"));
        add_moved_date = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "add_moved_date"));
        add_moved_time = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "add_moved_time"));
        SpecifyMoveFormat = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "SpecifyMoveFormat"));
        Node fields = XMLHandler.getSubNode(entrynode, "fields");
        // How many field arguments?
        int nrFields = XMLHandler.countNodes(fields, "field");
        allocate(nrFields);
        // Read them all...
        for (int i = 0; i < nrFields; i++) {
            Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
            source_filefolder[i] = XMLHandler.getTagValue(fnode, "source_filefolder");
            passphrase[i] = Encr.decryptPasswordOptionallyEncrypted(XMLHandler.getTagValue(fnode, "passphrase"));
            destination_filefolder[i] = XMLHandler.getTagValue(fnode, "destination_filefolder");
            wildcard[i] = XMLHandler.getTagValue(fnode, "wildcard");
        }
    } catch (KettleXMLException xe) {
        throw new KettleXMLException(BaseMessages.getString(PKG, "JobPGPDecryptFiles.Error.Exception.UnableLoadXML"), xe);
    }
}
Also used : Node(org.w3c.dom.Node) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException)

Example 35 with KettleXMLException

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

the class XMLOutputMetaTest method testLoadXmlException.

@Test
public void testLoadXmlException() throws Exception {
    XMLOutputMeta xmlOutputMeta = new XMLOutputMeta();
    DatabaseMeta dbMeta = mock(DatabaseMeta.class);
    IMetaStore metaStore = mock(IMetaStore.class);
    Node stepNode = mock(Node.class);
    when(stepNode.getChildNodes()).thenThrow(new RuntimeException("some words"));
    try {
        xmlOutputMeta.loadXML(stepNode, Collections.singletonList(dbMeta), metaStore);
    } catch (KettleXMLException e) {
        assertEquals("some words", e.getCause().getMessage());
    }
}
Also used : Node(org.w3c.dom.Node) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) IMetaStore(org.pentaho.metastore.api.IMetaStore) Test(org.junit.Test)

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