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


Java XMLHandler.loadXMLFile方法代碼示例

本文整理匯總了Java中org.pentaho.di.core.xml.XMLHandler.loadXMLFile方法的典型用法代碼示例。如果您正苦於以下問題:Java XMLHandler.loadXMLFile方法的具體用法?Java XMLHandler.loadXMLFile怎麽用?Java XMLHandler.loadXMLFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.pentaho.di.core.xml.XMLHandler的用法示例。


在下文中一共展示了XMLHandler.loadXMLFile方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: registerXmlPlugins

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
protected void registerXmlPlugins() throws KettlePluginException {
	for (PluginFolderInterface folder : pluginFolders) {
		
		if (folder.isPluginXmlFolder()) {
			List<FileObject> pluginXmlFiles = findPluginXmlFiles(folder.getFolder());
			for (FileObject file : pluginXmlFiles) {
				
				try {
					Document document = XMLHandler.loadXMLFile(file);
					Node pluginNode = XMLHandler.getSubNode(document, "plugin");
					if (pluginNode!=null) {
						registerPluginFromXmlResource(pluginNode, KettleVFS.getFilename(file.getParent()), this.getClass(), false, file.getParent().getURL());
					}
				} catch(Exception e) {
					// We want to report this plugin.xml error, perhaps an XML typo or something like that...
					//
					log.logError("Error found while reading step plugin.xml file: "+file.getName().toString(), e);
				}
			}
		}
	}
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:23,代碼來源:StepPluginType.java

示例2: registerXmlPlugins

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
protected void registerXmlPlugins() throws KettlePluginException {
	for (PluginFolderInterface folder : pluginFolders) {
		
		if (folder.isPluginXmlFolder()) {
			List<FileObject> pluginXmlFiles = findPluginXmlFiles(folder.getFolder());
			for (FileObject file : pluginXmlFiles) {
				
				try {
					Document document = XMLHandler.loadXMLFile(file);
					Node pluginNode = XMLHandler.getSubNode(document, "plugin");

					registerPluginFromXmlResource(pluginNode, KettleVFS.getFilename(file.getParent()), this.getClass(), false, file.getParent().getURL());
				} catch(Exception e) {
					// We want to report this plugin.xml error, perhaps an XML typo or something like that...
					//
					log.logError("Error found while reading repository plugin.xml file: "+file.getName().toString(), e);
				}
			}
		}
	}
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:22,代碼來源:RepositoryPluginType.java

示例3: registerXmlPlugins

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
protected void registerXmlPlugins() throws KettlePluginException {
	for (PluginFolderInterface folder : pluginFolders) {
		
		if (folder.isPluginXmlFolder()) {
			List<FileObject> pluginXmlFiles = findPluginXmlFiles(folder.getFolder());
			for (FileObject file : pluginXmlFiles) {
				
				try {
					Document document = XMLHandler.loadXMLFile(file);
					Node pluginNode = XMLHandler.getSubNode(document, "partitioner-plugin");
					if (pluginNode!=null) {
						registerPluginFromXmlResource(pluginNode, KettleVFS.getFilename(file.getParent()), this.getClass(), false, file.getParent().getURL());
					}
				} catch(Exception e) {
					// We want to report this plugin.xml error, perhaps an XML typo or something like that...
					//
					log.logError("Error found while reading partitioning plugin.xml file: "+file.getName().toString(), e);
				}
			}
		}
	}
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:23,代碼來源:PartitionerPluginType.java

示例4: JobMeta

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
/**
 * Load the job from the XML file specified.
 * 
 * @param log
 *            the logging channel
 * @param fname
 *            The filename to load as a job
 * @param rep
 *            The repository to bind againt, null if there is no repository
 *            available.
 * @throws KettleXMLException
 */
public JobMeta(VariableSpace parentSpace, String fname, Repository rep, OverwritePrompter prompter)
		throws KettleXMLException {
	this.initializeVariablesFrom(parentSpace);
	try {
		// OK, try to load using the VFS stuff...
		Document doc = XMLHandler.loadXMLFile(KettleVFS.getFileObject(fname, this));
		if (doc != null) {
			// Clear the job
			clear();

			// The jobnode
			Node jobnode = XMLHandler.getSubNode(doc, XML_TAG);

			loadXML(jobnode, rep, prompter);

			// Do this at the end
			setFilename(fname);
		} else {
			throw new KettleXMLException(BaseMessages.getString(PKG, "JobMeta.Exception.ErrorReadingFromXMLFile") + fname); //$NON-NLS-1$
		}
	} catch (Exception e) {
		throw new KettleXMLException(BaseMessages.getString(PKG, "JobMeta.Exception.UnableToLoadJobFromXMLFile") + fname + "]", e); //$NON-NLS-1$ //$NON-NLS-2$
	}
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:37,代碼來源:JobMeta.java

示例5: parseXmlForAdditionalClasses

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public void parseXmlForAdditionalClasses() throws KettleException{
	try {
		Properties sysprops = System.getProperties();
		String strActPath = sysprops.getProperty("user.dir");
		Document dom = XMLHandler.loadXMLFile(strActPath + "/plugins/steps/ScriptValues_mod/plugin.xml");
		Node stepnode = dom.getDocumentElement();
		Node libraries = XMLHandler.getSubNode(stepnode, "js_libraries");
		int nbOfLibs = XMLHandler.countNodes(libraries, "js_lib");
		additionalClasses = new ScriptAddClasses[nbOfLibs];
		for(int i=0;i<nbOfLibs;i++){
			Node fnode = XMLHandler.getSubNodeByNr(libraries, "js_lib", i);
			String strJarName = XMLHandler.getTagAttribute(fnode, "name");
			String strClassName =XMLHandler.getTagAttribute(fnode, "classname");
			String strJSName = XMLHandler.getTagAttribute(fnode, "js_name");
			
			Class<?> addClass = LoadAdditionalClass(strActPath + "/plugins/steps/ScriptValues_mod/"+ strJarName,strClassName);
			Object addObject = addClass.newInstance();
			additionalClasses[i] = new ScriptAddClasses(addClass, addObject, strJSName);
		}
	}catch(Exception e) {
		throw new KettleException(BaseMessages.getString(PKG, "ScriptMeta.Exception.UnableToParseXMLforAdditionalClasses"), e); 
	}
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:24,代碼來源:ScriptMeta.java

示例6: parseXmlForAdditionalClasses

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public void parseXmlForAdditionalClasses() throws KettleException{
	try {
		Properties sysprops = System.getProperties();
		String strActPath = sysprops.getProperty("user.dir");
		Document dom = XMLHandler.loadXMLFile(strActPath + "/plugins/steps/ScriptValues_mod/plugin.xml");
		Node stepnode = dom.getDocumentElement();
		Node libraries = XMLHandler.getSubNode(stepnode, "js_libraries");
		int nbOfLibs = XMLHandler.countNodes(libraries, "js_lib");
		additionalClasses = new ScriptValuesAddClasses[nbOfLibs];
		for(int i=0;i<nbOfLibs;i++){
			Node fnode = XMLHandler.getSubNodeByNr(libraries, "js_lib", i);
			String strJarName = XMLHandler.getTagAttribute(fnode, "name");
			String strClassName =XMLHandler.getTagAttribute(fnode, "classname");
			String strJSName = XMLHandler.getTagAttribute(fnode, "js_name");
			
			Class<?> addClass = LoadAdditionalClass(strActPath + "/plugins/steps/ScriptValues_mod/"+ strJarName,strClassName);
			Object addObject = addClass.newInstance();
			additionalClasses[i] = new ScriptValuesAddClasses(addClass, addObject, strJSName);
		}
	}catch(Exception e) {
		throw new KettleException(BaseMessages.getString(PKG, "ScriptValuesMetaMod.Exception.UnableToParseXMLforAdditionalClasses"), e); 
	}
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:24,代碼來源:ScriptValuesMetaMod.java

示例7: 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

示例8: 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

示例9: 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

示例10: TransMeta

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
/**
 * Parse a file containing the XML that describes the transformation.
 *
 * @param fname The filename
 * @param rep The repository to load the default set of connections from, null if no repository is available
 * @param setInternalVariables true if you want to set the internal variables based on this transformation information
 * @param parentVariableSpace the parent variable space to use during TransMeta construction
 * @param prompter the changed/replace listener or null if there is none
 */
public TransMeta(String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ) throws KettleXMLException
{
    // OK, try to load using the VFS stuff...
    Document doc=null;
    try
    {
        doc = XMLHandler.loadXMLFile(KettleVFS.getFileObject(fname));
    }
    catch (IOException e)
    {
        throw new KettleXMLException(Messages.getString("TransMeta.Exception.ErrorOpeningOrValidatingTheXMLFile", fname), e);
    }
    
    if (doc != null)
    {
        // Clear the transformation
        clearUndo();
        clear();

        // Root node:
        Node transnode = XMLHandler.getSubNode(doc, XML_TAG); //$NON-NLS-1$

        // Load from this node...
        loadXML(transnode, rep, setInternalVariables, parentVariableSpace, prompter);

        setFilename(fname);
    }
    else
    {
        throw new KettleXMLException(Messages.getString("TransMeta.Exception.ErrorOpeningOrValidatingTheXMLFile", fname)); //$NON-NLS-1$
    }
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:42,代碼來源:TransMeta.java

示例11: 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

示例12: createPopupMenus

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public static Map<String, Menu> createPopupMenus(String menusFile, Shell shell,Messages xulMessages,List<String> ids)
		throws KettleException
{
	try
	{
		URL xulFile = getAndValidate(menusFile); //$NON-NLS-1$

		Document doc = XMLHandler.loadXMLFile(xulFile);
		return MenuHelper.createPopupMenusFromXul(doc, shell, xulMessages, ids);
	} catch (IOException e)
	{
		throw new KettleException(e);
	}

}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:16,代碼來源:XulHelper.java

示例13: createToolbar

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public static Toolbar createToolbar(String resource, Composite parentComposite, Object caller,Messages xulMessages) throws KettleException
{
	try
	{
		// first get the XML document
		URL xulFile = getAndValidate(resource); //$NON-NLS-1$

		Document doc = XMLHandler.loadXMLFile(xulFile);
		return MenuHelper.createToolbarFromXul(doc, parentComposite, xulMessages, caller);
	} catch (IOException e)
	{
		throw new KettleException(e);
	}
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:15,代碼來源:XulHelper.java

示例14: loadNodeFromXML

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public Node loadNodeFromXML(ObjectId id, String tag) throws KettleException {
	try {
		// The object ID is the base name of the file in the Base directory folder
		//
		String filename = calcDirectoryName(null)+id.getId();
		FileObject fileObject = KettleVFS.getFileObject(filename);
		Document document = XMLHandler.loadXMLFile(fileObject);
		Node node = XMLHandler.getSubNode(document, tag);
		
		return node;
	}
	catch(Exception e) {
		throw new KettleException("Unable to load XML object from object with ID ["+id+"] and tag ["+tag+"]", e);
	}
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:16,代碼來源:KettleFileRepository.java

示例15: 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


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