|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lapetus_ltd.api.db.utils.TLptsDriverLoader
public class TLptsDriverLoader
Class Description : This module is responsible for loading all the drivers from Database Connections.
<XLptsDriverLoaderType xmlns="http://www.lapetus-ltd.com/2009/xml/types"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="XLptsDriverLoaderType"
version="1.0" id="357c84a9-8ebf-74f5-27f3-57860bf7cf01">
<title>Lapetus Driver Loader Configuration</title> // the title of the whole config
<driverListItem id="ed4714a7-cee0-1e7a-6ed3-3e310b8c59bf"> // a single item - a driver in other words
<title>PostgreSQL Datasource Driver</title> // The title for the driver.
<driverClass> // this specifies where the external JAR is and the driver class
<contextLookupName></contextLookupName> // the context support is planned for the next version of dbJAPI
<JarFilePath>drivers/postgresql-8.4-701.jdbc4.jar</JarFilePath> // the JAR file that contains the driver to load
<fullClassName>org.postgresql.ds.PGSimpleDataSource</fullClassName> // the class for the driver (either javax.sql.DataSource or java.sql.Driver types)
<pathType>FILE</pathType> // to be read from file (URL is another option)
</driverClass>
<rowSetClass> // this is to be released in the next version of dbJAPI
<contextLookupName></contextLookupName> // this is to be released in the next version of dbJAPI
<JarFilePath></JarFilePath> // this is to be released in the next version of dbJAPI
<fullClassName></fullClassName> // this is to be released in the next version of dbJAPI
<pathType>FILE</pathType> // this is to be released in the next version of dbJAPI
</rowSetClass>
<type>DATASOURCE</type> // either DATASOURCE or DRIVER
<jdbcType>4</jdbcType> // 1-4 based on the JAVA default type
<p/>
// the format of the connection string. The $$ relates to the functions declared below. The values at runtime are placed in here.
// the information in this connection string could be partial, which is then supplemented by the functions below being called on the driver interface.
<connectionStringFormat>jdbc:postgresql//$$Server Name$$:$$Server Port$$</connectionStringFormat>
<p/>
<defaultCharSet>UTF-8</defaultCharSet> // Default Charset for this driver. This is rattled down to Connection, Statement and Rowset.
<operatingSystemListItem>WINDOWS</operatingSystemListItem> // the list of operating systems that support this driver
<operatingSystemListItem>LINUX</operatingSystemListItem>
<operatingSystemListItem>SOLARIS</operatingSystemListItem>
<operatingSystemListItem>MACINTOSH</operatingSystemListItem>
<interfaceListItem> // this is a function to be called at runtime on the driver inteface
<title>ServerName</title> // a friendly title
<functionName>setServerName</functionName> // the actual function in the driver interface - case sensitive
<parameterListItem> // the list of parameters for this function
<name>Server Name</name> // friendly name
<type>STRING</type> // type of variable (STRING,INTEGER,CHARS,CHAR,BYTES,BYTE,DOUBLE,BOOLEAN)
<value>172.31.2.20</value> // the default value that is passed to the function if not changed with {@link com.lapetus_ltd.api.db.xml.types.TLptsDriverType#setValueForInterfaceFunctionParameter(String, String, String)} or dbJAPI GUI
</parameterListItem>
</interfaceListItem>
<interfaceListItem> // another function
<title>DatabaseName</title>
<functionName>setDatabaseName</functionName>
<parameterListItem> // another parameter
<name>Database Name</name>
<type>STRING</type>
<value>postgres</value>
</parameterListItem>
</interfaceListItem>
<interfaceListItem> // another function
<title>PortNumber</title>
<functionName>setPortNumber</functionName>
<parameterListItem> // another parameter
<name>Server Port</name>
<type>INTEGER</type>
<value>5432</value>
</parameterListItem>
</interfaceListItem>
<guestUser>postgres</guestUser> // the guest username, which is not ENCRYPTED. The credentials of the connection are encrypted {@link com.lapetus_ltd.api.db.xml.types.TLptsDBConnectionType}.
<guestPassword>test</guestPassword> // the guest password, which is not ENCRYPTED. The connection credentials are encrypted {@link com.lapetus_ltd.api.db.xml.types.TLptsDBConnectionType}.
</driverListItem>
<defaultCharSet>windows-1253</defaultCharSet>
</XLptsDriverLoaderType>
Method Summary | |
---|---|
static java.lang.Object |
executeDriverInterface(XLptsDriverType driverType)
Executes the interface of the driver and returns either the DRIVER or DATASOURCE object. |
static javax.sql.DataSource |
getDataSourceForClassName(java.lang.String className)
This gets the javax.sql.DataSource type with the given name. |
static javax.sql.DataSource |
getDataSourceWithJNDIContextName(java.lang.String name)
Gets the datasource driver under the supplied context name. |
static java.lang.String |
getDefaultCharSet()
Gets the default charset configured. |
static java.sql.Driver |
getDriverForClassName(java.lang.String className)
This gets the java.sql.Driver type with the given name. |
static XLptsDriverType |
getDriverTypeByClassName(java.lang.String fullClassName)
This returns the internal driver type for a given class name. |
static java.util.List<XLptsDriverType> |
getDriverTypeList()
Gets the driver type list. |
static java.sql.Driver |
getDriverWithJNDIContextName(java.lang.String name)
Gets the driver under the supplied context name. |
static javax.sql.RowSet |
getRowSetByClassName(java.lang.String fullClassName,
java.sql.Connection connection)
Gets the rowset class object with its full class name. |
static void |
zI()
Obfuscated, as it is not required by the application. |
static void |
zI(java.lang.String path)
Obfuscated, as it is not required by the application. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.lang.Object executeDriverInterface(XLptsDriverType driverType)
TLptsDriverType.setValueForInterfaceFunctionParameter(String, String, String)
to set values before calling this function.
public static javax.sql.DataSource getDataSourceForClassName(java.lang.String className)
Driver myDriver = TLptsDriverLoader.getDataSourceForClassName("org.postgresql.ds.PGSimpleDataSource");
className
- the fully qualified class name.
public static javax.sql.DataSource getDataSourceWithJNDIContextName(java.lang.String name)
Driver myContextDriver = TLptsDriverLoader.getDataSourceWithJNDIContextName("contextNameOfDriver");
name
- The context name which holds the driver.
public static java.lang.String getDefaultCharSet()
public static java.sql.Driver getDriverForClassName(java.lang.String className)
Driver myDriver = TLptsDriverLoader.getDriverForClassName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
className
- the fully qualified class name.
public static XLptsDriverType getDriverTypeByClassName(java.lang.String fullClassName)
XLptsDriverType driverType = getDriverTypeByClassName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); if (dt.getType().equals(XLptsDriverEnumType.DATASOURCE)) TLptsDriverLoader.getDataSourceForClassName(dt.getDriverClass().getFullClassName())); else TLptsDriverLoader.getDriverForClassName(dt.getDriverClass().getFullClassName()));
fullClassName
- The full class name of the driver.
public static java.util.List<XLptsDriverType> getDriverTypeList()
for (XLptsDriverType dt : TLptsDriverLoader.getDriverTypeList()) { if (dt.getType().equals(XLptsDriverEnumType.DATASOURCE)) TLptsDriverLoader.getDataSourceForClassName(dt.getDriverClass().getFullClassName())); else TLptsDriverLoader.getDriverForClassName(dt.getDriverClass().getFullClassName())); }
public static java.sql.Driver getDriverWithJNDIContextName(java.lang.String name)
Driver myContextDriver = TLptsDriverLoader.getDriverWithJNDIContextName("contextNameOfDriver");
name
- The context name which holds the driver.
public static javax.sql.RowSet getRowSetByClassName(java.lang.String fullClassName, java.sql.Connection connection)
RowSet declaredRowSet = TLptsDriverLoader.getRowSetByClassName("com.sun.rowset.JdbcRowSetImpl", myConnection);
fullClassName
- The fill class name of the rowSet.connection
- The java Connection (from TLptsConnection) that is to be passed to the rowset constructor for dynamic creation.
public static void zI()
public static void zI(java.lang.String path)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |