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 de.smartics.properties.api.config.domain;
17  
18  import java.io.Serializable;
19  
20  /**
21   * Provides direct access to the properties of a configuration.
22   * <p>
23   * {@stickyNote Note that changes made to the store via this interface are not
24   * reflected in the already loaded configurations, because they cache values and
25   * do not get informed of changes. Clients should usually only use reading
26   * methods of this interface.}
27   * </p>
28   */
29  public interface PropertyStoreAccessor extends Serializable
30  {
31    // ********************************* Fields *********************************
32  
33    // --- constants ------------------------------------------------------------
34  
35    // ****************************** Initializer *******************************
36  
37    // ****************************** Inner Classes *****************************
38  
39    // ********************************* Methods ********************************
40  
41    // --- get&set --------------------------------------------------------------
42  
43    // --- business -------------------------------------------------------------
44  
45    /**
46     * Sets the property to the given value.
47     *
48     * @param name the name of the property to set.
49     * @param value the value to the property.
50     * @return the old property. Must not be <code>null</code> (although the value
51     *         of the property may be <code>null</code>).
52     * @throws NullPointerException if {@code name} is <code>null</code>.
53     * @throws PropertyStoreException on any problem accessing the store.
54     * @impl No property change listeners are informed here. This is solely the
55     *       call to the underlying store.
56     */
57    Property setPropertyToStore(String name, String value)
58      throws NullPointerException, PropertyStoreException;
59  
60    /**
61     * Returns a collection to iterate over all properties of the configuration.
62     *
63     * @return a collection to iterate over all properties of the configuration.
64     * @throws PropertyStoreException on any problem accessing the store.
65     * @impl No property change listeners are informed here. This is solely the
66     *       call to the underlying store.
67     */
68    PropertyCollection getPropertyCollectionFromStore()
69      throws PropertyStoreException;
70  
71    /**
72     * Deletes the property with the given name.
73     *
74     * @param name the name of the property to delete.
75     * @return the value of the deleted property.
76     * @throws PropertyStoreException on any problem accessing the store.
77     * @impl No property change listeners are informed here. This is solely the
78     *       call to the underlying store.
79     */
80    Property deletePropertyInStore(String name) throws PropertyStoreException;
81  
82    /**
83     * Fetches the property from the store by the given name.
84     *
85     * @param name the name of the property to fetch.
86     * @return the property value. Must not be <code>null</code> (although the
87     *         value of the property may be <code>null</code>).
88     * @throws PropertyStoreException on any problem accessing the store.
89     * @impl No property change listeners are informed here. This is solely the
90     *       call to the underlying store.
91     */
92    Property getPropertyFromStore(String name) throws PropertyStoreException;
93  
94    // --- object basics --------------------------------------------------------
95  
96  }