1 /* 2 3 Derby - Class org.apache.derby.iapi.services.property.PropertyFactory 4 5 Licensed to the Apache Software Foundation (ASF) under one or more 6 contributor license agreements. See the NOTICE file distributed with 7 this work for additional information regarding copyright ownership. 8 The ASF licenses this file to you under the Apache License, Version 2.0 9 (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.catalog.UUID; 25 26 import org.apache.derby.iapi.services.context.ContextManager; 27 import org.apache.derby.iapi.services.locks.LockFactory; 28 29 import org.apache.derby.iapi.error.StandardException; 30 31 import org.apache.derby.iapi.store.access.TransactionController; 32 import org.apache.derby.iapi.store.access.conglomerate.MethodFactory; 33 34 import org.apache.derby.iapi.services.property.PropertySetCallback; 35 import java.util.Properties; 36 import java.io.File; 37 import java.io.Serializable; 38 import java.util.Dictionary; 39 40 /** 41 Module interface for an Property validation. 42 43 <p> 44 An PropertyFactory is typically obtained from the Monitor: 45 <p> 46 <blockquote><pre> 47 // Get the current validation factory. 48 PropertyFactory af; 49 af = (PropertyFactory) Monitor.findServiceModule(this, org.apache.derby.iapi.reference.Module.PropertyFactory); 50 </pre></blockquote> 51 **/ 52 53 public interface PropertyFactory 54 { 55 /************************************************************************** 56 * methods that are Property related. 57 ************************************************************************** 58 */ 59 60 /** 61 * Add a callback for a change in any property value. 62 * <BR> 63 * The callback is made in the context of the transaction making the change. 64 * 65 * @param who which object is called 66 **/ 67 public void addPropertySetNotification( 68 PropertySetCallback who); 69 70 /** 71 * Validate a Property set. 72 * <p> 73 * Validate a Property set by calling all the registered property set 74 * notification functions with . 75 * 76 * @param p Properties to validate. 77 * @param ignore Properties to not validate in p. Usefull for properties 78 * that may not be set after boot. 79 * 80 * @exception StandardException Throws if p fails a check. 81 **/ 82 public void verifyPropertySet( 83 Properties p, 84 Properties ignore) 85 throws StandardException; 86 87 /** 88 * validation a single property 89 */ 90 public void validateSingleProperty(String key, 91 Serializable value, 92 Dictionary set) 93 throws StandardException; 94 95 /** 96 97 */ 98 public Serializable doValidateApplyAndMap(TransactionController tc, 99 String key, Serializable value, 100 Dictionary d, boolean dbOnlyProperty) 101 throws StandardException; 102 103 104 /** 105 Call the property set callbacks to map a proposed property value 106 to a value to save. 107 <P> 108 The caller must run this in a block synchronized on this 109 to serialize validations with changes to the set of 110 property callbacks 111 */ 112 public Serializable doMap(String key, 113 Serializable value, 114 Dictionary set) 115 throws StandardException; 116 } 117