use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.
the class JobEntryXSDValidator 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);
xmlfilename = XMLHandler.getTagValue(entrynode, "xmlfilename");
xsdfilename = XMLHandler.getTagValue(entrynode, "xsdfilename");
} catch (KettleXMLException xe) {
throw new KettleXMLException("Unable to load job entry of type 'xsdvalidator' from XML node", xe);
}
}
use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.
the class JobEntryXSLT 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);
xmlfilename = XMLHandler.getTagValue(entrynode, "xmlfilename");
xslfilename = XMLHandler.getTagValue(entrynode, "xslfilename");
outputfilename = XMLHandler.getTagValue(entrynode, "outputfilename");
iffileexists = Const.toInt(XMLHandler.getTagValue(entrynode, "iffileexists"), -1);
addfiletoresult = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "addfiletoresult"));
filenamesfromprevious = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "filenamesfromprevious"));
xsltfactory = XMLHandler.getTagValue(entrynode, "xsltfactory");
if (xsltfactory == null) {
xsltfactory = FACTORY_JAXP;
}
Node parametersNode = XMLHandler.getSubNode(entrynode, "parameters");
int nrparams = XMLHandler.countNodes(parametersNode, "parameter");
Node parametersOutputProps = XMLHandler.getSubNode(entrynode, "outputproperties");
int nroutputprops = XMLHandler.countNodes(parametersOutputProps, "outputproperty");
allocate(nrparams, nroutputprops);
for (int i = 0; i < nrparams; i++) {
Node anode = XMLHandler.getSubNodeByNr(parametersNode, "parameter", i);
parameterField[i] = XMLHandler.getTagValue(anode, "field");
parameterName[i] = XMLHandler.getTagValue(anode, "name");
}
for (int i = 0; i < nroutputprops; i++) {
Node anode = XMLHandler.getSubNodeByNr(parametersOutputProps, "outputproperty", i);
outputPropertyName[i] = XMLHandler.getTagValue(anode, "name");
outputPropertyValue[i] = XMLHandler.getTagValue(anode, "value");
}
} catch (KettleXMLException xe) {
throw new KettleXMLException("Unable to load job entry of type 'xslt' from XML node", xe);
}
}
use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.
the class GetXMLDataMeta method readData.
private void readData(Node stepnode) throws KettleXMLException {
try {
includeFilename = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "include"));
filenameField = XMLHandler.getTagValue(stepnode, "include_field");
addResultFile = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "addresultfile"));
nameSpaceAware = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "namespaceaware"));
ignorecomments = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "ignorecomments"));
readurl = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "readurl"));
validating = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "validating"));
usetoken = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "usetoken"));
IsIgnoreEmptyFile = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "IsIgnoreEmptyFile"));
doNotFailIfNoFile = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "doNotFailIfNoFile"));
includeRowNumber = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "rownum"));
rowNumberField = XMLHandler.getTagValue(stepnode, "rownum_field");
encoding = XMLHandler.getTagValue(stepnode, "encoding");
Node filenode = XMLHandler.getSubNode(stepnode, "file");
Node fields = XMLHandler.getSubNode(stepnode, "fields");
int nrFiles = XMLHandler.countNodes(filenode, "name");
int nrFields = XMLHandler.countNodes(fields, "field");
allocate(nrFiles, nrFields);
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);
}
for (int i = 0; i < nrFields; i++) {
Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
GetXMLDataField field = new GetXMLDataField(fnode);
inputFields[i] = field;
}
// Is there a limit on the number of rows we process?
rowLimit = Const.toLong(XMLHandler.getTagValue(stepnode, "limit"), 0L);
// Do we skip rows before starting to read
loopxpath = XMLHandler.getTagValue(stepnode, "loopxpath");
inFields = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "IsInFields"));
IsAFile = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "IsAFile"));
xmlField = XMLHandler.getTagValue(stepnode, "XmlField");
prunePath = XMLHandler.getTagValue(stepnode, "prunePath");
shortFileFieldName = XMLHandler.getTagValue(stepnode, "shortFileFieldName");
pathFieldName = XMLHandler.getTagValue(stepnode, "pathFieldName");
hiddenFieldName = XMLHandler.getTagValue(stepnode, "hiddenFieldName");
lastModificationTimeFieldName = XMLHandler.getTagValue(stepnode, "lastModificationTimeFieldName");
uriNameFieldName = XMLHandler.getTagValue(stepnode, "uriNameFieldName");
rootUriNameFieldName = XMLHandler.getTagValue(stepnode, "rootUriNameFieldName");
extensionFieldName = XMLHandler.getTagValue(stepnode, "extensionFieldName");
sizeFieldName = XMLHandler.getTagValue(stepnode, "sizeFieldName");
} catch (Exception e) {
throw new KettleXMLException(BaseMessages.getString(PKG, "GetXMLDataMeta.Exception.ErrorLoadingXML", e.toString()));
}
}
use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.
the class MQTTConsumerMetaTest method fromXml.
public static MQTTConsumerMeta fromXml(String metaXml) {
Document doc;
try {
doc = XMLHandler.loadXMLString("<step>" + metaXml + "</step>");
Node stepNode = XMLHandler.getSubNode(doc, "step");
MQTTConsumerMeta mqttConsumerMeta = new MQTTConsumerMeta();
mqttConsumerMeta.loadXML(stepNode, emptyList(), (IMetaStore) null);
return mqttConsumerMeta;
} catch (KettleXMLException e) {
throw new RuntimeException(e);
}
}
use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.
the class XMLInputSaxMeta method readData.
private void readData(Node stepnode) throws KettleXMLException {
try {
String lim;
includeFilename = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "include"));
filenameField = XMLHandler.getTagValue(stepnode, "include_field");
includeRowNumber = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "rownum"));
rowNumberField = XMLHandler.getTagValue(stepnode, "rownum_field");
Node filenode = XMLHandler.getSubNode(stepnode, "file");
Node attributes = XMLHandler.getSubNode(stepnode, "def_attributes");
Node fields = XMLHandler.getSubNode(stepnode, "fields");
Node positions = XMLHandler.getSubNode(stepnode, "positions");
int nrFiles = XMLHandler.countNodes(filenode, "name");
int nrAttributes = XMLHandler.countNodes(attributes, "def_element");
int nrFields = XMLHandler.countNodes(fields, "field");
int nrPositions = XMLHandler.countNodes(positions, "position");
allocate(nrFiles, nrFields, nrPositions);
for (int i = 0; i < nrFiles; i++) {
Node filenamenode = XMLHandler.getSubNodeByNr(filenode, "name", i);
Node filemasknode = XMLHandler.getSubNodeByNr(filenode, "filemask", i);
fileName[i] = XMLHandler.getNodeValue(filenamenode);
fileMask[i] = XMLHandler.getNodeValue(filemasknode);
}
this.clearDefinition();
for (int i = 0; i < nrAttributes; i++) {
Node elementnode = XMLHandler.getSubNodeByNr(attributes, "def_element", i);
Node attributenode = XMLHandler.getSubNodeByNr(attributes, "def_attribute", i);
String a = XMLHandler.getNodeValue(elementnode);
String b = XMLHandler.getNodeValue(attributenode);
this.setDefiningAttribute(a, b);
}
for (int i = 0; i < nrFields; i++) {
Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
XMLInputSaxField field = new XMLInputSaxField(fnode);
inputFields[i] = field;
}
for (int i = 0; i < nrPositions; i++) {
Node positionnode = XMLHandler.getSubNodeByNr(positions, "position", i);
String encoded = XMLHandler.getNodeValue(positionnode);
inputPosition[i] = new XMLInputSaxFieldPosition(encoded);
}
// Is there a limit on the number of rows we process?
lim = XMLHandler.getTagValue(stepnode, "limit");
rowLimit = Const.toLong(lim, 0L);
} catch (Exception e) {
throw new KettleXMLException("Unable to load step info from XML", e);
}
}
Aggregations