@@ -0,0 +1,3149 @@
+/*%0A * Copyright 2013 the original author or authors.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage net.kuujo.vertigo.util;%0A%0Aimport org.vertx.java.core.Vertx;%0Aimport org.vertx.java.platform.Container;%0A%0Aimport net.kuujo.vertigo.Vertigo;%0Aimport net.kuujo.vertigo.VertigoFactory;%0Aimport net.kuujo.vertigo.component.ComponentFactory;%0Aimport net.kuujo.vertigo.component.impl.DefaultComponentFactory;%0Aimport net.kuujo.vertigo.context.InstanceContext;%0Aimport net.kuujo.vertigo.impl.DefaultVertigoFactory;%0A%0A/**%0A * Static Vertigo instance for language bindings.%0A *%0A * @author Jordan Halterman%0A */%0A@SuppressWarnings(%7B%22unchecked%22, %22rawtypes%22%7D)%0Apublic final class Static %7B%0A  private static Vertigo vertigo;%0A%0A  private static void init(Vertx vertx, Container container) %7B%0A    if (vertigo == null) %7B%0A      VertigoFactory vertigoFactory = new DefaultVertigoFactory(vertx, container);%0A      InstanceContext context = Context.parseContext(container.config());%0A      if (context != null) %7B%0A        ComponentFactory componentFactory = new DefaultComponentFactory(vertx, container);%0A        net.kuujo.vertigo.component.Component component = componentFactory.createComponent(context);%0A        vertigo = vertigoFactory.createVertigo(component);%0A      %7D%0A      else %7B%0A        vertigo = vertigoFactory.createVertigo();%0A      %7D%0A    %7D%0A  %7D%0A%0A  /**%0A   * Gets the current Vertigo instance.%0A   *%0A   * @param vertx%0A   *   A Vert.x instance with which to construct the Vertigo instance if necessary.%0A   * @param container%0A   *   A Container instance with which to construct the Vertigo instance if necessary.%0A   * @return%0A   *   A Vertigo instance.%0A   */%0A  public static Vertigo vertigo(Vertx vertx, Container container) %7B%0A    init(vertx, container);%0A    return vertigo;%0A  %7D%0A%0A  /**%0A   * Gets the current component type as a string.%0A   *%0A   * @return%0A   *   The current component type as a string, or null if the current context%0A   *   is not a Vertigo component.%0A   */%0A  public static String type() %7B%0A    InstanceContext context = context();%0A    if (context != null) %7B%0A      return Component.serializeType(context.getComponent().getType());%0A    %7D%0A    return null;%0A  %7D%0A%0A  /**%0A   * Gets the current instance context.%0A   *%0A   * @return%0A   *   The current instance context or null if the current context is not a component.%0A   */%0A  public static InstanceContext context() %7B%0A    return vertigo.context();%0A  %7D%0A%0A  /**%0A   * Gets the current component.%0A   *%0A   * @return%0A   *   The current verticle component or null if the current context is not a component.%0A   */%0A  public static net.kuujo.vertigo.component.Component component() %7B%0A    return vertigo.component();%0A  %7D%0A%0A%7D%0A

Add static helpers for working with Vertigo and Component instances.