Usage of Generated Java Code as Web Application

Deployment descriptor and other auxiliary files
Deployment process
Usage of application servers' internal connection pool
Deployment descriptor and other auxiliary files
For the time being there is no direct difference between code generated for JSP application and code generated for EJB application. The difference is in usage of different base classes. The base classes to be used should be determined in web.xml (deployment descriptor).

Deployment descriptor declares a web name for a servlet to be used. By default this name is AUTService. E.g. to call web application "Product" you should enter the following url:

http://www.servername.com:8080/WebApplicationName/AUTService?javaClass=com.softwaremining.examples.jsp.product.CPrd_Call&method=servletRun

Here www.servername.com is a main url for the web server where the application has been deployed to and WebApplicationName is a name of your web application.

Actually, as it's underlined above, AUTService is just an alias of some particular servlet. For the time being it can be mapped either to MainHttpServlet (for JSP applications) or to EJBHttpServlet (for EJB applications). A servlet section of web.xml should look like:

<servlet>
<servlet-name>AUTService</servlet-name>
<servlet-class>com.softwaremining.web.MainHttpServlet</servlet-class>
<init-param>
<param-name>WorkMode</param-name>
<param-value>jsp_multi_threaded</param-value>
</init-param>
</servlet>

Parameter "WorkMode" defines a work mode for indicated servlet. For MainHttpServlet (i.e. for JSP applications) it can be either "jsp_multi_threaded" or "jsp_signle_threaded". For EJBHttpServlet (i.e. for EJB applications) it must be "ejb". Please note that to be used in "jsp_signle_threaded" or "ejb" modes the application should conform to some criteria. E.g. an application that has ACCEPT statements within paragraphs that can be performed from other paragraphs can not be run in such modes.

For EJB version of the program you will also need application.xml and ejb-jar.xml files. They describe web application as a whole and its beans. These files are standard for all SoftwareMining based applications. Under "standard" we mean that if you don't want to change application name or some security attributes you can use these files as is.

Deployment process
The deployment process may differ for different application servers but usually it is doing through administrative console. E.g. to deploy your application onto WebSphere (ver. 5.0) you should type URL of WebSphere's administrative console in your browser - e.g.

http://www.servername.com:9090/admin/

Then:

1) Expand "Applications" node and select "Install New Application" (to update existing application select "Enterprise applications"):

In case of updating existing application, select it from the list:

2) Ensure that the settings on first setup screen are the following:

3) On second setup screen enter a path to application's ear file:

4) On next setup screen don't forget to check "Deploy EJBs" option; ensure that all settings are the following:

5) Ensure that the settings on next screens are the following or similar:

6) After the message that your application has been installed select "Save to Master Configuration":

7) In case of updating existing application confirm that all previous files should be overwritten:

8) In case of installing new application don't forget to start it:

Now your application is ready to work.

Usage of application servers' internal connection pool
SoftwareMining JSP applications can work with underlying databases either directly (through own connection pool, using JDBC drivers) or by using application servers' internal connection pool.

Shortly, administrator of application server should "public" data source for underlying DBMS that can be used by application servers' beans. See the bottom of this section for detailed information.

After that an application can use this data source. The only aspect is that the data source should be mentioned in application deployment descriptor:

ejb-jar.xml:
<enterprise-beans>
<session>
<ejb-name>EJBLauncher</ejb-name>
<home>com.softwaremining.ejb.EJBLauncherHome</home>
<remote>com.softwaremining.ejb.EJBLauncher</remote>
<ejb-class>com.softwaremining.ejb.EJBLauncherBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
<env-entry>
<description>Location of datasource in JNDI tree</description>
<env-entry-name>DataSourceJNDIName</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>jdbc/CobolDB</env-entry-value>
</env-entry>
</session>
</enterprise-beans>

Here jdbc/CobolDB is a location of DataSource object in JNDI tree. Class ACMConnection uses this data source to get connection. Nevertheless, if this entry isn't specified ACMConnection uses its standard connection pool.

Now how to "public" the data source on application server.

For relatively simple application servers like Orion the corresponding entry should be added to datasources.xml file (it can be found in Orion/conf folder). Such entry may look like:

<data-source
class="com.evermind.sql.DriverManagerDataSource"
name="Hypersonic"
location="jdbc/HypersonicCoreDS"
xa-location="jdbc/xa/HypersonicXADS"
ejb-location="jdbc/CobolDB"
connection-driver="org.hsql.jdbcDriver"
username="sa"
password=""
url="jdbc:HypersonicSQL:./database/cobolDB"
inactivity-timeout="30"
max-connections="10"
/>

For WebSphere you also can "public" the data source using administrative console (expand "Resources" node then select "JDBC Providers" one).