/**
 * Copyright (C) 2012 Ness Computing, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.nesscomputing.jmx;

import java.lang.management.ManagementFactory;

import javax.management.MBeanServer;

import org.weakref.jmx.MBeanExporter;
import org.weakref.jmx.guice.MBeanModule;

import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Scopes;
import com.google.inject.Singleton;
import com.nesscomputing.lifecycle.Lifecycle;

/**
 * Sets up JMX bindings.  Specifically, binds an {@link MBeanExporter}
 * that records all bindings made and will automagically unbind them at
 * {@link Lifecycle} STOP_STAGE.
 */

public class JmxModule extends AbstractModule
{
    @Override
    protected void configure()
    {
        bind(MBeanExporter.class).to(LifecycledMBeanExporter.class).in(Scopes.SINGLETON);

        // Ensure that the InternalMBeanModule gets installed, otherwise none of the
        // jmxutils bindings will show up.
        install (new MBeanModule());
    }

    @Provides
    @Singleton
    public MBeanServer getPlatformMBeanServer()
    {
        return ManagementFactory.getPlatformMBeanServer();
    }
}

@@ -838,16 +838,82 @@
 Module;%0A
+import com.google.inject.Binder;%0Aimport com.google.inject.Module;%0A
 import c
@@ -935,24 +935,24 @@
 t.Provides;%0A
-
 import com.g
@@ -1008,16 +1008,55 @@
 gleton;%0A
+import com.google.inject.util.Modules;%0A
 import c
@@ -1386,16 +1386,182 @@
         
+install(Modules.override(new MBeanModule()).with(new Module() %7B%0A            @Override%0A            public void configure(final Binder binder) %7B%0A                binder.
 bind(MBe
@@ -1634,25 +1634,24 @@
 LETON);%0A
-%0A
         
 // Ensur
@@ -1646,161 +1646,23 @@
     
-// Ensure that the InternalMBeanModule gets installed, otherwise none of the%0A        // jmxutils bindings will show up.%0A        install (new MBeanModule(
+    %7D%0A        %7D
 ));%0A

Fix for jmxutils 1.14