KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > sql > catalog > PermissionsCatalogRowFactory


1 /*
2
3    Derby - Class org.apache.derby.iapi.sql.dictionary.PermissionsCatalogRowFactory
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.impl.sql.catalog;
23
24 import org.apache.derby.iapi.error.StandardException;
25 import org.apache.derby.iapi.reference.Limits;
26 import org.apache.derby.iapi.services.uuid.UUIDFactory;
27 import org.apache.derby.iapi.sql.dictionary.CatalogRowFactory;
28 import org.apache.derby.iapi.sql.dictionary.PermissionsDescriptor;
29 import org.apache.derby.iapi.sql.execute.ExecIndexRow;
30 import org.apache.derby.iapi.sql.execute.ExecRow;
31 import org.apache.derby.iapi.sql.execute.ExecutionFactory;
32 import org.apache.derby.iapi.types.DataValueDescriptor;
33 import org.apache.derby.iapi.types.DataValueFactory;
34 import org.apache.derby.iapi.types.RowLocation;
35 import org.apache.derby.iapi.types.StringDataValue;
36
37 abstract class PermissionsCatalogRowFactory extends CatalogRowFactory
38 {
39     static final String JavaDoc AUTHORIZATION_ID_TYPE = "VARCHAR";
40     static final boolean AUTHORIZATION_ID_IS_BUILTIN_TYPE = true;
41     static final int AUTHORIZATION_ID_LENGTH = Limits.MAX_IDENTIFIER_LENGTH;
42
43     PermissionsCatalogRowFactory(UUIDFactory uuidf, ExecutionFactory ef, DataValueFactory dvf,
44                                         boolean convertIdToLower)
45     {
46         super(uuidf,ef,dvf,convertIdToLower);
47     }
48
49     DataValueDescriptor getAuthorizationID( String JavaDoc value)
50     {
51         return getDataValueFactory().getVarcharDataValue( value);
52     }
53
54     DataValueDescriptor getNullAuthorizationID()
55     {
56         return getDataValueFactory().getNullVarchar( (StringDataValue) null);
57     }
58
59     /**
60      * Extract an internal authorization ID from a row.
61      *
62      * @param row
63      * @param columnPos 1 based
64      *
65      * @return The internal authorization ID
66      */

67     String JavaDoc getAuthorizationID( ExecRow row, int columnPos)
68         throws StandardException
69     {
70         return row.getColumn( columnPos).getString();
71     }
72
73     /**
74      * Build an index key row from a permission descriptor. A key row does not include the RowLocation column.
75      *
76      * @param indexNumber
77      * @param perm a permission descriptor of the appropriate class for this PermissionsCatalogRowFactory class.
78      *
79      * @exception StandardException standard error policy
80      */

81     abstract ExecIndexRow buildIndexKeyRow( int indexNumber,
82                                                    PermissionsDescriptor perm)
83         throws StandardException;
84
85     /**
86      * Or a set of permissions in with a row from this catalog table
87      *
88      * @param row an existing row
89      * @param perm a permission descriptor of the appropriate class for this PermissionsCatalogRowFactory class.
90      * @param colsChanged An array with one element for each column in row. It is updated to
91      * indicate which columns in row were changed
92      *
93      * @return The number of columns that were changed.
94      *
95      * @exception StandardException standard error policy
96      */

97     abstract int orPermissions( ExecRow row, PermissionsDescriptor perm, boolean[] colsChanged)
98         throws StandardException;
99
100     /**
101      * Remove a set of permissions from a row from this catalog table
102      *
103      * @param row an existing row
104      * @param perm a permission descriptor of the appropriate class for this PermissionsCatalogRowFactory class.
105      * @param colsChanged An array with one element for each column in row. It is updated to
106      * indicate which columns in row were changed
107      *
108      * @return -1 if there are no permissions left in the row, otherwise the number of columns that were changed.
109      *
110      * @exception StandardException standard error policy
111      */

112     abstract int removePermissions( ExecRow row, PermissionsDescriptor perm, boolean[] colsChanged)
113         throws StandardException;
114
115     /**
116      * Set the uuid of the passed permission descriptor to the uuid of the row
117      * from the system table. DataDictionary will make this call before calling
118      * the dependency manager to send invalidation messages to the objects
119      * dependent on the permission descriptor's uuid.
120      *
121      * @param row The row from the system table for the passed permission descriptor
122      * @param perm Permission descriptor
123      * @throws StandardException
124      */

125     abstract void setUUIDOfThePassedDescriptor(ExecRow row, PermissionsDescriptor perm) throws StandardException;
126 }
127
Popular Tags