--- /dev/null
+/*\r
+\r
+ Derby - Class org.apache.derby.impl.sql.LanguageDbPropertySetter\r
+\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to you under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.impl.sql;\r
+\r
+import org.apache.derby.iapi.services.property.PropertySetCallback;\r
+import org.apache.derby.iapi.services.property.PropertyUtil;\r
+import org.apache.derby.iapi.reference.Property;\r
+import org.apache.derby.iapi.reference.SQLState;\r
+import org.apache.derby.iapi.services.daemon.Serviceable;\r
+import org.apache.derby.iapi.services.sanity.SanityManager;\r
+import org.apache.derby.iapi.services.context.ContextService;\r
+import org.apache.derby.iapi.error.StandardException;\r
+import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;\r
+import org.apache.derby.iapi.store.access.TransactionController;\r
+import java.io.Serializable;\r
+import java.util.Dictionary;\r
+\r
+/**\r
+ * A class to handle setting language database properties\r
+ */\r
+public class LanguageDbPropertySetter implements PropertySetCallback\r
+{\r
+ public void init(boolean dbOnly, Dictionary p) {\r
+ // not called yet ...\r
+ }\r
+ /** @exception StandardException Thrown on error. */\r
+ public boolean validate\r
+ (\r
+ String key,\r
+ Serializable value,\r
+ Dictionary p\r
+ ) throws StandardException \r
+ {\r
+ // Disallow changing sqlAuthorization from true to false or null after\r
+ // switching to Standard authorization\r
+ if (key.trim().equals(Property.SQL_AUTHORIZATION_PROPERTY))\r
+ {\r
+ LanguageConnectionContext lcc = (LanguageConnectionContext)\r
+ ContextService.getContext(LanguageConnectionContext.CONTEXT_ID);\r
+\r
+ if (lcc.usesSqlAuthorization() && !Boolean.valueOf((String)value).booleanValue())\r
+ throw StandardException.newException(SQLState.PROPERTY_UNSUPPORTED_CHANGE,\r
+ key, value);\r
+ }\r
+\r
+ if (key.equals(Property.LANGUAGE_STALE_PLAN_CHECK_INTERVAL)) {\r
+ PropertyUtil.intPropertyValue(\r
+ Property.LANGUAGE_STALE_PLAN_CHECK_INTERVAL,\r
+ value,\r
+ Property.MIN_LANGUAGE_STALE_PLAN_CHECK_INTERVAL,\r
+ Integer.MAX_VALUE,\r
+ Property.DEFAULT_LANGUAGE_STALE_PLAN_CHECK_INTERVAL\r
+ );\r
+ return true;\r
+ }\r
+\r
+ return false;\r
+ }\r
+\r
+ public Serviceable apply\r
+ (\r
+ String key,\r
+ Serializable value,\r
+ Dictionary p\r
+ ) \r
+ {\r
+ return null;\r
+ }\r
+\r
+ public Serializable map\r
+ (\r
+ String key,\r
+ Serializable value,\r
+ Dictionary p\r
+ ) \r
+ {\r
+ return null;\r
+ }\r
+}\r