01: /*
02:
03: Derby - Class org.apache.derby.iapi.services.property.PropertySetCallback
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to you under the Apache License, Version 2.0
09: (the "License"); you may not use this file except in compliance with
10: the License. You may obtain a copy of the License at
11:
12: http://www.apache.org/licenses/LICENSE-2.0
13:
14: Unless required by applicable law or agreed to in writing, software
15: distributed under the License is distributed on an "AS IS" BASIS,
16: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: See the License for the specific language governing permissions and
18: limitations under the License.
19:
20: */
21:
22: package org.apache.derby.iapi.services.property;
23:
24: import org.apache.derby.iapi.error.StandardException;
25: import org.apache.derby.iapi.services.daemon.Serviceable;
26: import java.io.Serializable;
27: import java.util.Dictionary;
28:
29: public interface PropertySetCallback {
30:
31: /**
32: Initialize the properties for this callback.
33: Called when addPropertySetNotification() is called
34: with a non-null transaction controller.
35: This allows code to set read its initial property
36: values at boot time.
37:
38: <P>
39: Code within an init() method should use the 3 argument
40: PropertyUtil method getPropertyFromSet() to obtain a property's value.
41:
42: @param dbOnly true if only per-database properties are to be looked at
43: @param p the complete set of per-database properties.
44: */
45: void init(boolean dbOnly, Dictionary p);
46:
47: /**
48: Validate a property change.
49: @param key Property key for the property being set
50: @param value proposed new value for the property being set or null if
51: the property is being dropped.
52: @param p Property set before the change. SettingProperty may read but
53: must never change p.
54:
55: @return true if this object was interested in this property, false otherwise.
56: @exception StandardException Oh well.
57: */
58: boolean validate(String key, Serializable value, Dictionary p)
59: throws StandardException;
60:
61: /**
62: Apply a property change. Will only be called after validate has been called
63: and only if validate returned true. If this method is called then the
64: new value is the value to be used, ie. the property is not set in the
65: overriding JVM system set.
66:
67: @param key Property key for the property being set
68: @param value proposed new value for the property being set or null if
69: the property is being dropped.
70: @param p Property set before the change. SettingProperty may read but
71: must never change p.
72: @return post commit work for the property change.
73: @exception StandardException Oh well.
74: */
75: Serviceable apply(String key, Serializable value, Dictionary p)
76: throws StandardException;
77:
78: /**
79:
80: Map a proposed new value for a property to an official value.
81:
82: Will only be called after apply() has been called.
83: @param key Property key for the property being set
84: @param value proposed new value for the property being set or null if
85: the property is being dropped.
86: @param p Property set before the change. SettingProperty may read but
87: must never change p.
88: @return new value for the change
89: @exception StandardException Oh well.
90: */
91: Serializable map(String key, Serializable value, Dictionary p)
92: throws StandardException;
93: }
|