commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prick...@apache.org
Subject cvs commit: jakarta-commons-sandbox/periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database DatabaseMetaData.java DatabaseMetaDataImpl.java
Date Sun, 20 Oct 2002 21:15:12 GMT
prickett    2002/10/20 14:15:12

  Added:       periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database
                        DatabaseMetaData.java DatabaseMetaDataImpl.java
  Log:
  Added a Database Meta Data class and a Database Meta Data Implementation.
  
  Revision  Changes    Path
  1.1                  jakarta-commons-sandbox/periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database/DatabaseMetaData.java
  
  Index: DatabaseMetaData.java
  ===================================================================
  package org.apache.commons.periodicity.database;
  
  public interface DatabaseMetaData
  {
      /**
       * The purpose of this method is to return the name of this database.
       * @return The name of the database as a string.
       */
      public String getName();
  
      /**
       * The purpose of this method is to return the type of the database.
       * @return The type of the database as a string.
       */
      public String getType();
  
      /**
       * The purpose of this method is to return the url that uniquely
       * identifies where to obtain a connection to the database.
       * @return The database url as a string.
       */
      public String getUrl();
  }    
      
      
  
  
  
  
  1.1                  jakarta-commons-sandbox/periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database/DatabaseMetaDataImpl.java
  
  Index: DatabaseMetaDataImpl.java
  ===================================================================
  package org.apache.commons.periodicity.database;
  
  public class DatabaseMetaDataImpl implements DatabaseMetaData
  {
      /** A variable to hold the name of the database */
      private String name = null;
  
      /** A variable to hold the type of the database */
      private String dbType = null;
  
      /**
       * The purpose of this method is to create a new database meta data
       * implementation given a name and a type.
       * @param newName The name of the new database to create.
       * @param newType The type of the new database to create.
       */
      public DatabaseMetaDataImpl(String newName, String newType) 
             throws Exception
      {
          if(newName != null && newType != null)
          {
              setName(newName);
              setType(newType);
          }
          else if(newName == null)
          {
              throw new Exception("newName == null");
          }
          else if(newType == null)
          {
              throw new Exception("newType == null");
          }
          else
          {
              throw new Exception("UNEXPECTED - Unexpected Exception");
          }
      }
  
      /**
       * The purpose of this method is to return the name of the database
       * that is represented by this meta data object.
       * @return The name of the database as a string.
       */
      public String getName()
      {
          return name;
      }    
  
      /**
       * The purpose of this method is to set the name of the database that 
       * is represented by this meta data object.
       * @param newval The new name of the database as a string.
       */
      private void setName(String newval) throws Exception
      {
          if(newval != null)
          {
              name = newval;
          }
          else
          {
              throw new Exception("newval == null");
          }
      }
  
      /**
       * The purpose of this method is to return the type of database that
       * is represented by this meta data object.
       * @return The type of the database as a string.
       */
      public String getType()
      {
          return dbType;
      }
  
      /**
       * The purpose of this method is to set the type of the database that
       * is represented by this meta data object.
       * @param newval The new value for the type of the database as a string.
       */
      private void setType(String newval) throws Exception
      {
          if(newval != null)
          {
              dbType = newval;
          }
          else
          {
              throw new Exception("newval == null");
          }
      }    
      
      /**
       * The purpose of this method is to return the url of the database.
       * @return The url of the database as a string.
       */
      public String getUrl()
      {
          return null;
      }    
  }    
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message