View Javadoc

1   package com.sourceforge.jpatterns.patterns.config;
2   
3   import com.sourceforge.jpatterns.core.configuration.exceptions.JPConfigException;
4   import com.sourceforge.jpatterns.patterns.PatternBase;
5   import com.sourceforge.jpatterns.schema.CastorSectionType;
6   import com.sourceforge.jpatterns.schema.Config;
7   import com.zmicer.utils.InputArgumentUtils;
8   import org.apache.log4j.Logger;
9   
10  /**
11   * The real, default implementation of the <code>IJPConfig</code> pattern interface.
12   *
13   * $Author::                    $<br/>
14   * $Rev::                       $<br/>
15   * $Date::                      $<br/>
16   */
17  public class JPConfigImpl extends PatternBase implements IJPConfig
18  {
19      /**
20       * Logger instance.
21       */
22      final public static Logger LOG = Logger.getLogger(JPConfigImpl.class);
23  
24      /**
25       * @see com.sourceforge.jpatterns.patterns.config.IJPConfig#getValue(String, String)
26       */
27      public String getValue(final String key, final String scope) throws JPConfigException
28      {
29          return retrieveItem(key, scope).getValue();
30      }
31  
32      /**
33       * @see com.sourceforge.jpatterns.patterns.IJPattern#checkCastorConfig(com.sourceforge.jpatterns.schema.CastorSectionType)
34       */
35      public boolean checkCastorConfig(CastorSectionType castorSectionType)
36      {
37          InputArgumentUtils.checkObjects(castorSectionType);
38          return (castorSectionType instanceof Config);
39      }
40  
41      /**
42       * @see com.zmicer.utils.model.ICheckable#check()
43       */
44      public boolean check()
45      {
46          return super.check() && (m_castorSection instanceof Config);
47      }
48  }