Package de.odysseus.calyxo.control.conf.impl

Source Code of de.odysseus.calyxo.control.conf.impl.ExceptionHandlerConfigImpl

/*
* Copyright 2004, 2005, 2006 Odysseus Software GmbH
*
* 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 de.odysseus.calyxo.control.conf.impl;

import java.util.HashMap;
import java.util.Iterator;

import de.odysseus.calyxo.base.conf.ConfigException;
import de.odysseus.calyxo.control.conf.DispatchConfig;
import de.odysseus.calyxo.control.conf.ExceptionHandlerConfig;

/**
* Exception handler configuration implementation.
*
* @author Christoph Beck
*/
public class ExceptionHandlerConfigImpl extends ParamsConfigImpl implements ExceptionHandlerConfig {

  private String className;
  private String type = "java.lang.Exception";
  private String id;
  private HashMap dispatches = new HashMap(4);

  /*
   * (non-Javadoc)
   * @see de.odysseus.calyxo.base.conf.impl.ConfigImpl#_getElementName()
   */
  protected String _getElementName() {
    return "exception-handler";
  }

  /*
   * (non-Javadoc)
   * @see de.odysseus.calyxo.base.conf.impl.ConfigImpl#_putAttributes(de.odysseus.calyxo.base.conf.impl.ConfigImpl.Attributes)
   */
  protected void _putAttributes(Attributes map) {
    super._putAttributes(map);
    map.put("class", className);
    map.put("type", type);
  }

  /*
   * (non-Javadoc)
   * @see de.odysseus.calyxo.base.conf.impl.ConfigImpl#_getDynamicAttributes()
   */
  protected String[] _getDynamicAttributes() {
    return new String[]{ "className", "type" };
  }

  /* (non-Javadoc)
   * @see de.odysseus.calyxo.control.conf.ExceptionHandlerConfig#getClassName()
   */
  public String getClassName() {
    return className;
  }

  /**
   * @param string
   */
  public void setClassName(String string) {
    className = string;
  }

  /* (non-Javadoc)
   * @see de.odysseus.calyxo.control.conf.ExceptionHandlerConfig#getType()
   */
  public String getType() {
    return type;
  }

  /**
   * @param string
   */
  public void setType(String string) {
    type = string;
  }

  /**
   * @param string
   */
  public void setId(String string) {
    id = string;
  }

  /* (non-Javadoc)
   * @see de.odysseus.calyxo.control.conf.ExceptionHandlerConfig#getId()
   */
  public String getId() {
    return id;
  }

  /**
   * Add dispatch element.
   */
  public void add(DispatchConfigImpl value) throws ConfigException {
    if (dispatches.containsKey(value.getName())) {
      throw new ConfigException("Duplicate dispatch name '" + value.getName() + "' in " + toInlineString());
    }
    dispatches.put(value.getName(), value);
  }

  /*
   * (non-Javadoc)
   * @see de.odysseus.calyxo.control.conf.DispatchesConfig#getDispatchConfig(java.lang.String)
   */
  public DispatchConfig getDispatchConfig(String name) {
    return (DispatchConfig)dispatches.get(name);
  }

  /*
   * (non-Javadoc)
   * @see de.odysseus.calyxo.control.conf.DispatchesConfig#getDispatchConfigs()
   */
  public Iterator getDispatchConfigs() {
    return dispatches.values().iterator();
  }
}
TOP

Related Classes of de.odysseus.calyxo.control.conf.impl.ExceptionHandlerConfigImpl

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.