use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.
the class LDAPOutputMeta method readData.
private void readData(Node stepnode) throws KettleXMLException {
try {
useAuthentication = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "useauthentication"));
Host = XMLHandler.getTagValue(stepnode, "host");
userName = XMLHandler.getTagValue(stepnode, "username");
setPassword(Encr.decryptPasswordOptionallyEncrypted(XMLHandler.getTagValue(stepnode, "password")));
port = XMLHandler.getTagValue(stepnode, "port");
dnFieldName = XMLHandler.getTagValue(stepnode, "dnFieldName");
failIfNotExist = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "failIfNotExist"));
operationType = getOperationTypeByCode(Const.NVL(XMLHandler.getTagValue(stepnode, "operationType"), ""));
multiValuedSeparator = XMLHandler.getTagValue(stepnode, "multivaluedseparator");
searchBase = XMLHandler.getTagValue(stepnode, "searchBase");
referralType = getReferralTypeByCode(Const.NVL(XMLHandler.getTagValue(stepnode, "referralType"), ""));
derefAliasesType = getDerefAliasesTypeByCode(Const.NVL(XMLHandler.getTagValue(stepnode, "derefAliasesType"), ""));
oldDnFieldName = XMLHandler.getTagValue(stepnode, "oldDnFieldName");
newDnFieldName = XMLHandler.getTagValue(stepnode, "newDnFieldName");
deleteRDN = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "deleteRDN"));
Node fields = XMLHandler.getSubNode(stepnode, "fields");
int nrFields = XMLHandler.countNodes(fields, "field");
allocate(nrFields);
for (int i = 0; i < nrFields; i++) {
Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
updateLookup[i] = XMLHandler.getTagValue(fnode, "name");
updateStream[i] = XMLHandler.getTagValue(fnode, "field");
if (updateStream[i] == null) {
// default: the same name!
updateStream[i] = updateLookup[i];
}
String updateValue = XMLHandler.getTagValue(fnode, "update");
if (updateValue == null) {
// default TRUE
update[i] = Boolean.TRUE;
} else {
if (updateValue.equalsIgnoreCase("Y")) {
update[i] = Boolean.TRUE;
} else {
update[i] = Boolean.FALSE;
}
}
}
protocol = XMLHandler.getTagValue(stepnode, "protocol");
trustStorePath = XMLHandler.getTagValue(stepnode, "trustStorePath");
trustStorePassword = Encr.decryptPasswordOptionallyEncrypted(XMLHandler.getTagValue(stepnode, "trustStorePassword"));
trustAllCertificates = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "trustAllCertificates"));
useCertificate = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "useCertificate"));
} catch (Exception e) {
throw new KettleXMLException(BaseMessages.getString(PKG, "LDAPOutputMeta.UnableToLoadFromXML"), e);
}
}
use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.
the class LoadFileInputMeta 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));
IsIgnoreEmptyFile = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, IS_IGNORE_EMPTY_FILE));
IsIgnoreMissingPath = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, IS_IGNORE_MISSING_PATH));
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);
LoadFileInputField field = new LoadFileInputField(fnode);
inputFields[i] = field;
}
// Is there a limit on the number of rows we process?
rowLimit = Const.toLong(XMLHandler.getTagValue(stepnode, LIMIT), 0L);
fileinfield = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, IS_IN_FIELDS));
DynamicFilenameField = XMLHandler.getTagValue(stepnode, DYNAMIC_FILENAME_FIELD);
shortFileFieldName = XMLHandler.getTagValue(stepnode, SHORT_FILE_FIELD_NAME);
pathFieldName = XMLHandler.getTagValue(stepnode, PATH_FIELD_NAME);
hiddenFieldName = XMLHandler.getTagValue(stepnode, HIDDEN_FIELD_NAME);
lastModificationTimeFieldName = XMLHandler.getTagValue(stepnode, LAST_MODIFICATION_TIME_FIELD_NAME);
uriNameFieldName = XMLHandler.getTagValue(stepnode, URI_NAME_FIELD_NAME);
rootUriNameFieldName = XMLHandler.getTagValue(stepnode, ROOT_URI_NAME_FIELD_NAME);
extensionFieldName = XMLHandler.getTagValue(stepnode, EXTENSION_FIELD_NAME);
} catch (Exception e) {
throw new KettleXMLException(BaseMessages.getString(PKG, "LoadFileInputMeta.Exception.ErrorLoadingXML", e.toString()));
}
}
use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.
the class MappingMeta method loadXML.
public void loadXML(Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore) throws KettleXMLException {
try {
String method = XMLHandler.getTagValue(stepnode, "specification_method");
specificationMethod = ObjectLocationSpecificationMethod.getSpecificationMethodByCode(method);
String transId = XMLHandler.getTagValue(stepnode, "trans_object_id");
transObjectId = Utils.isEmpty(transId) ? null : new StringObjectId(transId);
transName = XMLHandler.getTagValue(stepnode, "trans_name");
fileName = XMLHandler.getTagValue(stepnode, "filename");
directoryPath = XMLHandler.getTagValue(stepnode, "directory_path");
// Backward compatibility check for object specification
//
checkObjectLocationSpecificationMethod();
Node mappingsNode = XMLHandler.getSubNode(stepnode, "mappings");
inputMappings.clear();
outputMappings.clear();
if (mappingsNode != null) {
// Read all the input mapping definitions...
//
Node inputNode = XMLHandler.getSubNode(mappingsNode, "input");
int nrInputMappings = XMLHandler.countNodes(inputNode, MappingIODefinition.XML_TAG);
for (int i = 0; i < nrInputMappings; i++) {
Node mappingNode = XMLHandler.getSubNodeByNr(inputNode, MappingIODefinition.XML_TAG, i);
MappingIODefinition inputMappingDefinition = new MappingIODefinition(mappingNode);
inputMappings.add(inputMappingDefinition);
}
Node outputNode = XMLHandler.getSubNode(mappingsNode, "output");
int nrOutputMappings = XMLHandler.countNodes(outputNode, MappingIODefinition.XML_TAG);
for (int i = 0; i < nrOutputMappings; i++) {
Node mappingNode = XMLHandler.getSubNodeByNr(outputNode, MappingIODefinition.XML_TAG, i);
MappingIODefinition outputMappingDefinition = new MappingIODefinition(mappingNode);
outputMappings.add(outputMappingDefinition);
}
// Load the mapping parameters too..
//
Node mappingParametersNode = XMLHandler.getSubNode(mappingsNode, MappingParameters.XML_TAG);
mappingParameters = new MappingParameters(mappingParametersNode);
} else {
// backward compatibility...
//
Node inputNode = XMLHandler.getSubNode(stepnode, "input");
Node outputNode = XMLHandler.getSubNode(stepnode, "output");
int nrInput = XMLHandler.countNodes(inputNode, "connector");
int nrOutput = XMLHandler.countNodes(outputNode, "connector");
// null means: auto-detect
//
MappingIODefinition inputMappingDefinition = new MappingIODefinition();
inputMappingDefinition.setMainDataPath(true);
for (int i = 0; i < nrInput; i++) {
Node inputConnector = XMLHandler.getSubNodeByNr(inputNode, "connector", i);
String inputField = XMLHandler.getTagValue(inputConnector, "field");
String inputMapping = XMLHandler.getTagValue(inputConnector, "mapping");
inputMappingDefinition.getValueRenames().add(new MappingValueRename(inputField, inputMapping));
}
// null means: auto-detect
//
MappingIODefinition outputMappingDefinition = new MappingIODefinition();
outputMappingDefinition.setMainDataPath(true);
for (int i = 0; i < nrOutput; i++) {
Node outputConnector = XMLHandler.getSubNodeByNr(outputNode, "connector", i);
String outputField = XMLHandler.getTagValue(outputConnector, "field");
String outputMapping = XMLHandler.getTagValue(outputConnector, "mapping");
outputMappingDefinition.getValueRenames().add(new MappingValueRename(outputMapping, outputField));
}
// Don't forget to add these to the input and output mapping
// definitions...
//
inputMappings.add(inputMappingDefinition);
outputMappings.add(outputMappingDefinition);
// The default is to have no mapping parameters: the concept didn't
// exist before.
//
mappingParameters = new MappingParameters();
}
String multiInput = XMLHandler.getTagValue(stepnode, "allow_multiple_input");
allowingMultipleInputs = Utils.isEmpty(multiInput) ? inputMappings.size() > 1 : "Y".equalsIgnoreCase(multiInput);
String multiOutput = XMLHandler.getTagValue(stepnode, "allow_multiple_output");
allowingMultipleOutputs = Utils.isEmpty(multiOutput) ? outputMappings.size() > 1 : "Y".equalsIgnoreCase(multiOutput);
} catch (Exception e) {
throw new KettleXMLException(BaseMessages.getString(PKG, "MappingMeta.Exception.ErrorLoadingTransformationStepFromXML"), e);
}
}
use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.
the class AddSequenceMeta method readData.
private void readData(Node stepnode, List<? extends SharedObjectInterface> databases) throws KettleXMLException {
try {
valuename = XMLHandler.getTagValue(stepnode, "valuename");
useDatabase = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "use_database"));
String conn = XMLHandler.getTagValue(stepnode, "connection");
database = DatabaseMeta.findDatabase(databases, conn);
schemaName = XMLHandler.getTagValue(stepnode, "schema");
sequenceName = XMLHandler.getTagValue(stepnode, "seqname");
useCounter = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "use_counter"));
counterName = XMLHandler.getTagValue(stepnode, "counter_name");
startAt = XMLHandler.getTagValue(stepnode, "start_at");
incrementBy = XMLHandler.getTagValue(stepnode, "increment_by");
maxValue = XMLHandler.getTagValue(stepnode, "max_value");
// TODO startAt = Const.toLong(XMLHandler.getTagValue(stepnode, "start_at"), 1);
// incrementBy = Const.toLong(XMLHandler.getTagValue(stepnode, "increment_by"), 1);
// maxValue = Const.toLong(XMLHandler.getTagValue(stepnode, "max_value"), 999999999L);
} catch (Exception e) {
throw new KettleXMLException(BaseMessages.getString(PKG, "AddSequenceMeta.Exception.ErrorLoadingStepInfo"), e);
}
}
use of org.pentaho.di.core.exception.KettleXMLException in project pentaho-kettle by pentaho.
the class ChangeFileEncodingMeta method readData.
private void readData(Node stepnode, List<? extends SharedObjectInterface> databases) throws KettleXMLException {
try {
filenamefield = XMLHandler.getTagValue(stepnode, "filenamefield");
targetfilenamefield = XMLHandler.getTagValue(stepnode, "targetfilenamefield");
sourceencoding = XMLHandler.getTagValue(stepnode, "sourceencoding");
targetencoding = XMLHandler.getTagValue(stepnode, "targetencoding");
addsourceresultfilenames = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "addsourceresultfilenames"));
addtargetresultfilenames = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "addtargetresultfilenames"));
createparentfolder = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "createparentfolder"));
} catch (Exception e) {
throw new KettleXMLException(BaseMessages.getString(PKG, "ChangeFileEncodingMeta.Exception.UnableToReadStepInfo"), e);
}
}
Aggregations