A simple method to check the availability of the QBlast service. Sends {@code Info} command to QBlast

@return QBlast info output concatenated to String
@throws Exception if unable to connect to the NCBI QBlast service
331571
public String getRemoteBlastInfo() throws Exception {
		OutputStreamWriter writer = null;
		BufferedReader reader = null;
		try {
			URLConnection serviceConnection = setQBlastServiceProperties(serviceUrl.openConnection());
			writer = new OutputStreamWriter(serviceConnection.getOutputStream());
			writer.write("CMD=Info");
			writer.flush();
			reader = new BufferedReader(new InputStreamReader(serviceConnection.getInputStream()));
			StringBuilder sb = new StringBuilder();
			String line;
			while ((line = reader.readLine()) != null) {
				sb.append(line);
				sb.append(System.getProperty("line.separator"));
			}
			return sb.toString();
		} catch (IOException e) {
			throw new Exception("Impossible to get info from QBlast service at this time. Cause: " + e.getMessage(), e);
		} finally {
			IOUtils.close(reader);
			IOUtils.close(writer);
		}
	}
22570
private static String commandRun(Command command) {
        // Wait bind
        if (I_COMMAND == null) {
            synchronized (I_LOCK) {
                if (I_COMMAND == null) {
                    try {
                        I_LOCK.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }

        // Cancel Destroy Service
        cancelDestroyService();

        // Get result
        // In this we should try 5 count get the result
        int count = 5;
        Exception error = null;
        while (count > 0) {
            if (command.isCancel) {
                if (command.mListener != null)
                    command.mListener.onCancel();
                break;
            }
            try {
                command.mResult = I_COMMAND.command(command.mId, command.mTimeout, command.mParameters);
                if (command.mListener != null)
                    command.mListener.onCompleted(command.mResult);
                break;
            } catch (Exception e) {
                error = e;
                count--;
                try {
                    Thread.sleep(3000);
                } catch (InterruptedException e1) {
                    e1.printStackTrace();
                }
            }
        }

        // Check is Error
        if (count <= 0 && command.mListener != null) {
            command.mListener.onError(error);
        }

        // Check is end and call destroy service
        if (I_COMMAND != null) {
            try {
                if (I_COMMAND.getTaskCount() <= 0)
                    destroyService();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        // Return
        return command.mResult;
    }
541206
public String retrieveServiceStatus(String service, String cluster) throws Exception {
        String status = "";
        String endPoint = "/service/deploy-api/deploy/status/service?service=" + service;
        String element = "$.status";
        Future response;

        this.setRestProtocol("https://");
        this.setRestHost(cluster);
        this.setRestPort(":443");

        response = this.generateRequest("GET", true, null, null, endPoint, null, "json");
        this.setResponse("GET", (Response) response.get());
        assertThat(this.getResponse().getStatusCode()).as("It hasn't been possible to obtain status for service: " + service).isEqualTo(200);

        String json = this.getResponse().getResponse();

        String value = this.getJSONPathString(json, element, null);

        switch (value) {
            case "0":
                status = "deploying";
                break;
            case "1":
                status = "suspended";
                break;
            case "2":
                status = "running";
                break;
            case "3":
                status = "delayed";
                break;
            default:
                throw new Exception("Unknown service status code");
        }

        return status;
    }
400141
@Override
    protected Object openConnection() throws ConnectionException {
        qConnection = null;
        qSession = null;
        queue = null;
        try {
            String server_url = this.getAttributeValueSmart(SERVER_URL);
            if ("THIS_SERVER".equals(server_url)) server_url = null;
            String queue_name = this.getQueueName();
            JMSServices jmsServices = JMSServices.getInstance();
            QueueConnectionFactory qFactory = jmsServices.getQueueConnectionFactory(server_url);
            qConnection = qFactory.createQueueConnection();
            qSession = qConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            qConnection.start();
            queue = jmsServices.getQueue(qSession, queue_name);
        } catch (Exception e) {
            logger.severeException("Exception in JmsAdapter.openConnection()" , e);
            throw new ConnectionException(ConnectionException.CONNECTION_DOWN, "Exception in invoking JmsAdapter" , e);

        }
        return qSession;
    }
250608
public long getLastTickReceived() throws SIMPRuntimeOperationFailedException
  {
    //Returns the tick of the last message received and acknowleged
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getLastTickReceived");

    try
    {
      assertValidControllable();
    }
    catch (SIMPControllableNotFoundException e)
    {
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.runtime.RemoteConsumerReceiver.getLastTickReceived",
        "1:161:1.47",
        this);
      
      SIMPRuntimeOperationFailedException finalE =
        new SIMPRuntimeOperationFailedException(
          nls.getFormattedMessage(
            "INTERNAL_MESSAGING_ERROR_CWSIP0003",
            new Object[] {"RemoteConsumerReceiver.getLastTickReceived",
                "1:169:1.47",
                          e,
                          aiStream.getStreamId()},
            null), e);
            
      SibTr.exception(tc, finalE);
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getLastTickReceived", finalE);
      throw finalE;
    }
    //the last tick received and acknowledged is the compelted prefix
    long tick = aiStream.getStateStream().getCompletedPrefix();

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getLastTickReceived", Long.valueOf(tick));
      
    return tick;
  }
1228432
public String getContent() throws ConnectionException {
    	
    	logger.debug("Enter Response::getContent");	
    	
    	if (content != null) {
    		logger.debug("content already available ");
            return content;
        }

    	BufferedReader rd = new BufferedReader(new InputStreamReader(stream));
		StringBuffer result = new StringBuffer();
		String line = "";
		try {
			while ((line = rd.readLine()) != null) {
			    result.append(line);
			}
		} catch (IOException e) {
			logger.error("Exception while retrieving content", e);
            throw new ConnectionException(e.getMessage());
		}
		content = result.toString();
		logger.debug("End Response::getContent");	
		return content;
        
    }
470468
public final String getExceptionMessage() {
        /* If the Exception information is set, return the translated message */
        if (getHdr2().getChoiceField(JsHdr2Access.EXCEPTION) != JsHdr2Access.IS_EXCEPTION_EMPTY) {
            return exceptionMessages.getFormattedMessage(MfpConstants.EXCEPTION_MESSAGE_KEY_PREFIX + getExceptionReason().toString()
                                                         , getExceptionInserts()
                                                         , "Failed to deliver message, rc=" + getExceptionReason() + ". Inserts: " + Arrays.asList(getExceptionInserts())
                            );
        }
        /* If no, just return null. */
        else {
            return null;
        }
    }
1129101
public final ServletOutputStream getOutputStream() throws IOException {
        if (out == null) {
            OutputStream out = createOutputStream();
            this.out = out instanceof ServletOutputStream ? out : new OutputStreamAdapter(out);
        }
        else if (out instanceof PrintWriter) {
            throw new IllegalStateException("getWriter() already called.");
        }

        return (ServletOutputStream) out;
    }
1172972
public String getMessage ()
    {
    String message = super.getMessage();

    if (message == null && exception != null) {
        return exception.getMessage();
    } else {
        return message;
    }
    }
1330524
@Deprecated
    @Then("^the command exit status is '(.+?)'$")
    public void checkShellExitStatus(int expectedExitStatus) throws Exception {
        assertThat(commonspec.getCommandExitStatus()).as("Is equal to " + expectedExitStatus + ".").isEqualTo(expectedExitStatus);
    }
100088
public String getAsText()
   {
      if (throwable != null)
         return throwable.toString();

      if (result != null)
      {
         try 
         {
            if (editor != null)
            {
               editor.setValue(result);
               return editor.getAsText();
            }
            else
            {
               return result.toString();
            }
         }
         catch (Exception e)
         {
            return "String representation of " + name + "unavailable";
         }
      }

      return null;
   }
866809
@Override
    public List<MonitorLine> getLastLine(Integer count) throws Exception {
        String line;
        final List<MonitorLine> result = new ArrayList<MonitorLine>();
        BufferedReader in = null;
        try {
            in = new BufferedReader(new FileReader(getFilename()));
            int i = 0;
            line = in.readLine();
            while (line != null) {
                result.add(new MonitorLine(i, line));
                i++;
                line = in.readLine();
            }
        } finally {
            try {
                if (in != null) {
                    in.close();
                }
            } catch (IOException ignore) {
            }
        }
        if (result.size() <= count) {
            return result;
        } else {
            return result.subList(result.size() - count, result.size());
        }
    }
1257473
@Restricted(NoExternalUse.class)
    public final String getSingleLineSummary() {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        getCmdLineParser().printSingleLineUsage(out);
        return out.toString();
    }
606929
public String
getErrorString() {
	checkDone();
	if (error != null)
		return error;
	switch (result) {
		case SUCCESSFUL:	return "successful";
		case UNRECOVERABLE:	return "unrecoverable error";
		case TRY_AGAIN:		return "try again";
		case HOST_NOT_FOUND:	return "host not found";
		case TYPE_NOT_FOUND:	return "type not found";
	}
	throw new IllegalStateException("unknown result");
}
712544
public String getExceptionStackTrace() {
        Throwable t = getException();
        if (t == null) {
            return null;
        }
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        t.printStackTrace(pw);
        return sw.toString();
    }
1343005
@Override
    protected RpcResponse onFailure(ServiceRequestContext ctx, RpcRequest req, @Nullable Throwable cause)
            throws Exception {
        return RpcResponse.ofFailure(HttpStatusException.of(HttpStatus.SERVICE_UNAVAILABLE));
    }
1232784
@Override
    public String getConnectionInfo() throws Exception {
        return String.format("Cluster Name - %s : Keyspace Name - %s : CF Name - %s ::: ColsPerRow - %s : ReadCL - %s : WriteCL - %s ", config.getCluster(), config.getKeyspace(), config.getCfname()
        , config.getColsPerRow(), config.getReadConsistencyLevel(), config.getWriteConsistencyLevel());

    }