Package eu.mosaic_cloud.platform.interop.idl.IdlCommon

Examples of eu.mosaic_cloud.platform.interop.idl.IdlCommon.CompletionToken


    return null;
  }

  public CallbackCompletion<Void> write(String fileHandlerUUID, byte[] data) {
   
    final CompletionToken token = this.generateToken();
    this.transcript.traceDebugging ("Writing data to fileHandler: `%s` (with request token `%s`)...", fileHandlerUUID, token.getMessageId ());
   
    final DFSPayloads.WriteFile.Builder writeFileBuilder = DFSPayloads.WriteFile.newBuilder();
    writeFileBuilder.setToken(token);
    writeFileBuilder.setFileHandler(fileHandlerUUID);
    writeFileBuilder.setData(ByteString.copyFrom(data));
View Full Code Here


    return (this.sendRequest(message, token, Void.class));
  }

  public CallbackCompletion<byte[]> read(String fileHandlerUUID, long numOfBytes) {
   
    final CompletionToken token = this.generateToken();
    this.transcript.traceDebugging ("Reading data from fileHandler: `%s` (with request token `%s`)...", fileHandlerUUID, token.getMessageId ());
   
    final DFSPayloads.ReadFile.Builder readFileBuilder = DFSPayloads.ReadFile.newBuilder();
    readFileBuilder.setToken(token);
    readFileBuilder.setFileHandler(fileHandlerUUID);
    readFileBuilder.setNumBytes(numOfBytes);
View Full Code Here

    return (this.sendRequest(message, token, byte[].class)); //TODO check if this is okay
  }

  public CallbackCompletion<Void> close(String fileHandlerUUID) {
   
    final CompletionToken token = this.generateToken();
    this.transcript.traceDebugging ("Closing fileHandler: `%s` (with request token `%s`)...", fileHandlerUUID, token.getMessageId ());

    final DFSPayloads.CloseFile.Builder closeFileBuilder = DFSPayloads.CloseFile.newBuilder();
    closeFileBuilder.setToken(token);
    closeFileBuilder.setFileHandler(fileHandlerUUID);
   
View Full Code Here

    final DFSHandlerMessage dfsMsg = (DFSHandlerMessage)message.specification;
   
    switch(dfsMsg) {
      case SUCCESS: {
        final SuccessResponse successPayload = (SuccessResponse)message.payload;
        final CompletionToken token = successPayload.getToken();
        this.transcript.traceDebugging ("processing the success response for pending request with token `%s`...", token.getMessageId ());
        if(successPayload.getSuccessful()){
          this.pendingRequests.succeed(token.getMessageId(), null);
        }else {
          this.pendingRequests.fail(token.getMessageId()new Exception ("I/O exception")); //TODO err message?
        }
      }
        break;
      case BYTES: {
        final FileRead fileReadPayload = (FileRead)message.payload;
        final CompletionToken token = fileReadPayload.getToken();
        this.transcript.traceDebugging ("processing the BYTE response for pending request with token `%s`...", token.getMessageId ());
        this.pendingRequests.succeed(token.getMessageId(), fileReadPayload.getData().toByteArray());
      }
        break;
      default: {
        this.transcript.traceWarning ("processing unexpected message of type `%s`; ignoring...", message.specification);
      }
View Full Code Here

    final DFSMessage dfsMsg = (DFSMessage)message.specification;
   
    switch(dfsMsg) {
      case ERROR: {
        final IdlCommon.Error errorPayload = (Error)message.payload;
        final CompletionToken token = errorPayload.getToken();
        this.transcript.traceDebugging ("processing the failure (error) response for pending request with token `%s` with message `%s`...", token.getMessageId (), errorPayload.getErrorMessage ());
        this.pendingRequests.fail(token.getMessageId()new Exception (errorPayload.getErrorMessage ()));
      }
        break;
      case SUCCESS: {
        final SuccessResponse successPayload = (SuccessResponse)message.payload;
        final CompletionToken token = successPayload.getToken();
        this.transcript.traceDebugging ("processing the success response for pending request with token `%s`...", token.getMessageId ());
        if(successPayload.getSuccessful()){
          this.pendingRequests.succeed(token.getMessageId(), null);
        }else {
          this.pendingRequests.fail(token.getMessageId()new Exception ("I/O exception")); //TODO err message?
        }
      }
        break;
      case LISTING: {
        final ListResult listResultPayload = (ListResult)message.payload;
        final CompletionToken token = listResultPayload.getToken();
        this.transcript.traceDebugging ("processing the list response for pending request with token `%s`...", token.getMessageId ());
       
        List<LsElement> list = getLsResult(listResultPayload);
       
        this.pendingRequests.succeed(token.getMessageId(), list);
      }
        break;
      case HANDLER: {
        receivedHandlerRequest(message);
      }
View Full Code Here

  }
 
  protected void receivedHandlerRequest(Message message){
    final FileHandlerResponse fileHandlerResponsePayload = (FileHandlerResponse)message.payload;
    final CompletionToken token = fileHandlerResponsePayload.getToken();
    this.transcript.traceDebugging ("processing the FileHandler response for pending request with token `%s`...", token.getMessageId ());
   
    TDfsFileConnector dfsFileConnector = this.createFileConnector (fileHandlerResponsePayload.getFileHandler());
   
    this.pendingRequests.succeed(token.getMessageId(), dfsFileConnector);
  }
View Full Code Here

  }
 
  @Override
  public CallbackCompletion<Void> ack (final long delivery, final boolean multiple)
  {
    final CompletionToken token = this.generateToken ();
    this.transcript.traceDebugging ("acknowledging the message `%l` (with multiple `%b`) (with request token `%s`)...", Long.valueOf (delivery), Boolean.valueOf (multiple), token.getMessageId ());
    final AmqpPayloads.Ack.Builder requestBuilder = AmqpPayloads.Ack.newBuilder ();
    requestBuilder.setToken (token);
    requestBuilder.setDelivery (delivery);
    requestBuilder.setMultiple (multiple);
    final Message message = new Message (AmqpMessage.ACK, requestBuilder.build ());
View Full Code Here

  public CallbackCompletion<Void> bindQueue (final String exchange, final String queue, final String routingKey)
  {
    Preconditions.checkNotNull (exchange);
    Preconditions.checkNotNull (queue);
    Preconditions.checkNotNull (routingKey);
    final CompletionToken token = this.generateToken ();
    this.transcript.traceDebugging ("binding the queue `%s` to the exchange `%s` with the routing key `%s` (with request token `%s`)...", queue, exchange, routingKey, token.getMessageId ());
    final AmqpPayloads.BindQueueRequest.Builder requestBuilder = AmqpPayloads.BindQueueRequest.newBuilder ();
    requestBuilder.setToken (token);
    requestBuilder.setExchange (exchange);
    requestBuilder.setQueue (queue);
    requestBuilder.setRoutingKey (routingKey);
View Full Code Here

 
  @Override
  public CallbackCompletion<Void> cancel (final String consumer)
  {
    Preconditions.checkNotNull (consumer);
    final CompletionToken token = this.generateToken ();
    this.transcript.traceDebugging ("canceling the consumer `%s` (with request token `%s`)...", consumer, token.getMessageId ());
    final AmqpPayloads.CancelRequest.Builder requestBuilder = AmqpPayloads.CancelRequest.newBuilder ();
    requestBuilder.setToken (token);
    requestBuilder.setConsumer (consumer);
    final Message message = new Message (AmqpMessage.CANCEL_REQUEST, requestBuilder.build ());
    final CallbackCompletionDeferredFuture<Void> consumeFuture = CallbackCompletionDeferredFuture.create (Void.class);
View Full Code Here

  public CallbackCompletion<Void> consume (final String queue, final String consumer, final boolean exclusive, final boolean autoAck, final IAmqpQueueRawConsumerCallback consumerCallback)
  {
    Preconditions.checkNotNull (queue);
    Preconditions.checkNotNull (consumer);
    Preconditions.checkNotNull (consumerCallback);
    final CompletionToken token = this.generateToken ();
    this.transcript.traceDebugging ("registering the consumer `%s` for queue `%s` (with exclusive `%b`, auto-acknowledge `%b`, and callbacks `%{object:identity}`) (with request token `%s`)...", consumer, queue, Boolean.valueOf (exclusive), Boolean.valueOf (autoAck), consumerCallback, token.getMessageId ());
    final AmqpPayloads.ConsumeRequest.Builder requestBuilder = AmqpPayloads.ConsumeRequest.newBuilder ();
    requestBuilder.setToken (token);
    requestBuilder.setQueue (queue);
    requestBuilder.setConsumer (consumer);
    requestBuilder.setExclusive (exclusive);
View Full Code Here

TOP

Related Classes of eu.mosaic_cloud.platform.interop.idl.IdlCommon.CompletionToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.