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

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


  @Override
  public CallbackCompletion<Void> declareExchange (final String name, final AmqpExchangeType type, final boolean durable, final boolean autoDelete, final boolean passive)
  {
    Preconditions.checkNotNull (name);
    Preconditions.checkNotNull (type);
    final CompletionToken token = this.generateToken ();
    final ExchangeType eType = AmqpPayloads.DeclareExchangeRequest.ExchangeType.valueOf (type.toString ().toUpperCase ());
    this.transcript.traceDebugging ("declaring the exchange `%s` of type `%s` (with durable `%b`, auto-delete `%b`, and passive `%b`) (with request token `%s`)...", name, type, Boolean.valueOf (durable), Boolean.valueOf (autoDelete), Boolean.valueOf (passive), token.getMessageId ());
    final AmqpPayloads.DeclareExchangeRequest.Builder requestBuilder = AmqpPayloads.DeclareExchangeRequest.newBuilder ();
    requestBuilder.setToken (token);
    requestBuilder.setExchange (name);
    requestBuilder.setType (eType);
    requestBuilder.setDurable (durable);
View Full Code Here


 
  @Override
  public CallbackCompletion<Void> declareQueue (final String queue, final boolean exclusive, final boolean durable, final boolean autoDelete, final boolean passive)
  {
    Preconditions.checkNotNull (queue);
    final CompletionToken token = this.generateToken ();
    this.transcript.traceDebugging ("declaring the queue `%s` (with exclusive `%b`, durable `%b`, auto-delete `%b`, and passive `%b`) (with request token `%s`)...", queue, Boolean.valueOf (exclusive), Boolean.valueOf (durable), Boolean.valueOf (autoDelete), Boolean.valueOf (passive), Boolean.valueOf (passive), token.getMessageId ());
    final AmqpPayloads.DeclareQueueRequest.Builder requestBuilder = AmqpPayloads.DeclareQueueRequest.newBuilder ();
    requestBuilder.setToken (token);
    requestBuilder.setQueue (queue);
    requestBuilder.setExclusive (exclusive);
    requestBuilder.setDurable (durable);
View Full Code Here

 
  @Override
  public CallbackCompletion<Void> get (final String queue, final boolean autoAck)
  {
    Preconditions.checkNotNull (queue);
    final CompletionToken token = this.generateToken ();
    this.transcript.traceDebugging ("pulling one message from the queue `%s` (with auto-acknowledge `%b`) (with request token `%s`)...", queue, Boolean.valueOf (autoAck), token.getMessageId ());
    final AmqpPayloads.GetRequest.Builder requestBuilder = AmqpPayloads.GetRequest.newBuilder ();
    requestBuilder.setToken (token);
    requestBuilder.setQueue (queue);
    requestBuilder.setAutoAck (autoAck);
    final Message message = new Message (AmqpMessage.GET_REQUEST, requestBuilder.build ());
View Full Code Here

  public CallbackCompletion<Void> publish (final byte[] data, final String exchange, final String routingKey, final String contentType, final String contentEncoding, final boolean mandatory, final boolean immediate, final boolean durable, final String correlation, final String callback)
  {
    Preconditions.checkNotNull (data);
    Preconditions.checkNotNull (exchange);
    Preconditions.checkNotNull (routingKey);
    final CompletionToken token = this.generateToken ();
    this.transcript.traceDebugging ("publishing a message (of size `%d`) to exchange `%s` with routing key `%s` (with content-type `%s`, content-encoding `%s`, mandatory `%b`, immediate `%b`, durable `%b`, correlation `%s`, and callback `%s`) (with request token `%s`)", Integer.valueOf (data.length), exchange, routingKey, contentType, contentEncoding, Boolean.valueOf (mandatory), Boolean.valueOf (immediate), Boolean.valueOf (durable), correlation, callback, token.getMessageId ());
    final AmqpPayloads.PublishRequest.Builder requestBuilder = AmqpPayloads.PublishRequest.newBuilder ();
    requestBuilder.setToken (token);
    requestBuilder.setExchange (exchange);
    requestBuilder.setRoutingKey (routingKey);
    requestBuilder.setData (ByteString.copyFrom (data));
View Full Code Here

  {
    final AmqpMessage amqpMessage = (AmqpMessage) message.specification;
    switch (amqpMessage) {
      case OK : {
        final IdlCommon.Ok okPayload = (Ok) message.payload;
        final CompletionToken token = okPayload.getToken ();
        this.transcript.traceDebugging ("processing the success (OK) response for pending request with token `%s`...", token.getMessageId ());
        this.pendingRequests.succeed (token.getMessageId (), null);
      }
        break;
      case NOK : {
        final IdlCommon.NotOk nokPayload = (NotOk) message.payload;
        final CompletionToken token = nokPayload.getToken ();
        this.transcript.traceDebugging ("processing the failure (NOK) response for pending request with token `%s`...", token.getMessageId ());
        this.pendingRequests.fail (token.getMessageId (), new Exception ("request failed"));
      }
        break;
      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 CONSUME_REPLY : {
        final AmqpPayloads.ConsumeReply consumePayload = (ConsumeReply) message.payload;
        final CompletionToken token = consumePayload.getToken ();
        this.transcript.traceDebugging ("processing the success (consumer reply) response for pending request with token `%s`...", token.getMessageId ());
        this.pendingRequests.succeed (token.getMessageId (), null);
      }
        break;
      case CANCEL_OK : {
        final AmqpPayloads.CancelOkMessage cancelOkPayload = (CancelOkMessage) message.payload;
        final String consumerIdentifier = cancelOkPayload.getConsumerTag ();
View Full Code Here

    return null;
  }

  private void receivedFSMessage(Session session, Message message) {
    final DFSMessage type = (DFSMessage) message.specification;
    CompletionToken token = null;
    Object result;
    String path;
    String from;
    String to;
   
View Full Code Here


  private void receivedHandlerMessage(Session session, Message message) {
   
    final DFSHandlerMessage type = (DFSHandlerMessage) message.specification;
    CompletionToken token = null;
    AbstractFileHandlerDriver driver = null;
    Object result;
   
    switch (type)
    {
View Full Code Here

  @Override
  public CallbackCompletion<Void> destroy ()
  {
    this.transcript.traceDebugging ("destroying the proxy...");
    final CompletionToken token = this.generateToken ();
    final AbortRequest.Builder requestBuilder = AbortRequest.newBuilder ();
    requestBuilder.setToken (token);
    return (this.disconnect (new Message (DFSMessage.ABORTED, requestBuilder.build ())));
  }
View Full Code Here

  }
 
  @Override
  public CallbackCompletion<Void> removeFile(String fullPath) {
   
    final CompletionToken token = this.generateToken();
    this.transcript.traceDebugging ("Deleting file `%s` (with request token `%s`)...", fullPath, token.getMessageId ());
   
    final DFSPayloads.RemoveFile.Builder removeFileBuilder = DFSPayloads.RemoveFile.newBuilder();
    removeFileBuilder.setToken(token);
    removeFileBuilder.setFullPath(fullPath);
    final Message message = new Message(DFSMessage.REMOVE_FILE, removeFileBuilder.build());
View Full Code Here

  }

  @Override
  public CallbackCompletion<Void> removeDirectory(String fullPath) {
   
    final CompletionToken token = this.generateToken();
    this.transcript.traceDebugging ("Deleting directory `%s` (with request token `%s`)...", fullPath, token.getMessageId ());
   
    final DFSPayloads.RemoveDir.Builder removeDirBuilder = DFSPayloads.RemoveDir.newBuilder();
    removeDirBuilder.setToken(token);
    removeDirBuilder.setFullPath(fullPath);
    final Message message = new Message(DFSMessage.REMOVE_DIR, removeDirBuilder.build());
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.