KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > cjdbc > controller > scheduler > schema > SchedulerDatabaseTable


1 /**
2  * C-JDBC: Clustered JDBC.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Contact: c-jdbc@objectweb.org
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; either version 2.1 of the License, or any later
10  * version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20  *
21  * Initial developer(s): Emmanuel Cecchet.
22  * Contributor(s): _________________________.
23  */

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

42 public class SchedulerDatabaseTable implements Serializable JavaDoc
43 {
44   /** Database table name. */
45   private String JavaDoc name;
46
47   private TransactionExclusiveLock lock = new TransactionExclusiveLock();
48
49   /**
50    * Creates a new <code>CacheDatabaseTable</code> instance.
51    *
52    * @param databaseTable the database table
53    */

54   public SchedulerDatabaseTable(DatabaseTable databaseTable)
55   {
56     // Clone the name and the columns
57
name = databaseTable.getName();
58   }
59
60   /**
61    * Gets the name of the table.
62    *
63    * @return the table name
64    */

65   public String JavaDoc getName()
66   {
67     return name;
68   }
69
70   /**
71    * Returns the lock for this table.
72    *
73    * @return a <code>TransactionExclusiveLock</code> instance
74    * @see TransactionExclusiveLock
75    */

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

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

103   public String JavaDoc getInformation(boolean longFormat)
104   {
105     return "Table " + name + ": ";
106   }
107 }
108
Popular Tags