Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To facilitate the creation of Geronimo-specific deployment plans there is a new portlet now available. The Plan Creator wizard available from the Geronimo Administration Administrative Console makes deployment easier by walking you through a sequence of steps to auto-generate the geronimo-web.xml for a given WAR file.

The wizard searches the references declared in the web.xml as well as what is now defined within the code itself via annotations. Depending on the type of application the Plan Creator wizard will present a series of pages requesting specific information to resolve the references and dependencies. The wizard also offers default values which work for most of the configurations.

...

The Plan Creator wizard will help you generate the appropriate deployment plan for the application you are deploying. The wizard currently works for web apps Web applications and supports the following features.:

  • References: EJB, EJB Local, JDBC Connection Pool, JMS Connection Factory, JMS Destination, JavaMail Session & Web Service references declared in the web-apps Web applications are auto discovered and users are asked to resolve them by listing Available Resources in the server environment to which they can be linked.
  • Above type of references declared inside the Java classes through Annotations are also auto discovered.
  • Simplified configuration of Security.

...

There are four simple applications attached to give you a better idea of how the plan creator wizard would work when deploying web Web applications.

...

The Annotations-TestJDBCAccess.zip file provides a BankDB.sql, WebAppJDBCAccessAnnotations.war which is the WAR we will be deploying and a sample of the generated deployment plan WebAppJDBCAccessAnnotations_generatedPlan.xml. Download and extract the zip file to a directory of your convenience.

WebAppJDBCAccessAnnotations.war includes a Servlet, a JSP and a basic web.xml. The following excerpt shows the annotation part the wizard has identified and will likely be prompting for additional information while deploying the application.

...

With the server up and running access the Geronimo Administration Administrative Console with a web Web browser and click on Plan Creator on the left menu.

Browse to the WebAppJDBCAccessAnnotations.war you just extracted and click on Configure. In the resulting screen you will be configuring the web Web application identity. You may want to change the default proposed values however, for this example, we will be accepting the defaults. Click Next.

In the following screen, the wizard would have identified all WAR references that need to be resolved. The references listed on this screen are specific to this application. The JDBCRef column is showing the resource name defined in ListCustomers.java. See @Resource(name = "jdbc/MyDataSource") from the excerpt above.

As mentioned earlier, for this example we created a database connection pool we called BankDB_Pool. From the JDBC Pools pull-down menu you can now select the appropriate connection pool and click Next.

The following screen list lists all available modules and allows you specify the modules this WAR has dependencies on. This screen also provides a default selection, in this case the database connection pool will be already selected. Accept the default and click Next. For most scenarios the default values should be sufficient.

...

You should receive two confirmation messages stating the application was successfully deployed and successfully started. The Launch Web App link takes your browser directly to the application you just deployed based on the context root you defined earlier. The Finish link takes you to the Plan Creator portlet again to start deploying a new application.

EJB access
Anchor
ejb
ejb

This sample is a simple web Web application that accesses a Session EJB. It requires a JAR to be deployed before you can deploy the web Web application. In the #Attachments section we have included all the files you need to test the deployment of this sample application.

...

With the server up and running access the Geronimo Administration Console with a web Web browser and click on Deploy New on the left menu. We will now deploy the WAR prerequisite JAR file.

...

WebAppEjbAccessAnnotations.war includes a Servlet, a JSP and a basic web.xml. The following excerpt shows the annotation part the wizard has identified and will likely be prompting for additional information while deploying the application.

...

With the prerequisite JAR just installed click on Plan Creator on the left menu to proceed with the WAR installation. Browse to the WebAppEjbAccessAnnotations.war you just extracted and click on Configure. In the resulting screen you will be configuring the web Web application identity. You may want to change the default proposed values however, for this example, we will be accepting the defaults. Click Next.

...

JMS access
Anchor
jms
jms

This is a simple web Web application that accesses a JMS Connection Factory and a JMS destination. Producer servlet sends 5 messages to a JMS queue and the Consumer servlet synchronously receives messages from the same queue.

...

With the server up and running access the Geronimo Administration Administrative Console with a web Web browser and click on Plan Creator on the left menu. Browse to the WebAppJMSAccess.war you just extracted and click on Configure. The subsequent configuration pages are nearly identical to what we described in the Sample with annotations section so we will skip the step-by-steps details. The end result is the same, the Plan Creator wizard has generated the deployment plan directly from the provided web.xml.

Once again we are providing both generated deployment plans side-by-side to facilitate comparison. These two sample applications are slightly different so you can see some additional variations in the generated deployment plan.

...

This sample application is a basic time reporting system that uses Servlets, JSPs and J2EE Java EE declarative security. In addition to above features it uses Geronimo's embedded Derby database to store user information of the system. Even though this application uses a database to hold user information, it is merely for configuration purposes. This sample application is a slight variation from the one covered in Geronimo v2.0 Documentation. The focus of this document is on the Plan Creator wizard so we will not cover in much detail this application's inner working, please refer to Web application security sample for further details.

The noAnnotations-TestSecuritySettings.zip provides a number of SQL scripts and deployment plans to facilitate set up the environment the security sample application requires to run. The provided files are 1_TimeReportDB.sql, 2_dbPoolPlan.xml, 3_securityRealmPlan.xml. In addition there is a 0_Readme.txt which is a condensed set of intructions to deploy this sample application, timereport.war which is the application we will be deploying and a sample of the generated deployment plan timereport_generatedPlan.xml. Download and extract the zip file to a directory of your convenience.

...

  1. With the server up and running access the Geronimo Administration Administrative Console and click on DB Manager. Create a database by name "TimeReportDB" and run 1_TimeReportDB.sql on this new database.
  2. Create a database connection pool by clicking on Deploy New and specify <geronimo_home>\repository\org\tranql\tranql-connector-ra\1.3\tranql-connector-ra-1.3.rar as the Archive: and 2_dbPoolPlan.xml as the Plan. This will create the new database pool "TimeReportPool".
  3. Create a new security realm by clickin on Deploy New and only specify 3_securityRealmPlan.xml as the "Plan". This will create the TimeReportRealm security realm.

Now that we have configured the environment we go back to the application. timereport.war provides 2 Servlets, several JSPs and the web.xml we will be focusing on. In addition this WAR contains the sources and full java docs. The following sample illustrates the web.xml, here are defined all the security constraints, realms and roles the Plan Creator wizard will use to generate the Geronimo specific deployment plan.

Code Block
xml
xml
borderStylesolid
titleweb.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
	 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
	 version="2.4">	
	 
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
  	</welcome-file-list>
  	
	<security-constraint>
		<web-resource-collection>
			<web-resource-name>employee</web-resource-name>
			<url-pattern>/employee/*</url-pattern>			
		</web-resource-collection>
		<auth-constraint>
			<role-name>employee</role-name>			 
		</auth-constraint>
	</security-constraint>
	
	<security-constraint>
		<web-resource-collection>
			<web-resource-name>manager</web-resource-name>
			<url-pattern>/manager/*</url-pattern>			
		</web-resource-collection>
		<auth-constraint>
			<role-name>manager</role-name>
		</auth-constraint>
	</security-constraint>
	
	<login-config>
		<auth-method>FORM</auth-method>
		<realm-name>TimeReportRealm</realm-name>
		<form-login-config>
			<form-login-page>/login/login.jsp</form-login-page>
			<form-error-page>/login/login_error.jsp</form-error-page>
		</form-login-config>
	</login-config>
	
	<security-role>
		<role-name>employee</role-name>		
    </security-role>
	<security-role>
		<role-name>manager</role-name>		
    </security-role>
    	
    <servlet>
	    <display-name>AddTimeRecordServlet</display-name>
	    <servlet-name>AddTimeRecordServlet</servlet-name>
	    <servlet-class>org.apache.geronimo.samples.timereport.web.AddTimeRecordServlet</servlet-class>
  	</servlet>
  	<servlet>
	    <display-name>AddEmployeeServlet</display-name>
	    <servlet-name>AddEmployeeServlet</servlet-name>
	    <servlet-class>org.apache.geronimo.samples.timereport.web.AddEmployeeServlet</servlet-class>
  	</servlet>
  	
  	<servlet-mapping>
	    <servlet-name>AddTimeRecordServlet</servlet-name>
	    <url-pattern>/employee/add_timerecord</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
	    <servlet-name>AddEmployeeServlet</servlet-name>
	    <url-pattern>/manager/add_employee</url-pattern>
    </servlet-mapping>
        
</web-app>
  1. Back in the Geronimo Administration Administrative Console click on Plan Creator. Browse to the timereport.war you just extracted and click on Configure.



  2. In the resulting screen you will be configuring the web application identity. You may want to change the default proposed values however, for this example, we will be accepting the defaults. Click Next.



  3. As a difference from the other sample applications, for this example we do not have to resolve any resource references so the wizard will jump directly to the security part of the configuration. In the resulting screendefine screen define the security configuration.
    1. Select "TimeReportRealm" from the "Security Realm Name:" pull down menu. This is the security realm you deployed earlier.
    2. For security role employee select Add -> Principal from the pull down menu and add 2 Group Prinicipals with name EmployeeGroup and ManagerGroup.
    3. For security role manager, select Add -> Principal and add 1 Group Prinicipal with name ManagerGroup.



  4. Click Next, the following screen allows you to select WAR dependencies. This application has not dependencies on any these modules, click Next.
  5. In the Created Plan screen you should see a plan similar to this one.
    Code Block
    xml
    xml
    borderStylesolid
    titleGenerated deployment plan without Annotations
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
        <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
            <dep:moduleId>
                <dep:groupId>default</dep:groupId>
                <dep:artifactId>timereport</dep:artifactId>
                <dep:version>1.0</dep:version>
                <dep:type>war</dep:type>
            </dep:moduleId>
        </dep:environment>
        <context-root>timereport</context-root>
        <security-realm-name>TimeReportRealm</security-realm-name>
        <app:security xsi:type="sec:securityType" xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0" 
                      xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0" 
    		  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <sec:role-mappings>
                <sec:role role-name="employee">
                    <sec:principal name="EmployeeGroup" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
                    <sec:principal name="ManagerGroup" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
                </sec:role>
                <sec:role role-name="manager">
                    <sec:principal name="ManagerGroup" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
                </sec:role>
            </sec:role-mappings>
        </app:security>
    </web-app>
    
  6. Click on Deploy WAR and then click on Launch Web App to run the sample application. Verify using userid and password values from 1_TimeReportDB.sql.

Attachments

Attachments
patterns.*zip