當前位置: 首頁>>代碼示例>>Java>>正文


Java XMLHandler.getNodes方法代碼示例

本文整理匯總了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);
  }
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:19,代碼來源:ImportRules.java

示例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$
  }
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:21,代碼來源:PentahoReportingOutputMeta.java

示例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);
  }
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:26,代碼來源:BaseStepMeta.java

示例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));
   }
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:41,代碼來源:SlaveServerConfig.java

示例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);
		}
	}
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:14,代碼來源:UserDefinedJavaClassCodeSnippits.java

示例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);
	}
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:33,代碼來源:PartitionerPluginType.java

示例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);
	}
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:30,代碼來源:DatabasePluginType.java

示例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);
	}
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:33,代碼來源:ImportRulePluginType.java

示例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);
	}
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:32,代碼來源:RepositoryPluginType.java

示例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);
  }
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:49,代碼來源:DatabaseMeta.java


注:本文中的org.pentaho.di.core.xml.XMLHandler.getNodes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。