Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jbossas/quickstart
Browse files Browse the repository at this point in the history
Conflicts:
	pom.xml
  • Loading branch information
spagop committed Jan 7, 2012
2 parents bdec44f + 96fd185 commit a3b6e1a
Show file tree
Hide file tree
Showing 32 changed files with 358 additions and 57 deletions.
31 changes: 30 additions & 1 deletion README.html
@@ -1,6 +1,35 @@
<h1>JBoss AS Quickstarts</h1>
<p>These quickstarts will run in both the JBoss AS or JBoss EAP environments. Check the README.md file in each quickstart folder for more details and specific instructions. </p>
<p>These quickstarts will run in both the JBoss AS 7 or JBoss EAP 6 environments. Check the README.md file in each quickstart folder for more details and specific instructions. </p>
<p>If you want to run the quickstarts in JBoss EAP, we recommend using the JBoss EAP zip. This version chooses the exact dependencies used in EAP and ensures you test and compile against your runtime environment. </p>
<h2>Available Quickstarts</h2>
<p>These are the quickstarts for JBoss AS 7 and JBoss EAP 6. You will find detailed tutorials in the
various guides at <a href="https://docs.jboss.org/author/display/AS7">https://docs.jboss.org/author/display/AS7</a></p>
<p>Quickstarts with tutorials in The Getting Started Developing Applications Guide -
<a href="https://docs.jboss.org/author/display/AS7/Getting+Started+Developing+Applications+Guide">https://docs.jboss.org/author/display/AS7/Getting+Started+Developing+Applications+Guide</a>
are noted with two asterisks ( ** ) following the quickstart name.</p>
<ul>
<li><code>bmt</code> - EJB, Programmatically control transactions</li>
<li><code>cdi-injection</code> - CDI injections &amp; qualifiers + Servlet</li>
<li><code>ejb-in-ear</code> - EJB + JSF, JAR and WAR deployed as EAR</li>
<li><code>ejb-in-war</code> - EJB + JSF deployed as a war</li>
<li><code>ejb-remote</code> - shows how to access EJBs remotely (EJB + JNDI)</li>
<li><code>greeter</code> - CDI + JSF + JPA + EJB + JTA</li>
<li><code>h2-console</code> - H2 Database console</li>
<li><code>helloworld</code> ** -Very basic CDI + Servlet</li>
<li><code>helloworld-gwt</code> - GWT</li>
<li><code>helloworld-jsf</code> - Very basic CDI + JSF</li>
<li><code>helloworld-mdb</code> - Very basic JMS and MDBs</li>
<li><code>helloworld-osgi</code> - OSGi</li>
<li><code>helloworld-rs</code> - CDI + JAX-RS</li>
<li><code>html5-mobile</code> - kitchensink using HTML5, suitable for mobile and tablet computers</li>
<li><code>kitchensink</code> ** - CDI + JSF + JPA + EJB + JPA + JAX-RS + BV</li>
<li><code>kitchensink-jsp</code> - kitchensink converted to use JSP</li>
<li><code>kitchensink-ear</code> - kitchensink as an EAR archive</li>
<li><code>log4jdemo</code> - JBoss Modules, Class loading, logging</li>
<li><code>numberguess</code> ** - CDI + JSF</li>
<li><code>servlet-async</code> - CDI + Asynchronous Servlet + Asynchronous EJB </li>
<li><code>servlet-filterlistener</code> - Servlet Filter and Listener</li>
</ul>
<h2>Prerequisites</h2>
<p>To run these quickstarts with the provided build scripts, you will need the following:</p>
<ol>
Expand Down
35 changes: 34 additions & 1 deletion README.md
@@ -1,10 +1,42 @@
JBoss AS Quickstarts
====================

These quickstarts will run in both the JBoss AS or JBoss EAP environments. Check the README.md file in each quickstart folder for more details and specific instructions.
These quickstarts will run in both the JBoss AS 7 or JBoss EAP 6 environments. Check the README.md file in each quickstart folder for more details and specific instructions.

If you want to run the quickstarts in JBoss EAP, we recommend using the JBoss EAP zip. This version chooses the exact dependencies used in EAP and ensures you test and compile against your runtime environment.

Available Quickstarts
---------------------

These are the quickstarts for JBoss AS 7 and JBoss EAP 6. You will find detailed tutorials in the
various guides at <https://docs.jboss.org/author/display/AS7>

Quickstarts with tutorials in The Getting Started Developing Applications Guide -
<https://docs.jboss.org/author/display/AS7/Getting+Started+Developing+Applications+Guide>
are noted with two asterisks ( ** ) following the quickstart name.

* `bmt` - EJB, Programmatically control transactions
* `cdi-injection` - CDI injections & qualifiers + Servlet
* `ejb-in-ear` - EJB + JSF, JAR and WAR deployed as EAR
* `ejb-in-war` - EJB + JSF deployed as a war
* `ejb-remote` - shows how to access EJBs remotely (EJB + JNDI)
* `greeter` - CDI + JSF + JPA + EJB + JTA
* `h2-console` - H2 Database console
* `helloworld` ** -Very basic CDI + Servlet
* `helloworld-gwt` - GWT
* `helloworld-jsf` - Very basic CDI + JSF
* `helloworld-mdb` - Very basic JMS and MDBs
* `helloworld-osgi` - OSGi
* `helloworld-rs` - CDI + JAX-RS
* `html5-mobile` - kitchensink using HTML5, suitable for mobile and tablet computers
* `kitchensink` ** - CDI + JSF + JPA + EJB + JPA + JAX-RS + BV
* `kitchensink-jsp` - kitchensink converted to use JSP
* `kitchensink-ear` - kitchensink as an EAR archive
* `log4jdemo` - JBoss Modules, Class loading, logging
* `numberguess` ** - CDI + JSF
* `servlet-async` - CDI + Asynchronous Servlet + Asynchronous EJB
* `servlet-filterlistener` - Servlet Filter and Listener

Prerequisites
-------------

Expand Down Expand Up @@ -72,3 +104,4 @@ To build and deploy a quickstart, in most cases you will do the following:
4. See the README file in the individual quickstart folder for specific information on how to run and access the example.


2 changes: 1 addition & 1 deletion bmt/pom.xml
Expand Up @@ -4,7 +4,7 @@

<groupId>org.jboss.as.quickstarts</groupId>
<artifactId>jboss-as-bmt</artifactId>
<version>7.0.2-SNAPSHOT</version>
<version>7.0.2.CR3</version>
<packaging>war</packaging>
<name>JBoss AS Quickstarts: Bean Managed Transactions</name>
<description>JBoss AS Quickstarts: Bean Managed Transactions</description>
Expand Down
2 changes: 1 addition & 1 deletion cdi-injection/pom.xml
Expand Up @@ -4,7 +4,7 @@

<groupId>org.jboss.as.quickstarts</groupId>
<artifactId>jboss-as-cdi-injection</artifactId>
<version>7.0.2-SNAPSHOT</version>
<version>7.0.2.CR3</version>
<packaging>war</packaging>
<name>JBoss AS Quickstarts: CDI-Injection</name>
<description>JBoss AS Quickstarts: CDI-Injection</description>
Expand Down
2 changes: 1 addition & 1 deletion dist/pom.xml
Expand Up @@ -9,7 +9,7 @@
</parent>
<groupId>org.jboss.as.quickstarts</groupId>
<artifactId>jboss-as-quickstarts-dist</artifactId>
<version>7.0.2-SNAPSHOT</version>
<version>7.0.2.CR3</version>
<packaging>pom</packaging>
<name>JBoss AS Quickstarts Distribution</name>
<description>JBoss AS Quickstarts Distribution</description>
Expand Down
1 change: 1 addition & 0 deletions dist/src/main/assembly/README.html
Expand Up @@ -22,4 +22,5 @@ <h1>JBoss AS Quickstarts</h1>
<li><code>numberguess</code> - CDI + JSF</li>
<li><code>servlet-async</code> - CDI + Asynchronous Servlet + Asynchronous EJB </li>
<li><code>servlet-filterlistener</code> - Servlet Filter and Listener</li>
<li><code>ejb-remote</code> - shows how to access EJBs remotely (EJB + JNDI)</li>
</ul>
2 changes: 1 addition & 1 deletion greeter/pom.xml
Expand Up @@ -4,7 +4,7 @@

<groupId>org.jboss.as.quickstarts</groupId>
<artifactId>jboss-as-greeter</artifactId>
<version>7.0.2-SNAPSHOT</version>
<version>7.0.2.CR3</version>
<packaging>war</packaging>
<name>JBoss AS Quickstarts: Greeter</name>
<description>JBoss AS Quickstarts: Greeter</description>
Expand Down
2 changes: 1 addition & 1 deletion helloworld-gwt/pom.xml
Expand Up @@ -5,7 +5,7 @@

<groupId>org.jboss.as.quickstarts</groupId>
<artifactId>jboss-as-helloworld-gwt</artifactId>
<version>7.0.2-SNAPSHOT</version>
<version>7.0.2.CR3</version>
<packaging>war</packaging>
<name>JBoss AS Quickstarts: GWT Hello World</name>

Expand Down
2 changes: 1 addition & 1 deletion helloworld-jsf/pom.xml
Expand Up @@ -4,7 +4,7 @@

<groupId>org.jboss.as.quickstarts</groupId>
<artifactId>jboss-as-helloworld-jsf</artifactId>
<version>7.0.2-SNAPSHOT</version>
<version>7.0.2.CR3</version>
<packaging>war</packaging>
<name>JBoss AS Quickstarts: Hello world JSF</name>
<description>JBoss AS Quickstarts: Hello world JSF</description>
Expand Down
2 changes: 1 addition & 1 deletion helloworld-osgi/pom.xml
Expand Up @@ -4,7 +4,7 @@

<groupId>org.jboss.as.quickstarts</groupId>
<artifactId>jboss-as-helloworld-osgi</artifactId>
<version>7.0.2-SNAPSHOT</version>
<version>7.0.2.CR3</version>
<packaging>bundle</packaging>
<name>JBoss AS Quickstarts: Helloworld OSGi</name>
<description>JBoss AS Quickstarts: Helloworld OSGi</description>
Expand Down
2 changes: 1 addition & 1 deletion helloworld-rs/pom.xml
Expand Up @@ -4,7 +4,7 @@

<groupId>org.jboss.as.quickstarts</groupId>
<artifactId>jboss-as-helloworld-rs</artifactId>
<version>7.0.2-SNAPSHOT</version>
<version>7.0.2.CR3</version>
<packaging>war</packaging>
<name>JBoss AS Quickstarts: helloworld-rs</name>
<description>JBoss AS Quickstarts: helloworld-rs</description>
Expand Down
51 changes: 51 additions & 0 deletions helloworld-singleton/README.md
@@ -0,0 +1,51 @@
jboss-as-helloworld-singleton Example
===============================

What is it?
-----------

This quickstart demonstrates the use of an *EJB 3.1 Singleton Bean* in JBoss AS 7.1.0.

System requirements
-------------------

All you need to build this project is Java 6.0 (Java SDK 1.6) or better, Maven
3.0 or better.

The application this project produces is designed to be run on a JBoss AS 7.1.0 or EAP 6.

With the prerequisites out of the way, you're ready to build and deploy.

Deploying the application
-------------------------

First of all you need to enable the "admin" user from $JBOSS_HOME/standalone/configuration/mgmt-users.properties file, and then start JBoss AS 7 (or EAP 6). To do this, run this script

$JBOSS_HOME/bin/standalone.sh

or if you are using windows

$JBOSS_HOME/bin/standalone.bat

To deploy the application, you first need to produce the archive to deploy using
the following Maven goal:

mvn package

You can now deploy the artifact to JBoss AS by executing the following command:

mvn jboss-as:deploy

This will deploy `target/jboss-as-helloworld-singleton.war`.

The application will be running at the following URL <http://localhost:8080/jboss-as-helloworld-singleton>.

This example demonstrates a singleton session bean that maintains state information for 2 variables: "Increment A" and "Increment B". A counter is incremented when you click on the link to the variable name. If you close and restart your browser, or if you have multiple browsers, you can see that the counter always increments the last value. These values are maintained until you restart the server. To test the singleton bean, on the home page, click on either "Increment A" or "Increment B". The result page will give you the current value of the variable.

To undeploy from JBoss AS, run this command:

mvn jboss-as:undeploy

You can also start JBoss AS 7 and deploy the project using Eclipse. See the JBoss AS 7
Getting Started Guide for Developers for more information.

96 changes: 96 additions & 0 deletions helloworld-singleton/pom.xml
@@ -0,0 +1,96 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.jboss.as.quickstarts</groupId>
<artifactId>jboss-as-helloworld-singleton</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<name>JBoss AS Quickstarts: Helloworld Singleton Session Bean with JSF 2.0 as client</name>

<url>http://jboss.org/jbossas</url>
<licenses>
<license>
<name>GNU Lesser General Public License</name>
<url>http://www.gnu.org/copyleft/lesser.html</url>
<distribution>repo</distribution>
</license>
</licenses>

<properties>
<!-- Explicitly declaring the source encoding eliminates the following
message: -->
<!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
resources, i.e. build is platform dependent! -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencyManagement>
<dependencies>
<!-- Define the version of JBoss' Java EE 6 APIs we want to use -->
<!-- JBoss distributes a complete set of Java EE 6 APIs including a Bill
of Materials (BOM). A BOM specifies the versions of a "stack" (or a collection)
of artifacts. We use this here so that we always get the correct versions
of artifacts. Here we use the jboss-javaee-6.0 stack (you can read this as
the JBoss stack of the Java EE 6 APIs). You can actually use this stack with
any version of JBoss AS that implements Java EE 6, not just JBoss AS 7! -->
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>3.0.0.Beta1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<!-- Import the Servlet API, we use provided scope as the API is included
in JBoss EAP 6/JBoss AS 7 -->
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.1_spec</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the CDI API, we use provided scope as the API is included in
JBoss AS 7 -->
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<!-- Set the name of the war, used as the context root when the app is
deployed -->
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! -->
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<!-- JBoss AS plugin to deploy war -->
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.1.0.CR1</version>
</plugin>
<!-- Compiler plugin enforces Java 1.6 compatibility and activates annotation
processors -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,34 @@
package org.jboss.as.quickstarts.singleton;

import javax.ejb.Singleton;
import javax.inject.Named;

/**
* This singleton stores stores two counters which are only reset when the application is restarted.
*
* @author Serge Pagop (spagop@redhat.com)
*
*/
@Singleton
@Named
public class Counter {

private int a = 1;
private int b = 1;

public void incrementA() {
a++;
}

public void incrementB() {
b++;
}

public int getA() {
return a;
}

public int getB() {
return b;
}
}
8 changes: 8 additions & 0 deletions helloworld-singleton/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,8 @@
<!-- Marker file indicating CDI 1.0 should be enabled -->

<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>
11 changes: 11 additions & 0 deletions helloworld-singleton/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding='UTF-8'?>
<!-- Marker file indicating JSF 2.0 should be enabled in the application -->

<faces-config version="2.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">

</faces-config>

0 comments on commit a3b6e1a

Please sign in to comment.