Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Logback: the reliable, generic, fast and flexible logging framework. Copyright (C) 1999-2011, All rights reserved. This program and the accompanying materials are dual-licensed under either the terms of the Eclipse Public License v1.0 as published by the Eclipse Foundation or (per the licensee's choosing) under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation.
package ch.qos.logback.core.db;

Ceki Gulcu
public class BindDataSourceToJNDIAction extends Action {
  static final String DATA_SOURCE_CLASS = "dataSourceClass";
  static final String URL = "url";
  static final String USER = "user";
  static final String PASSWORD = "password";

Instantiates an a data source and bind it to JNDI Most of the required parameters are placed in the ec.substitutionProperties
  public void begin(
      InterpretationContext ecString localNameAttributes attributes) {
    String dsClassName = ec.getProperty();
    if (OptionHelper.isEmpty(dsClassName)) {
      addWarn("dsClassName is a required parameter");
      ec.addError("dsClassName is a required parameter");
    String urlStr = ec.getProperty();
    String userStr = ec.getProperty();
    String passwordStr = ec.getProperty();
    try {
      DataSource ds =
        (DataSource) OptionHelper.instantiateByClassName(dsClassNameDataSource.class);
      PropertySetter setter = new PropertySetter(ds);
      if (!OptionHelper.isEmpty(urlStr)) {
      if (!OptionHelper.isEmpty(userStr)) {
      if (!OptionHelper.isEmpty(passwordStr)) {
      Context ctx = new InitialContext();
    } catch (Exception oops) {
        "Could not bind  datasource. Reported error follows."oops);
      ec.addError("Could not not bind  datasource of type [" + dsClassName + "].");
  public void end(InterpretationContext ecString name) {
New to GrepCode? Check out our FAQ X