Package ch.hortis.sonar.web.listener

Source Code of ch.hortis.sonar.web.listener.SonarRailsContextListener

/**
* This program is copyright (c) 2007 Hortis-GRC SA.
*
* This file is part of Sonar.
* Sonar is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Sonar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
package ch.hortis.sonar.web.listener;

import org.jruby.webapp.RailsContextListener;
import org.jruby.webapp.RailsFactory;

/**
* Sonar rails context listener using the JRuby extras goldspike framework
* This listener takes all string JNDI vars in the java:comp/env/sonar location
* and expose them in the jruby ENV runtime env
*/
public class SonarRailsContextListener extends RailsContextListener {
 
  protected RailsFactory createRailsFactory() {
    RailsFactory goldSpikeRailsFactoryImpl = super.createRailsFactory();
    SonarContext sonarCtx = SonarContext.getInstance();
    for ( String ctxKey : sonarCtx.keys() ) {
        goldSpikeRailsFactoryImpl.addEnvironmentOverride( ctxKey, sonarCtx.get(ctxKey) );
    }
    return goldSpikeRailsFactoryImpl;
  }
}
TOP

Related Classes of ch.hortis.sonar.web.listener.SonarRailsContextListener

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.