com.ouncelabs.core.appserverimporter
Interface AppServerImporter

All Known Implementing Classes:
BaseAppServerImporter

public interface AppServerImporter

The interface to implement for an application server importer. Custom importer applications must extend BaseAppServerImporter, which provides additional functionality required by the framework.

A single instance of this class can be used repeatedly to import from different installations of an application server, so implementations must not cache any data related to a specific installation of an application server. Such information rightly belongs on the AppServer returned by importAppServer(String).


Method Summary
 BaseAppServerClasspathProvider createClasspathProvider()
          Oprtionally creates an instance of the AppServerClasspathProvider implementation for the application server, defining the runtime classpath for it.
 JSPCompilerSupport createJSPCompilerSupprt()
          Optionally creates an instance of the JSPCompilerSupport implementation for the application server, defining JSP precompilation behavior for it.
 java.lang.String getId()
          Returns the ID used to register this application server importer.
 JSPCompilerType getJSPCompilerType()
          Specifies the JSP compiler to use for created projects.
 java.lang.String getName()
          Returns the name for the application server importer, which is also the name of the application server it handles.
 boolean handleImportResult(org.eclipse.core.runtime.IStatus result, java.lang.Object shell)
          Displays, logs, or otherwise handles the IStatus representing the result of the import process.
 AppServer importAppServer(java.lang.String installDirectory)
          Analyzes an application server directory and returns an AppServer object representing the server and the applications on it.
 boolean isMultiProfile()
          Indicates whether or not the application server type supports multiple profiles.
 boolean isValidLocation(java.lang.String installDirectory)
          Determines if the specified install directory represents an instance of the application server that can be imported by this importer.
 void precompileJSPs(AppServer appServer)
          Optionally precompiles the JSPs for the application server.
 

Method Detail

getId

java.lang.String getId()
Returns the ID used to register this application server importer.

Returns:
the application server importer ID

getName

java.lang.String getName()
Returns the name for the application server importer, which is also the name of the application server it handles.

Returns:
the application server importer name

isMultiProfile

boolean isMultiProfile()
Indicates whether or not the application server type supports multiple profiles.

For example, WebSphere Application Sever does, Tomcat does not.

Returns:
true if the application server supports multiple profiles, false otherwise

isValidLocation

boolean isValidLocation(java.lang.String installDirectory)
Determines if the specified install directory represents an instance of the application server that can be imported by this importer.

Parameters:
installDirectory - The root directory of the application server
Returns:
whether installDirectory is a valid root directory of the supported application server

importAppServer

AppServer importAppServer(java.lang.String installDirectory)
                          throws java.lang.Exception
Analyzes an application server directory and returns an AppServer object representing the server and the applications on it. This method is only called if isValidLocation(String) returns true for the same directory.

Parameters:
installDirectory - The root directory of the application server
Returns:
a description of the application server
Throws:
java.lang.Exception - exceptions thrown by the implementations of this method are handled by the caller
See Also:
isValidLocation(String)

getJSPCompilerType

JSPCompilerType getJSPCompilerType()
Specifies the JSP compiler to use for created projects. If null is returned, the product default JSP compiler will be used.

Implementations that return JSPCompilerType.PRECOMPILED here must implement createJSPCompilerSupprt(), createClasspathProvider(), and precompileJSPs(AppServer).

Returns:
the JSP compiler type, or null for the product default
See Also:
precompileJSPs(AppServer), createJSPCompilerSupprt(), createClasspathProvider()

createJSPCompilerSupprt

JSPCompilerSupport createJSPCompilerSupprt()
Optionally creates an instance of the JSPCompilerSupport implementation for the application server, defining JSP precompilation behavior for it. This only needs to be implemented if getJSPCompilerType() returns precompiled. It is not needed in importers that rely on shipped JSP compilers (e.g. Tomcat) being used at scan-time.

Returns:
an instance of JSPCompilerSupport or null
See Also:
getJSPCompilerType(), JSPCompilerType.PRECOMPILED

createClasspathProvider

BaseAppServerClasspathProvider createClasspathProvider()
Oprtionally creates an instance of the AppServerClasspathProvider implementation for the application server, defining the runtime classpath for it. This only needs to be implemented if getJSPCompilerType() returns precompiled. It is not needed in importers that rely on shipped JSP compilers (e.g. Tomcat) being used at scan-time.

Returns:
an instance of BaseAppServerClasspathProvider or null
See Also:
AppServerClasspathProvider, getJSPCompilerType(), JSPCompilerType.PRECOMPILED

precompileJSPs

void precompileJSPs(AppServer appServer)
                    throws java.lang.Exception
Optionally precompiles the JSPs for the application server. This only needs to be implemented if getJSPCompilerType() returns precompiled. It is not needed in importers that rely on shipped JSP compilers (e.g. Tomcat) being used at scan-time.

Implementors should use AppServer.getMapping() to obtain a Mapping mapping to the imported AppScan Source applications, and Application.getStagingDirectory(Project) to obtain the staging directory for a project.

Parameters:
appServer - the application server
Throws:
java.lang.Exception - exceptions thrown by the implementations of this method are handled by the caller
See Also:
getJSPCompilerType(), JSPCompilerType.PRECOMPILED, AppServer.getMapping(), Mapping, Application.getStagingDirectory(Project)

handleImportResult

boolean handleImportResult(org.eclipse.core.runtime.IStatus result,
                           java.lang.Object shell)
Displays, logs, or otherwise handles the IStatus representing the result of the import process. Implementations may do nothing and return false to let the caller provide default handling.

In a UI environment, the active window shell is supplied as the second argument, shell. In a non-UI environment, that argument will be null. Implementors wishing to display UI should do so only if shell is non-null. The parameter is declared as an Object so that implementors do not need to depend on SWT, but if the argument is non-null, it can always be cast safely to Shell. If displaying a dialog, the supplied active window shell should be used as its parent.

Parameters:
result - result of the import process
shell - the shell of the active window, or null in a non-UI environment
Returns:
true if the status has been handled, false if the caller should handle it
See Also:
Shell