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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations