|
Oracle® Data Integrator Java API Reference 11g Release 1 (11.1.1.5.0) E17060-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.odi.core.OdiInstance
public class OdiInstance
Represents an instance of ODI master / work repositories. Can be defined as a unique ODI master repository, or as a couple ODI master / work repositories.
OdiInstance is the central class in ODI Core Infrastructure, providing low level infrastructure services required by ODI consumers needing read / write access to an ODI master / work repositories couple:
Therefore, an instance of ODI serves as an entry points for ODI master / work repositories consumers (ODI components / applications, as well as external consumers that needs to perform ODI repositories data access). It is created from the static factory method createInstance(OdiInstanceConfig)
which basically checks repository consistency and create required resources such as JDBC DataSources and JPA persistence service (optional) against underlying repositories. An OdiInstance is expected to be closed by a call to the method close()
in order to release any held resources.
An OdiInstance object is expected to be shared across multiple ODI users and threads that want to access same couple of ODI master / work repositories. However any number of OdiInstance objects can be created by an application and there can be several OdiInstances referencing the same master / work DB repositories. OdiInstances are agnostic about existence of each others. The source of truth as far as the repositories data is concerned is the repository DB. Creation of an OdiInstance object is an operation that maybe time and resource consuming. Typically, during ODI instance creation, JDBC DataSources and JPA persistence provider are initialized. Also, note that during repository consistency check, some queries are issued against repositories.
Additionally and for convenience regarding actual legacy layer code base, an instance of ODI also provides external (i.e. not ODI repositories) JDBC DataSources management and lookup capabilities. Such DataSource management and lookup is typically required during ETL processes to access target and source data stores. Application / domain services implementation can rely on this to access external data servers.
Note: access to an OdiInstance object should be restricted to "trusted" users only. Applications should take care to never provide a reference to an OdiInstance to ELT developers (e.g. from OdiRef).
Note: OdiInstance class implements the depreciated IOdiInstance interface for code compatibility purpose. This would ease migration of code using some depreciated APIs such as OdiPlatform.
Field Summary | |
---|---|
static java.lang.String |
MASTER_VALIDATION_QUERY |
Method Summary | |
---|---|
void |
close() Close this OdiInstance , releasing any held resources. |
IOdiEntityManager |
createEntityManager() Create an application-managed IOdiEntityManager. |
static OdiInstance |
createInstance(OdiInstanceConfig pConfig) Create an OdiInstance object. |
OdiInstanceConfig |
getConfig() Obtains this OdiInstance configuration object. |
MasterRepository |
getMasterRepository() Return MasterRepository associated with this OdiInstance . |
SecurityManager |
getSecurityManager() Gets SecurityManager bounds to this OdiInstance . |
IOdiEntityManager |
getTransactionalEntityManager() Gets managed IOdiEntityManager , attached to the current transaction. |
java.sql.Connection |
getTransactionalMasterConnection() Gets managed JDBC Connection against master repository. |
java.sql.Connection |
getTransactionalWorkConnection() Gets managed JDBC Connection against work repository. |
ITransactionManager |
getTransactionManager() |
WorkRepository |
getWorkRepository() Return WorkRepository associated with this OdiInstance . |
boolean |
isClosed() Returns whether this OdiInstance has been closed, or not. |
javax.sql.DataSource |
lookupDataSource(oracle.odi.core.datasource.DataSourceDefinition pDefinition) Looks up JDBC DataSource for given DataSourceDefinition . |
void |
releaseDataSource(oracle.odi.core.datasource.DataSourceDefinition pDefinition) Release the JDBC DataSource with given definition if managed inside this OdiInstance . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String MASTER_VALIDATION_QUERY
Method Detail |
---|
public static OdiInstance createInstance(OdiInstanceConfig pConfig) throws OdiConfigurationException
pConfig
- ODI configurationjava.lang.IllegalArgumentException
- in case given config object is null
OdiConfigurationException
- in case of any configuration issue (see OdiConfigurationException
exceptions hierarchy)public OdiInstanceConfig getConfig()
OdiInstance
configuration object.OdiInstanceConfig
objectpublic MasterRepository getMasterRepository()
MasterRepository
associated with this OdiInstance
.MasterRepository
objectOdiRuntimeException
- if this OdiInstance has been closedpublic WorkRepository getWorkRepository()
WorkRepository
associated with this OdiInstance
. This method will return null
if the OdiInstance is connected only to a master repository i.e. the OdiInstanceConfig used to create the OdiInstance had no WorkRepositoryDbInfo
specified.WorkRepository
objectOdiRuntimeException
- if this OdiInstance has been closedpublic javax.sql.DataSource lookupDataSource(oracle.odi.core.datasource.DataSourceDefinition pDefinition)
DataSourceDefinition
. Subsequent calls to this method with a same / equals definition will return the same DataSource instance each time.
Once a DataSource
has been looked up, release it by calling releaseDataSource(DataSourceDefinition)
.
pDefinition
- DataSource definitionjava.lang.IllegalArgumentException
- if given definition is null
OdiRuntimeException
- if this OdiInstance has been closedreleaseDataSource(DataSourceDefinition)
public void releaseDataSource(oracle.odi.core.datasource.DataSourceDefinition pDefinition)
DataSource
with given definition if managed inside this OdiInstance
. This will release any resource held by related DataSource.pDefinition
- definition of the DataSource to be releasedjava.lang.IllegalArgumentException
- if given definition is null
OdiRuntimeException
- if this OdiInstance has been closedlookupDataSource(DataSourceDefinition)
public java.sql.Connection getTransactionalMasterConnection()
Connection
against master repository.
Obtained connection is attached to the current transaction if exists, or a new one if no transaction is in progress.
Connection
OdiRuntimeException
- if this OdiInstance has been closedpublic java.sql.Connection getTransactionalWorkConnection()
Connection
against work repository.
Obtained connection is attached to the current transaction if exists, or a new one if no transaction is in progress. Life-cycle of the connection is managed within the transaction.
Connection
OdiRuntimeException
- if this OdiInstance has been closedpublic IOdiEntityManager getTransactionalEntityManager()
IOdiEntityManager
, attached to the current transaction.
Life-cycle of the IOdiEntityManager is managed within the transaction. If there is no current transaction, this method returns a read-only IOdiEntityManager (only the find methods will be allowed).
IOdiEntityManager
OdiRuntimeException
- if this OdiInstance has been closedOdiRuntimeException
- if this OdiInstance only support limited persistence servicepublic void close()
OdiInstance
, releasing any held resources.
Any looked up DataSource
s are released, as well as persistence resources. After an OdiInstance
is closed, all methods invoked on it will throw an OdiRuntimeException, except for isCloded(), which will return true
.
OdiRuntimeException
- if the OdiInstance has been already closedpublic boolean isClosed()
OdiInstance
has been closed, or not.true
if it has been closed, false
otherwise.public IOdiEntityManager createEntityManager()
Such an application-managed IOdiEntityManager need to be manually closed when required by the application.
This type of IOdiEntityManager
is mainly for extended persistent context management. An extended persistent context isn't bound to a single transaction.
OdiRuntimeException
- if this OdiInstance has been closedOdiRuntimeException
- if this OdiInstance only support limited persistence servicepublic SecurityManager getSecurityManager()
SecurityManager
bounds to this OdiInstance
.OdiRuntimeException
- if this OdiInstance has been closedpublic ITransactionManager getTransactionManager()
|
Oracle® Data Integrator Java API Reference 11g Release 1 (11.1.1.5.0) E17060-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |