Package net.simplace.sim.io.interfaces
Class DatabaseInterface
java.lang.Object
net.simplace.sim.io.interfaces.FWSimInterface<Connection>
net.simplace.sim.io.interfaces.DatabaseInterface
- Direct Known Subclasses:
DBFInterface
implementation of the
using ConnectionPool
giving access to resources from and output to Databases
use by
FWSimInterface
FWSimInterface.getInterface(FWSimVarMap, CONTENT_TYPE)
.createStatement();
Make sure to free connections after use by calling
ConnectionPoolManager#getInstance#freeConnection(Connection)- Author:
- Andreas Enders
-
Nested Class Summary
Nested classes/interfaces inherited from class net.simplace.sim.io.interfaces.FWSimInterface
FWSimInterface.INTERFACE_TYPE
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected String
protected String
protected String
protected String
Fields inherited from class net.simplace.sim.io.interfaces.FWSimInterface
iColumnMap, iColumnNamesInt, iIntColumnNames
-
Constructor Summary
ModifierConstructorDescriptionDatabaseInterface
(String aName) protected
DatabaseInterface
(String aName, FWSimInterface.INTERFACE_TYPE aInterfaceType, int aPoolSize) Constructor has to be called from implementing interfacesprotected
DatabaseInterface
(String aName, FWSimInterface.INTERFACE_TYPE aInterfaceType, org.jdom2.Element aInterfaceElement) Constructor has to be called from implementing interfacesprotected
DatabaseInterface
(String aName, org.jdom2.Element aInterfaceElement) -
Method Summary
Modifier and TypeMethodDescriptionvoid
finalize()
getInterface
(FWSimVarMap aVarMap, FWSimVariable.CONTENT_TYPE aContentType) getPass()
getURL()
getUser()
static PreparedStatement
prepareDatabase
(String aTableName, HashMap<String, FWSimVariable<?>> aHeaderVariables, Connection aConnection, boolean isArrayMode) Used to create a prepared statement using the driver information and the connection.read
(FWSimSession aFwSimSession, String aProjectID, Object aCache, LinkedHashMap<String, String> aKeyMap, FWSimInputAdapter aResourceAdapter, String aUniqueID, FWSimInterface.INTERFACE_TYPE aInterfaceType) factory method creating an interface instance concerning the given data typevoid
void
void
void
org.jdom2.Element
toXML()
Methods inherited from class net.simplace.sim.io.interfaces.FWSimInterface
checkHeaderForColMode, createInterface, createInterface, createStatisticInterface, getInterfaceType, getName, getPoolSize, readColArray, toString, transformArrays, writeToDatabase
-
Field Details
-
iDriver
-
iURL
-
iPass
-
iUser
-
iAlias
-
-
Constructor Details
-
DatabaseInterface
protected DatabaseInterface(String aName, FWSimInterface.INTERFACE_TYPE aInterfaceType, int aPoolSize) Constructor has to be called from implementing interfaces- Parameters:
aName
-aInterfaceType
-aPoolSize
-
-
DatabaseInterface
protected DatabaseInterface(String aName, FWSimInterface.INTERFACE_TYPE aInterfaceType, org.jdom2.Element aInterfaceElement) Constructor has to be called from implementing interfaces- Parameters:
aName
-aInterfaceType
-aInterfaceElement
-
-
DatabaseInterface
- Parameters:
aName
-aPoolSize
-aInterfaceElement
-
-
DatabaseInterface
- Parameters:
aName
-aDriver
-aURL
-aPass
-aUser
-
-
DatabaseInterface
- Parameters:
aName
-
-
-
Method Details
-
getInterface
- Specified by:
getInterface
in classFWSimInterface<Connection>
- Returns:
- generic interface connection object. for example: database - connection; xml - fileinfo
- See Also:
-
prepareDatabase
public static PreparedStatement prepareDatabase(String aTableName, HashMap<String, FWSimVariable<?>> aHeaderVariables, Connection aConnection, boolean isArrayMode) throws SQLExceptionUsed to create a prepared statement using the driver information and the connection.- Parameters:
aTableName
-aHeaderVariables
-aConnection
-isArrayMode
-- Returns:
- the prepared statement
- Throws:
SQLException
-
read
public FWSimResourceCache read(FWSimSession aFwSimSession, String aProjectID, Object aCache, LinkedHashMap<String, String> aKeyMap, FWSimInputAdapter aResourceAdapter, String aUniqueID, FWSimInterface.INTERFACE_TYPE aInterfaceType) throws MissingSimResourceExceptionDescription copied from class:FWSimInterface
factory method creating an interface instance concerning the given data type- Specified by:
read
in classFWSimInterface<Connection>
- Returns:
- generic
FWSimResourceCache
- Throws:
MissingSimResourceException
-
getDriver
- Returns:
- the driver
-
setDriver
- Parameters:
aDriver
- the driver to set
-
getURL
- Returns:
- the uRL
-
setURL
- Parameters:
aURL
- the uRL to set
-
getPass
- Returns:
- the pass
-
setPass
- Parameters:
aPass
- the pass to set
-
getUser
- Returns:
- the user
-
setUser
- Parameters:
aUser
- the user to set
-
toXML
public org.jdom2.Element toXML()- Overrides:
toXML
in classFWSimInterface<Connection>
- Returns:
- Element containing configuration for this Interface
-
finalize
- Specified by:
finalize
in classFWSimInterface<Connection>
- Throws:
Exception
- See Also:
-