View Javadoc

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 test.de.smartics.properties.spi.config.support;
17  
18  import java.io.Serializable;
19  
20  import de.smartics.properties.api.config.domain.ConfigurationValidationException;
21  import de.smartics.properties.api.config.domain.DescribedProperty;
22  import de.smartics.properties.api.config.domain.SerializableConfigurationProperties;
23  import de.smartics.properties.api.config.domain.UnknownPropertyException;
24  import de.smartics.properties.api.config.domain.ValidatedProperty;
25  import de.smartics.properties.api.config.domain.key.ConfigurationKey;
26  import de.smartics.properties.api.core.app.PropertyRootException;
27  import de.smartics.properties.api.core.domain.PropertyDescriptor;
28  import de.smartics.properties.api.core.domain.PropertyDescriptorRegistry;
29  import de.smartics.properties.api.core.domain.PropertyValidationException;
30  import de.smartics.properties.api.core.domain.PropertyValueConversionException;
31  import de.smartics.properties.api.core.security.Base64PropertyValueSecurity;
32  import de.smartics.properties.api.core.security.SecurityException;
33  import de.smartics.properties.spi.config.support.AbstractConfigurationProperties;
34  import de.smartics.util.lang.NullArgumentException;
35  
36  /**
37   * Used to test serializability of {@link AbstractConfigurationProperties}.
38   */
39  public class DummyConfigurationProperties extends
40      AbstractConfigurationProperties implements Serializable,
41      SerializableConfigurationProperties
42  {
43    // ********************************* Fields *********************************
44  
45    // --- constants ------------------------------------------------------------
46  
47    /**
48     * The class version identifier.
49     */
50    private static final long serialVersionUID = 1L;
51  
52    // --- members --------------------------------------------------------------
53  
54    // ****************************** Initializer *******************************
55  
56    // ****************************** Constructors ******************************
57  
58    /**
59     * Default constructor.
60     *
61     * @param key the key that identifies the configuration.
62     * @param registry the registry to resolve property descriptors.
63     * @throws NullArgumentException if {@code key} or {@code registry} is
64     *           <code>null</code>.
65     */
66    public DummyConfigurationProperties(final ConfigurationKey<?> key,
67        final PropertyDescriptorRegistry registry) throws NullArgumentException
68    {
69      super(key, registry, new Base64PropertyValueSecurity());
70    }
71  
72    // ****************************** Inner Classes *****************************
73  
74    // ********************************* Methods ********************************
75  
76    // --- init -----------------------------------------------------------------
77  
78    // --- get&set --------------------------------------------------------------
79  
80    @Override
81    public boolean isInAdminMode()
82    {
83      return false;
84    }
85  
86    // --- business -------------------------------------------------------------
87  
88    @Override
89    public Object getPropertyAsType(final PropertyDescriptor descriptor)
90      throws IllegalArgumentException, UnknownPropertyException,
91      PropertyValueConversionException, SecurityException, PropertyRootException
92    {
93      return null;
94    }
95  
96    @Override
97    public ValidatedProperty getValidatedProperty(
98        final PropertyDescriptor descriptor, final Object defaultValue)
99      throws IllegalArgumentException, UnknownPropertyException,
100     PropertyValidationException
101   {
102     return null;
103   }
104 
105   @Override
106   public void validate(final boolean lenient, final Class<?>... groups)
107     throws ConfigurationValidationException
108   {
109   }
110 
111   @Override
112   public void validate(final PropertyDescriptor descriptor,
113       final Class<?>... ifInOneOfTheseGroups)
114     throws ConfigurationValidationException
115   {
116   }
117 
118   @Override
119   public void validate(final PropertyDescriptor descriptor, final String value,
120       final Class<?>... ifInOneOfTheseGroups)
121     throws ConfigurationValidationException
122   {
123   }
124 
125   @Override
126   public SerializableConfigurationProperties toSerializable()
127   {
128     return this;
129   }
130 
131   @Override
132   public DescribedProperty getProperty(final PropertyDescriptor descriptor,
133       final Object defaultValue) throws NullPointerException,
134     UnknownPropertyException
135   {
136     return null;
137   }
138 
139   // --- object basics --------------------------------------------------------
140 
141 }