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.

Excerpt

The Plan Creator wizard available from the Geronimo Administrative Administration Console makes deployment easier by walking you through a sequence of steps to auto-generate the geronimo-web.xml for a given WAR file.

...

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

...

With the server up and running access the Geronimo Administrative Administration Console with a 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.

...

  1. With the server up and running access the Geronimo Administrative Administration 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.

...

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 Administrative Administration 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 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 userid and password values from 1_TimeReportDB.sql.

...