public class EJB11Context extends java.lang.Object implements IEJBContextInit, java.io.Serializable
IEJBContext
for a EJB 1.1 server.
Since EJB 1.1 standardizes enough things only it's needed one version,
and it is not required additional properties files.
If you can use getConnection()
without argument, you need to define
in the bean a property named DATA_SOURCE that indicate the default data source.
In the DATA_SOURCE property you can put also the username and password by default,
thus datasource;usuario;clave.
Constructor and Description |
---|
EJB11Context() |
Modifier and Type | Method and Description |
---|---|
java.security.Principal |
getCallerPrincipal()
As
EJBContext.getCallerPrincipal in EJB 1.1. |
java.sql.Connection |
getConnection()
The connection is obtained from data source defined in DATA_SOURCE property of bean.
|
java.sql.Connection |
getConnection(java.lang.String name)
Returns a JDBC connection from a identifier.
|
java.lang.String |
getProperty(java.lang.String name)
Property value from name.
|
boolean |
isCallerInRole(java.lang.String roleName)
As
EJBContext.isCallerInRole in EJB 1.1. |
void |
setDefaultDataSource(java.lang.String dataSourceName)
Sets the datasource name used when using
IConnectionProvider.getConnection() . |
void |
setEJBContext(javax.ejb.EJBContext ejbContext)
Sets a
EJBContext needed for implementing. |
void |
setPassword(java.lang.String password)
Sets password used to create connection.
|
void |
setUser(java.lang.String user)
Sets the user used to craete the connection.
|
public java.security.Principal getCallerPrincipal()
IEJBContext
EJBContext.getCallerPrincipal
in EJB 1.1.getCallerPrincipal
in interface IEJBContext
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface IConnectionProvider
java.sql.SQLException
- If there are problem obtaining the connetionpublic java.sql.Connection getConnection(java.lang.String name) throws java.sql.SQLException
IConnectionProvider
getConnection
in interface IConnectionProvider
name
- Name of data source from what I obtain the connectionjava.sql.SQLException
- If there are problem obtaining the connetionpublic java.lang.String getProperty(java.lang.String name)
IEJBContext
null
if the property
does not exist or it is not possible obtain it.getProperty
in interface IEJBContext
public boolean isCallerInRole(java.lang.String roleName)
IEJBContext
EJBContext.isCallerInRole
in EJB 1.1.isCallerInRole
in interface IEJBContext
public void setPassword(java.lang.String password)
IConnectionProvider
*
Must to call to IConnectionProvider.setUser(java.lang.String)
too. Although set user and password
is not mandatory.
setPassword
in interface IConnectionProvider
public void setDefaultDataSource(java.lang.String dataSourceName)
IConnectionProvider
IConnectionProvider.getConnection()
. setDefaultDataSource
in interface IConnectionProvider
public void setEJBContext(javax.ejb.EJBContext ejbContext)
IEJBContextInit
EJBContext
needed for implementing. IEJBContext
can be used.setEJBContext
in interface IEJBContextInit
public void setUser(java.lang.String user)
IConnectionProvider
It is not mandatory to call this method.
setUser
in interface IConnectionProvider