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


Java XMLHandler.loadXMLString方法代碼示例

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


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

示例1: readWsdl

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
private Definition readWsdl(WSDLReader wsdlReader, String uri, String username, String password) 
    throws WSDLException, KettleException, AuthenticationException {
              
    try {
        HTTPProtocol http = new HTTPProtocol();
        Document doc = XMLHandler.loadXMLString(http.get(wsdlURI.toString(), username, password), true, false);
        if (doc != null) {
           return(wsdlReader.readWSDL(doc.getBaseURI(), doc));
        }
        else {
            throw new KettleException("Unable to get document.");
        }
    }
    catch (MalformedURLException mue) {
        throw new KettleException(mue);
    }
    catch (AuthenticationException ae) {
        //  re-throw this.  If not IOException seems to catch it
        throw ae;
    }
    catch (IOException ioe) {
        throw new KettleException(ioe);
    }
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:25,代碼來源:Wsdl.java

示例2: pasteJob

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
/**
 * Paste job from the clipboard...
 * 
 */
public void pasteJob() {
  String xml = fromClipboard();
  try {
    Document doc = XMLHandler.loadXMLString(xml);
    JobMeta jobMeta = new JobMeta(XMLHandler.getSubNode(doc, JobMeta.XML_TAG), rep, this);
    addJobGraph(jobMeta); // create a new tab
    refreshGraph();
    refreshTree();
  } catch (KettleException e) {
    new ErrorDialog(shell,
    // Error pasting transformation
        // "An error occurred pasting a transformation from the clipboard"
        BaseMessages.getString(PKG, "Spoon.Dialog.ErrorPastingJob.Title"), BaseMessages.getString(PKG,
            "Spoon.Dialog.ErrorPastingJob.Message"), e);
  }
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:21,代碼來源:Spoon.java

示例3: pasteJob

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
/**
 * Paste job from the clipboard...
 * 
 */
public void pasteJob() {
	String xml = fromClipboard();
	try {
		Document doc = XMLHandler.loadXMLString(xml);
		JobMeta jobMeta = new JobMeta(log, XMLHandler.getSubNode(doc, JobMeta.XML_TAG), rep, this);
		delegates.jobs.addJobGraph(jobMeta); // create a new tab
		refreshGraph();
		refreshTree();
	} catch (KettleException e) {
		new ErrorDialog(shell, Messages.getString("Spoon.Dialog.ErrorPastingJob.Title"), Messages.getString("Spoon.Dialog.ErrorPastingJob.Message"), e);// Error
		// pasting
		// transformation
		// "An error occurred pasting a transformation from the clipboard"
	}
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:20,代碼來源:Spoon.java

示例4: pasteTransformation

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
/**
 * Paste transformation from the clipboard...
 * 
 */
public void pasteTransformation() {
  if (log.isDetailed())
    log.logDetailed(BaseMessages.getString(PKG, "Spoon.Log.PasteTransformationFromClipboard"));// "Paste transformation from the clipboard!"
  String xml = fromClipboard();
  try {
    Document doc = XMLHandler.loadXMLString(xml);
    
    TransMeta transMeta = new TransMeta(XMLHandler.getSubNode(doc, TransMeta.XML_TAG), rep);
    setTransMetaVariables(transMeta);
    addTransGraph(transMeta); // create a new tab
    sharedObjectsFileMap.put(transMeta.getSharedObjects().getFilename(), transMeta.getSharedObjects());
    refreshGraph();
    refreshTree();
  } catch (KettleException e) {
    new ErrorDialog(shell, BaseMessages.getString(PKG, "Spoon.Dialog.ErrorPastingTransformation.Title"), BaseMessages
        .getString(PKG, "Spoon.Dialog.ErrorPastingTransformation.Message"), e);
  }
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:23,代碼來源:Spoon.java

示例5: readRep

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
@Override
public void readRep(Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases) throws KettleException {
    String inputRowMetaXml = rep.getStepAttributeString(id_step, INPUT_ROW_META);
    if (!Const.isEmpty(inputRowMetaXml)) {
        Document document = XMLHandler.loadXMLString(inputRowMetaXml);
        inputRowMeta = new RowMeta(document);
    }
}
 
開發者ID:brosander,項目名稱:kettle-docker,代碼行數:9,代碼來源:DockerTransInputMeta.java

示例6: xparseXmlFile

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
private static void xparseXmlFile(String strFileName) throws KettleXMLException{
       try
       {
           InputStream is = ScriptValuesHelp.class.getResourceAsStream(strFileName);
           int c;
           StringBuffer buffer = new StringBuffer();
           while ( (c=is.read())!=-1 ) buffer.append((char)c);
           is.close();
           dom = XMLHandler.loadXMLString(buffer.toString());
       }
       catch(Exception e)
       {
           throw new KettleXMLException("Unable to read script values help file from file ["+strFileName+"]", e);
       }
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:16,代碼來源:ScriptValuesHelp.java

示例7: getNextSlaveSequenceValue

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public long getNextSlaveSequenceValue(String slaveSequenceName, long incrementValue) throws KettleException {
 try {
  String xml = execService(NextSequenceValueServlet.CONTEXT_PATH+"/"+
   "?"+NextSequenceValueServlet.PARAM_NAME+"="+URLEncoder.encode(slaveSequenceName, "UTF-8")+
   "&"+NextSequenceValueServlet.PARAM_INCREMENT+"="+Long.toString(incrementValue)   
  ); //$NON-NLS-1$  //$NON-NLS-2$
  
  Document doc = XMLHandler.loadXMLString(xml);
  Node seqNode = XMLHandler.getSubNode(doc, NextSequenceValueServlet.XML_TAG);
  String nextValueString = XMLHandler.getTagValue(seqNode, NextSequenceValueServlet.XML_TAG_VALUE);
   String errorString = XMLHandler.getTagValue(seqNode, NextSequenceValueServlet.XML_TAG_ERROR);
   
  if (!Const.isEmpty(errorString)) {
    throw new KettleException(errorString);
  }
  if (Const.isEmpty(nextValueString)) {
    throw new KettleException("No value retrieved from slave sequence '"+slaveSequenceName+"' on slave "+toString());
  }
  long nextValue = Const.toLong(nextValueString, Long.MIN_VALUE);
  if (nextValue==Long.MIN_VALUE) {
    throw new KettleException("Incorrect value '"+nextValueString+"' retrieved from slave sequence '"+slaveSequenceName+"' on slave "+toString());
  }
  
  return nextValue;
 } catch(Exception e) {
    throw new KettleException("There was a problem retrieving a next sequence value from slave sequence '"+slaveSequenceName+"' on slave "+toString(), e);
 }
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:29,代碼來源:SlaveServer.java

示例8: getSlaveServerDetections

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public List<SlaveServerDetection> getSlaveServerDetections() throws Exception
{
    String xml = execService(GetSlavesServlet.CONTEXT_PATH+"/"); //$NON-NLS-1$
    Document document = XMLHandler.loadXMLString(xml);
    Node detectionsNode = XMLHandler.getSubNode(document, GetSlavesServlet.XML_TAG_SLAVESERVER_DETECTIONS);
    int nrDetections = XMLHandler.countNodes(detectionsNode, SlaveServerDetection.XML_TAG);
    
    List<SlaveServerDetection> detections = new ArrayList<SlaveServerDetection>();
    for (int i=0;i<nrDetections;i++) {
    	Node detectionNode = XMLHandler.getSubNodeByNr(detectionsNode, SlaveServerDetection.XML_TAG, i);
    	SlaveServerDetection detection = new SlaveServerDetection(detectionNode);
    	detections.add(detection);
    }
    return detections;
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:16,代碼來源:SlaveServer.java

示例9: paste

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public void paste() {
  String clipcontent = fromClipboard();
  if (clipcontent != null) {
    // Load the XML
    //
    try {
      Document document = XMLHandler.loadXMLString(clipcontent);

      boolean transformation = XMLHandler.getSubNode(document, TransMeta.XML_TAG) != null;
      boolean job = XMLHandler.getSubNode(document, JobMeta.XML_TAG) != null;
      boolean steps = XMLHandler.getSubNode(document, Spoon.XML_TAG_TRANSFORMATION_STEPS) != null;
      boolean jobEntries = XMLHandler.getSubNode(document, Spoon.XML_TAG_JOB_JOB_ENTRIES) != null;

      if (transformation) {
        pasteTransformation();
      } else if (job) {
        pasteJob();
      } else if (steps) {
        TransGraph transGraph = getActiveTransGraph();
        if (transGraph != null && transGraph.getLastMove() != null) {
          pasteXML(transGraph.getManagedObject(), clipcontent, transGraph.screen2real(transGraph.getLastMove().x, transGraph.getLastMove().y));
        }
      } else if (jobEntries) {
        JobGraph jobGraph = getActiveJobGraph();
        if (jobGraph != null && jobGraph.getLastMove() != null) {
          pasteXML(jobGraph.getManagedObject(), clipcontent, jobGraph.getLastMove());
        }

      }
    } catch (KettleXMLException e) {
      log.logError("Unable to paste", e);
    }
  }

}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:36,代碼來源:Spoon.java

示例10: allocateServerSocket

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public synchronized int allocateServerSocket(String runId, int portRangeStart, String hostname, String transformationName, String sourceSlaveName, String sourceStepName, String sourceStepCopy, String targetSlaveName, String targetStepName, String targetStepCopy) throws Exception {

    	// Look up the IP address of the given hostname
    	// Only this way we'll be to allocate on the correct host.
    	//
    	InetAddress inetAddress = InetAddress.getByName(hostname);
    	String address = inetAddress.getHostAddress();
    	
    	String service=AllocateServerSocketServlet.CONTEXT_PATH+"/?";
    	service += AllocateServerSocketServlet.PARAM_RANGE_START+"="+Integer.toString(portRangeStart);
      service += "&" + AllocateServerSocketServlet.PARAM_ID+"="+URLEncoder.encode(runId, "UTF-8");
    	service += "&" + AllocateServerSocketServlet.PARAM_HOSTNAME+"="+address;
    	service += "&" + AllocateServerSocketServlet.PARAM_TRANSFORMATION_NAME+"="+URLEncoder.encode(transformationName, "UTF-8");
    	service += "&" + AllocateServerSocketServlet.PARAM_SOURCE_SLAVE+"="+URLEncoder.encode(sourceSlaveName, "UTF-8");
    	service += "&" + AllocateServerSocketServlet.PARAM_SOURCE_STEPNAME+"="+URLEncoder.encode(sourceStepName, "UTF-8");
    	service += "&" + AllocateServerSocketServlet.PARAM_SOURCE_STEPCOPY+"="+URLEncoder.encode(sourceStepCopy, "UTF-8");
    	service += "&" + AllocateServerSocketServlet.PARAM_TARGET_SLAVE+"="+URLEncoder.encode(targetSlaveName, "UTF-8");
    	service += "&" + AllocateServerSocketServlet.PARAM_TARGET_STEPNAME+"="+URLEncoder.encode(targetStepName, "UTF-8");
    	service += "&" + AllocateServerSocketServlet.PARAM_TARGET_STEPCOPY+"="+URLEncoder.encode(targetStepCopy, "UTF-8");
    	service += "&xml=Y";
    	String xml = execService(service);
    	Document doc = XMLHandler.loadXMLString(xml);
    	String portString = XMLHandler.getTagValue(doc, AllocateServerSocketServlet.XML_TAG_PORT);
    	
    	int port = Const.toInt(portString, -1);
    	if (port<0) {
    		throw new Exception("Unable to retrieve port from service : "+service+", received : \n"+xml);
    	}

    	return port;
    }
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:32,代碼來源:SlaveServer.java

示例11: fromXML

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public static SlaveServerTransStatus fromXML(String xml) throws KettleXMLException
{
    Document document = XMLHandler.loadXMLString(xml);
    SlaveServerTransStatus status = new SlaveServerTransStatus(XMLHandler.getSubNode(document, XML_TAG));
    return status;
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:7,代碼來源:SlaveServerTransStatus.java

示例12: fromXML

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public static SlaveServerJobStatus fromXML(String xml) throws KettleXMLException
{
    Document document = XMLHandler.loadXMLString(xml);
    SlaveServerJobStatus status = new SlaveServerJobStatus(XMLHandler.getSubNode(document, XML_TAG));
    return status;
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:7,代碼來源:SlaveServerJobStatus.java

示例13: sniff

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
protected void sniff() {
  TreeItem ti[] = wTree.getSelection();
  if (ti.length == 1) {
    TreeItem treeItem = ti[0];
    String[] path = ConstUI.getTreeStrings(treeItem);

    // Make sure we're positioned on a step
    //
    if (path.length <= 2) {
      return;
    }

    String name = path[1];
    String step = path[2];
    String copy = treeItem.getText(1);

    EnterNumberDialog numberDialog = new EnterNumberDialog(shell, PropsUI.getInstance().getDefaultPreviewSize(), BaseMessages.getString(PKG,
        "SpoonSlave.SniffSizeQuestion.Title"), BaseMessages.getString(PKG, "SpoonSlave.SniffSizeQuestion.Message"));
    int lines = numberDialog.open();
    if (lines <= 0) {
      return;
    }

    EnterSelectionDialog selectionDialog = new EnterSelectionDialog(shell, new String[] { SniffStepServlet.TYPE_INPUT, SniffStepServlet.TYPE_OUTPUT, },
        BaseMessages.getString(PKG, "SpoonSlave.SniffTypeQuestion.Title"), BaseMessages.getString(PKG, "SpoonSlave.SniffTypeQuestion.Message"));
    String type = selectionDialog.open(1);
    if (type == null) {
      return;
    }

    try {
      String xml = slaveServer.sniffStep(name, step, copy, lines, type);

      Document doc = XMLHandler.loadXMLString(xml);
      Node node = XMLHandler.getSubNode(doc, SniffStepServlet.XML_TAG);
      Node metaNode = XMLHandler.getSubNode(node, RowMeta.XML_META_TAG);
      RowMetaInterface rowMeta = new RowMeta(metaNode);

      int nrRows = Const.toInt(XMLHandler.getTagValue(node, "nr_rows"), 0);
      List<Object[]> rowBuffer = new ArrayList<Object[]>();
      for (int i = 0; i < nrRows; i++) {
        Node dataNode = XMLHandler.getSubNodeByNr(node, RowMeta.XML_DATA_TAG, i);
        Object[] row = rowMeta.getRow(dataNode);
        rowBuffer.add(row);
      }

      PreviewRowsDialog prd = new PreviewRowsDialog(shell, new Variables(), SWT.NONE, step, rowMeta, rowBuffer);
      prd.open();
    } catch (Exception e) {
      new ErrorDialog(shell, BaseMessages.getString(PKG, "SpoonSlave.ErrorSniffingStep.Title"), BaseMessages.getString(PKG,
          "SpoonSlave.ErrorSniffingStep.Message"), e);
    }
  }
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:55,代碼來源:SpoonSlave.java

示例14: fromXML

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public StepStatus fromXML(String xml) throws KettleXMLException
{
    Document document = XMLHandler.loadXMLString(xml);
    return new StepStatus(XMLHandler.getSubNode(document, XML_TAG));
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:6,代碼來源:StepStatus.java

示例15: fromXML

import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public static final JobConfiguration fromXML(String xml) throws KettleException
{
    Document document = XMLHandler.loadXMLString(xml);
    Node configNode = XMLHandler.getSubNode(document, XML_TAG);
    return new JobConfiguration(configNode);
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:7,代碼來源:JobConfiguration.java


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