// Path: nicobar-manager/src/main/java/com/netflix/nicobar/manager/rest/GsonMessageBodyHandler.java
// @Provider
// @Produces(MediaType.APPLICATION_JSON)
// @Consumes(MediaType.APPLICATION_JSON)
// public final class GsonMessageBodyHandler implements MessageBodyWriter<Object>, MessageBodyReader<Object> {
// 
//     private Gson gson;
// 
//     @Override
//     public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
//         return true;
//     }
// 
//     @Override
//     public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) {
//         InputStreamReader streamReader = new InputStreamReader(entityStream, Charsets.UTF_8);
//         try {
//             Type jsonType;
//             if (type.equals(genericType)) {
//                 jsonType = type;
//             } else {
//                 jsonType = genericType;
//             }
//             return getGson().fromJson(streamReader, jsonType);
//         } finally {
//             IOUtils.closeQuietly(streamReader);
//         }
//     }
// 
//     @Override
//     public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
//         return true;
//     }
// 
//     @Override
//     public long getSize(Object object, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
//         return -1;
//     }
// 
//     @Override
//     public void writeTo(Object object, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
//         OutputStreamWriter writer = new OutputStreamWriter(entityStream, Charsets.UTF_8);
//         try {
//             Type jsonType;
//             if (type.equals(genericType)) {
//                 jsonType = type;
//             } else {
//                 jsonType = genericType;
//             }
//             getGson().toJson(object, jsonType, writer);
//         } finally {
//             IOUtils.closeQuietly(writer);
//         }
//     }
// 
//     protected Gson getGson() {
//         if (gson == null) {
//             final GsonBuilder gsonBuilder = new GsonBuilder();
//             gson = gsonBuilder.create();
//         }
//         return gson;
//     }
// }


import com.sun.jersey.api.core.PackagesResourceConfig;
import com.sun.jersey.guice.JerseyServletModule;
import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.Scopes;
import com.google.inject.name.Names;
import com.netflix.explorers.AppConfigGlobalModelContext;
import com.netflix.explorers.ExplorerManager;
import com.netflix.explorers.ExplorersManagerImpl;
import com.netflix.explorers.context.GlobalModelContext;
import com.netflix.governator.guice.LifecycleInjectorBuilder;
import com.netflix.karyon.server.ServerBootstrap;
import com.netflix.nicobar.manager.rest.GsonMessageBodyHandler;
/*
 * Copyright 2013 Netflix, 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.netflix.nicobar.manager.explorer;




public class ScriptManagerBootstrap extends ServerBootstrap {
    private static final Logger LOG = LoggerFactory.getLogger(ScriptManagerBootstrap.class);

    @Override
    protected void beforeInjectorCreation(@SuppressWarnings("unused") LifecycleInjectorBuilder builderToBeUsed) {

       JerseyServletModule jerseyServletModule = new JerseyServletModule() {
            @Override
            protected void configureServlets() {
                bind(String.class).annotatedWith(Names.named("explorerAppName")).toInstance("scriptmanager");
// Path: nicobar-manager/src/main/java/com/netflix/nicobar/manager/rest/GsonMessageBodyHandler.java
// @Provider
// @Produces(MediaType.APPLICATION_JSON)
// @Consumes(MediaType.APPLICATION_JSON)
// public final class GsonMessageBodyHandler implements MessageBodyWriter<Object>, MessageBodyReader<Object> {
// 
//     private Gson gson;
// 
//     @Override
//     public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
//         return true;
//     }
// 
//     @Override
//     public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) {
//         InputStreamReader streamReader = new InputStreamReader(entityStream, Charsets.UTF_8);
//         try {
//             Type jsonType;
//             if (type.equals(genericType)) {
//                 jsonType = type;
//             } else {
//                 jsonType = genericType;
//             }
//             return getGson().fromJson(streamReader, jsonType);
//         } finally {
//             IOUtils.closeQuietly(streamReader);
//         }
//     }
// 
//     @Override
//     public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
//         return true;
//     }
// 
//     @Override
//     public long getSize(Object object, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
//         return -1;
//     }
// 
//     @Override
//     public void writeTo(Object object, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
//         OutputStreamWriter writer = new OutputStreamWriter(entityStream, Charsets.UTF_8);
//         try {
//             Type jsonType;
//             if (type.equals(genericType)) {
//                 jsonType = type;
//             } else {
//                 jsonType = genericType;
//             }
//             getGson().toJson(object, jsonType, writer);
//         } finally {
//             IOUtils.closeQuietly(writer);
//         }
//     }
// 
//     protected Gson getGson() {
//         if (gson == null) {
//             final GsonBuilder gsonBuilder = new GsonBuilder();
//             gson = gsonBuilder.create();
//         }
//         return gson;
//     }
// }


// Path: nicobar-manager/src/main/java/com/netflix/nicobar/manager/explorer/ScriptManagerBootstrap.java
import com.sun.jersey.api.core.PackagesResourceConfig;
import com.sun.jersey.guice.JerseyServletModule;
import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.Scopes;
import com.google.inject.name.Names;
import com.netflix.explorers.AppConfigGlobalModelContext;
import com.netflix.explorers.ExplorerManager;
import com.netflix.explorers.ExplorersManagerImpl;
import com.netflix.explorers.context.GlobalModelContext;
import com.netflix.governator.guice.LifecycleInjectorBuilder;
import com.netflix.karyon.server.ServerBootstrap;
import com.netflix.nicobar.manager.rest.GsonMessageBodyHandler;

/*
 * Copyright 2013 Netflix, 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.netflix.nicobar.manager.explorer;




public class ScriptManagerBootstrap extends ServerBootstrap {
    private static final Logger LOG = LoggerFactory.getLogger(ScriptManagerBootstrap.class);

    @Override
    protected void beforeInjectorCreation(@SuppressWarnings("unused") LifecycleInjectorBuilder builderToBeUsed) {

       JerseyServletModule jerseyServletModule = new JerseyServletModule() {
            @Override
            protected void configureServlets() {
                bind(String.class).annotatedWith(Names.named("explorerAppName")).toInstance("scriptmanager");
                bind(GsonMessageBodyHandler.class).in(Scopes.SINGLETON);