Package net.kuujo.vertigo.component

Examples of net.kuujo.vertigo.component.InstanceContext


  /**
   * Creates a component instance for the current Vert.x instance.
   */
  public static Component createComponent(Vertx vertx, Container container) {
    InstanceContext context = parseContext(container.config());
    return new DefaultComponentFactory().setVertx(vertx).setContainer(container).createComponent(context, new DefaultCluster(context.component().network().cluster(), vertx, container));
  }
View Full Code Here


      instances.clear();
    } else {
      Iterator<DefaultInstanceContext> iter = instances.iterator();
      while (iter.hasNext()) {
        DefaultInstanceContext instance = iter.next();
        InstanceContext match = null;
        for (InstanceContext i : update.instances()) {
          if (instance.equals(i)) {
            match = i;
            break;
          }
View Full Code Here

      ComponentContext<?> component = network.component(curi.getComponent());
      if (component == null) {
        throw new IllegalArgumentException("The URI component " + curi.getComponent() + " does not exist in the given network configuration");
      }
      if (curi.hasInstance()) {
        InstanceContext instance = component.instance(curi.getInstance());
        if (instance == null) {
          throw new IllegalArgumentException("The URI instance " + curi.getInstance() + " does not exist in the given component configuration");
        }
        if (curi.hasEndpoint()) {
          switch (curi.getEndpoint()) {
            case ContextUri.ENDPOINT_IN:
              InputContext input = instance.input();
              if (curi.hasPort()) {
                InputPortContext inPort = input.port(curi.getPort());
                if (inPort == null) {
                  throw new IllegalArgumentException("The URI port " + curi.getPort() + " does not exist in the given input configuration");
                }
                return (T) inPort;
              }
              return (T) input;
            case ContextUri.ENDPOINT_OUT:
              OutputContext output = instance.output();
              if (curi.hasPort()) {
                OutputPortContext outPort = output.port(curi.getPort());
                if (outPort == null) {
                  throw new IllegalArgumentException("The URI port " + curi.getPort() + " does not exist in the given output configuration");
                }
View Full Code Here

                .addInstance(DefaultInstanceContext.Builder.newBuilder()
                    .setAddress("test.test-1")
                    .setStatusAddress("test.test-1.__status")
                    .setInput(DefaultInputContext.Builder.newBuilder().build())
                    .setOutput(DefaultOutputContext.Builder.newBuilder().build()).build()).build()).build();
        final InstanceContext instance = context.component("test").instances().iterator().next();

        final Cluster cluster = new DefaultCluster("vertigo", vertx, container);
        final WatchableAsyncMap<String, String> data = new WrappedWatchableAsyncMap<String, String>(cluster.<String, String>getMap("test"), vertx);

        data.put(instance.address(), Contexts.serialize(instance).encode(), new Handler<AsyncResult<String>>() {
          @Override
          public void handle(AsyncResult<String> result) {
            if (result.failed()) {
              fail(result.cause().getMessage());
            } else {
View Full Code Here

                .addInstance(DefaultInstanceContext.Builder.newBuilder()
                    .setAddress("test.test-1")
                    .setStatusAddress("test.test-1.__status")
                    .setInput(DefaultInputContext.Builder.newBuilder().build())
                    .setOutput(DefaultOutputContext.Builder.newBuilder().build()).build()).build()).build();
        final InstanceContext instance = context.component("test").instances().iterator().next();

        final Cluster cluster = new DefaultCluster("vertigo", vertx, container);
        final WatchableAsyncMap<String, String> data = new WrappedWatchableAsyncMap<String, String>(cluster.<String, String>getMap("test"), vertx);

        data.put(instance.address(), Contexts.serialize(instance).encode(), new Handler<AsyncResult<String>>() {
          @Override
          public void handle(AsyncResult<String> result) {
            if (result.failed()) {
              fail(result.cause().getMessage());
            } else {
View Full Code Here

                .addInstance(DefaultInstanceContext.Builder.newBuilder()
                    .setAddress("test.test-1")
                    .setStatusAddress("test.test-1.__status")
                    .setInput(DefaultInputContext.Builder.newBuilder().build())
                    .setOutput(DefaultOutputContext.Builder.newBuilder().build()).build()).build()).build();
        final InstanceContext instance = context.component("test").instances().iterator().next();

        final Cluster cluster = new DefaultCluster("vertigo", vertx, container);
        final WatchableAsyncMap<String, String> data = new WrappedWatchableAsyncMap<String, String>(cluster.<String, String>getMap("test"), vertx);

        data.put(instance.address(), Contexts.serialize(instance).encode(), new Handler<AsyncResult<String>>() {
          @Override
          public void handle(AsyncResult<String> result) {
            if (result.failed()) {
              fail(result.cause().getMessage());
            } else {
View Full Code Here

TOP

Related Classes of net.kuujo.vertigo.component.InstanceContext

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.