org.netbeans.modules.j2ee.deployment.devmodules.spi
Class J2eeModuleProvider

java.lang.Object
  extended by org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider
Direct Known Subclasses:
J2eeAppProvider

public abstract class J2eeModuleProvider
extends Object

This object must be implemented by J2EE module support and an instance added into project lookup.


Nested Class Summary
static interface J2eeModuleProvider.ConfigSupport
          Configuration support to allow development module code to access well-known configuration propeties, such as web context root, cmp mapping info...
 
Field Summary
static String PROP_ENTERPRISE_RESOURCE_DIRECTORY
          Enterprise resorce directory property
 
Constructor Summary
J2eeModuleProvider()
           
 
Method Summary
 void addConfigurationFilesListener(ConfigurationFilesListener l)
           
 void addInstanceListener(InstanceListener l)
          Register an instance listener that will listen to server instances changes.
 void addPropertyChangeListener(PropertyChangeListener l)
          Register a listener which will be notified when some of the properties change.
 Datasource createDatasource(String jndiName, String url, String username, String password, String driver)
          Creates and saves data source in the module if it does not exist yet on the target server or in the module.
 void deployDatasources()
          Deploys data sources saved in the module.
abstract  org.openide.filesystems.FileObject findDeploymentConfigurationFile(String name)
          Finds source deployment configuration file object for the given deployment configuration file name.
protected  void firePropertyChange(String propName, Object oldValue, Object newValue)
          Fire PropertyChange to all registered PropertyChangeListeners.
protected  void fireServerChange(String oldServerID, String newServerID)
           
 J2eeModuleProvider.ConfigSupport getConfigSupport()
           
 org.openide.filesystems.FileObject[] getConfigurationFiles()
          Returns all configuration files known to this J2EE Module.
 org.openide.filesystems.FileObject[] getConfigurationFiles(boolean refresh)
           
abstract  File getDeploymentConfigurationFile(String name)
          Returns source deployment configuration file path for the given deployment configuration file name.
 String getDeploymentName()
          Return name to be used in deployment of the module.
 File getEnterpriseResourceDirectory()
          Returns directory containing definition for enterprise resources needed for the module execution; return null if not supported
 InstanceProperties getInstanceProperties()
          Return InstanceProperties of the server instance
abstract  J2eeModule getJ2eeModule()
           
abstract  ModuleChangeReporter getModuleChangeReporter()
           
 Set<Datasource> getModuleDatasources()
          Gets the data sources saved in the module.
 Set<Datasource> getServerDatasources()
          Gets the data sources deployed on the target server instance.
 ServerDebugInfo getServerDebugInfo()
          Return server debug info.
 String getServerID()
          This method is used to determin type of target server.
 String getServerInstanceID()
          Id of server isntance for deployment.
 SourceFileMap getSourceFileMap()
          Return destination path-to-source file mappings.
 org.openide.filesystems.FileObject[] getSourceRoots()
          Returns list of root directories for source files including configuration files.
 boolean hasVerifierSupport()
          Returns true if the current target platform provide verifier support for this module.
 boolean isDatasourceCreationSupported()
          Tests whether data source creation is supported.
 void removeConfigurationFilesListener(ConfigurationFilesListener l)
           
 void removeInstanceListener(InstanceListener l)
          Remove an instance listener which has been registered previously.
 void removePropertyChangeListener(PropertyChangeListener l)
          Remove a listener registered previously.
abstract  void setServerInstanceID(String severInstanceID)
          Set ID of the server instance that will be used for deployment.
 boolean useDefaultServer()
          If the module wants to specify a target server instance for deployment it needs to override this method to return false.
 void verify(org.openide.filesystems.FileObject target, OutputStream logger)
          Invoke verifier from current platform on the provided target file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_ENTERPRISE_RESOURCE_DIRECTORY

public static final String PROP_ENTERPRISE_RESOURCE_DIRECTORY
Enterprise resorce directory property

Since:
1.12
See Also:
Constant Field Values
Constructor Detail

J2eeModuleProvider

public J2eeModuleProvider()
Method Detail

getJ2eeModule

public abstract J2eeModule getJ2eeModule()

getModuleChangeReporter

public abstract ModuleChangeReporter getModuleChangeReporter()

getConfigSupport

public final J2eeModuleProvider.ConfigSupport getConfigSupport()

getServerDebugInfo

public final ServerDebugInfo getServerDebugInfo()
Return server debug info. Note: if server is not running and needs to be up for retrieving debug info, this call will return null. This call is also used by UI so it should not try to ping or start the server.


getServerDatasources

public Set<Datasource> getServerDatasources()
Gets the data sources deployed on the target server instance.

Returns:
set of data sources
Since:
1.15

getModuleDatasources

public Set<Datasource> getModuleDatasources()
Gets the data sources saved in the module.

Returns:
set of data sources
Since:
1.15

isDatasourceCreationSupported

public boolean isDatasourceCreationSupported()
Tests whether data source creation is supported.

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

createDatasource

public final Datasource createDatasource(String jndiName,
                                         String url,
                                         String username,
                                         String password,
                                         String driver)
                                  throws DatasourceAlreadyExistsException
Creates and saves data source in the module if it does not exist yet on the target server or in the module. Data source is considered to be existing when JNDI name of the found data source and the one just created equal.

Parameters:
jndiName - name of data source
url - database URL
username - database user
password - user's password
driver - fully qualified name of database driver class
Returns:
created data source
Throws:
DatasourceAlreadyExistsException - if conflicting data source is found
Since:
1.15

deployDatasources

public void deployDatasources()
                       throws javax.enterprise.deploy.spi.exceptions.ConfigurationException,
                              DatasourceAlreadyExistsException
Deploys data sources saved in the module.

Throws:
javax.enterprise.deploy.spi.exceptions.ConfigurationException - if there is some problem with data source configuration
DatasourceAlreadyExistsException - if module data source(s) are conflicting with data source(s) already deployed on the server
Since:
1.15

addPropertyChangeListener

public final void addPropertyChangeListener(PropertyChangeListener l)
Register a listener which will be notified when some of the properties change.

Parameters:
l - listener which should be added.
Since:
1.12

removePropertyChangeListener

public final void removePropertyChangeListener(PropertyChangeListener l)
Remove a listener registered previously.

Parameters:
l - listener which should be removed.
Since:
1.12

firePropertyChange

protected final void firePropertyChange(String propName,
                                        Object oldValue,
                                        Object newValue)
Fire PropertyChange to all registered PropertyChangeListeners.

Parameters:
propName - property name.
oldValue - old value.
newValue - new value.
Since:
1.12

getDeploymentConfigurationFile

public abstract File getDeploymentConfigurationFile(String name)
Returns source deployment configuration file path for the given deployment configuration file name.

Parameters:
name - file name of the deployement configuration file.
Returns:
non-null absolute path to the deployment configuration file.

findDeploymentConfigurationFile

public abstract org.openide.filesystems.FileObject findDeploymentConfigurationFile(String name)
Finds source deployment configuration file object for the given deployment configuration file name.

Parameters:
name - file name of the deployement configuration file.
Returns:
FileObject of the configuration descriptor file; null if the file does not exists.

getEnterpriseResourceDirectory

public File getEnterpriseResourceDirectory()
Returns directory containing definition for enterprise resources needed for the module execution; return null if not supported


getSourceRoots

public org.openide.filesystems.FileObject[] getSourceRoots()
Returns list of root directories for source files including configuration files. Examples: file objects for src/java, src/conf. Note: If there is a standard configuration root, it should be the first one in the returned list.


getSourceFileMap

public SourceFileMap getSourceFileMap()
Return destination path-to-source file mappings. Default returns config file mapping with straight mapping from the configuration directory to distribution directory.


useDefaultServer

public boolean useDefaultServer()
If the module wants to specify a target server instance for deployment it needs to override this method to return false.


setServerInstanceID

public abstract void setServerInstanceID(String severInstanceID)
Set ID of the server instance that will be used for deployment.

Parameters:
severInstanceID - server instance ID.
Since:
1.6

getServerInstanceID

public String getServerInstanceID()
Id of server isntance for deployment. The default implementation returns the default server instance selected in Server Registry. The return value may not be null. If modules override this method they also need to override useDefaultServer.


getInstanceProperties

public InstanceProperties getInstanceProperties()
Return InstanceProperties of the server instance


getServerID

public String getServerID()
This method is used to determin type of target server. The return value must correspond to value returned from getServerInstanceID.


getDeploymentName

public String getDeploymentName()
Return name to be used in deployment of the module.


hasVerifierSupport

public boolean hasVerifierSupport()
Returns true if the current target platform provide verifier support for this module.


verify

public void verify(org.openide.filesystems.FileObject target,
                   OutputStream logger)
            throws ValidationException
Invoke verifier from current platform on the provided target file.

Parameters:
target - File to run verifier against.
logger - output stream to write verification resutl to.
Throws:
ValidationException

fireServerChange

protected final void fireServerChange(String oldServerID,
                                      String newServerID)

getConfigurationFiles

public final org.openide.filesystems.FileObject[] getConfigurationFiles()
Returns all configuration files known to this J2EE Module.


getConfigurationFiles

public final org.openide.filesystems.FileObject[] getConfigurationFiles(boolean refresh)

addConfigurationFilesListener

public final void addConfigurationFilesListener(ConfigurationFilesListener l)

removeConfigurationFilesListener

public final void removeConfigurationFilesListener(ConfigurationFilesListener l)

addInstanceListener

public final void addInstanceListener(InstanceListener l)
Register an instance listener that will listen to server instances changes.

Since:
1.6

removeInstanceListener

public final void removeInstanceListener(InstanceListener l)
Remove an instance listener which has been registered previously.

Since:
1.6

 

Built on March 27 2006.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.