001: /*
002:
003: Derby - Class org.apache.derby.iapi.services.property.PersistentSet
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to you under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.iapi.services.property;
023:
024: import java.util.Properties;
025:
026: import java.io.Serializable;
027:
028: import org.apache.derby.iapi.error.StandardException;
029:
030: public interface PersistentSet {
031: /**
032: * Gets a value for a stored property. The returned value will be:
033: *
034: * <OL>
035: * <LI> the de-serialized object associated with the key
036: * using setProperty if such a value is defined or
037: * <LI> the default de-serialized object associated with
038: * the key using setPropertyDefault if such a value
039: * is defined or
040: * <LI> null
041: * </OL>
042: *
043: * <p>
044: * The Store provides a transaction protected list of database properties.
045: * Higher levels of the system can store and retrieve these properties
046: * once Recovery has finished. Each property is a serializable object
047: * and is stored/retrieved using a String key.
048: * <p>
049: *
050: * @param key The "key" of the property that is being requested.
051: *
052: * @return object The requested object or null.
053: *
054: * @exception StandardException Standard exception policy.
055: **/
056: public Serializable getProperty(String key)
057: throws StandardException;
058:
059: /**
060: * Gets a default value for a stored property. The returned
061: * value will be:
062: *
063: * <OL>
064: * <LI> the default de-serialized object associated with
065: * the key using setPropertyDefault if such a value
066: * is defined or
067: * <LI> null
068: * </OL>
069: *
070: * <p>
071: * The Store provides a transaction protected list of database properties.
072: * Higher levels of the system can store and retrieve these properties
073: * once Recovery has finished. Each property is a serializable object
074: * and is stored/retrieved using a String key.
075: * <p>
076: *
077: * @param key The "key" of the property that is being requested.
078: *
079: * @return object The requested object or null.
080: *
081: * @exception StandardException Standard exception policy.
082: **/
083: public Serializable getPropertyDefault(String key)
084: throws StandardException;
085:
086: /**
087: * Return true if the default property is visible. A default
088: * is visible as long as the property is not set.
089: *
090: * @param key The "key" of the property that is being requested.
091: * @exception StandardException Standard exception policy.
092: **/
093: public boolean propertyDefaultIsVisible(String key)
094: throws StandardException;
095:
096: /**
097: * Sets the Serializable object associated with a property key.
098: * <p>
099: * See the discussion of getProperty().
100: * <p>
101: * The value stored may be a Formatable object or a Serializable object
102: * whose class name starts with java.*. This stops arbitary objects being
103: * stored in the database by class name, which will cause problems in
104: * obfuscated/non-obfuscated systems.
105: *
106: * @param key The key used to lookup this property.
107: * @param value The value to be associated with this key. If null,
108: * delete the property from the properties list.
109: @param dbOnlyProperty True if property is only ever searched for int the database properties.
110: *
111: * @exception StandardException Standard exception policy.
112: **/
113: public void setProperty(String key, Serializable value,
114: boolean dbOnlyProperty) throws StandardException;
115:
116: /**
117: * Sets the Serializable object default value associated with a property
118: * key.
119: * <p>
120: * See the discussion of getProperty().
121: * <p>
122: * The value stored may be a Formatable object or a Serializable object
123: * whose class name starts with java.*. This stops arbitary objects being
124: * stored in the database by class name, which will cause problems in
125: * obfuscated/non-obfuscated systems.
126: *
127: * @param key The key used to lookup this propertyDefault.
128: * @param value The default value to be associated with this key.
129: * If null, delete the property default from the
130: * properties list.
131: *
132: * @exception StandardException Standard exception policy.
133: **/
134: public void setPropertyDefault(String key, Serializable value)
135: throws StandardException;
136:
137: /**
138: * Get properties that can be stored in a java.util.Properties object.
139: * <p>
140: * Get the sub-set of stored properties that can be stored in a
141: * java.util.Properties object. That is all the properties that have a
142: * value of type java.lang.String. Changes to this properties object are
143: * not reflected in any persisent storage.
144: * <p>
145: * Code must use the setProperty() method call.
146: *
147: * @return The sub-set of stored properties that can be stored in a
148: * java.util.Propertes object.
149: *
150: * @exception StandardException Standard exception policy.
151: **/
152: public Properties getProperties() throws StandardException;
153: }
|