Package eu.mosaic_cloud.components.core

Examples of eu.mosaic_cloud.components.core.ComponentCallReply


        }
        final String channelId = ConfigUtils.resolveParameter (this.getDriverConfiguration (), "interop.driver.identifier", String.class, "");
        final Map<String, String> outcome = new HashMap<String, String> ();
        outcome.put ("channelEndpoint", channelEndpoint);
        outcome.put ("channelIdentifier", channelId);
        final ComponentCallReply reply = ComponentCallReply.create (true, outcome, ByteBuffer.allocate (0), request.reference);
        component.callReturn (reply);
      } else {
        throw new UnsupportedOperationException ();
      }
    } else {
View Full Code Here


      final ComponentCallRequest inboundRequest = (ComponentCallRequest) componentCallbacks.queue.poll (BasicComponentTest.defaultPollTimeout, TimeUnit.MILLISECONDS);
      Assert.assertNotNull (inboundRequest);
      Assert.assertEquals (outboundRequest.operation, inboundRequest.operation);
      Assert.assertEquals (outboundRequest.inputs, inboundRequest.inputs);
      Assert.assertEquals (outboundRequest.data, inboundRequest.data);
      final ComponentCallReply outboundReply = RandomMessageGenerator.defaultInstance.generateComponentCallReply (inboundRequest);
      Assert.assertTrue (componentController.callReturn (outboundReply).await (BasicComponentTest.defaultPollTimeout));
      final ComponentCallReply inboundReply = (ComponentCallReply) componentCallbacks.queue.poll (BasicComponentTest.defaultPollTimeout, TimeUnit.MILLISECONDS);
      Assert.assertNotNull (inboundReply);
      Assert.assertEquals (outboundRequest.reference, inboundReply.reference);
      Assert.assertEquals (outboundRequest.inputs, inboundReply.outputsOrError);
      Assert.assertEquals (outboundRequest.data, inboundReply.data);
    }
View Full Code Here

    for (int index = 0; index < AbacusTest.defaultTries; index++) {
      final double operandA = (int) (Math.random () * 10);
      final double operandB = (int) (Math.random () * 10);
      final ComponentCallRequest request = ComponentCallRequest.create ("+", Arrays.asList (Double.valueOf (operandA), Double.valueOf (operandB)), ByteBuffer.allocate (0), ComponentCallReference.create ());
      Assert.assertTrue (clientComponentController.call (peer, request).await (AbacusTest.defaultPollTimeout));
      final ComponentCallReply reply = (ComponentCallReply) clientComponentCallbacks.queue.poll (AbacusTest.defaultPollTimeout, TimeUnit.MILLISECONDS);
      Assert.assertNotNull (reply);
      Assert.assertTrue (reply.ok);
      Assert.assertNotNull (reply.outputsOrError);
      Assert.assertEquals (request.reference, reply.reference);
      Assert.assertTrue ((operandA + operandB) == ((Number) reply.outputsOrError).doubleValue ());
View Full Code Here

          this.exceptions.traceIgnoredException (exception);
          return (null);
        }
      } else
        throw (new IllegalArgumentException ());
      final ComponentCallReply reply = ComponentCallReply.create (true, Double.valueOf (outcome), ByteBuffer.allocate (0), request.reference);
      component.callReturn (reply);
    }
    return (null);
  }
View Full Code Here

      Preconditions.checkArgument (correlationValue instanceof String, "invalid correlation attribute `%s`", correlationValue);
      final String correlation = (String) correlationValue;
      final Object okValue = message.metaData.get (Token.Ok.string);
      Preconditions.checkNotNull (okValue, "missing ok attribute");
      Preconditions.checkArgument (okValue instanceof Boolean, "invalid ok attribute `%s`", okValue);
      final ComponentCallReply reply;
      if (Boolean.TRUE.equals (okValue)) {
        final Object outputsValue = message.metaData.get (Token.Outputs.string);
        Preconditions.checkArgument (message.metaData.containsKey (Token.Outputs.string), "missing outputs attribute");
        Preconditions.checkArgument (this.outboundCalls.inverse ().containsKey (correlation), "mismatched correlation attribute `%s`", correlation);
        final ComponentCallReference reference = this.outboundCalls.inverse ().remove (correlation);
View Full Code Here

        }
        final String channelId = ConfigUtils.resolveParameter (this.getDriverConfiguration (), ConfigProperties.getString ("KVDriverComponentCallbacks.4"), String.class, ""); // $NON-NLS-1$
        final Map<String, String> outcome = new HashMap<String, String> ();
        outcome.put ("channelEndpoint", channelEndpoint);
        outcome.put ("channelIdentifier", channelId);
        final ComponentCallReply reply = ComponentCallReply.create (true, outcome, ByteBuffer.allocate (0), request.reference);
        component.callReturn (reply);
      } else {
        throw new UnsupportedOperationException ();
      }
    } else {
View Full Code Here

        }
        final String channelId = ConfigUtils.resolveParameter (this.getDriverConfiguration (), ConfigProperties.getString ("AmqpDriverComponentCallbacks.4"), String.class, ""); // $NON-NLS-1$
        final Map<String, String> outcome = new HashMap<String, String> ();
        outcome.put ("channelEndpoint", channelEndpoint);
        outcome.put ("channelIdentifier", channelId);
        final ComponentCallReply reply = ComponentCallReply.create (true, outcome, ByteBuffer.allocate (0), request.reference);
        component.callReturn (reply);
      } else {
        throw new UnsupportedOperationException ();
      }
    } else {
View Full Code Here

      CloudletComponent.this.fsm.new FsmFutureCompletionAccess<ComponentCallReply> () {
        @Override
        protected final Void execute (final Future<ComponentCallReply> future1)
        {
          Preconditions.checkState (future == future1);
          final ComponentCallReply reply;
          try {
            reply = future.get ();
          } catch (final Throwable exception) {
            // FIXME: should call callbacks with failure
            CloudletComponent.this.exceptions.traceIgnoredException (exception, "resolving the interoperability channel endpoint for target `%s` failed; ignoring!", target);
View Full Code Here

      return (CloudletComponent.this.fsm.new FsmCallbackAccess () {
        @Override
        protected final CallbackCompletion<Void> execute ()
        {
          CloudletComponent.this.transcript.traceError ("called the cloudlet component with an unsupported operation `%s` and reference `%{object:identity}`; returning failure!", request.operation, request.reference);
          final ComponentCallReply reply = ComponentCallReply.create (false, "unsupported-call", request.reference);
          CloudletComponent.this.componentControllerProxy.callReturn (reply);
          return (CallbackCompletion.createOutcome ());
        }
      }.trigger ());
    }
View Full Code Here

      CloudletComponent.this.fsm.new FsmFutureCompletionAccess<ComponentCallReply> () {
        @Override
        protected final Void execute (final Future<ComponentCallReply> future1)
        {
          Preconditions.checkState (future == future1);
          final ComponentCallReply reply;
          try {
            reply = future.get ();
          } catch (final Throwable exception) {
            CloudletComponent.this.exceptions.traceDeferredException (exception, "calling to the component `%s` with operation `%s` failed; deferring!", component.string, operation);
            completionFuture.trigger.triggerFailed (exception);
View Full Code Here

TOP

Related Classes of eu.mosaic_cloud.components.core.ComponentCallReply

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.