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
FWSimInterfaceFWSimInterface.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
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringprotected Stringprotected Stringprotected StringFields inherited from class net.simplace.sim.io.interfaces.FWSimInterface
iColumnMap, iColumnNamesInt, iIntColumnNames -
Constructor Summary
ConstructorsModifierConstructorDescriptionDatabaseInterface(String aName) protectedDatabaseInterface(String aName, FWSimInterface.INTERFACE_TYPE aInterfaceType, int aPoolSize) Constructor has to be called from implementing interfacesprotectedDatabaseInterface(String aName, FWSimInterface.INTERFACE_TYPE aInterfaceType, org.jdom2.Element aInterfaceElement) Constructor has to be called from implementing interfacesprotectedDatabaseInterface(String aName, org.jdom2.Element aInterfaceElement) -
Method Summary
Modifier and TypeMethodDescriptionvoidfinalize()getInterface(FWSimVarMap aVarMap, FWSimVariable.CONTENT_TYPE aContentType) getPass()getURL()getUser()static PreparedStatementprepareDatabase(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 typevoidvoidvoidvoidorg.jdom2.ElementtoXML()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:
getInterfacein 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:FWSimInterfacefactory method creating an interface instance concerning the given data type- Specified by:
readin 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:
toXMLin classFWSimInterface<Connection>- Returns:
- Element containing configuration for this Interface
-
finalize
- Specified by:
finalizein classFWSimInterface<Connection>- Throws:
Exception- See Also:
-