|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lapetus_ltd._2009.xml.types.XLptsDriverLoaderType
com.lapetus_ltd.api.db.xml.types.TLptsDriverLoaderType
public class TLptsDriverLoaderType
Class Description : This class holds the driver information for the driver loader.
It is the data class of the Driver Loader capability, and is used by TLptsDriverLoader for storing all the
information for the drivers and their interfaces. The functions and parameters are stored here for every
driver that is to be used in dbJAPI for connection purposes.
The drivers are dynamically loaded, along with their functional interfaces. The interfaces are then used by
the GUI for processing the parameters from the user for the connection.
$LastChangedRevision: 1190 $
$LastChangedDate:: 2010-11-17 13:21:35#$
Field Summary |
---|
Fields inherited from class com.lapetus_ltd._2009.xml.types.XLptsDriverLoaderType |
---|
defaultCharSet, driverListItem, id, title, version |
Constructor Summary | |
---|---|
TLptsDriverLoaderType()
This constructs an empty TLptsDriverLoaderType. |
|
TLptsDriverLoaderType(XLptsDriverLoaderType driverLoaderType)
This constructs a XLptsDriverLoaderType, which is a copy of another. |
Method Summary | |
---|---|
void |
addDriverListItem(XLptsDriverType driverType)
Adds a driver to the driver list. |
boolean |
equals(java.lang.Object obj)
Check for equal TLptsDriverLoaderType objects. |
java.util.List<XLptsDriverType> |
getDriverListItem()
Returns a synchronised copy of the driver list. |
int |
getDriverListItemSize()
Returns the size of the actual list. |
void |
initialise(XLptsDriverLoaderType driverLoaderType)
Initialises this XLptsDriverLoaderType class with all the values from another XLptsDriverLoaderType. |
void |
removeDriverListItem(XLptsDriverType driverType)
Removes a driver to the driver list. |
Methods inherited from class com.lapetus_ltd._2009.xml.types.XLptsDriverLoaderType |
---|
getDefaultCharSet, getId, getTitle, getVersion, setDefaultCharSet, setId, setTitle, setVersion |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TLptsDriverLoaderType()
This constructs an empty TLptsDriverLoaderType.
Thread Safe : Yes Spawns its own Thread : No May Return NULL : Never. Notes : Default Constructor set a new id, title as "Driver Loader Info" and version as "1.0". Also creates a new driver list.TLptsDriverLoaderType driverLoaderType = new TLptsDriverLoaderType(); TLptsDriverType driverItem = new TLptsDriverType(); driverItem.setTitle("MS SQL DataSource Driver"); ... driverLoaderType.addDriverListItem(driverItem); ObjectFactory of1 = new ObjectFactory(); TLptsXmlUtil.marshal("driver.loader.xml",XLptsDriverLoaderType.class,of1.createXLptsDriverLoaderType(driverLoaderType));
public TLptsDriverLoaderType(XLptsDriverLoaderType driverLoaderType)
This constructs a XLptsDriverLoaderType, which is a copy of another.
Thread Safe : Yes Spawns its own Thread : No May Return NULL : Never. Notes : Use this Constructor to set TLptsDriverLoaderType from another XLptsDriverLoaderType"//Load from file XLptsDriverLoaderType dlt = (XLptsDriverLoaderType) TLptsXmlUtil.unmarshal("driver.loader.xml",XLptsDriverLoaderType.class); TLptsDriverLoaderType driverLoaderTypeLoad = new TLptsDriverLoaderType(dlt); ...
driverLoaderType
- The driver loader type to copy.Method Detail |
---|
public void addDriverListItem(XLptsDriverType driverType)
Adds a driver to the driver list.
Thread Safe : Yes Spawns its own Thread : No May Return NULL : n/a Notes : Use this and not the getDriverListItem().add() function. Example :TLptsDriverLoaderType driverLoaderType = new TLptsDriverLoaderType(); TLptsDriverType driverItem = new TLptsDriverType(); driverItem.setTitle("MS SQL DataSource Driver"); ... driverLoaderType.addDriverListItem(driverItem);
driverType
- the driver type to add in the list.public boolean equals(java.lang.Object obj)
Check for equal TLptsDriverLoaderType objects.
Thread Safe : Yes Spawns its own Thread : No May Return NULL : n/a Notes : Use this to compare two TLptsDriverLoaderType objects by there id. Example :TLptsDriverLoaderType dlt1 = new TLptsDriverLoaderType(); TLptsDriverLoaderType dlt2 = new TLptsDriverLoaderType(); return dlt1.equals(dlt2); Result: false, because each TLptsDriverLoaderType has each own unique id.
equals
in class java.lang.Object
obj
- the driver loader type
public java.util.List<XLptsDriverType> getDriverListItem()
Returns a synchronised copy of the driver list.
Thread Safe : Yes Spawns its own Thread : No May Return NULL : Never. In the worst case an empty list is returned. Notes : Never add to or remove from this list and there is not affect to the driver list. Example :if(driverLoaderType.getDriverListItemSize()>0) { for (XLptsDriverType dlit : driverLoaderType.getDriverListItem()) { if (!isSupportedOnOS(dlit)) { driverLoaderType.removeDriverListItem(dlit); break; } } } else TLptsLogger.logMessage("Driver List Size is zero",null); ... private boolean isSupportedOnOS(XLptsDriverType driverType) { TLptsDriverType dt = new TLptsDriverType(driverType); for (XLptsOperatingSystemType ost : dt.getOperatingSystemListItem()) { if (ost.equals(XLptsOperatingSystemType.WINDOWS)) if (TLptsSysInfoUtil.isHostWindows()) return true; } return false; }
getDriverListItem
in class XLptsDriverLoaderType
public int getDriverListItemSize()
Returns the size of the actual list.
Thread Safe : Yes Spawns its own Thread : No May Return NULL : Never. The result may be an empty list. Notes : Do not use getDriverListItem().size() as it is not efficient. Example :if(driverLoaderType.getDriverListItemSize()>0) { for (XLptsDriverType dlit : driverLoaderType.getDriverListItem()) { if (!isSupportedOnOS(dlit)) { driverLoaderType.removeDriverListItem(dlit); break; } } } else TLptsLogger.logMessage("Driver List Size is zero",null); ... private boolean isSupportedOnOS(XLptsDriverType driverType) { TLptsDriverType dt = new TLptsDriverType(driverType); for (XLptsOperatingSystemType ost : dt.getOperatingSystemListItem()) { if (ost.equals(XLptsOperatingSystemType.WINDOWS)) if (TLptsSysInfoUtil.isHostWindows()) return true; } return false; }
public void initialise(XLptsDriverLoaderType driverLoaderType)
Initialises this XLptsDriverLoaderType class with all the values from another XLptsDriverLoaderType.
Thread Safe : Yes Spawns its own Thread : No May Return NULL : n/a Notes : It is used by the driver loader to initialise the driver loader from the xml config file. Example :XLptsDriverLoaderType dlt = (XLptsDriverLoaderType) TLptsXmlUtil.unmarshal(driverLoaderUrlOrFile, XLptsDriverLoaderType.class); TLptsDriverLoaderType driverLoaderType = new TLptsDriverLoaderType(); driverLoaderType.initialise(dlt); //Or //TLptsDriverLoaderType driverLoaderType = new TLptsDriverLoaderType(dlt);
driverLoaderType
- The driver loader type to use for initialising this class.public void removeDriverListItem(XLptsDriverType driverType)
Removes a driver to the driver list.
Thread Safe : Yes Spawns its own Thread : No May Return NULL : n/a Notes : Use this and not the getDriverListItem().remove() function. Example :if(driverLoaderType.getDriverListItemSize()>0) { for (XLptsDriverType dlit : driverLoaderType.getDriverListItem()) { if (!isSupportedOnOS(dlit)) { driverLoaderType.removeDriverListItem(dlit); break; } } } else TLptsLogger.logMessage("Driver List Size is zero",null); ... private boolean isSupportedOnOS(XLptsDriverType driverType) { TLptsDriverType dt = new TLptsDriverType(driverType); for (XLptsOperatingSystemType ost : dt.getOperatingSystemListItem()) { if (ost.equals(XLptsOperatingSystemType.WINDOWS)) if (TLptsSysInfoUtil.isHostWindows()) return true; } return false; }
driverType
- the driver type to remove from driver list
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |