Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
CacheConfigurationPropertiesManagement |
|
|
1.0;1 |
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.cache; |
|
17 | ||
18 | import de.smartics.properties.api.config.domain.ConfigurationPropertiesManagement; |
|
19 | import de.smartics.properties.api.config.domain.PropertyStoreAccessor; |
|
20 | import de.smartics.properties.api.config.domain.SerializableConfigurationPropertiesManagement; |
|
21 | import de.smartics.properties.spi.config.support.ConfigurationPropertiesManagementSpi; |
|
22 | import de.smartics.properties.spi.config.support.SerializableConfigurationPropertiesManagementSpi; |
|
23 | import de.smartics.util.lang.Arg; |
|
24 | ||
25 | /** |
|
26 | * A delegate that provides a cache. |
|
27 | */ |
|
28 | 0 | public final class CacheConfigurationPropertiesManagement extends |
29 | AbstractCacheConfigurationPropertiesManagement implements |
|
30 | ConfigurationPropertiesManagement |
|
31 | { |
|
32 | // ********************************* Fields ********************************* |
|
33 | ||
34 | // --- constants ------------------------------------------------------------ |
|
35 | ||
36 | // --- members -------------------------------------------------------------- |
|
37 | ||
38 | /** |
|
39 | * The class version identifier. |
|
40 | */ |
|
41 | private static final long serialVersionUID = 1L; |
|
42 | ||
43 | /** |
|
44 | * The wrapped delegate whose properties are to be cached. |
|
45 | */ |
|
46 | private final ConfigurationPropertiesManagementSpi delegate; |
|
47 | ||
48 | // ****************************** Initializer ******************************* |
|
49 | ||
50 | // ****************************** Constructors ****************************** |
|
51 | ||
52 | /** |
|
53 | * Default constructor. |
|
54 | * |
|
55 | * @param delegate the wrapped delegate whose properties are to be cached. |
|
56 | * @throws NullPointerException if {@code delegate} is <code>null</code>. |
|
57 | */ |
|
58 | public CacheConfigurationPropertiesManagement( |
|
59 | final ConfigurationPropertiesManagementSpi delegate) |
|
60 | throws NullPointerException |
|
61 | { |
|
62 | 0 | super(Arg.checkNotNull("delegate", delegate).getKey()); |
63 | 0 | this.delegate = delegate; |
64 | 0 | } |
65 | ||
66 | // ****************************** Inner Classes ***************************** |
|
67 | ||
68 | // ********************************* Methods ******************************** |
|
69 | ||
70 | // --- init ----------------------------------------------------------------- |
|
71 | ||
72 | // --- get&set -------------------------------------------------------------- |
|
73 | ||
74 | @Override |
|
75 | public boolean isInAdminMode() |
|
76 | { |
|
77 | 0 | return delegate.isInAdminMode(); |
78 | } |
|
79 | ||
80 | @Override |
|
81 | public void setToAdminMode(final boolean newMode) |
|
82 | { |
|
83 | 0 | delegate.setToAdminMode(newMode); |
84 | 0 | } |
85 | ||
86 | @Override |
|
87 | protected ConfigurationPropertiesManagementSpi getDelegate() |
|
88 | { |
|
89 | 0 | return delegate; |
90 | } |
|
91 | ||
92 | // --- business ------------------------------------------------------------- |
|
93 | ||
94 | @Override |
|
95 | public SerializableConfigurationPropertiesManagement toSerializable() |
|
96 | { |
|
97 | 0 | return new SerializableCacheConfigurationPropertiesManagement( |
98 | (SerializableConfigurationPropertiesManagementSpi) delegate |
|
99 | .toSerializable(), |
|
100 | getCache()); |
|
101 | } |
|
102 | ||
103 | @Override |
|
104 | public PropertyStoreAccessor getPropertyStoreAccessor() |
|
105 | { |
|
106 | 0 | return delegate.getPropertyStoreAccessor(); |
107 | } |
|
108 | ||
109 | // --- object basics -------------------------------------------------------- |
|
110 | ||
111 | } |