EMMA Coverage Report (generated Wed Jun 28 22:15:27 PDT 2006)
[all classes][org.apache.derby.impl.sql]

COVERAGE SUMMARY FOR SOURCE FILE [LanguageDbPropertySetter.java]

nameclass, %method, %block, %line, %
LanguageDbPropertySetter.java100% (1/1)80%  (4/5)96%  (22/23)88%  (7/8)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class LanguageDbPropertySetter100% (1/1)80%  (4/5)96%  (22/23)88%  (7/8)
LanguageDbPropertySetter (): void 100% (1/1)100% (3/3)100% (1/1)
apply (String, Serializable, Dictionary): Serviceable 100% (1/1)100% (2/2)100% (1/1)
init (boolean, Dictionary): void 0%   (0/1)0%   (0/1)0%   (0/1)
map (String, Serializable, Dictionary): Serializable 100% (1/1)100% (2/2)100% (1/1)
validate (String, Serializable, Dictionary): boolean 100% (1/1)100% (15/15)100% (4/4)

1/*
2 
3   Derby - Class org.apache.derby.impl.sql.LanguageDbPropertySetter
4 
5   Copyright 1999, 2004 The Apache Software Foundation or its licensors, as applicable.
6 
7   Licensed under the Apache License, Version 2.0 (the "License");
8   you may not use this file except in compliance with the License.
9   You may obtain a copy of the License at
10 
11      http://www.apache.org/licenses/LICENSE-2.0
12 
13   Unless required by applicable law or agreed to in writing, software
14   distributed under the License is distributed on an "AS IS" BASIS,
15   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   See the License for the specific language governing permissions and
17   limitations under the License.
18 
19 */
20 
21package org.apache.derby.impl.sql;
22 
23import org.apache.derby.iapi.services.property.PropertySetCallback;
24import org.apache.derby.iapi.services.property.PropertyUtil;
25import org.apache.derby.iapi.reference.Property;
26import org.apache.derby.iapi.reference.SQLState;
27import org.apache.derby.iapi.services.daemon.Serviceable;
28import org.apache.derby.iapi.services.sanity.SanityManager;
29import org.apache.derby.iapi.services.context.ContextService;
30import org.apache.derby.iapi.error.StandardException;
31import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
32import org.apache.derby.iapi.store.access.TransactionController;
33import java.io.Serializable;
34import java.util.Dictionary;
35 
36/**
37 * A class to handle setting language database properties
38 */
39public class LanguageDbPropertySetter implements PropertySetCallback
40{
41        public void init(boolean dbOnly, Dictionary p) {
42                // not called yet ...
43        }
44        /** @exception StandardException Thrown on error. */
45        public boolean validate
46        (
47                String                        key,
48                Serializable        value,
49                Dictionary                p
50        ) throws StandardException 
51        {
52                // Disallow changing sqlAuthorization from true to false or null after
53                // switching to Standard authorization
54                if (key.trim().equals(Property.SQL_AUTHORIZATION_PROPERTY))
55                {
56                        LanguageConnectionContext lcc = (LanguageConnectionContext)
57                                        ContextService.getContext(LanguageConnectionContext.CONTEXT_ID);
58 
59                        if (lcc.usesSqlAuthorization() && !Boolean.valueOf((String)value).booleanValue())
60                                throw StandardException.newException(SQLState.PROPERTY_UNSUPPORTED_CHANGE,
61                                        key, value);
62                }
63 
64                if (key.equals(Property.LANGUAGE_STALE_PLAN_CHECK_INTERVAL)) {
65                        PropertyUtil.intPropertyValue(
66                                                Property.LANGUAGE_STALE_PLAN_CHECK_INTERVAL,
67                                                value,
68                                                Property.MIN_LANGUAGE_STALE_PLAN_CHECK_INTERVAL,
69                                                Integer.MAX_VALUE,
70                                                Property.DEFAULT_LANGUAGE_STALE_PLAN_CHECK_INTERVAL
71                                                );
72                        return true;
73                }
74 
75                return false;
76        }
77 
78        public Serviceable apply
79        (
80                String                        key,
81                Serializable        value,
82                Dictionary                p
83        ) 
84        {
85                return null;
86        }
87 
88         public Serializable map
89        (
90                String                        key,
91                Serializable        value,
92                Dictionary                p
93        ) 
94        {
95                return null;
96        }
97}

[all classes][org.apache.derby.impl.sql]
EMMA 2.0.5312 (C) Vladimir Roubtsov