| 1 | | | |
| 2 | | | |
| 3 | | | |
| 4 | | | |
| 5 | | | |
| 6 | | | |
| 7 | | | |
| 8 | | | |
| 9 | | | |
| 10 | | | |
| 11 | | | |
| 12 | | | |
| 13 | | | |
| 14 | | | |
| 15 | | | |
| 16 | | | |
| 17 | | | |
| 18 | | | |
| 19 | | | |
| 20 | | | |
| 21 | | | |
| 22 | | | |
| 23 | | | |
| 24 | | | |
| 25 | | | |
| 26 | | | |
| 27 | | | |
| 28 | | | |
| 29 | | | |
| 30 | | | |
| 31 | | | |
| 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 | | | |
| 77 | | | |
| 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 | | | |
| 106 | | | |
| 107 | | | |
| 108 | | | |
| 109 | | (2) | |
| 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 | | | |