org.netbeans.modules.j2eeserver/4 1.89.0 1

org.netbeans.modules.j2ee.deployment.plugins.spi.config
Interface DatasourceConfiguration


public interface DatasourceConfiguration

Configuration useful for managing module data sources.

Implementation of this interface should be registered in the ModuleConfiguration lookup.

Since:
1.23

Method Summary
 void bindDatasourceReference(String referenceName, String jndiName)
          Binds the data source reference name with the corresponding data source which is identified the given JNDI name.
 void bindDatasourceReferenceForEjb(String ejbName, String ejbType, String referenceName, String jndiName)
          Binds the data source reference name with the corresponding data source which is identified the given JNDI name.
 Datasource createDatasource(String jndiName, String url, String username, String password, String driver)
          Creates the data source definition in the module.
 String findDatasourceJndiName(String referenceName)
          Finds JNDI name of the data source which is mapped to the given reference name.
 String findDatasourceJndiNameForEjb(String ejbName, String referenceName)
          Finds JNDI name of the data source which is mapped to the given reference name in the scope the EJB.
 Set<Datasource> getDatasources()
          Returns the data sources defined in the module.
 boolean supportsCreateDatasource()
          Returns true if data source creation is supported, false otherwise.
 

Method Detail

getDatasources

Set<Datasource> getDatasources()
                               throws ConfigurationException
Returns the data sources defined in the module.

Returns:
a set of data sources defined in the module.
Throws:
ConfigurationException - reports problems in retrieving data source definitions.

supportsCreateDatasource

boolean supportsCreateDatasource()
Returns true if data source creation is supported, false otherwise.

Returns:
true if data source creation is supported, false otherwise.

createDatasource

Datasource createDatasource(String jndiName,
                            String url,
                            String username,
                            String password,
                            String driver)
                            throws UnsupportedOperationException,
                                   ConfigurationException,
                                   DatasourceAlreadyExistsException
Creates the data source definition in the module.

Parameters:
jndiName - data source JNDI name.
url - database URL.
username - database user.
password - user's password.
driver - fully qualified name of the database driver class.
Returns:
created data source.
Throws:
UnsupportedOperationException - if operation is not supported.
ConfigurationException - reports problems in creating data source definition.
DatasourceAlreadyExistsException - if a data source with the same JNDI name already exists.

bindDatasourceReference

void bindDatasourceReference(String referenceName,
                             String jndiName)
                             throws ConfigurationException
Binds the data source reference name with the corresponding data source which is identified the given JNDI name.

Parameters:
referenceName - name used to identify the data source
jndiName - JNDI name of the data source
Throws:
ConfigurationException - if there is some problem with data source configuration
Since:
1.25

bindDatasourceReferenceForEjb

void bindDatasourceReferenceForEjb(String ejbName,
                                   String ejbType,
                                   String referenceName,
                                   String jndiName)
                                   throws ConfigurationException
Binds the data source reference name with the corresponding data source which is identified the given JNDI name. The reference is used within the scope of the EJB.

Parameters:
ejbName - EJB name
ejbType - EJB type - the possible values are org.netbeans.modules.j2ee.dd.api.ejb.EnterpriseBeans.SESSION, org.netbeans.modules.j2ee.dd.api.ejb.EnterpriseBeans.ENTITY and org.netbeans.modules.j2ee.dd.api.ejb.EnterpriseBeans.MESSAGE_DRIVEN
referenceName - name used to identify the data source
jndiName - JNDI name of the data source
Throws:
ConfigurationException - if there is some problem with data source configuration
Since:
1.25

findDatasourceJndiName

String findDatasourceJndiName(String referenceName)
                              throws ConfigurationException
Finds JNDI name of the data source which is mapped to the given reference name.

Parameters:
referenceName - reference name
Returns:
JNDI name of the data source if the mapping exists, null otherwise
Throws:
ConfigurationException - if there is some problem with data source configuration
Since:
1.25

findDatasourceJndiNameForEjb

String findDatasourceJndiNameForEjb(String ejbName,
                                    String referenceName)
                                    throws ConfigurationException
Finds JNDI name of the data source which is mapped to the given reference name in the scope the EJB.

Parameters:
ejbName - EJB name
referenceName - reference name
Returns:
JNDI name of the data source if the mapping exists, null otherwise
Throws:
ConfigurationException - if there is some problem with data source configuration
Since:
1.25

org.netbeans.modules.j2eeserver/4 1.89.0 1

Built on May 22 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.