本文整理汇总了Java中org.pentaho.di.core.xml.XMLHandler.getNodes方法的典型用法代码示例。如果您正苦于以下问题:Java XMLHandler.getNodes方法的具体用法?Java XMLHandler.getNodes怎么用?Java XMLHandler.getNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.xml.XMLHandler
的用法示例。
在下文中一共展示了XMLHandler.getNodes方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadXML
import org.pentaho.di.core.xml.XMLHandler; //导入方法依赖的package包/类
public void loadXML(Node rulesNode) throws KettleException {
List<Node> ruleNodes = XMLHandler.getNodes(rulesNode, BaseImportRule.XML_TAG);
for (Node ruleNode : ruleNodes) {
String id = XMLHandler.getTagValue(ruleNode, "id");
PluginRegistry registry = PluginRegistry.getInstance();
PluginInterface plugin = registry.findPluginWithId(ImportRulePluginType.class, id);
if (plugin==null) {
throw new KettleException("The import rule of type '"+id+"' could not be found in the plugin registry.");
}
ImportRuleInterface rule = (ImportRuleInterface) registry.loadClass(plugin);
rule.loadXML(ruleNode);
getRules().add(rule);
}
}
示例2: readData
import org.pentaho.di.core.xml.XMLHandler; //导入方法依赖的package包/类
private void readData(Node stepnode) throws KettleXMLException {
try {
inputFileField = XMLHandler.getTagValue(stepnode, "input_file_field");
outputFileField = XMLHandler.getTagValue(stepnode, "output_file_field");
parameterFieldMap = new HashMap<String, String>();
Node parsNode = XMLHandler.getSubNode(stepnode, XML_TAG_PARAMETERS);
List<Node> nodes = XMLHandler.getNodes(parsNode, XML_TAG_PARAMETER);
for (Node node : nodes) {
String parameter = XMLHandler.getTagValue(node, "name");
String fieldname = XMLHandler.getTagValue(node, "field");
if (!Const.isEmpty(parameter) && !Const.isEmpty(fieldname)) {
parameterFieldMap.put(parameter, fieldname);
}
}
outputProcessorType = ProcessorType.getProcessorTypeByCode(XMLHandler.getTagValue(stepnode, "processor_type")); //$NON-NLS-1$
} catch (Exception e) {
throw new KettleXMLException(BaseMessages.getString(PKG, "PentahoReportingOutputMeta.Exception.UnableToLoadStepInfo"), e); //$NON-NLS-1$
}
}
示例3: loadStepAttributes
import org.pentaho.di.core.xml.XMLHandler; //导入方法依赖的package包/类
protected void loadStepAttributes() throws KettleException {
try {
InputStream inputStream = getClass().getResourceAsStream(STEP_ATTRIBUTES_FILE);
if (inputStream!=null) {
Document document = XMLHandler.loadXMLFile(inputStream);
Node attrsNode = XMLHandler.getSubNode(document, "attributes");
List<Node> nodes = XMLHandler.getNodes(attrsNode, "attribute");
attributes = new ArrayList<KettleAttributeInterface>();
for (Node node : nodes) {
String key = XMLHandler.getTagAttribute(node, "id");
String xmlCode = XMLHandler.getTagValue(node, "xmlcode");
String repCode = XMLHandler.getTagValue(node, "repcode");
String description = XMLHandler.getTagValue(node, "description");
String tooltip = XMLHandler.getTagValue(node, "tooltip");
int valueType = ValueMeta.getType( XMLHandler.getTagValue(node, "valuetype") );
String parentId = XMLHandler.getTagValue(node, "parentid");
KettleAttribute attribute = new KettleAttribute(key, xmlCode, repCode, description, tooltip, valueType, findParent(attributes, parentId));
attributes.add(attribute);
}
}
} catch(Exception e) {
throw new KettleException("Unable to load file "+STEP_ATTRIBUTES_FILE, e);
}
}
示例4: SlaveServerConfig
import org.pentaho.di.core.xml.XMLHandler; //导入方法依赖的package包/类
public SlaveServerConfig(LogChannelInterface log, Node node) throws KettleXMLException {
this();
Node mastersNode = XMLHandler.getSubNode(node, XML_TAG_MASTERS);
int nrMasters = XMLHandler.countNodes(mastersNode, SlaveServer.XML_TAG);
for (int i=0;i<nrMasters;i++) {
Node masterSlaveNode = XMLHandler.getSubNodeByNr(mastersNode, SlaveServer.XML_TAG, i);
SlaveServer masterSlaveServer = new SlaveServer(masterSlaveNode);
checkNetworkInterfaceSetting(log, masterSlaveNode, masterSlaveServer);
masters.add(masterSlaveServer);
}
reportingToMasters = "Y".equalsIgnoreCase(XMLHandler.getTagValue(node, "report_to_masters"));
Node slaveNode = XMLHandler.getSubNode(node, SlaveServer.XML_TAG);
if (slaveNode!=null) {
slaveServer = new SlaveServer(slaveNode);
checkNetworkInterfaceSetting(log, slaveNode, slaveServer);
}
joining = "Y".equalsIgnoreCase(XMLHandler.getTagValue(node, "joining"));
maxLogLines = Const.toInt(XMLHandler.getTagValue(node, "max_log_lines"), 0);
maxLogTimeoutMinutes = Const.toInt(XMLHandler.getTagValue(node, "max_log_timeout_minutes"), 0);
objectTimeoutMinutes = Const.toInt(XMLHandler.getTagValue(node, "object_timeout_minutes"), 0);
// Read sequence information
//
List<Node> dbNodes = XMLHandler.getNodes(node, DatabaseMeta.XML_TAG);
for (Node dbNode : dbNodes) {
databases.add(new DatabaseMeta(dbNode));
}
Node sequencesNode = XMLHandler.getSubNode(node, "sequences");
List<Node> seqNodes = XMLHandler.getNodes(sequencesNode, SlaveSequence.XML_TAG);
for (Node seqNode : seqNodes) {
slaveSequences.add(new SlaveSequence(seqNode, databases));
}
Node autoSequenceNode = XMLHandler.getSubNode(node, XML_TAG_AUTOSEQUENCE);
if (autoSequenceNode!=null) {
autoSequence = new SlaveSequence(autoSequenceNode, databases);
automaticCreationAllowed="Y".equalsIgnoreCase(XMLHandler.getTagValue(autoSequenceNode, XML_TAG_AUTO_CREATE));
}
}
示例5: buildSnippitList
import org.pentaho.di.core.xml.XMLHandler; //导入方法依赖的package包/类
private void buildSnippitList(Document doc) {
List<Node> nodes = XMLHandler.getNodes(XMLHandler.getSubNode(doc, "codeSnippits"), "codeSnippit");
for (Node node : nodes) {
Snippit snippit = new Snippit(Category.valueOf(XMLHandler.getTagValue(node, "category")), XMLHandler
.getTagValue(node, "name"), XMLHandler.getTagValue(node, "sample"), XMLHandler.getTagValue(
node, "code"));
snippits.add(snippit);
Snippit oldSnippit = snippitsMap.put(snippit.name, snippit);
if (oldSnippit != null) {
log.logError("Multiple code snippits for name: " + snippit.name);
}
}
}
示例6: registerNatives
import org.pentaho.di.core.xml.XMLHandler; //导入方法依赖的package包/类
/**
* Scan & register internal step plugins
*/
protected void registerNatives() throws KettlePluginException {
// Scan the native steps...
//
String kettlePartitionerXmlFile = Const.XML_FILE_KETTLE_PARTITION_PLUGINS;
// Load the plugins for this file...
//
try {
InputStream inputStream = getClass().getResourceAsStream(kettlePartitionerXmlFile);
if (inputStream==null) {
inputStream = getClass().getResourceAsStream("/"+kettlePartitionerXmlFile);
}
if (inputStream==null) {
throw new KettlePluginException("Unable to find native partition plugins definition file: "+Const.XML_FILE_KETTLE_PARTITION_PLUGINS);
}
Document document = XMLHandler.loadXMLFile(inputStream, null, true, false);
// Document document = XMLHandler.loadXMLFile(kettleStepsXmlFile);
Node stepsNode = XMLHandler.getSubNode(document, "plugins");
List<Node> stepNodes = XMLHandler.getNodes(stepsNode, "plugin-partitioner");
for (Node stepNode : stepNodes) {
registerPluginFromXmlResource(stepNode, null, this.getClass(), true, null);
}
} catch (KettleXMLException e) {
throw new KettlePluginException("Unable to read the kettle steps XML config file: "+kettlePartitionerXmlFile, e);
}
}
示例7: registerNatives
import org.pentaho.di.core.xml.XMLHandler; //导入方法依赖的package包/类
/**
* Scan & register internal step plugins
*/
protected void registerNatives() throws KettlePluginException {
// Scan the native database types...
//
String xmlFile = Const.XML_FILE_KETTLE_DATABASE_TYPES;
// Load the plugins for this file...
//
try {
InputStream inputStream = getClass().getResourceAsStream(xmlFile);
if (inputStream==null) {
inputStream = getClass().getResourceAsStream("/"+xmlFile);
}
if (inputStream==null) {
throw new KettlePluginException("Unable to find native kettle database types definition file: "+xmlFile);
}
Document document = XMLHandler.loadXMLFile(inputStream, null, true, false);
Node repsNode = XMLHandler.getSubNode(document, "database-types");
List<Node> repsNodes = XMLHandler.getNodes(repsNode, "database-type");
for (Node repNode : repsNodes) {
registerPluginFromXmlResource(repNode, "./", this.getClass(), true, null);
}
} catch (KettleXMLException e) {
throw new KettlePluginException("Unable to read the kettle database types XML config file: "+xmlFile, e);
}
}
示例8: registerNatives
import org.pentaho.di.core.xml.XMLHandler; //导入方法依赖的package包/类
/**
* Scan & register internal step plugins
*/
protected void registerNatives() throws KettlePluginException {
// Scan the native steps...
//
String kettleImportRulesXmlFile = Const.XML_FILE_KETTLE_IMPORT_RULES;
// Load the plugins for this file...
//
try {
InputStream inputStream = getClass().getResourceAsStream(kettleImportRulesXmlFile);
if (inputStream==null) {
inputStream = getClass().getResourceAsStream("/"+kettleImportRulesXmlFile);
}
if (inputStream==null) {
throw new KettlePluginException("Unable to find native import rules definition file: "+Const.XML_FILE_KETTLE_IMPORT_RULES);
}
Document document = XMLHandler.loadXMLFile(inputStream, null, true, false);
// Document document = XMLHandler.loadXMLFile(kettleStepsXmlFile);
Node stepsNode = XMLHandler.getSubNode(document, "rules");
List<Node> stepNodes = XMLHandler.getNodes(stepsNode, "rule");
for (Node stepNode : stepNodes) {
registerPluginFromXmlResource(stepNode, null, this.getClass(), true, null);
}
} catch (KettleXMLException e) {
throw new KettlePluginException("Unable to read the kettle steps XML config file: "+kettleImportRulesXmlFile, e);
}
}
示例9: registerNatives
import org.pentaho.di.core.xml.XMLHandler; //导入方法依赖的package包/类
/**
* Scan & register internal step plugins
*/
protected void registerNatives() throws KettlePluginException {
// Scan the native repository types...
//
String xmlFile = Const.XML_FILE_KETTLE_REPOSITORIES;
// Load the plugins for this file...
//
try {
InputStream inputStream = getClass().getResourceAsStream(xmlFile);
if (inputStream==null) {
inputStream = getClass().getResourceAsStream("/"+xmlFile);
}
if (inputStream==null) {
throw new KettlePluginException("Unable to find native repository type definition file: "+xmlFile);
}
Document document = XMLHandler.loadXMLFile(inputStream, null, true, false);
// Document document = XMLHandler.loadXMLFile(kettleStepsXmlFile);
Node repsNode = XMLHandler.getSubNode(document, "repositories");
List<Node> repsNodes = XMLHandler.getNodes(repsNode, "repository");
for (Node repNode : repsNodes) {
registerPluginFromXmlResource(repNode, null, this.getClass(), true, null);
}
} catch (KettleXMLException e) {
throw new KettlePluginException("Unable to read the kettle repositories XML config file: "+xmlFile, e);
}
}
示例10: DatabaseMeta
import org.pentaho.di.core.xml.XMLHandler; //导入方法依赖的package包/类
/**
* Reads the information from an XML Node into this new database connection.
* @param con The Node to read the data from
* @throws KettleXMLException
*/
public DatabaseMeta(Node con) throws KettleXMLException {
this();
try {
String type = XMLHandler.getTagValue(con, "type");
try {
databaseInterface = getDatabaseInterface(type);
} catch (KettleDatabaseException kde) {
throw new KettleXMLException("Unable to create new database interface", kde);
}
setName(XMLHandler.getTagValue(con, "name"));
setHostname(XMLHandler.getTagValue(con, "server"));
String acc = XMLHandler.getTagValue(con, "access");
setAccessType(getAccessType(acc));
setDBName(XMLHandler.getTagValue(con, "database"));
// The DB port is read here too for backward compatibility!
//
setDBPort(XMLHandler.getTagValue(con, "port"));
setUsername(XMLHandler.getTagValue(con, "username"));
setPassword(Encr.decryptPasswordOptionallyEncrypted(XMLHandler.getTagValue(con, "password")));
setServername(XMLHandler.getTagValue(con, "servername"));
setDataTablespace(XMLHandler.getTagValue(con, "data_tablespace"));
setIndexTablespace(XMLHandler.getTagValue(con, "index_tablespace"));
// Also, read the database attributes...
Node attrsnode = XMLHandler.getSubNode(con, "attributes");
if (attrsnode != null) {
List<Node> attrnodes = XMLHandler.getNodes(attrsnode, "attribute");
for (Node attrnode : attrnodes) {
String code = XMLHandler.getTagValue(attrnode, "code");
String attribute = XMLHandler.getTagValue(attrnode, "attribute");
if (code != null && attribute != null)
getAttributes().put(code, attribute);getDatabasePortNumberString();
}
}
} catch (Exception e) {
throw new KettleXMLException("Unable to load database connection info from XML node", e);
}
}