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 DatabaseMetaDataImpl.java
Date Wed, 04 Dec 2002 03:30:15 GMT
prickett    2002/12/03 19:30:15

  Modified:    periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database
                        DatabaseMetaDataImpl.java
  Log:
  Added the following constants to DatabaseMetaDataImpl
  
  SYSTEM_USER_NAME_KEY
  SYSTEM_USER_HOME_KEY
  ABSOLUTE_DEFAULT_DB_TYPE
  ABSOLUTE_DEFAULT_USER_NAME
  ABSOLUTE_DEFAULT_PASSWORD
  ABSOLUTE_DEFAULT_PATH
  ABSOLUTE_DEFAULT_NAME
  ABSOLUTE_DEFAULT_HOST
  
  Added the following accessors
  
  getUserName()
  setUserName()
  getPassword()
  setPassword()
  getDefaultUserName()
  setDefaultUserName()
  getDefaultPassword()
  setDefaultPassword()
  getDefaultAdminPath()
  setDefaultAdminPath()
  getDefaultType()
  setDefaultType()
  getGlobalDefaultUserName()
  setGlobalDefaultUserName()
  getGlobalDefaultPassword()
  setGlobalDefaultPassword()
  getDefaultName()
  setDefaultName()
  getDefaultPath()
  setDefaultPath()
  getDefaultHost()
  setDefaultHost()
  
  Revision  Changes    Path
  1.14      +323 -3    jakarta-commons-sandbox/periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database/DatabaseMetaDataImpl.java
  
  Index: DatabaseMetaDataImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database/DatabaseMetaDataImpl.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DatabaseMetaDataImpl.java	2 Dec 2002 02:16:31 -0000	1.13
  +++ DatabaseMetaDataImpl.java	4 Dec 2002 03:30:15 -0000	1.14
  @@ -91,6 +91,34 @@
       /** The key for the database host in the velocity context */
       public static final String DATABASE_HOST_KEY = "databaseHost";
   
  +    /** The key for the system user name in the velocity context */
  +    public static final String SYSTEM_USER_NAME_KEY = "systemUserName";
  +
  +    /** The key for the system user home directory in the velocity context */
  +    public static final String SYSTEM_USER_HOME_KEY = "systemUserHome";
  +
  +    /** A hard coded default db type */
  +    public static final String ABSOLUTE_DEFAULT_DB_TYPE = "axion";
  +    
  +    /** A hard coded default user name */
  +    public static final String ABSOLUTE_DEFAULT_USER_NAME =
  +           System.getProperty("user.name");
  +    
  +    /** A hard coded default user password */
  +    public static final String ABSOLUTE_DEFAULT_PASSWORD = "";
  +
  +    /** A hard coded default user path */
  +    public static final String ABSOLUTE_DEFAULT_PATH = 
  +           System.getProperty("user.home") + 
  +           System.getProperty("file.separator") + ".periodicity";
  +    
  +    /** A hard coded default database name */
  +    public static final String ABSOLUTE_DEFAULT_NAME = "periodicity";
  +
  +    /** A hard coded default database host */
  +    public static final String ABSOLUTE_DEFAULT_HOST = "localhost";
  +           
  +    
       /** A variable to hold the name of the database */
       private String name = null;
   
  @@ -626,6 +654,298 @@
           {
               throw new Exception("newval is an illegal value.");
           }
  +    }    
  +
  +    /**
  +     * The purpose of this method is to return the database user name
  +     * @return The database user name as a string
  +     */
  +    public String getUserName()
  +    {
  +        if(userName != null)
  +        {
  +            return userName;
  +        }
  +        else
  +        {
  +            return getDefaultUserName();
  +        }    
  +    }
  +
  +    /**
  +     * The purpose of this method is to set the database user name.
  +     * @param newval The new value of the database user name as a string.
  +     */
  +    public void setUserName(String newval)
  +    {
  +        userName = newval;
  +    }
  +
  +    /**
  +     * The purpose of this method is to return the database password
  +     * @return The database password as a string.
  +     */
  +    public String getPassword()
  +    {
  +        if(databasePassword != null)
  +        {
  +            return databasePassword;
  +        }
  +        else
  +        {
  +            return getDefaultPassword();
  +        }    
  +    }
  +
  +    /**
  +     * The purpose of this method is to set the database password.
  +     * @param newval The new value for the database password as a string.
  +     */
  +    public void setPassword(String newval)
  +    {
  +        databasePassword = newval;
  +    }    
  +
  +    /**
  +     * The purpose of this method is to return the default user name.
  +     * @return The default user name as a string.
  +     */
  +    public String getDefaultUserName()
  +    {
  +        if(defaultUser != null)
  +        {
  +            return defaultUser;
  +        }
  +        else
  +        {
  +            return getGlobalDefaultUserName();
  +        }    
  +    }
  +
  +    /**
  +     * The purpose of this method is to set the default user name.
  +     * @param newval The new value for the user name as a string.
  +     */
  +    void setDefaultUserName(String newval)
  +    {
  +        defaultUser = newval;
  +    }
  +
  +    /**
  +     * The purpose of this method is to return the default password.
  +     * @return The default password as a string.
  +     */
  +    public String getDefaultPassword()
  +    {
  +        if(defaultPassword != null)
  +        {
  +            return defaultPassword;
  +        }
  +        else
  +        {
  +            return getGlobalDefaultPassword();
  +        }
  +    }
  +
  +    /**
  +     * The purpose of this method is to set the default password.
  +     * @param newval The new value of the default password.
  +     */
  +    void setDefaultPassword(String newval)
  +    {
  +        defaultPassword = newval;
  +    }
  +
  +    /**
  +     * The purpose of this method is to get the default administration path
  +     * @return The default administration path as a string.
  +     */
  +    public String getDefaultAdminPath()
  +    {
  +        return defaultAdminPath;
  +    }
  +
  +    /**
  +     * The purpose of this method is to set the default administration path
  +     * @param newval The new value for the administration path as a string.
  +     */
  +    void setDefaultAdminPath(String newval)
  +    {
  +        defaultAdminPath = newval;
  +    }
  +
  +    /**
  +     * The purpose of this method is to return the default database type.
  +     * @return The default database type.
  +     */
  +    public static String getDefaultType()
  +    {
  +        if(defaultType != null)
  +        {
  +            return defaultType;
  +        }
  +        else
  +        {
  +            return ABSOLUTE_DEFAULT_DB_TYPE;
  +        }    
  +    }
  +
  +    /**
  +     * The purpose of this method is to set the default database type.
  +     * @param newval The new value for the default database type.
  +     */
  +    static void setDefaultType(String newval)
  +    {
  +        defaultType = newval;
  +    }
  +
  +    /**
  +     * The purpose of this method is to get the global default user name.
  +     * @return The global default user name as a string.
  +     */
  +    public static String getGlobalDefaultUserName()
  +    {
  +        if(globalDefaultUser != null)
  +        {
  +            return globalDefaultUser;
  +        }
  +        else
  +        {
  +            return ABSOLUTE_DEFAULT_USER_NAME;
  +        }
  +    }
  +
  +    /**
  +     * The purpose of this method is to set the global default user name.
  +     * @param newval The new value for the global default user name as a 
  +     *        string.
  +     */
  +    void setGlobalDefaultUserName(String newval) throws Exception
  +    {
  +        VelocityContext context = new VelocityContext();
  +        context.put(SYSTEM_USER_NAME_KEY, 
  +               ABSOLUTE_DEFAULT_USER_NAME);
  +        StringWriter swriter = new StringWriter();
  +        if(Velocity.evaluate(context, swriter, "defaultUserName", newval))
  +        {
  +            defaultUser = swriter.toString();
  +        }
  +        else
  +        {
  +            throw new Exception("Velocity Error");
  +        }    
  +    }
  +
  +    /**
  +     * The purpose of this method is to get the global default password.
  +     * @return The global default password as a string.
  +     */
  +    public static String getGlobalDefaultPassword()
  +    {
  +        if(globalDefaultPassword != null)
  +        {
  +            return globalDefaultPassword;
  +        }
  +        else
  +        {
  +            return ABSOLUTE_DEFAULT_PASSWORD;
  +        }
  +    }
  +
  +    /**
  +     * The purpose of this method is to set the global default password.
  +     * @param newval The new value for the global default password.
  +     */
  +    static void setGlobalDefaultPassword(String newval)
  +    {
  +        globalDefaultPassword = newval;
  +    }    
  +
  +    /**
  +     * The purpose of this method is to get the default name for the
  +     * database.
  +     * @return The default name of the database as a string.
  +     */
  +    public String getDefaultName()
  +    {
  +        if(defaultName != null)
  +        {
  +            return defaultName;
  +        }
  +        else
  +        {
  +            return ABSOLUTE_DEFAULT_NAME;
  +        }
  +    }    
  +
  +    /**
  +     * The purpose of this method is to set the default name for the database.
  +     * @param newval The new value for the name of this database as a string.
  +     */
  +    static void setDefaultName(String newval)
  +    {
  +        defaultName = newval;
  +    }
  +
  +    /**
  +     * The purpose of this method is to get the default path for the database
  +     * @return The default path of the database as a string
  +     */
  +    public String getDefaultPath()
  +    {
  +        if(defaultPath != null)
  +        {
  +            return defaultPath;
  +        }
  +        else
  +        {
  +            return ABSOLUTE_DEFAULT_PATH;
  +        }
  +    }    
  +    
  +    /**
  +     * The purpose of this method is to set the default path for this database
  +     * @param newval The new value or the default path as a string.
  +     */
  +    void setDefaultPath(String newval) throws Exception
  +    {
  +        VelocityContext context = new VelocityContext();
  +        context.put(SYSTEM_USER_HOME_KEY,
  +               System.getProperty("user.home"));
  +        StringWriter swriter = new StringWriter();
  +        if(Velocity.evaluate(context, swriter, "defaultPath", newval))
  +        {
  +            defaultPath = swriter.toString();
  +        }
  +        else
  +        {
  +            throw new Exception("Velocity error");
  +        }    
  +    }
  +
  +    /**
  +     * The purpose of this method is to get the default host for the database
  +     * @return The default host for the database.
  +     */
  +    public String getDefaultHost()
  +    {
  +        if(defaultHost != null)
  +        {
  +            return defaultHost;
  +        }
  +        else
  +        {
  +            return ABSOLUTE_DEFAULT_HOST;
  +        }
  +    }    
  +
  +    /**
  +     * The purpose of this method is to set the default host for the database
  +     * @param newval The new value for the default host as a string
  +     */
  +    void setDefaultHost(String newval)
  +    {
  +        defaultHost = newval;
       }    
   
       /**
  
  
  

--
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