KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > controller > scheduler > schema > SchedulerDatabaseTable


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Contact: sequoia@continuent.org
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  * Initial developer(s): Emmanuel Cecchet.
20  * Contributor(s): _________________________.
21  */

22
23 package org.continuent.sequoia.controller.scheduler.schema;
24
25 import org.continuent.sequoia.controller.sql.schema.DatabaseTable;
26
27 /**
28  * A <code>CacheDatabaseTable</code> represents a database table and its
29  * associated cache entries. It has an array of <code>CacheDatabaseColumn</code>
30  * objects.
31  * <p>
32  * Keep it mind that <code>ArrayList</code> is not synchronized...
33  *
34  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet</a>
35  * @version 1.0
36  */

37 public class SchedulerDatabaseTable
38 {
39   /** Database table name. */
40   private String JavaDoc name;
41
42   private TransactionExclusiveLock lock = new TransactionExclusiveLock();
43
44   /**
45    * Creates a new <code>CacheDatabaseTable</code> instance.
46    *
47    * @param databaseTable the database table
48    */

49   public SchedulerDatabaseTable(DatabaseTable databaseTable)
50   {
51     // Clone the name and the columns
52
name = databaseTable.getName();
53   }
54
55   /**
56    * Gets the name of the table.
57    *
58    * @return the table name
59    */

60   public String JavaDoc getName()
61   {
62     return name;
63   }
64
65   /**
66    * Returns the lock for this table.
67    *
68    * @return a <code>TransactionExclusiveLock</code> instance
69    * @see TransactionExclusiveLock
70    */

71   public TransactionExclusiveLock getLock()
72   {
73     return lock;
74   }
75
76   /**
77    * Two <code>CacheDatabaseColumn</code> are equals if they have the same
78    * name and the same columns.
79    *
80    * @param other the object to compare with
81    * @return true if the 2 objects are the same
82    */

83   public boolean equals(Object JavaDoc other)
84   {
85     if ((other == null) || !(other instanceof SchedulerDatabaseTable))
86       return false;
87     else
88       return name.equals(((SchedulerDatabaseTable) other).getName());
89   }
90
91   /**
92    * Returns information about the database table and its columns.
93    *
94    * @param longFormat <code>true</code> for a long format, <code>false</code>
95    * for a short summary
96    * @return a <code>String</code> value
97    */

98   public String JavaDoc getInformation(boolean longFormat)
99   {
100     return "Table " + name + ": ";
101   }
102 }
103
Popular Tags