// Path: src/main/java/org/jruby/jubilee/vertx/JubileeVertx.java
// public class JubileeVertx {
//     public static Vertx vertx;
// 
//     private JubileeVertx() {
//     }
// 
//     public static void init(Vertx vertx) {
//         JubileeVertx.vertx = vertx;
//     }
// 
//     public synchronized static Vertx vertx() {
//         if (JubileeVertx.vertx == null)
//             throw new RuntimeException("vertx is not initialized, do you run in jubilee server?");
//         return JubileeVertx.vertx;
//     }
// }


import io.vertx.core.*;
import io.vertx.core.json.JsonObject;
import org.jruby.*;
import org.jruby.anno.JRubyMethod;
import org.jruby.jubilee.vertx.JubileeVertx;
import org.jruby.runtime.Block;
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
package org.jruby.jubilee;



/**
 * Created by isaiah on 23/01/2014.
 */
public class RubyPlatformManager extends RubyObject {
    private RubyHash options;
    private Vertx vertx;
    private String deploymentID;

    public static void createPlatformManagerClass(Ruby runtime) {
        RubyModule mJubilee = runtime.defineModule("Jubilee");
        RubyClass serverClass = mJubilee.defineClassUnder("PlatformManager", runtime.getObject(), ALLOCATOR);
        serverClass.defineAnnotatedMethods(RubyPlatformManager.class);
    }

    private static ObjectAllocator ALLOCATOR = new ObjectAllocator() {
        public IRubyObject allocate(Ruby ruby, RubyClass rubyClass) {
            return new RubyPlatformManager(ruby, rubyClass);
        }
    };

    public RubyPlatformManager(Ruby ruby, RubyClass rubyClass) {
        super(ruby, rubyClass);
    }

    @JRubyMethod
    public IRubyObject initialize(ThreadContext context, IRubyObject config) {
        this.options = config.convertToHash();
        Ruby runtime = context.runtime;
        RubySymbol clustered_k = runtime.newSymbol("clustered");
        RubySymbol cluster_host_k = runtime.newSymbol("cluster_host");
        RubySymbol cluster_port_k = runtime.newSymbol("cluster_port");

        VertxOptions vertxOptions = new VertxOptions();
// Path: src/main/java/org/jruby/jubilee/vertx/JubileeVertx.java
// public class JubileeVertx {
//     public static Vertx vertx;
// 
//     private JubileeVertx() {
//     }
// 
//     public static void init(Vertx vertx) {
//         JubileeVertx.vertx = vertx;
//     }
// 
//     public synchronized static Vertx vertx() {
//         if (JubileeVertx.vertx == null)
//             throw new RuntimeException("vertx is not initialized, do you run in jubilee server?");
//         return JubileeVertx.vertx;
//     }
// }


// Path: src/main/java/org/jruby/jubilee/RubyPlatformManager.java
import io.vertx.core.*;
import io.vertx.core.json.JsonObject;
import org.jruby.*;
import org.jruby.anno.JRubyMethod;
import org.jruby.jubilee.vertx.JubileeVertx;
import org.jruby.runtime.Block;
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;

package org.jruby.jubilee;



/**
 * Created by isaiah on 23/01/2014.
 */
public class RubyPlatformManager extends RubyObject {
    private RubyHash options;
    private Vertx vertx;
    private String deploymentID;

    public static void createPlatformManagerClass(Ruby runtime) {
        RubyModule mJubilee = runtime.defineModule("Jubilee");
        RubyClass serverClass = mJubilee.defineClassUnder("PlatformManager", runtime.getObject(), ALLOCATOR);
        serverClass.defineAnnotatedMethods(RubyPlatformManager.class);
    }

    private static ObjectAllocator ALLOCATOR = new ObjectAllocator() {
        public IRubyObject allocate(Ruby ruby, RubyClass rubyClass) {
            return new RubyPlatformManager(ruby, rubyClass);
        }
    };

    public RubyPlatformManager(Ruby ruby, RubyClass rubyClass) {
        super(ruby, rubyClass);
    }

    @JRubyMethod
    public IRubyObject initialize(ThreadContext context, IRubyObject config) {
        this.options = config.convertToHash();
        Ruby runtime = context.runtime;
        RubySymbol clustered_k = runtime.newSymbol("clustered");
        RubySymbol cluster_host_k = runtime.newSymbol("cluster_host");
        RubySymbol cluster_port_k = runtime.newSymbol("cluster_port");

        VertxOptions vertxOptions = new VertxOptions();
        long maxEventLoopExecuteTime = 6000000000L;