PluginsConfigImpl.java :  » Web-Framework » calyxo » de » odysseus » calyxo » control » conf » impl » Java Open Source

Java Open Source » Web Framework » calyxo 
calyxo » de » odysseus » calyxo » control » conf » impl » PluginsConfigImpl.java
/*
 * 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.ArrayList;
import java.util.Iterator;

import de.odysseus.calyxo.control.conf.PluginsConfig;
import de.odysseus.calyxo.base.conf.ConfigException;
import de.odysseus.calyxo.base.conf.impl.ConfigImpl;

/**
 * Plugins configuration implementation.
 * 
 * @author Christoph Beck
 */
public class PluginsConfigImpl extends ConfigImpl implements PluginsConfig {
  private ArrayList plugins = new ArrayList();

  /**
   * Merge other plugins element into the receiver.
   * Add all plugin configs from other element.
   */
  void merge(PluginsConfigImpl other) throws ConfigException {
    if (other != null) {
      Iterator otherPlugins = other.getPluginConfigs();
      while (otherPlugins.hasNext()) {
        add((PluginConfigImpl)otherPlugins.next());
      }
    }
  }

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

  /*
   * (non-Javadoc)
   * @see de.odysseus.calyxo.base.conf.impl.ConfigImpl#_addChildren(de.odysseus.calyxo.base.conf.impl.ConfigImpl.Elements)
   */
  protected void _addChildren(Elements list) {
    super._addChildren(list);
    list.add(getPluginConfigs());
  }

  /*
   * (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);
    // no attributes
  }

  /**
   * Add plugin element.
   */
  public void add(PluginConfigImpl value) throws ConfigException {
    plugins.add(value);
  }

  /*
   * (non-Javadoc)
   * @see de.odysseus.calyxo.control.conf.PluginsConfig#getPluginConfigs()
   */
  public Iterator getPluginConfigs() {
    return plugins.iterator();
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.