prickett    2002/10/25 17:29:37

  Modified:    
periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database
                        DriverContentHandler.java DriverMetaDataImpl.java
  Log:
  Added a driverMeta variable to the driver content handler
  
  Added a DEFAULT_PROTOCOL_NAME to the DriverMetaDataImpl
  
  Added a short description variable to the DriverMetaDataImpl
  
  Added a web url variable to the DriverMetaDataImpl
  
  Added a driver class name variable to the the DriverMetaDataImpl
  
  Added a map to hold all the protocols in DriverMetaDataImpl,
  it is keyed on name.
  
  Removed the second constructor that took everything as an argument and replaced
  it with a constructor that takes only a string.
  
  Added an addProtocol method to the DriverMetaDataImpl class
  
  Revision  Changes    Path
  1.3       +7 -7      
jakarta-commons-sandbox/periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database/DriverContentHandler.java
  
  Index: DriverContentHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database/DriverContentHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DriverContentHandler.java 25 Oct 2002 22:29:34 -0000      1.2
  +++ DriverContentHandler.java 26 Oct 2002 00:29:37 -0000      1.3
  @@ -133,6 +133,10 @@
       /** A variable to hold the protocols for the current driver */
       private Map protocols = null;
   
  +    /** A variable to hold the Meta Data Object to be added to the Driver 
  +        Service */
  +    private DriverMetaData driverMeta = null;    
  +
       /** A buffer to hold the current character information until it
           is stored in its respective variable */
       private StringBuffer buffy = null;
  @@ -309,10 +313,6 @@
                      PeriodicityDrivers.getService();
                   if(driversService != null)
                   {
  -                    DriverMetaDataImpl driverMeta = 
  -                           new DriverMetaDataImpl(name, driverClassName, 
  -                           protocols, 
  -                           shortDescription, description, webUrl, scheme);
                       driversService.addDriver(driverMeta);
                   }
                   else if(driversService == null)
  
  
  
  1.5       +133 -11   
jakarta-commons-sandbox/periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database/DriverMetaDataImpl.java
  
  Index: DriverMetaDataImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/periodicity/src/plugins-build/database/src/java/org/apache/commons/periodicity/database/DriverMetaDataImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DriverMetaDataImpl.java   25 Oct 2002 22:29:34 -0000      1.4
  +++ DriverMetaDataImpl.java   26 Oct 2002 00:29:37 -0000      1.5
  @@ -65,15 +65,33 @@
   
   
   import java.util.Map;
  +import java.util.Hashtable;
   import org.apache.velocity.VelocityContext;
   import org.apache.velocity.context.Context;
   
   public class DriverMetaDataImpl implements DriverMetaData
   {
   
  +    public static final String DEFAULT_PROTOCOL_NAME = "default.protocol";
  +
       /** A variable to store the name of the driver */
       private String name = null;
   
  +    /** A variable to store the short description of the driver */
  +    private String shortDescription = null;
  +
  +    /** A variable to store the description of the driver */
  +    private String description = null;
  +
  +    /** A variable to store the url of the driver's website */
  +    private String webUrl = null;
  +
  +    /** A variable to store the class name of the driver */
  +    private String driverClassName = null;
  +
  +    /** A Map to store the protocols supported by the driver keyed by name */
  +    private Map protocols = null;
  +
       /** A variable to store the properties of the driver */
       private Context context = null;
   
  @@ -82,17 +100,21 @@
        * implementation given a name and a set of properties.
        * @param newName The name of the new Driver Meta Data object.
        */
  -    DriverMetaDataImpl(String newName, String driverClassName, 
  -           Map protocols, String shortDescription, String description,
  -           String webUrl, String scheme) 
  -           throws Exception
  +    DriverMetaDataImpl(String newName) throws Exception 
       {
  -        if(name != null && driverClassName != null && protocols != null &&
  -               !protocols.isEmpty())
  +        if(newName != null)
  +        {
  +            setName(newName);
  +        }
  +        else if(newName == null)
           {
  -            context = new VelocityContext();
  +            throw new Exception("newName == null");
  +        }
  +        else
  +        {
  +            throw new Exception("UNEXPECTED EXCEPTION");
           }    
  -    }    
  +    }
       
       /**
        * The purpose of this method is to return the name of this driver
  @@ -120,6 +142,106 @@
               throw new Exception("newName == null");
           }
       }    
  +
  +    /**
  +     * The purpose of this method is to return the short description for 
  +     * this driver.
  +     * @return The short description of this driver as a string
  +     */
  +    public String getShortDescription()
  +    {
  +        return shortDescription;
  +    }
  +
  +    /**
  +     * The purpose of this method is to set the short description of this 
  +     * driver.
  +     * @param newval The new value for the short description as a string.
  +     */
  +    void setShortDescription(String newval)
  +    {
  +        shortDescription = newval;
  +    }
  +
  +    /**
  +     * The purpose of this method is to return the url of the website for this
  +     * driver.
  +     * @return The url of the website for this driver as a string.
  +     */
  +    public String getWebUrl()
  +    {
  +        return webUrl;
  +    }
  +
  +    /**
  +     * The purpose of this method is to set the url of the website for this 
  +     * driver.
  +     * @param newval The new value for the url of the website for this driver.
  +     */
  +    void setWebUrl(String newval)
  +    {
  +        webUrl = newval;
  +    }
  +
  +    /**
  +     * The purpose of this method is to return the class name of this jdbc 
  +     * driver.
  +     * @return The class name of the jdbc driver as a string.
  +     */
  +    public String getClassName()
  +    {
  +        return driverClassName;
  +    }
  +
  +    /**
  +     * The purpose of this method is to set the class name of this jdbc driver.
  +     * @param newval The name of the class for this jdbc driver.
  +     */
  +    void setClassName(String newval) throws Exception
  +    {
  +        if(newval != null)
  +        {
  +            driverClassName = newval;
  +        }
  +        else if(newval == null)
  +        {
  +            throw new Exception("newval == null");
  +        }
  +        else
  +        {
  +            throw new Exception("UNEXPECTED EXCEPTION");
  +        }
  +    }    
  +
  +    /**
  +     * The purpose of this method is to add a protocol to the driver.
  +     * @param newName The name of the new protocol as a string
  +     * @param newScheme The url scheme for the new protocol
  +     */
  +    public void addProtocol(String newName, String newScheme) throws Exception
  +    {
  +        if(newName == null && newScheme != null)
  +        {
  +            addProtocol(DEFAULT_PROTOCOL_NAME, newScheme);
  +        }
  +        else if(newName != null && newScheme != null)
  +        {
  +            if(protocols == null)
  +            {
  +                protocols = new Hashtable();
  +            }
  +            protocols.put(newName, newScheme);
  +        }
  +        else if(newScheme == null)
  +        {
  +            throw new Exception("scheme == null");
  +        }
  +        else
  +        {
  +            throw new Exception("UNEXPECTED EXCEPTION");
  +        }    
  +    }    
  +    
   
       /**
        * The purpose of this method is to return the properties that are
  
  
  

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

Reply via email to