Versions Compared

Key

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

...

Supported features

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 and supports the following features.

...

The following sections provide sample applications with different features so you can better appreciate the wizard behavior.

Sample with annotations
Anchor
annotations
annotations

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

JDBC access
Anchor
jdbc
jdbc

This sample is a very simple database access application that uses annotations. For this example we have created a sample BankDB database on the embedded Derby as well as a database connection pool. Although we will not be covering in this section how to create a database or a connection pool we still provide in the #Attachments section some SQL sample to generate the required sample database.

...

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. Finish 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 application that accesses a Session EJB. It requires a JAR to be deployed before you can deploy the web application. In the #Attachments section we have included all the files you need to test the deployment of this sample application.

...

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. Finish takes you to the Plan Creator portlet again to start deploying a new application.

JMS access
Anchor
jms
jms

This is a simple 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.

...

So far we have shown you how easy is to deploy a web application when using annotations. The following section focuses on applications not using annotations, this is mainly for applications based on the previous J2EE specification.

Sample without annotations
Anchor
noannotations
noannotations

To make it easier to compare we are providing a similar set of applications as in the previous section(JDBC, EJB and JMS) but without the advantage of using annotations. In addition we are also including a security configuration application to cover the additional functionality we didn't cover in the previous section.

JDBC access
Anchor
jdbc2
jdbc2

This is basically the same sample application we used in the Sample with annotations section, but obviously without annotations. Once again for this example we created a sample database and a connection pool. However, the emphasis of this section is on the web.xml file which contains the resource reference required for this application to run.

...

Section
Column
width50%
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>WebAppJDBCAccess</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>war</dep:type>
        </dep:moduleId>
        <dep:dependencies>
            <dep:dependency>
                <dep:groupId>console.dbpool</dep:groupId>
                <dep:artifactId>BankDB_Pool</dep:artifactId>
                <dep:version>1.0</dep:version>
                <dep:type>rar</dep:type>
            </dep:dependency>
        </dep:dependencies>
    </dep:environment>
    <context-root>WebAppJDBCAccess</context-root>
    <nam:resource-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
        <nam:ref-name>jdbc/MyDataSource</nam:ref-name>
        <nam:pattern>
            <nam:groupId>console.dbpool</nam:groupId>
            <nam:artifactId>BankDB_Pool</nam:artifactId>
            <nam:version>1.0</nam:version>
            <nam:name>BankDB_Pool</nam:name>
        </nam:pattern>
    </nam:resource-ref>
</web-app>
Column
width50%
Code Block
xml
xml
borderStylesolid
titleGenerated deployment plan with 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>WebAppJDBCAccessAnnotations</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>war</dep:type>
        </dep:moduleId>
        <dep:dependencies>
            <dep:dependency>
                <dep:groupId>console.dbpool</dep:groupId>
                <dep:artifactId>BankDB_Pool</dep:artifactId>
                <dep:version>1.0</dep:version>
                <dep:type>rar</dep:type>
            </dep:dependency>
        </dep:dependencies>
    </dep:environment>
    <context-root>WebAppJDBCAccessAnnotations</context-root>
    <nam:resource-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
        <nam:ref-name>jdbc/MyDataSource</nam:ref-name>
        <nam:pattern>
            <nam:groupId>console.dbpool</nam:groupId>
            <nam:artifactId>BankDB_Pool</nam:artifactId>
            <nam:version>1.0</nam:version>
            <nam:name>BankDB_Pool</nam:name>
        </nam:pattern>
    </nam:resource-ref>
</web-app>

EJB access
Anchor
ejb2
ejb2

This example is based on the same sample application we used in the Sample with annotations section but without annotations. In the #Attachments section we have included all the files you need to test the deployment of this sample application.

...

Section
Column
width50%
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>WebAppEjbAccess</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>war</dep:type>
        </dep:moduleId>
        <dep:dependencies>
            <dep:dependency>
                <dep:groupId>default</dep:groupId>
                <dep:artifactId>CurrencyConverterEJB</dep:artifactId>
                <dep:version>1199912901187</dep:version>
                <dep:type>jar</dep:type>
            </dep:dependency>
        </dep:dependencies>
    </dep:environment>
    <context-root>WebAppEjbAccess</context-root>
    <nam:ejb-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
        <nam:ref-name>ejb/Converter</nam:ref-name>
        <nam:pattern>
            <nam:groupId>default</nam:groupId>
            <nam:artifactId>CurrencyConverterEJB</nam:artifactId>
            <nam:version>1199912901187</nam:version>
            <nam:name>ConverterBean</nam:name>
        </nam:pattern>
    </nam:ejb-ref>
</web-app>
Column
width50%
Code Block
xml
xml
borderStylesolid
titleGenerated deployment plan with 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>WebAppEjbAccessAnnotations</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>war</dep:type>
        </dep:moduleId>
        <dep:dependencies>
            <dep:dependency>
                <dep:groupId>default</dep:groupId>
                <dep:artifactId>CurrencyConverterEJB</dep:artifactId>
                <dep:version>1199912901187</dep:version>
                <dep:type>jar</dep:type>
            </dep:dependency>
        </dep:dependencies>
    </dep:environment>
    <context-root>WebAppEjbAccessAnnotations</context-root>
    <nam:ejb-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
        <nam:ref-name>ejb/Converter</nam:ref-name>
        <nam:pattern>
            <nam:groupId>default</nam:groupId>
            <nam:artifactId>CurrencyConverterEJB</nam:artifactId>
            <nam:version>1199912901187</nam:version>
            <nam:name>ConverterBean</nam:name>
        </nam:pattern>
    </nam:ejb-ref>
</web-app>

JMS access
Anchor
jms2
jms2

Once again we are basing this sample application from the one we used in the annotations section. There is a Producer servlet that sends 5 messages to a JMS queue and a Consumer servlet that synchronously receives messages from the same queue.

...

Section
Column
width50%
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>WebAppJMSAccess</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>war</dep:type>
        </dep:moduleId>
        <dep:dependencies>
            <dep:dependency>
                <dep:groupId>org.apache.geronimo.configs</dep:groupId>
                <dep:artifactId>activemq-ra</dep:artifactId>
                <dep:version>2.1-SNAPSHOT</dep:version>
                <dep:type>car</dep:type>
            </dep:dependency>
        </dep:dependencies>
    </dep:environment>
    <context-root>WebAppJMSAccess</context-root>
    <nam:resource-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
        <nam:ref-name>jms/TestConnectionFactory</nam:ref-name>
        <nam:pattern>
            <nam:groupId>org.apache.geronimo.configs</nam:groupId>
            <nam:artifactId>activemq-ra</nam:artifactId>
            <nam:version>2.1-SNAPSHOT</nam:version>
            <nam:name>DefaultActiveMQConnectionFactory</nam:name>
        </nam:pattern>
    </nam:resource-ref>
    <nam:message-destination xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
        <nam:message-destination-name>TestQueue</nam:message-destination-name>
        <nam:admin-object-link>MDBTransferBeanOutQueue</nam:admin-object-link>
    </nam:message-destination>
</web-app>
Column
width50%
Code Block
xml
xml
borderStylesolid
titleGenerated deployment plan with 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>WebAppJMSAccessAnnotations</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>war</dep:type>
        </dep:moduleId>
        <dep:dependencies>
            <dep:dependency>
                <dep:groupId>org.apache.geronimo.configs</dep:groupId>
                <dep:artifactId>activemq-ra</dep:artifactId>
                <dep:version>2.1-SNAPSHOT</dep:version>
                <dep:type>car</dep:type>
            </dep:dependency>
        </dep:dependencies>
    </dep:environment>
    <context-root>WebAppJMSAccessAnnotations</context-root>
    <nam:resource-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
        <nam:ref-name>jms/TestConnectionFactory</nam:ref-name>
        <nam:pattern>
            <nam:groupId>org.apache.geronimo.configs</nam:groupId>
            <nam:artifactId>activemq-ra</nam:artifactId>
            <nam:version>2.1-SNAPSHOT</nam:version>
            <nam:name>DefaultActiveMQConnectionFactory</nam:name>
        </nam:pattern>
    </nam:resource-ref>
    <nam:resource-env-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
        <nam:ref-name>jms/TestQueue</nam:ref-name>
        <nam:pattern>
            <nam:groupId>org.apache.geronimo.configs</nam:groupId>
            <nam:artifactId>activemq-ra</nam:artifactId>
            <nam:version>2.1-SNAPSHOT</nam:version>
            <nam:name>MDBTransferBeanOutQueue</nam:name>
        </nam:pattern>
    </nam:resource-env-ref>
</web-app>

Security configuration
Anchor
security2
security2

This sample application is a basic time reporting system that uses Servlets, JSPs and J2EE 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.

...

  1. Back in the Geronimo 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 screendefine 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