|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.modules.j2ee.deployment.plugins.api.ConfigurationSupport
public abstract class ConfigurationSupport
ConfigurationSupport provides support for server specific configuration. It supplements the JSR-88 DeploymentConfiguration class of life cycle management and some additional module change notifications.
When a new project is created or an existing one is opened, the j2eeserver will create a DeploymentConfiguration object for the project target server by calling DeploymentManager.createConfiguration(). After the configuration is created, the j2eeserver will initialize it by calling ConfigurationSupport.initConfiguration(). In this moment, plugin should make sure that the server specific deployment descriptors exist and create them, if they do not. From now on the server specific deployment descriptors for the target server should be ready to respond to the module changes.
In case that the project target server is changed, the old server is notified by calling ConfigurationSupport.disposeConfiguration() that the old DeploymentConfiguration will be disposed, which means that the j2eeserver will release the reference to it and the configuration will be no longer receiving notifications of the module changes. The server specific deployment descriptors for the old server will thus stop responding to the module changes.
The life cycle for the new target server is the same as if an existing project is opened, see above.
In case that the target server plugin needs to have access to the initilized deployment configuration before the j2eeserver created and initilized it by itself, the plugin can request the j2eeserver to create and initilize it by calling ConfigurationSupport.requestCreateConfiguration(). This may happen for example when the IDE is started and if the server specific deployment descriptor was left open in the editor before the IDE was shutdown the last time. After calling ConfigurationSupport.requestCreateConfiguration() the life cycle is the same as if the j2eeserver created and initialized the deployment configuration during project opening by itself.
In case that other than target server plugin needs to have access to the initilized deployment configuration, the plugin can request the j2eeserver to create and initilize the configuration by calling ConfigurationSupport.requestCreateConfiguration(). The j2eeserver will create the configuration by calling DeploymentManager.createConfiguration() and will initilize it by calling ConfigurationSupport.initConfiguration(), however, with the keepUpdated=false parameter. This will tell the plugin that its server specific deployment descriptors should not respond to the module changes. In fact, the deployment configuration will not be receiving module change events in this case. Since the j2eeserver will not even keep a reference to this configuration, the ConfigurationSupport.disposeConfiguration() will never be called for this configuration, there is also no reason for it.
Constructor Summary | |
---|---|
ConfigurationSupport()
|
Method Summary | |
---|---|
Datasource |
createDatasource(javax.enterprise.deploy.spi.DeploymentConfiguration config,
String jndiName,
String url,
String username,
String password,
String driver)
Creates and saves data source in the module if it does not exist yet in the module. |
abstract void |
disposeConfiguration(javax.enterprise.deploy.spi.DeploymentConfiguration config)
The specified deployment configuration instance is about to be disposed, which means that the j2eeserver will release the reference to it and the configuration will be no longer receiving notifications of the module changes. |
abstract void |
ensureResourceDefined(javax.enterprise.deploy.spi.DeploymentConfiguration config,
javax.enterprise.deploy.model.DDBean bean)
Ensure resource is defined for the specified DD bean (for example entity bean). |
Set<Datasource> |
getDatasources(javax.enterprise.deploy.spi.DeploymentConfiguration config)
Gets the data sources saved in the module. |
abstract String |
getWebContextRoot(javax.enterprise.deploy.spi.DeploymentConfiguration config,
javax.enterprise.deploy.model.DeployableObject deplObj)
Return the context root (context path) defined for the module specified by the deployable object. |
abstract void |
initConfiguration(javax.enterprise.deploy.spi.DeploymentConfiguration config,
File[] files,
File resourceDir,
boolean keepUpdated)
Initialize the specified deployment configuration. |
boolean |
isDatasourceCreationSupported()
Tests whether data source creation is supported. |
static void |
requestCreateConfiguration(org.openide.filesystems.FileObject fo,
String serverID)
Request the j2eeserver to create and initialize the deployment configuration for the specified server and module the given server specific deployment descriptor file belongs to. |
abstract void |
setMappingInfo(javax.enterprise.deploy.spi.DeploymentConfiguration config,
OriginalCMPMapping[] mappings)
Setting the CMP and CMR mapping info to the given configuration for the EJB by the given name. |
abstract void |
setWebContextRoot(javax.enterprise.deploy.spi.DeploymentConfiguration config,
javax.enterprise.deploy.model.DeployableObject deplObj,
String contextRoot)
Set the web context root (context path) for the module specified by the deployable object. |
abstract void |
updateResourceDir(javax.enterprise.deploy.spi.DeploymentConfiguration config,
File resourceDir)
Update the enterprise resource directory for the specified deployment configuration. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConfigurationSupport()
Method Detail |
---|
public abstract void setMappingInfo(javax.enterprise.deploy.spi.DeploymentConfiguration config, OriginalCMPMapping[] mappings)
config
- The configuration to push the CMP mapping tomappings
- All the mapping info needed to be pushed in one batch.public abstract void ensureResourceDefined(javax.enterprise.deploy.spi.DeploymentConfiguration config, javax.enterprise.deploy.model.DDBean bean)
config
- deployment configurationbean
- DD bean in questionpublic abstract String getWebContextRoot(javax.enterprise.deploy.spi.DeploymentConfiguration config, javax.enterprise.deploy.model.DeployableObject deplObj) throws javax.enterprise.deploy.spi.exceptions.ConfigurationException
config
- deployment configurationdeplObj
- deployable object that specifies the module
javax.enterprise.deploy.spi.exceptions.ConfigurationException
- reports errors in getting the web context
rootpublic abstract void setWebContextRoot(javax.enterprise.deploy.spi.DeploymentConfiguration config, javax.enterprise.deploy.model.DeployableObject deplObj, String contextRoot) throws javax.enterprise.deploy.spi.exceptions.ConfigurationException
config
- deployment configurationdeplObj
- deployable object that specifies the modulecontextRoot
- context root to be set
javax.enterprise.deploy.spi.exceptions.ConfigurationException
- reports errors in setting the web context
rootpublic abstract void initConfiguration(javax.enterprise.deploy.spi.DeploymentConfiguration config, File[] files, File resourceDir, boolean keepUpdated) throws javax.enterprise.deploy.spi.exceptions.ConfigurationException
config
- the deployment configuration that should be initialized.files
- server specific deployment configuration files.resourceDir
- directory containing definition for enterprise resources
needed for the module execution or null if not supported.ensureCreated
- if keepUpdated is true ensure the server specific
deployment descriptors are created if they do not
exist and that they are ready to respond to the module
changes. If keepUpdated is false, the module changes
should not be reflected in the server specific deployment
descriptors.
javax.enterprise.deploy.spi.exceptions.ConfigurationException
- reports errors in deployment configuration
initialization.public abstract void disposeConfiguration(javax.enterprise.deploy.spi.DeploymentConfiguration config)
config
- deployment configuration which is about to be disposed.public static final void requestCreateConfiguration(org.openide.filesystems.FileObject fo, String serverID) throws javax.enterprise.deploy.spi.exceptions.ConfigurationException
Request the j2eeserver to create and initialize the deployment configuration for the specified server and module the given server specific deployment descriptor file belongs to. If the deployment configuration has already been created nothing will happen, otherwise a new instance will be created by calling DeploymentManager.createConfiguration() and then initialized by calling ConfigurationSupport.initConfiguration().
The j2eeserver creates and initializes the deployment configuration for the server that is set as a target server for the given module. In some cases, however, the data object representing the server specific deployment descriptor may require access to the initialized deployment configuration even before the configuration is created and initialized by the j2eeserver itself. This may happen for instance when the server specific deployment descriptor is being reopened during the IDE startup if it was left open before the IDE was shut down the last time.
fo
- server specific deployment descriptor file objectserverID
- server (plugin) ID
javax.enterprise.deploy.spi.exceptions.ConfigurationException
public abstract void updateResourceDir(javax.enterprise.deploy.spi.DeploymentConfiguration config, File resourceDir)
config
- deployment configurationresourceDir
- new enterprise resource directory.public Set<Datasource> getDatasources(javax.enterprise.deploy.spi.DeploymentConfiguration config)
config
- deployment configuration
public boolean isDatasourceCreationSupported()
public Datasource createDatasource(javax.enterprise.deploy.spi.DeploymentConfiguration config, String jndiName, String url, String username, String password, String driver) throws javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException, javax.enterprise.deploy.spi.exceptions.ConfigurationException, DatasourceAlreadyExistsException
config
- deployment configurationjndiName
- name of data sourceurl
- database URLusername
- database userpassword
- user's passworddriver
- fully qualified name of the database driver class
javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException
- if operation is not supported
javax.enterprise.deploy.spi.exceptions.ConfigurationException
- if data source configuration file is not parseable
DatasourceAlreadyExistsException
- if conflicting data source is found
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |