SPT RWT Application API

com.sptci.rwt
Class DatabaseType

java.lang.Object
  extended by com.sptci.rwt.DatabaseType
All Implemented Interfaces:
Serializable

public class DatabaseType
extends Object
implements Serializable

A simple bean used to represent different types of database engines that the application can connect to.

© Copyright 2007 Sans Pareil Technologies, Inc.

Version:
$Id: DatabaseType.java 4123 2008-05-25 21:49:01Z rakesh $
Author:
Rakesh Vidyadharan 2007-09-24
See Also:
Serialized Form

Field Summary
private  String driver
          The fully qualified name of the JDBC driver class.
private  String name
          The name of the database engine represented by this instance.
private  Map<String,ConnectionData> savedConnections
          A map that stores saved ConnectionData identified by a unique name.
private  String urlPattern
          The encoded JDBC url pattern to use to build a connection url to the database.
 
Constructor Summary
protected DatabaseType()
          Default constructor.
 
Method Summary
(package private)  void add(String name, ConnectionData data)
          Add the specified connection data to the savedConnections map.
(package private)  void delete(String name)
          Remove the saved connection identified by the specified name.
 Map<String,ConnectionData> getConnectionData()
          Return a collection of all the saved connection data objects.
 ConnectionData getConnectionData(String name)
          Return the connection data uniquely identified by the specified name.
 String getDriver()
          Returns driver.
 String getName()
          Returns name.
 Collection<String> getNames()
          Return a collection of all the names used to store connections.
 String getUrlPattern()
          Returns urlPattern.
 boolean hasName(String name)
          Check to see if a saved connection exists with the specified name.
protected  void setDriver(String driver)
          Set driver.
protected  void setName(String name)
          Set name.
protected  void setUrlPattern(String urlPattern)
          Set urlPattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

savedConnections

private Map<String,ConnectionData> savedConnections
A map that stores saved ConnectionData identified by a unique name.


name

private String name
The name of the database engine represented by this instance.


urlPattern

private String urlPattern
The encoded JDBC url pattern to use to build a connection url to the database.


driver

private String driver
The fully qualified name of the JDBC driver class.

Constructor Detail

DatabaseType

protected DatabaseType()
Default constructor. Not publicly instantiable.

Method Detail

hasName

public boolean hasName(String name)
Check to see if a saved connection exists with the specified name.

Parameters:
name - The name to check for uniqueness.

getNames

public Collection<String> getNames()
Return a collection of all the names used to store connections.

Returns:
The collection of unique names for saved connections.

getConnectionData

public ConnectionData getConnectionData(String name)
Return the connection data uniquely identified by the specified name.

Parameters:
name - The unique name to use to fetch the connection data.
Returns:
The matching connection data object or null if no such mapping exists.

getConnectionData

public Map<String,ConnectionData> getConnectionData()
Return a collection of all the saved connection data objects.

Returns:
The map of all saved name-connection combinations.

add

void add(String name,
         ConnectionData data)
Add the specified connection data to the savedConnections map. If such a mapping already exists, the existing mapping is updated.

Parameters:
name - The unique name to use to identify this connection.
data - The connection data to be saved.
See Also:
hasName(java.lang.String)

delete

void delete(String name)
Remove the saved connection identified by the specified name.

Parameters:
name - The unique name to use to identify the connection to remove.

getName

public String getName()
Returns name.

Returns:
The value/reference of/to name.

setName

protected void setName(String name)
Set name.

Parameters:
name - The value to set.

getUrlPattern

public String getUrlPattern()
Returns urlPattern.

Returns:
The value/reference of/to urlPattern.

setUrlPattern

protected void setUrlPattern(String urlPattern)
Set urlPattern.

Parameters:
urlPattern - The value to set.

getDriver

public String getDriver()
Returns driver.

Returns:
The value/reference of/to driver.

setDriver

protected void setDriver(String driver)
Set driver.

Parameters:
driver - The value to set.

SPT RWT Application API