Search in sources :

Example 1 with HopXmlException

use of org.apache.hop.core.exception.HopXmlException in project hop by apache.

the class TransformMeta method fromXml.

public static TransformMeta fromXml(String metaXml) {
    Document doc;
    try {
        doc = XmlHandler.loadXmlString(metaXml);
        Node transformNode = XmlHandler.getSubNode(doc, "transform");
        return new TransformMeta(transformNode, null);
    } catch (HopXmlException | HopPluginLoaderException e) {
        throw new RuntimeException(e);
    }
}
Also used : HopXmlException(org.apache.hop.core.exception.HopXmlException) Node(org.w3c.dom.Node) HopPluginLoaderException(org.apache.hop.core.exception.HopPluginLoaderException) Document(org.w3c.dom.Document)

Example 2 with HopXmlException

use of org.apache.hop.core.exception.HopXmlException in project hop by apache.

the class ActionFileExists method loadXml.

@Override
public void loadXml(Node entrynode, IHopMetadataProvider metadataProvider, IVariables variables) throws HopXmlException {
    try {
        super.loadXml(entrynode);
        filename = XmlHandler.getTagValue(entrynode, "filename");
    } catch (HopXmlException xe) {
        throw new HopXmlException(BaseMessages.getString(PKG, "ActionFileExists.ERROR_0001_Cannot_Load_Job_Entry_From_Xml_Node"), xe);
    }
}
Also used : HopXmlException(org.apache.hop.core.exception.HopXmlException)

Example 3 with HopXmlException

use of org.apache.hop.core.exception.HopXmlException in project hop by apache.

the class ActionFtp method loadXml.

@Override
public void loadXml(Node entryNode, IHopMetadataProvider metadataProvider, IVariables variables) throws HopXmlException {
    try {
        super.loadXml(entryNode);
        serverPort = XmlHandler.getTagValue(entryNode, "port");
        serverName = XmlHandler.getTagValue(entryNode, "servername");
        userName = XmlHandler.getTagValue(entryNode, "username");
        password = Encr.decryptPasswordOptionallyEncrypted(XmlHandler.getTagValue(entryNode, "password"));
        remoteDirectory = XmlHandler.getTagValue(entryNode, "ftpdirectory");
        targetDirectory = XmlHandler.getTagValue(entryNode, "targetdirectory");
        wildcard = XmlHandler.getTagValue(entryNode, "wildcard");
        binaryMode = "Y".equalsIgnoreCase(XmlHandler.getTagValue(entryNode, "binary"));
        timeout = Const.toInt(XmlHandler.getTagValue(entryNode, "timeout"), 10000);
        remove = "Y".equalsIgnoreCase(XmlHandler.getTagValue(entryNode, "remove"));
        onlyGettingNewFiles = "Y".equalsIgnoreCase(XmlHandler.getTagValue(entryNode, "only_new"));
        activeConnection = "Y".equalsIgnoreCase(XmlHandler.getTagValue(entryNode, "active"));
        controlEncoding = XmlHandler.getTagValue(entryNode, "control_encoding");
        if (controlEncoding == null) {
            // if we couldn't retrieve an encoding, assume it's an old instance and
            // put in the the encoding used before v 2.4.0
            controlEncoding = LEGACY_CONTROL_ENCODING;
        }
        moveFiles = "Y".equalsIgnoreCase(XmlHandler.getTagValue(entryNode, "movefiles"));
        moveToDirectory = XmlHandler.getTagValue(entryNode, "movetodirectory");
        addDate = "Y".equalsIgnoreCase(XmlHandler.getTagValue(entryNode, "adddate"));
        addTime = "Y".equalsIgnoreCase(XmlHandler.getTagValue(entryNode, "addtime"));
        specifyFormat = "Y".equalsIgnoreCase(XmlHandler.getTagValue(entryNode, "SpecifyFormat"));
        dateTimeFormat = XmlHandler.getTagValue(entryNode, "date_time_format");
        addDateBeforeExtension = "Y".equalsIgnoreCase(XmlHandler.getTagValue(entryNode, "AddDateBeforeExtension"));
        String addresult = XmlHandler.getTagValue(entryNode, "isaddresult");
        if (Utils.isEmpty(addresult)) {
            isAddResult = true;
        } else {
            isAddResult = "Y".equalsIgnoreCase(addresult);
        }
        createMoveFolder = "Y".equalsIgnoreCase(XmlHandler.getTagValue(entryNode, "createmovefolder"));
        proxyHost = XmlHandler.getTagValue(entryNode, "proxy_host");
        proxyPort = XmlHandler.getTagValue(entryNode, "proxy_port");
        proxyUsername = XmlHandler.getTagValue(entryNode, "proxy_username");
        proxyPassword = Encr.decryptPasswordOptionallyEncrypted(XmlHandler.getTagValue(entryNode, "proxy_password"));
        socksProxyHost = XmlHandler.getTagValue(entryNode, "socksproxy_host");
        socksProxyPort = XmlHandler.getTagValue(entryNode, "socksproxy_port");
        socksProxyUsername = XmlHandler.getTagValue(entryNode, "socksproxy_username");
        socksProxyPassword = Encr.decryptPasswordOptionallyEncrypted(XmlHandler.getTagValue(entryNode, "socksproxy_password"));
        stringIfFileExists = XmlHandler.getTagValue(entryNode, "ifFileExists");
        if (Utils.isEmpty(stringIfFileExists)) {
            ifFileExists = ifFileExistsSkip;
        } else {
            if (stringIfFileExists.equals(STRING_IF_FILE_EXISTS_CREATE_UNIQ)) {
                ifFileExists = ifFileExistsCreateUniq;
            } else if (stringIfFileExists.equals(STRING_IF_FILE_EXISTS_FAIL)) {
                ifFileExists = ifFileExistsFail;
            } else {
                ifFileExists = ifFileExistsSkip;
            }
        }
        nrLimit = XmlHandler.getTagValue(entryNode, "nr_limit");
        successCondition = Const.NVL(XmlHandler.getTagValue(entryNode, "success_condition"), SUCCESS_IF_NO_ERRORS);
    } catch (HopXmlException xe) {
        throw new HopXmlException("Unable to load action of type 'ftp' from XML node", xe);
    }
}
Also used : HopXmlException(org.apache.hop.core.exception.HopXmlException)

Example 4 with HopXmlException

use of org.apache.hop.core.exception.HopXmlException in project hop by apache.

the class ActionFoldersCompare method loadXml.

@Override
public void loadXml(Node entrynode, IHopMetadataProvider metadataProvider, IVariables variables) throws HopXmlException {
    try {
        super.loadXml(entrynode);
        includesubfolders = "Y".equalsIgnoreCase(XmlHandler.getTagValue(entrynode, "include_subfolders"));
        comparefilecontent = "Y".equalsIgnoreCase(XmlHandler.getTagValue(entrynode, "compare_filecontent"));
        comparefilesize = "Y".equalsIgnoreCase(XmlHandler.getTagValue(entrynode, "compare_filesize"));
        compareonly = XmlHandler.getTagValue(entrynode, "compareonly");
        wildcard = XmlHandler.getTagValue(entrynode, "wildcard");
        filename1 = XmlHandler.getTagValue(entrynode, "filename1");
        filename2 = XmlHandler.getTagValue(entrynode, "filename2");
    } catch (HopXmlException xe) {
        throw new HopXmlException(BaseMessages.getString(PKG, "ActionFoldersCompare.Meta.UnableLoadXML", xe.getMessage()));
    }
}
Also used : HopXmlException(org.apache.hop.core.exception.HopXmlException)

Example 5 with HopXmlException

use of org.apache.hop.core.exception.HopXmlException in project hop by apache.

the class ActionFolderIsEmpty method loadXml.

@Override
public void loadXml(Node entrynode, IHopMetadataProvider metadataProvider, IVariables variables) throws HopXmlException {
    try {
        super.loadXml(entrynode);
        folderName = XmlHandler.getTagValue(entrynode, "foldername");
        includeSubfolders = "Y".equalsIgnoreCase(XmlHandler.getTagValue(entrynode, "include_subfolders"));
        specifyWildcard = "Y".equalsIgnoreCase(XmlHandler.getTagValue(entrynode, "specify_wildcard"));
        wildcard = XmlHandler.getTagValue(entrynode, "wildcard");
    } catch (HopXmlException xe) {
        throw new HopXmlException("Unable to load action of type 'create folder' from XML node", xe);
    }
}
Also used : HopXmlException(org.apache.hop.core.exception.HopXmlException)

Aggregations

HopXmlException (org.apache.hop.core.exception.HopXmlException)167 Node (org.w3c.dom.Node)99 HopTransformException (org.apache.hop.core.exception.HopTransformException)74 HopException (org.apache.hop.core.exception.HopException)55 ValueMetaString (org.apache.hop.core.row.value.ValueMetaString)14 HopPluginException (org.apache.hop.core.exception.HopPluginException)13 HopValueException (org.apache.hop.core.exception.HopValueException)7 Document (org.w3c.dom.Document)7 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)5 MalformedURLException (java.net.MalformedURLException)4 ParseException (java.text.ParseException)4 HopFileException (org.apache.hop.core.exception.HopFileException)4 IStream (org.apache.hop.pipeline.transform.stream.IStream)4 DocumentBuilder (javax.xml.parsers.DocumentBuilder)3 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)3 Condition (org.apache.hop.core.Condition)3 IOException (java.io.IOException)2 DOMSource (javax.xml.transform.dom.DOMSource)2 StreamResult (javax.xml.transform.stream.StreamResult)2 HopDatabaseException (org.apache.hop.core.exception.HopDatabaseException)2