KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > controller > semantic > SemanticBehavior


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2006 Continuent, Inc.
4  * Contact: sequoia@continuent.org
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * Initial developer(s): Emmanuel Cecchet.
19  * Contributor(s): ______________________.
20  */

21
22 package org.continuent.sequoia.controller.semantic;
23
24 import java.util.SortedSet JavaDoc;
25
26 /**
27  * This class defines a Semantic behavior for any kind of structure.
28  *
29  * @author <a HREF="mailto:emmanuel.cecchet@continuent.com">Emmanuel Cecchet</a>
30  * @version 1.0
31  */

32 public class SemanticBehavior
33 {
34   private SortedSet JavaDoc readSet;
35   private SortedSet JavaDoc writeSet;
36   private SortedSet JavaDoc proceduresReferenced;
37   private boolean altersDatabaseSchema;
38   private boolean altersMetadataCache;
39   private boolean altersQueryResultCache;
40   private boolean altersUsers;
41   private boolean isReadOnly;
42   private boolean needsMacroProcessing;
43   private int ordering;
44   private int requiresConnectionPoolFlush;
45
46   /** Serializable order value for ordering semantic */
47   public static final int SERIALIZABLE_ORDER = 1;
48   /** Out of order value for ordering semantic */
49   public static final int OUT_OF_ORDER = 2;
50
51   /** Flush current user value for requiresConnectionPoolFlush */
52   public static final int FLUSH_CURRENT_USER = 1;
53   /** Flush all users value for requiresConnectionPoolFlush */
54   public static final int FLUSH_ALL_USERS = 2;
55   /** Flush none value for requiresConnectionPoolFlush */
56   public static final int FLUSH_NONE = 3;
57
58   /**
59    * Creates a new <code>SemanticBehavior</code> object
60    *
61    * @param readSet list of table/views accessed in read
62    * @param writeSet list of table/views accessed in write
63    * @param proceduresReferenced list of stored procedures keys referenced
64    * @param altersDatabaseSchema true if the database schema is altered
65    * (contains DDL)
66    * @param altersMetadataCache true if the metadata cache must be refreshed
67    * after this call
68    * @param altersQueryResultCache true if the query result cache must be
69    * refreshed after this call
70    * @param altersUsers true if the user rights are altered and must be
71    * refreshed after this call
72    * @param isReadOnly true if the call does not update in any way (directly or
73    * indirectly)
74    * @param needsMacroProcessing true if macros should be processed
75    * @param ordering SERIALIZABLE_ORDER or OUT_OF_ORDER
76    * @param requiresConnectionPoolFlush one of FLUSH_CURRENT_USER,
77    * FLUSH_ALL_USERS or FLUSH_NONE
78    */

79   public SemanticBehavior(SortedSet JavaDoc readSet, SortedSet JavaDoc writeSet,
80       SortedSet JavaDoc proceduresReferenced, boolean altersDatabaseSchema,
81       boolean altersMetadataCache, boolean altersQueryResultCache,
82       boolean altersUsers, boolean isReadOnly, boolean needsMacroProcessing,
83       int ordering, int requiresConnectionPoolFlush)
84   {
85     this.readSet = readSet;
86     this.writeSet = writeSet;
87     this.proceduresReferenced = proceduresReferenced;
88     this.altersDatabaseSchema = altersDatabaseSchema;
89     this.altersMetadataCache = altersMetadataCache;
90     this.altersQueryResultCache = altersQueryResultCache;
91     this.altersUsers = altersUsers;
92     this.isReadOnly = isReadOnly;
93     this.needsMacroProcessing = needsMacroProcessing;
94     this.ordering = ordering;
95     this.requiresConnectionPoolFlush = requiresConnectionPoolFlush;
96   }
97
98   /**
99    * Returns the altersDatabaseSchema value.
100    *
101    * @return Returns the altersDatabaseSchema.
102    */

103   public boolean altersDatabaseSchema()
104   {
105     return altersDatabaseSchema;
106   }
107
108   /**
109    * Returns the altersMetadataCache value.
110    *
111    * @return Returns the altersMetadataCache.
112    */

113   public boolean altersMetadataCache()
114   {
115     return altersMetadataCache;
116   }
117
118   /**
119    * Returns the altersQueryResultCache value.
120    *
121    * @return Returns the altersQueryResultCache.
122    */

123   public boolean altersQueryResultCache()
124   {
125     return altersQueryResultCache;
126   }
127
128   /**
129    * Returns the altersUsers value.
130    *
131    * @return Returns the altersUsers.
132    */

133   public boolean altersUsers()
134   {
135     return altersUsers;
136   }
137
138   /**
139    * Returns true if the ordering is set to OUT_OF_ORDER
140    *
141    * @return true if the command can execute out of order
142    */

143   public boolean canExecuteOutOfOrder()
144   {
145     return ordering == OUT_OF_ORDER;
146   }
147
148   /**
149    * Returns the ordering value.
150    *
151    * @return Returns the ordering.
152    */

153   public int getOrdering()
154   {
155     return ordering;
156   }
157
158   /**
159    * Returns the proceduresReferenced value.
160    *
161    * @return Returns the proceduresReferenced.
162    */

163   public SortedSet JavaDoc getProceduresReferenced()
164   {
165     return proceduresReferenced;
166   }
167
168   /**
169    * Returns the readSet value.
170    *
171    * @return Returns the readSet.
172    */

173   public SortedSet JavaDoc getReadSet()
174   {
175     return readSet;
176   }
177
178   /**
179    * Returns the requiresConnectionPoolFlush value.
180    *
181    * @return Returns the requiresConnectionPoolFlush.
182    */

183   public int getRequiresConnectionPoolFlush()
184   {
185     return requiresConnectionPoolFlush;
186   }
187
188   /**
189    * Returns the writeSet value.
190    *
191    * @return Returns the writeSet.
192    */

193   public SortedSet JavaDoc getWriteSet()
194   {
195     return writeSet;
196   }
197
198   /**
199    * Returns the isReadOnly value.
200    *
201    * @return Returns the isReadOnly.
202    */

203   public boolean isReadOnly()
204   {
205     return isReadOnly;
206   }
207
208   /**
209    * Returns the needsMacroProcessing value.
210    *
211    * @return Returns the needsMacroProcessing.
212    */

213   public boolean needsMacroProcessing()
214   {
215     return needsMacroProcessing;
216   }
217
218 }
219
Popular Tags