Project Report: fawkez

Packagesummary org.jcoderz.commons.config

org.jcoderz.commons.config.ConfigurationServiceAdminImpl

LineHitsNoteSource
1  /*
2   * $Id: ConfigurationServiceAdminImpl.java 1011 2008-06-16 17:57:36Z amandel $
3   *
4   * Copyright 2006, The jCoderZ.org Project. All rights reserved.
5   *
6   * Redistribution and use in source and binary forms, with or without
7   * modification, are permitted provided that the following conditions are
8   * met:
9   *
10   *    * Redistributions of source code must retain the above copyright
11   *      notice, this list of conditions and the following disclaimer.
12   *    * Redistributions in binary form must reproduce the above
13   *      copyright notice, this list of conditions and the following
14   *      disclaimer in the documentation and/or other materials
15   *      provided with the distribution.
16   *    * Neither the name of the jCoderZ.org Project nor the names of
17   *      its contributors may be used to endorse or promote products
18   *      derived from this software without specific prior written
19   *      permission.
20   *
21   * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
22   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24   * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS
25   * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28   * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32   */
33  package org.jcoderz.commons.config;
34   
35  import java.util.HashSet;
36  import java.util.Iterator;
37  import java.util.Set;
38  import java.util.logging.Logger;
39   
40  import org.jcoderz.commons.ArgumentMalformedException;
41   
42  /**
43   * Implementation of the ConfigurationService business methods of the
44   * administration interface.
45   *
46   * This class holds all business logic of the service related to administrative
47   * tasks like getting all configuration keys or single configuration values.
48   * On this level only primitve types String, int, long and boolean are used.
49   * The wellformed and complex typed interfaces for the specific services are
50   * using this more simple interface.
51   *
52   * Implementing the business interface ConfigurationServiceAdminInterface and
53   * thus the ConfigurationServiceCommonInterface.
54   *
55   * IMPORTANT:
56   * Because of XDoclet Bug in current version, we define deligators to the super
57   * class with ejb-tags here.
58   * These should be deleted if XDoclet is fixed.
59   *
60   */
61 (1)public class ConfigurationServiceAdminImpl
62        extends ConfigurationServiceCommonImpl
63        implements ConfigurationServiceAdminInterface
64  {
65     /** class name for use in logging. */
66     private static final String CLASSNAME
67           = ConfigurationServiceAdminImpl.class.getName();
68   
69     /** Class logger. */
70     private static final Logger logger = Logger.getLogger(CLASSNAME);
71   
72     /**
73      * Name of a parameter in a few get.. methods.
74      * This member exists only for checkstyles's sake.
75      */
76  //   private static final transient
77  //      String PARAM_KEY_OF_GET_METHODS = "key";
78   
79   
80     /** {@inheritDoc} 
81      *
82      * @ejb.interface-method view-type="remote"
83      * @ejb.transaction type="Required"
84      * @ejb.permission role-name="Admin,Observer"
85      */
86     public Set getKeys ()
87           throws ConfigurationInitializationFailedException
88     {
89        final Set keys = getConfigurationCacheCurrent().getKeys();
90        final Set result = new HashSet();
91        for (final Iterator iter = keys.iterator(); iter.hasNext();)
92        {
93           try
94           {
95              result.add(ConfigurationKey.fromString((String) iter.next()));
96           }
97           catch (Exception e)
98           {
99              throw new ConfigurationInitializationFailedException(e);
100           }
101        }
102        return result;
103     }
104   
105     // IMPORTANT:
106     // Because of XDoclet Bug in current version, we define the deligators
107     // here with ejb-tags.
108     // Normally the implementation from CommonImpl is already inherited.
109 (2)   // FIXME: This should be changed when XDoclet BugFix is available.
110     //
111   
112     /**
113      * {@inheritDoc}
114      *
115      * @ejb.interface-method view-type="remote"
116      * @ejb.transaction type="Required"
117      * @ejb.permission role-name="Admin,Observer"
118      */
119 (3)   public (3)boolean getBoolean (ConfigurationKey key)
120           throws ConfigurationValueNotFoundException,
121                 ConfigurationTypeConversionFailedException,
122                 ArgumentMalformedException
123     {
124        return super.getBoolean(key);
125     }
126   
127   
128     /**
129      * {@inheritDoc}
130      *
131      * @ejb.interface-method view-type="remote"
132      * @ejb.transaction type="Required"
133      * @ejb.permission role-name="Admin,Observer"
134      */
135 (4)   public (4)int getInt (ConfigurationKey key)
136           throws ConfigurationValueNotFoundException,
137                 ConfigurationTypeConversionFailedException,
138                 ArgumentMalformedException
139     {
140        return super.getInt(key);
141     }
142   
143   
144     /**
145      * {@inheritDoc}
146      *
147      * @ejb.interface-method view-type="remote"
148      * @ejb.transaction type="Required"
149      * @ejb.permission role-name="Admin,Observer"
150      */
151 (5)   public (5)long getLong (ConfigurationKey key)
152           throws ConfigurationValueNotFoundException,
153                 ConfigurationTypeConversionFailedException,
154                 ArgumentMalformedException
155     {
156        return super.getLong(key);
157     }
158   
159   
160     /**
161      * {@inheritDoc}
162      *
163      * @ejb.interface-method view-type="remote"
164      * @ejb.transaction type="Required"
165      * @ejb.permission role-name="Admin,Observer"
166      */
167 (6)   public (6)String getString (ConfigurationKey key)
168           throws ConfigurationValueNotFoundException,
169                  ArgumentMalformedException
170     {
171        return super.getString(key);
172     }
173  }
174   

Findings in this File

c (1) 61 : 0 Type Javadoc comment is missing an @author tag.
i (2) 109 : 0 Comment matches to-do format '(TODO|FIXME|CHECKME)'.
d (3) 119 : 11 Overriding method merely calls super
d (4) 135 : 11 Overriding method merely calls super
d (5) 151 : 11 Overriding method merely calls super
d (6) 167 : 11 Overriding method merely calls super