001: /*
002:
003: Derby - Class org.apache.derby.iapi.services.property.PropertyFactory
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 org.apache.derby.catalog.UUID;
025:
026: import org.apache.derby.iapi.services.context.ContextManager;
027: import org.apache.derby.iapi.services.locks.LockFactory;
028:
029: import org.apache.derby.iapi.error.StandardException;
030:
031: import org.apache.derby.iapi.store.access.TransactionController;
032: import org.apache.derby.iapi.store.access.conglomerate.MethodFactory;
033:
034: import org.apache.derby.iapi.services.property.PropertySetCallback;
035: import java.util.Properties;
036: import java.io.File;
037: import java.io.Serializable;
038: import java.util.Dictionary;
039:
040: /**
041: Module interface for an Property validation.
042:
043: <p>
044: An PropertyFactory is typically obtained from the Monitor:
045: <p>
046: <blockquote><pre>
047: // Get the current validation factory.
048: PropertyFactory af;
049: af = (PropertyFactory) Monitor.findServiceModule(this, org.apache.derby.iapi.reference.Module.PropertyFactory);
050: </pre></blockquote>
051: **/
052:
053: public interface PropertyFactory {
054: /**************************************************************************
055: * methods that are Property related.
056: **************************************************************************
057: */
058:
059: /**
060: * Add a callback for a change in any property value.
061: * <BR>
062: * The callback is made in the context of the transaction making the change.
063: *
064: * @param who which object is called
065: **/
066: public void addPropertySetNotification(PropertySetCallback who);
067:
068: /**
069: * Validate a Property set.
070: * <p>
071: * Validate a Property set by calling all the registered property set
072: * notification functions with .
073: *
074: * @param p Properties to validate.
075: * @param ignore Properties to not validate in p. Usefull for properties
076: * that may not be set after boot.
077: *
078: * @exception StandardException Throws if p fails a check.
079: **/
080: public void verifyPropertySet(Properties p, Properties ignore)
081: throws StandardException;
082:
083: /**
084: * validation a single property
085: */
086: public void validateSingleProperty(String key, Serializable value,
087: Dictionary set) throws StandardException;
088:
089: /**
090:
091: */
092: public Serializable doValidateApplyAndMap(TransactionController tc,
093: String key, Serializable value, Dictionary d,
094: boolean dbOnlyProperty) throws StandardException;
095:
096: /**
097: Call the property set callbacks to map a proposed property value
098: to a value to save.
099: <P>
100: The caller must run this in a block synchronized on this
101: to serialize validations with changes to the set of
102: property callbacks
103: */
104: public Serializable doMap(String key, Serializable value,
105: Dictionary set) throws StandardException;
106: }
|