1 /* 2 * Copyright 2012-2013 smartics, Kronseder & Reiner GmbH 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package de.smartics.properties.impl.config.properties; 17 18 import javax.annotation.concurrent.ThreadSafe; 19 20 import de.smartics.properties.api.config.domain.SerializableConfigurationPropertiesManagement; 21 import de.smartics.properties.api.config.domain.key.ConfigurationKey; 22 import de.smartics.properties.api.core.domain.PropertyDescriptorRegistry; 23 import de.smartics.properties.api.core.security.PropertyValueSecurity; 24 import de.smartics.properties.spi.config.support.AbstractInMemoryConfigurationProperties; 25 import de.smartics.properties.spi.core.registry.InMemoryPropertyDescriptorRegistry; 26 import de.smartics.util.lang.NullArgumentException; 27 28 /** 29 * Implementation based on {@link java.util.Properties}. 30 * <p> 31 * This implementation is <strong>not capable of tracking changes</strong> to 32 * properties after they have been added to this configuration. 33 * </p> 34 */ 35 @ThreadSafe 36 public final class PropertiesConfigurationProperties extends 37 AbstractInMemoryConfigurationProperties 38 { // NOPMD 39 // ********************************* Fields ********************************* 40 41 // --- constants ------------------------------------------------------------ 42 43 // --- members -------------------------------------------------------------- 44 45 /** 46 * The class version identifier. 47 */ 48 private static final long serialVersionUID = 1L; 49 50 // ****************************** Initializer ******************************* 51 52 // ****************************** Constructors ****************************** 53 54 /** 55 * Convenience constructor using its own registry. 56 * 57 * @param key the key that identifies the configuration. 58 * @param decrypter the helper to decrypt secured property values. 59 * @throws NullArgumentException if {@code key} or {@code decrypter} is 60 * <code>null</code>. 61 */ 62 public PropertiesConfigurationProperties(final ConfigurationKey<?> key, 63 final PropertyValueSecurity decrypter) throws NullArgumentException 64 { 65 super(key, new InMemoryPropertyDescriptorRegistry(), decrypter); 66 } 67 68 /** 69 * Default constructor. 70 * 71 * @param key the key that identifies the configuration. 72 * @param registry the registry to resolve property descriptors. 73 * @param decrypter the helper to decrypt secured property values. 74 * @throws NullArgumentException if {@code key}, {@code registry} or 75 * {@code decrypter} is <code>null</code>. 76 */ 77 public PropertiesConfigurationProperties(final ConfigurationKey<?> key, 78 final PropertyDescriptorRegistry registry, 79 final PropertyValueSecurity decrypter) throws NullArgumentException 80 { 81 super(key, registry, decrypter); 82 } 83 84 // ****************************** Inner Classes ***************************** 85 86 // ********************************* Methods ******************************** 87 88 // --- init ----------------------------------------------------------------- 89 90 @Override 91 public SerializableConfigurationPropertiesManagement toSerializable() 92 { 93 return this; 94 } 95 96 // --- get&set -------------------------------------------------------------- 97 98 // --- business ------------------------------------------------------------- 99 100 // --- object basics -------------------------------------------------------- 101 102 }