use of org.apache.derby.iapi.services.property.PropertySetCallback in project derby by apache.
the class PropertyValidation method doMap.
/**
* Call the property set callbacks to map a proposed property value
* to a value to save.
* <P>
* The caller must run this in a block synchronized on this
* to serialize validations with changes to the set of
* property callbacks
*/
public Serializable doMap(String key, Serializable value, Dictionary set) throws StandardException {
Serializable mappedValue = null;
if (notifyOnSet != null) {
for (int i = 0; i < notifyOnSet.size() && mappedValue == null; i++) {
PropertySetCallback psc = notifyOnSet.get(i);
mappedValue = psc.map(key, value, set);
}
}
if (mappedValue == null)
return value;
else
return mappedValue;
}
use of org.apache.derby.iapi.services.property.PropertySetCallback in project derby by apache.
the class PropertyValidation method doValidateApplyAndMap.
public Serializable doValidateApplyAndMap(TransactionController tc, String key, Serializable value, Dictionary d, boolean dbOnlyProperty) throws StandardException {
Serializable mappedValue = null;
if (notifyOnSet != null) {
synchronized (this) {
for (int i = 0; i < notifyOnSet.size(); i++) {
PropertySetCallback psc = notifyOnSet.get(i);
if (!psc.validate(key, value, d))
continue;
if (mappedValue == null)
mappedValue = psc.map(key, value, d);
if (!dbOnlyProperty && key.startsWith("derby.")) {
if (PropertyUtil.whereSet(key, d) == PropertyUtil.SET_IN_JVM)
continue;
}
Serviceable s;
if ((s = psc.apply(key, value, d)) != null)
((TransactionManager) tc).addPostCommitWork(s);
}
}
}
return mappedValue;
}
use of org.apache.derby.iapi.services.property.PropertySetCallback in project derby by apache.
the class PropertyValidation method validateSingleProperty.
public void validateSingleProperty(String key, Serializable value, Dictionary set) throws StandardException {
// RESOLVE: log device cannot be changed on the fly right now
if (key.equals(Attribute.LOG_DEVICE)) {
throw StandardException.newException(SQLState.RAWSTORE_CANNOT_CHANGE_LOGDEVICE);
}
if (notifyOnSet != null) {
for (int i = 0; i < notifyOnSet.size(); i++) {
PropertySetCallback psc = notifyOnSet.get(i);
psc.validate(key, value, set);
}
}
}
Aggregations