Class DataSourceConnectionInfo
java.lang.Object
org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity<DataSourceConnectionInfo,org.silverpeas.core.persistence.datasource.model.identifier.UniqueIntegerIdentifier>
org.silverpeas.core.persistence.datasource.model.jpa.BasicJpaEntity<DataSourceConnectionInfo,org.silverpeas.core.persistence.datasource.model.identifier.UniqueIntegerIdentifier>
org.silverpeas.components.jdbcconnector.model.DataSourceConnectionInfo
- All Implemented Interfaces:
Serializable,org.silverpeas.core.persistence.datasource.model.IdentifiableEntity
@Entity
public class DataSourceConnectionInfo
extends org.silverpeas.core.persistence.datasource.model.jpa.BasicJpaEntity<DataSourceConnectionInfo,org.silverpeas.core.persistence.datasource.model.identifier.UniqueIntegerIdentifier>
Information about a JDBC connection to a data source. Such information is the name of the
data source and the credentials required to access that data source.
- Author:
- mmoquillon
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDataSourceConnectionInfo(String dataSource, String instanceId) -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic DataSourceConnectionInfointGets the maximum number of data to return when requesting the data source.Gets the JNDI name of the data source targeted by this connection information.static List<DataSourceConnectionInfo> getFromComponentInstance(String instanceId) Gets the unique identifier of the component instance this connection info belongs to.getLogin()Gets the user identifier used in the data source authentication.Gets the password associated with the login to connect the data source.Gets the SQL request used to select data from the connected data source.inthashCode()booleanIs this connection information defined?Opens a connection to the data source targeted by this connection information.voidremove()Removes this connection information from the persistence context.static voidremoveFromComponentInstance(String instanceId) voidsave()Saves or updates this connection information into the persistence context in order to be able to retrieve it later.voidsetDataMaxNumber(int maxNumber) Sets the maximum number of data to select when requesting the data source.voidsetDataSourceName(String dataSourceName) Sets a new data source by its JNDI name to this connection info.voidsetLoginAndPassword(String login, String password) Sets the login and the password required to open a connection to the targeted data source.voidsetSqlRequest(String sqlRequest) Sets the SQL request to used when requesting the data source.withDataMaxNumber(int maxNumber) Sets the maximum number of data to select when requesting the data source and returns this connection information.withDataSourceName(String dataSourceName) Sets a new data source by its JNDI name to this connection info.withLoginAndPassword(String login, String password) withSqlRequest(String sqlRequest) Sets the SQL request to used when requesting the data source and returns this connection information.Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.BasicJpaEntity
performBeforePersist, performBeforeRemove, performBeforeUpdateMethods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity
getId, getNativeId, isPersisted, setId
-
Constructor Details
-
DataSourceConnectionInfo
protected DataSourceConnectionInfo() -
DataSourceConnectionInfo
-
-
Method Details
-
getById
-
getFromComponentInstance
-
removeFromComponentInstance
-
isDefined
public boolean isDefined()Is this connection information defined? Information about a connection to a data source is defined if both it is related to a ConnecteurJDBC application instance and the name of the data source is defined.- Returns:
- true is the data source is well-defined
-
withSqlRequest
Sets the SQL request to used when requesting the data source and returns this connection information.- Parameters:
sqlRequest- a SQL request.- Returns:
- itself.
-
withDataMaxNumber
Sets the maximum number of data to select when requesting the data source and returns this connection information.- Parameters:
maxNumber- the maximum number of data to return. 0 means all.- Returns:
- itself.
-
withLoginAndPassword
-
withDataSourceName
Sets a new data source by its JNDI name to this connection info.- Parameters:
dataSourceName- the JNDI name of the data source to connect to.- Returns:
- itself.
-
getDataSourceName
Gets the JNDI name of the data source targeted by this connection information.- Returns:
- the JNDI name of the data source.
-
getInstanceId
Gets the unique identifier of the component instance this connection info belongs to.- Returns:
- the unique identifier of the component instance.
-
getLogin
Gets the user identifier used in the data source authentication.- Returns:
- the login.
-
getPassword
Gets the password associated with the login to connect the data source.- Returns:
- the password.
-
getSqlRequest
Gets the SQL request used to select data from the connected data source.- Returns:
- the SQL request used in this connection information.
-
getDataMaxNumber
public int getDataMaxNumber()Gets the maximum number of data to return when requesting the data source.- Returns:
- the maximum number of data to consider. 0 means all.
-
setDataSourceName
Sets a new data source by its JNDI name to this connection info.- Parameters:
dataSourceName- the JNDI name of the data source to connect to.
-
setLoginAndPassword
Sets the login and the password required to open a connection to the targeted data source.- Parameters:
login- a login.password- the password associated with the login.
-
setSqlRequest
Sets the SQL request to used when requesting the data source.- Parameters:
sqlRequest- a SQL request.
-
setDataMaxNumber
public void setDataMaxNumber(int maxNumber) Sets the maximum number of data to select when requesting the data source.- Parameters:
maxNumber- the maximum number of data to return. 0 means all.
-
save
public void save()Saves or updates this connection information into the persistence context in order to be able to retrieve it later. -
remove
public void remove()Removes this connection information from the persistence context. -
openConnection
Opens a connection to the data source targeted by this connection information.- Returns:
- a connection against the data source referred by this object.
- Throws:
JdbcConnectorException
-
equals
- Overrides:
equalsin classorg.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity<DataSourceConnectionInfo,org.silverpeas.core.persistence.datasource.model.identifier.UniqueIntegerIdentifier>
-
hashCode
public int hashCode()- Overrides:
hashCodein classorg.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity<DataSourceConnectionInfo,org.silverpeas.core.persistence.datasource.model.identifier.UniqueIntegerIdentifier>
-