package org.eurekaclinical.user.webapp.config;

/*-
 * #%L
 * Eureka! Clinical User
 * %%
 * Copyright (C) 2016 Emory University
 * %%
 * 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.
 * #L%
 */
import com.google.inject.Injector;
import com.google.inject.Module;
import com.google.inject.servlet.GuiceServletContextListener;

import javax.servlet.ServletContextEvent;
import org.eurekaclinical.common.config.ApiGatewayServletModule;
import org.eurekaclinical.common.config.ClientSessionListener;

import org.eurekaclinical.common.config.InjectorSupport;

/**
 *
 * @author miaoai
 */
public class UserWebappListener extends GuiceServletContextListener {

    private final UserWebappProperties userWebAppProperties;
    private Injector injector;

    public UserWebappListener() {
        this.userWebAppProperties = new UserWebappProperties();
    }

    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        super.contextInitialized(servletContextEvent);
        servletContextEvent.getServletContext().addListener(
                new ClientSessionListener());
        servletContextEvent.getServletContext().setAttribute(
                "userWebAppProperties", this.userWebAppProperties);
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        super.contextDestroyed(servletContextEvent);
        servletContextEvent.getServletContext().removeAttribute(
                "userWebAppProperties");
    }

    @Override
    protected Injector getInjector() {
        this.injector = new InjectorSupport(
                new Module[]{
                    new AppModule(this.userWebAppProperties),
                    new ApiGatewayServletModule(this.userWebAppProperties)
                },
                this.userWebAppProperties).getInjector();
        return this.injector;
    }
}

@@ -1613,394 +1613,8 @@
 ));%0A
-        servletContextEvent.getServletContext().setAttribute(%0A                %22userWebAppProperties%22, this.userWebAppProperties);%0A    %7D%0A%0A    @Override%0A    public void contextDestroyed(ServletContextEvent servletContextEvent) %7B%0A        super.contextDestroyed(servletContextEvent);%0A        servletContextEvent.getServletContext().removeAttribute(%0A                %22userWebAppProperties%22);%0A
     

Remove some unused code.