• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java WebResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.pentaho.di.www.WebResult的典型用法代码示例。如果您正苦于以下问题:Java WebResult类的具体用法?Java WebResult怎么用?Java WebResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WebResult类属于org.pentaho.di.www包,在下文中一共展示了WebResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: pause

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
protected void pause() {
  TreeEntry treeEntry = getTreeEntry();
  if (treeEntry == null)
    return;

  // Transformations
  //
  if (treeEntry.isTransformation()) {
    try {
      WebResult webResult = slaveServer.pauseResumeTransformation(treeEntry.name, treeEntry.id);
      if (!webResult.getResult().equalsIgnoreCase(WebResult.STRING_OK)) {
        EnterTextDialog dialog = new EnterTextDialog(shell, BaseMessages.getString(PKG, "SpoonSlave.ErrorPausingOrResumingTrans.Title"),
            BaseMessages.getString(PKG, "SpoonSlave.ErrorPausingOrResumingTrans.Message"), webResult.getMessage());
        dialog.setReadOnly();
        dialog.open();
      }
    } catch (Exception e) {
      new ErrorDialog(shell, BaseMessages.getString(PKG, "SpoonSlave.ErrorPausingOrResumingTrans.Title"), BaseMessages.getString(PKG,
          "SpoonSlave.ErrorPausingOrResumingTrans.Message"), e);
    }
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:23,代码来源:SpoonSlave.java


示例2: cancel

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
public synchronized void cancel() throws SQLException {
  
  // Kill the service transformation on the server...
  // Only ever try once.
  //
  if (!stopped.get()) {
    stopped.set(true);
    try {
      String reply = HttpUtil.execService(new Variables(), 
          connection.getHostname(), connection.getPort(), connection.getWebAppName(), 
          connection.getService()+"/stopTrans"+"/?name="+URLEncoder.encode(serviceTransName, "UTF-8")+"&id="+Const.NVL(serviceObjectId, "")+"&xml=Y",
          connection.getUsername(), connection.getPassword(), 
          connection.getProxyHostname(), connection.getProxyPort(), connection.getNonProxyHosts());
      
      WebResult webResult = new WebResult(XMLHandler.loadXMLString(reply, WebResult.XML_TAG));
      if (!"OK".equals(webResult.getResult())) {
        throw new SQLException("Cancel on remote server failed: "+webResult.getMessage());
      }
      
    } catch(Exception e) {
      throw new SQLException("Couldn't cancel SQL query on slave server", e);
    }
  }
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:25,代码来源:ThinResultSet.java


示例3: cleanupSlaveServer

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
/**
 * Cleanup the slave server as part of a clustered transformation.
 *
 * @param transSplitter
 *          the TransSplitter object
 * @param slaveServer
 *          the slave server
 * @param slaveTransMeta
 *          the slave transformation meta-data
 * @throws KettleException
 *           if any errors occur during cleanup
 */
public static void cleanupSlaveServer( TransSplitter transSplitter, SlaveServer slaveServer,
    TransMeta slaveTransMeta ) throws KettleException {
  String transName = slaveTransMeta.getName();
  try {
    String carteObjectId = transSplitter.getCarteObjectMap().get( slaveTransMeta );
    WebResult webResult = slaveServer.cleanupTransformation( transName, carteObjectId );
    if ( !WebResult.STRING_OK.equals( webResult.getResult() ) ) {
      throw new KettleException( "Unable to run clean-up on slave server '" + slaveServer + "' for transformation '"
          + transName + "' : " + webResult.getMessage() );
    }
  } catch ( Exception e ) {
    throw new KettleException( "Unexpected error contacting slave server '" + slaveServer
        + "' to clear up transformation '" + transName + "'", e );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:28,代码来源:Trans.java


示例4: pause

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
protected void pause() {
  TreeEntry treeEntry = getTreeEntry();
  if ( treeEntry == null ) {
    return;
  }

  if ( treeEntry.isTransformation() ) {
    // Transformation
    try {
      WebResult webResult = slaveServer.pauseResumeTransformation( treeEntry.name, treeEntry.id );
      if ( !WebResult.STRING_OK.equalsIgnoreCase( webResult.getResult() ) ) {
        EnterTextDialog dialog =
          new EnterTextDialog( shell,
            BaseMessages.getString( PKG, "SpoonSlave.ErrorPausingOrResumingTrans.Title" ),
            BaseMessages.getString( PKG, "SpoonSlave.ErrorPausingOrResumingTrans.Message" ),
            webResult.getMessage() );
        dialog.setReadOnly();
        dialog.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( shell,
        BaseMessages.getString( PKG, "SpoonSlave.ErrorPausingOrResumingTrans.Title" ),
        BaseMessages.getString( PKG, "SpoonSlave.ErrorPausingOrResumingTrans.Message" ), e );
    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:27,代码来源:SpoonSlave.java


示例5: cleanupSlaveServer

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
public static void cleanupSlaveServer(TransSplitter transSplitter, SlaveServer slaveServer, TransMeta slaveTransMeta) throws KettleException {
  String transName = slaveTransMeta.getName();
  try {
    String carteObjectId = transSplitter.getCarteObjectMap().get(slaveTransMeta);
    WebResult webResult = slaveServer.cleanupTransformation(transName, carteObjectId);
    if (!WebResult.STRING_OK.equals(webResult.getResult()))
    {
        throw new KettleException("Unable to run clean-up on slave server '"+slaveServer+"' for transformation '"+transName+"' : "+webResult.getMessage());
    }
  } catch(Exception e) {
    throw new KettleException("Unexpected error contacting slave server '"+slaveServer+"' to clear up transformation '"+transName+"'", e);
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:14,代码来源:Trans.java


示例6: remove

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
protected void remove() {
  TreeEntry treeEntry = getTreeEntry();
  if (treeEntry == null)
    return;

  // Transformations
  //
  if (treeEntry.isTransformation()) {
    SlaveServerTransStatus transStatus = slaveServerStatus.findTransStatus(treeEntry.name, treeEntry.id);
    if (transStatus != null) {
      if (!transStatus.isRunning() && !transStatus.isPaused() && !transStatus.isStopped()) {
        try {
          WebResult webResult = slaveServer.removeTransformation(treeEntry.name, transStatus.getId());
          if (!webResult.getResult().equalsIgnoreCase(WebResult.STRING_OK)) {
            EnterTextDialog dialog = new EnterTextDialog(shell, BaseMessages.getString(PKG, "SpoonSlave.ErrorRemovingTrans.Title"), BaseMessages.getString(
                PKG, "SpoonSlave.ErrorRemovingTrans.Message"), webResult.getMessage());
            dialog.setReadOnly();
            dialog.open();
          }
        } catch (Exception e) {
          new ErrorDialog(shell, BaseMessages.getString(PKG, "SpoonSlave.ErrorRemovingTrans.Title"), BaseMessages.getString(PKG,
              "SpoonSlave.ErrorRemovingTrans.Message"), e);
        }
      }
    }
  }

  // TODO: support for jobs
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:30,代码来源:SpoonSlave.java


示例7: cleanupSlaveServer

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
/**
 * Cleanup the slave server as part of a clustered transformation.
 *
 * @param transSplitter the TransSplitter object
 * @param slaveServer the slave server
 * @param slaveTransMeta the slave transformation meta-data
 * @throws KettleException if any errors occur during cleanup
 */
public static void cleanupSlaveServer(TransSplitter transSplitter, SlaveServer slaveServer, TransMeta slaveTransMeta) throws KettleException {
  String transName = slaveTransMeta.getName();
  try {
    String carteObjectId = transSplitter.getCarteObjectMap().get(slaveTransMeta);
    WebResult webResult = slaveServer.cleanupTransformation(transName, carteObjectId);
    if (!WebResult.STRING_OK.equals(webResult.getResult()))
    {
        throw new KettleException("Unable to run clean-up on slave server '"+slaveServer+"' for transformation '"+transName+"' : "+webResult.getMessage());
    }
  } catch(Exception e) {
    throw new KettleException("Unexpected error contacting slave server '"+slaveServer+"' to clear up transformation '"+transName+"'", e);
  }
}
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:22,代码来源:Trans.java


示例8: sendXML

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
public String sendXML(String xml, String service) throws Exception
{
	byte[] content = xml.getBytes(Const.XML_ENCODING);
	PutMethod put = getSendByteArrayMethod(content, service);
	
    // Get HTTP client
    // 
    HttpClient client = new HttpClient();
    addCredentials(client);
    
    // Execute request
    // 
    try
    {
        int result = client.executeMethod(put);
        
        // The status code
        log.logDebug(toString(), Messages.getString("SlaveServer.DEBUG_ResponseStatus", Integer.toString(result))); //$NON-NLS-1$
        
        // the response
        InputStream inputStream = new BufferedInputStream(put.getResponseBodyAsStream(), 1000);
        
        StringBuffer bodyBuffer = new StringBuffer();
        int c;
        while ( (c=inputStream.read())!=-1) bodyBuffer.append((char)c);
        inputStream.close();
        String bodyTmp = bodyBuffer.toString();
        
        switch(result)
        {
        case 401: // Security problem: authentication required
          // Non-internationalized message
            String message = "Authentication failed"+Const.DOSCR+Const.DOSCR+bodyTmp; //$NON-NLS-1$
            WebResult webResult = new WebResult(WebResult.STRING_ERROR, message);
            bodyBuffer.setLength(0);
            bodyBuffer.append(webResult.getXML());
            break;
        }

        String body = bodyBuffer.toString();
        

        // String body = post.getResponseBodyAsString(); 
        log.logDebug(toString(), Messages.getString("SlaveServer.DEBUG_ResponseBody",body)); //$NON-NLS-1$
        
        return body;
    }
    finally
    {
        // Release current connection to the connection pool once you are done
        put.releaseConnection();
        log.logDetailed(toString(), Messages.getString("SlaveServer.DETAILED_SentXmlToService", service, environmentSubstitute(hostname))); //$NON-NLS-1$
    }
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:55,代码来源:SlaveServer.java


示例9: sendExport

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
/**
 * Send an exported archive over to this slave server
 * @param filename The archive to send
 * @param type The type of file to add to the slave server (AddExportServlet.TYPE_*)
 * @param load The filename to load in the archive (the .kjb or .ktr)
 * @return the XML of the web result
 * @throws Exception in case something goes awry
 */
public String sendExport(String filename, String type, String load) throws Exception
{
	String serviceUrl=AddExportServlet.CONTEXT_PATH;
	if (type!=null && load!=null) {
		serviceUrl = serviceUrl+= "/?"+AddExportServlet.PARAMETER_TYPE+"="+type+"&"+AddExportServlet.PARAMETER_LOAD+"="+URLEncoder.encode(load, "UTF-8");
	}

    String urlString = constructUrl(serviceUrl);
    log.logDebug(toString(), Messages.getString("SlaveServer.DEBUG_ConnectingTo", urlString)); //$NON-NLS-1$

    PutMethod putMethod = new PutMethod(urlString);
    
    // Request content will be retrieved directly from the input stream
    // 
	FileObject fileObject = KettleVFS.getFileObject(filename);
    RequestEntity entity = new InputStreamRequestEntity(KettleVFS.getInputStream(fileObject));
    
    putMethod.setRequestEntity(entity);
    putMethod.setDoAuthentication(true);
    putMethod.addRequestHeader(new Header("Content-Type", "binary/zip"));
	
    // Get HTTP client
    // 
    HttpClient client = new HttpClient();
    addCredentials(client);
    
    // Execute request
    // 
    try
    {
        int result = client.executeMethod(putMethod);
        
        // The status code
        log.logDebug(toString(), Messages.getString("SlaveServer.DEBUG_ResponseStatus", Integer.toString(result))); //$NON-NLS-1$
        
        // the response
        InputStream inputStream = new BufferedInputStream(putMethod.getResponseBodyAsStream(), 1000);
        
        StringBuffer bodyBuffer = new StringBuffer();
        int c;
        while ( (c=inputStream.read())!=-1) bodyBuffer.append((char)c);
        inputStream.close();
        String bodyTmp = bodyBuffer.toString();
        
        switch(result)
        {
        case 401: // Security problem: authentication required
          // Non-internationalized message
            String message = "Authentication failed"+Const.DOSCR+Const.DOSCR+bodyTmp; //$NON-NLS-1$
            WebResult webResult = new WebResult(WebResult.STRING_ERROR, message);
            bodyBuffer.setLength(0);
            bodyBuffer.append(webResult.getXML());
            break;
        }

        String body = bodyBuffer.toString();
        

        // String body = post.getResponseBodyAsString(); 
        log.logDebug(toString(), Messages.getString("SlaveServer.DEBUG_ResponseBody",body)); //$NON-NLS-1$
        
        return body;
    }
    finally
    {
        // Release current connection to the connection pool once you are done
        putMethod.releaseConnection();
        log.logDetailed(toString(), Messages.getString("SlaveServer.DETAILED_SentExportToService", AddExportServlet.CONTEXT_PATH, environmentSubstitute(hostname))); //$NON-NLS-1$
    }
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:79,代码来源:SlaveServer.java


示例10: stopTransformation

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
public WebResult stopTransformation(String transName) throws Exception
{
    String xml = execService(StopTransServlet.CONTEXT_PATH+"/?name="+URLEncoder.encode(transName, "UTF-8")+"&xml=Y"); //$NON-NLS-1$  //$NON-NLS-2$
    return WebResult.fromXMLString(xml);
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:6,代码来源:SlaveServer.java


示例11: stopJob

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
public WebResult stopJob(String transName) throws Exception
{
    String xml = execService(StopJobServlet.CONTEXT_PATH+"/?name="+URLEncoder.encode(transName, "UTF-8")+"&xml=Y"); //$NON-NLS-1$  //$NON-NLS-2$
    return WebResult.fromXMLString(xml);
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:6,代码来源:SlaveServer.java


示例12: startTransformation

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
public WebResult startTransformation(String transName) throws Exception
{
    String xml = execService(StartTransServlet.CONTEXT_PATH+"/?name="+URLEncoder.encode(transName, "UTF-8")+"&xml=Y");  //$NON-NLS-1$ //$NON-NLS-2$
    return WebResult.fromXMLString(xml);
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:6,代码来源:SlaveServer.java


示例13: startJob

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
public WebResult startJob(String transName) throws Exception
{
    String xml = execService(StartJobServlet.CONTEXT_PATH+"/?name="+URLEncoder.encode(transName, "UTF-8")+"&xml=Y");  //$NON-NLS-1$ //$NON-NLS-2$
    return WebResult.fromXMLString(xml);
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:6,代码来源:SlaveServer.java


示例14: cleanupTransformation

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
public WebResult cleanupTransformation(String transName) throws Exception
{
    String xml = execService(CleanupTransServlet.CONTEXT_PATH+"/?name="+URLEncoder.encode(transName, "UTF-8")+"&xml=Y"); //$NON-NLS-1$  //$NON-NLS-2$
    return WebResult.fromXMLString(xml);
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:6,代码来源:SlaveServer.java


示例15: deallocatePorts

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
public WebResult deallocatePorts(String transName) throws Exception
{
    String xml = execService(CleanupTransServlet.CONTEXT_PATH+"/?sockets=Y&name="+URLEncoder.encode(transName, "UTF-8")+"&xml=Y"); //$NON-NLS-1$  //$NON-NLS-2$
    return WebResult.fromXMLString(xml);
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:6,代码来源:SlaveServer.java


示例16: sendXML

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
public synchronized String sendXML(String xml, String service) throws Exception
{
	byte[] content = xml.getBytes(Const.XML_ENCODING);
	PostMethod post = getSendByteArrayMethod(content, service);
	
    // Get HTTP client
    // 
    HttpClient client = SlaveConnectionManager.getInstance().createHttpClient();
    addCredentials(client);
    addProxy(client);
    
    // Execute request
    // 
    InputStream inputStream=null;
    BufferedInputStream bufferedInputStream=null;
    
    try
    {
        int result = client.executeMethod(post);
        
        // The status code
        log.logDebug(BaseMessages.getString(PKG, "SlaveServer.DEBUG_ResponseStatus", Integer.toString(result))); //$NON-NLS-1$
        
        // the response
        //
        inputStream = post.getResponseBodyAsStream();
        bufferedInputStream = new BufferedInputStream(inputStream, 1000);
        
        StringBuffer bodyBuffer = new StringBuffer();
        int c;
        while ( (c=bufferedInputStream.read())!=-1) bodyBuffer.append((char)c);

        String bodyTmp = bodyBuffer.toString();
        
        switch(result)
        {
        case 401: // Security problem: authentication required
          // Non-internationalized message
            String message = "Authentication failed"+Const.DOSCR+Const.DOSCR+bodyTmp; //$NON-NLS-1$
            WebResult webResult = new WebResult(WebResult.STRING_ERROR, message);
            bodyBuffer.setLength(0);
            bodyBuffer.append(webResult.getXML());
            break;
        }

        String body = bodyBuffer.toString();

        // String body = post.getResponseBodyAsString(); 
        log.logDebug(BaseMessages.getString(PKG, "SlaveServer.DEBUG_ResponseBody",body)); //$NON-NLS-1$
        
        return body;
    } catch (Exception e) {
    	log.logError(toString(), String.format("Exception sending message to service %s", service), e);
    	throw e;
    } finally
    {
      
        if (bufferedInputStream!=null) {
          bufferedInputStream.close();
        }
        if (inputStream!=null) {
          inputStream.close();
        }
        
        // Release current connection to the connection pool once you are done
        post.releaseConnection();
        log.logDetailed(BaseMessages.getString(PKG, "SlaveServer.DETAILED_SentXmlToService", service, environmentSubstitute(hostname))); //$NON-NLS-1$
    }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:70,代码来源:SlaveServer.java


示例17: stopTransformation

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
public WebResult stopTransformation(String transName, String carteObjectId) throws Exception
{
    String xml = execService(StopTransServlet.CONTEXT_PATH+"/?name="+URLEncoder.encode(transName, "UTF-8")+"&id="+Const.NVL(carteObjectId, "")+"&xml=Y"); //$NON-NLS-1$  //$NON-NLS-2$
    return WebResult.fromXMLString(xml);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:6,代码来源:SlaveServer.java


示例18: pauseResumeTransformation

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
public WebResult pauseResumeTransformation(String transName, String carteObjectId) throws Exception
{
    String xml = execService(PauseTransServlet.CONTEXT_PATH+"/?name="+URLEncoder.encode(transName, "UTF-8")+"&id="+Const.NVL(carteObjectId, "")+"&xml=Y"); //$NON-NLS-1$  //$NON-NLS-2$
    return WebResult.fromXMLString(xml);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:6,代码来源:SlaveServer.java


示例19: removeTransformation

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
public WebResult removeTransformation(String transName, String carteObjectId) throws Exception
{
    String xml = execService(RemoveTransServlet.CONTEXT_PATH+"/?name="+URLEncoder.encode(transName, "UTF-8")+"&id="+Const.NVL(carteObjectId, "")+"&xml=Y"); //$NON-NLS-1$  //$NON-NLS-2$
    return WebResult.fromXMLString(xml);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:6,代码来源:SlaveServer.java


示例20: removeJob

import org.pentaho.di.www.WebResult; //导入依赖的package包/类
public WebResult removeJob(String jobName, String carteObjectId) throws Exception
{
    String xml = execService(RemoveJobServlet.CONTEXT_PATH+"/?name="+URLEncoder.encode(jobName, "UTF-8")+"&id="+Const.NVL(carteObjectId, "")+"&xml=Y"); //$NON-NLS-1$  //$NON-NLS-2$
    return WebResult.fromXMLString(xml);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:6,代码来源:SlaveServer.java



注:本文中的org.pentaho.di.www.WebResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Customer类代码示例发布时间:2022-05-22
下一篇:
Java ItemRecord类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap