Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

SchedulerDatabaseTable.java

00001 /**
00002  * C-JDBC: Clustered JDBC.
00003  * Copyright (C) 2002-2004 French National Institute For Research In Computer
00004  * Science And Control (INRIA).
00005  * Contact: c-jdbc@objectweb.org
00006  * 
00007  * This library is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU Lesser General Public License as published by the
00009  * Free Software Foundation; either version 2.1 of the License, or any later
00010  * version.
00011  * 
00012  * This library is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00015  * for more details.
00016  * 
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this library; if not, write to the Free Software Foundation,
00019  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00020  *
00021  * Initial developer(s): Emmanuel Cecchet.
00022  * Contributor(s): _________________________.
00023  */
00024 
00025 package org.objectweb.cjdbc.controller.scheduler.schema;
00026 
00027 import java.io.Serializable;
00028 
00029 import org.objectweb.cjdbc.common.sql.schema.DatabaseTable;
00030 
00031 /**
00032  * A <code>CacheDatabaseTable</code> represents a database table and its
00033  * associated cache entries. It has an array of <code>CacheDatabaseColumn</code>
00034  * objects.
00035  * 
00036  * <p>
00037  * Keep it mind that <code>ArrayList</code> is not synchronized...
00038  * 
00039  * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet</a>
00040  * @version 1.0
00041  */
00042 public class SchedulerDatabaseTable implements Serializable
00043 {
00044   /** Database table name. */
00045   private String name;
00046 
00047   private TransactionExclusiveLock lock = new TransactionExclusiveLock();
00048 
00049   /**
00050    * Creates a new <code>CacheDatabaseTable</code> instance.
00051    * 
00052    * @param databaseTable the database table
00053    */
00054   public SchedulerDatabaseTable(DatabaseTable databaseTable)
00055   {
00056     // Clone the name and the columns
00057     name = databaseTable.getName();
00058   }
00059 
00060   /**
00061    * Gets the name of the table.
00062    * 
00063    * @return the table name
00064    */
00065   public String getName()
00066   {
00067     return name;
00068   }
00069 
00070   /**
00071    * Returns the lock for this table.
00072    * 
00073    * @return a <code>TransactionExclusiveLock</code> instance
00074    * @see TransactionExclusiveLock
00075    */
00076   public TransactionExclusiveLock getLock()
00077   {
00078     return lock;
00079   }
00080 
00081   /**
00082    * Two <code>CacheDatabaseColumn</code> are equals if they have the same
00083    * name and the same columns.
00084    * 
00085    * @param other the object to compare with
00086    * @return true if the 2 objects are the same
00087    */
00088   public boolean equals(Object other)
00089   {
00090     if ((other == null) || !(other instanceof SchedulerDatabaseTable))
00091       return false;
00092     else
00093       return name.equals(((SchedulerDatabaseTable) other).getName());
00094   }
00095 
00096   /**
00097    * Returns information about the database table and its columns.
00098    * 
00099    * @param longFormat <code>true</code> for a long format, <code>false</code>
00100    *          for a short summary
00101    * @return a <code>String</code> value
00102    */
00103   public String getInformation(boolean longFormat)
00104   {
00105     return "Table " + name + ": ";
00106   }
00107 }

Generated on Mon Apr 11 22:01:34 2005 for C-JDBC by  doxygen 1.3.9.1