http://git-wip-us.apache.org/repos/asf/tomee-tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/moviefun.adoc ---------------------------------------------------------------------- diff --git a/src/main/jbake/content/examples/moviefun.adoc b/src/main/jbake/content/examples/moviefun.adoc new file mode 100755 index 0000000..bd2ccd9 --- /dev/null +++ b/src/main/jbake/content/examples/moviefun.adoc @@ -0,0 +1,385 @@ += Movies Complete +:jbake-date: 2016-09-06 +:jbake-type: page +:jbake-tomeepdf: +:jbake-status: published + +Example moviefun can be browsed at https://github.com/apache/tomee/tree/master/examples/moviefun + + +*Help us document this example! Click the blue pencil icon in the upper right to edit this page.* + +== AddInterceptor + + +[source,java] +---- +package org.superbiz.injection.tx; + +import javax.interceptor.AroundInvoke; +import javax.interceptor.InvocationContext; + +/** + * @version $Revision$ $Date$ + */ +public class AddInterceptor { + + @AroundInvoke + public Object invoke(InvocationContext context) throws Exception { + // Log Add + return context.proceed(); + } +} +---- + + +== DeleteInterceptor + + +[source,java] +---- +package org.superbiz.injection.tx; + +import javax.interceptor.AroundInvoke; +import javax.interceptor.InvocationContext; + +/** + * @version $Revision$ $Date$ + */ +public class DeleteInterceptor { + + @AroundInvoke + public Object invoke(InvocationContext context) throws Exception { + // Log Delete + return context.proceed(); + } +} +---- + + +== Movie + + +[source,java] +---- +package org.superbiz.injection.tx; + +import javax.persistence.Entity; + +@Entity +public class Movie { + + private String director; + private String title; + private int year; + + public Movie() { + } + + public Movie(String director, String title, int year) { + this.director = director; + this.title = title; + this.year = year; + } + + public String getDirector() { + return director; + } + + public void setDirector(String director) { + this.director = director; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public int getYear() { + return year; + } + + public void setYear(int year) { + this.year = year; + } + +} +---- + + +== Movies + + +[source,java] +---- +package org.superbiz.injection.tx; + +import javax.annotation.security.PermitAll; +import javax.annotation.security.RolesAllowed; +import javax.ejb.Stateful; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.interceptor.Interceptors; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.PersistenceContextType; +import javax.persistence.Query; +import java.util.List; + +//START SNIPPET: code +@Stateful +public class Movies { + + @PersistenceContext(unitName = "movie-unit", type = PersistenceContextType.TRANSACTION) + private EntityManager entityManager; + + @RolesAllowed({"Employee", "Manager"}) + @TransactionAttribute(TransactionAttributeType.REQUIRED) + @Interceptors(AddInterceptor.class) + public void addMovie(Movie movie) throws Exception { + entityManager.persist(movie); + } + + @RolesAllowed({"Manager"}) + @TransactionAttribute(TransactionAttributeType.MANDATORY) + @Interceptors(DeleteInterceptor.class) + public void deleteMovie(Movie movie) throws Exception { + entityManager.remove(movie); + } + + @PermitAll + @TransactionAttribute(TransactionAttributeType.SUPPORTS) + public List<Movie> getMovies() throws Exception { + Query query = entityManager.createQuery("SELECT m from Movie as m"); + return query.getResultList(); + } +} +---- + + +== ReadInterceptor + + +[source,java] +---- +package org.superbiz.injection.tx; + +import javax.interceptor.AroundInvoke; +import javax.interceptor.InvocationContext; + +/** + * @version $Revision$ $Date$ + */ +public class ReadInterceptor { + + @AroundInvoke + public Object invoke(InvocationContext context) throws Exception { + // Log Delete + return context.proceed(); + } +} +---- + + +== persistence.xml + + +[source,xml] +---- +<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> + + <persistence-unit name="movie-unit"> + <jta-data-source>movieDatabase</jta-data-source> + <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source> + <class>org.superbiz.injection.tx.Movie</class> + + <properties> + <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/> + </properties> + </persistence-unit> +</persistence> +---- + + +== MoviesTest + + +[source,java] +---- +package org.superbiz.injection.tx; + +import junit.framework.TestCase; + +import javax.annotation.security.RunAs; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.ejb.embeddable.EJBContainer; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.Callable; + +import static javax.ejb.TransactionAttributeType.REQUIRES_NEW; + +/** + * See the transaction-rollback example as it does the same thing + * via UserTransaction and shows more techniques for rollback + */ +//START SNIPPET: code +public class MoviesTest extends TestCase { + + @EJB + private Movies movies; + + @EJB(beanName = "TransactionBean") + private Caller transactionalCaller; + + @EJB(beanName = "NoTransactionBean") + private Caller nonTransactionalCaller; + + protected void setUp() throws Exception { + final Properties p = new Properties(); + p.put("movieDatabase", "new://Resource?type=DataSource"); + p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver"); + p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb"); + + EJBContainer.createEJBContainer(p).getContext().bind("inject", this); + } + + private void doWork() throws Exception { + + movies.addMovie(new Movie("Quentin Tarantino", "Reservoir Dogs", 1992)); + movies.addMovie(new Movie("Joel Coen", "Fargo", 1996)); + movies.addMovie(new Movie("Joel Coen", "The Big Lebowski", 1998)); + + List<Movie> list = movies.getMovies(); + assertEquals("List.size()", 3, list.size()); + + for (Movie movie : list) { + movies.deleteMovie(movie); + } + + assertEquals("Movies.getMovies()", 0, movies.getMovies().size()); + } + + public void testWithTransaction() throws Exception { + transactionalCaller.call(new Callable() { + public Object call() throws Exception { + doWork(); + return null; + } + }); + } + + public void testWithoutTransaction() throws Exception { + try { + nonTransactionalCaller.call(new Callable() { + public Object call() throws Exception { + doWork(); + return null; + } + }); + fail("The Movies bean should be using TransactionAttributeType.MANDATORY"); + } catch (javax.ejb.EJBException e) { + // good, our Movies bean is using TransactionAttributeType.MANDATORY as we want + } + } + + + public static interface Caller { + public <V> V call(Callable<V> callable) throws Exception; + } + + /** + * This little bit of magic allows our test code to execute in + * the scope of a container controlled transaction. + */ + @Stateless + @RunAs("Manager") + @TransactionAttribute(REQUIRES_NEW) + public static class TransactionBean implements Caller { + + public <V> V call(Callable<V> callable) throws Exception { + return callable.call(); + } + } + + @Stateless + @RunAs("Manager") + @TransactionAttribute(TransactionAttributeType.NEVER) + public static class NoTransactionBean implements Caller { + + public <V> V call(Callable<V> callable) throws Exception { + return callable.call(); + } + } +} +---- + + += Running + + + +[source] +---- +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running org.superbiz.injection.tx.MoviesTest +Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06 +http://tomee.apache.org/ +INFO - openejb.home = /Users/dblevins/examples/movies-complete +INFO - openejb.base = /Users/dblevins/examples/movies-complete +INFO - Using 'javax.ejb.embeddable.EJBContainer=true' +INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service) +INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager) +INFO - Configuring Service(id=movieDatabase, type=Resource, provider-id=Default JDBC Database) +INFO - Found EjbModule in classpath: /Users/dblevins/examples/movies-complete/target/classes +INFO - Found EjbModule in classpath: /Users/dblevins/examples/movies-complete/target/test-classes +INFO - Beginning load: /Users/dblevins/examples/movies-complete/target/classes +INFO - Beginning load: /Users/dblevins/examples/movies-complete/target/test-classes +INFO - Configuring enterprise application: /Users/dblevins/examples/movies-complete +INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container) +INFO - Auto-creating a container for bean Movies: Container(type=STATEFUL, id=Default Stateful Container) +INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container) +INFO - Auto-creating a container for bean TransactionBean: Container(type=STATELESS, id=Default Stateless Container) +INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container) +INFO - Auto-creating a container for bean org.superbiz.injection.tx.MoviesTest: Container(type=MANAGED, id=Default Managed Container) +INFO - Configuring PersistenceUnit(name=movie-unit) +INFO - Auto-creating a Resource with id 'movieDatabaseNonJta' of type 'DataSource for 'movie-unit'. +INFO - Configuring Service(id=movieDatabaseNonJta, type=Resource, provider-id=movieDatabase) +INFO - Adjusting PersistenceUnit movie-unit <non-jta-data-source> to Resource ID 'movieDatabaseNonJta' from 'movieDatabaseUnmanaged' +INFO - Enterprise application "/Users/dblevins/examples/movies-complete" loaded. +INFO - Assembling app: /Users/dblevins/examples/movies-complete +INFO - PersistenceUnit(name=movie-unit, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 402ms +INFO - Jndi(name="java:global/movies-complete/Movies!org.superbiz.injection.tx.Movies") +INFO - Jndi(name="java:global/movies-complete/Movies") +INFO - Jndi(name="java:global/movies-complete/TransactionBean!org.superbiz.injection.tx.MoviesTest$Caller") +INFO - Jndi(name="java:global/movies-complete/TransactionBean") +INFO - Jndi(name="java:global/movies-complete/NoTransactionBean!org.superbiz.injection.tx.MoviesTest$Caller") +INFO - Jndi(name="java:global/movies-complete/NoTransactionBean") +INFO - Jndi(name="java:global/EjbModule1013462002/org.superbiz.injection.tx.MoviesTest!org.superbiz.injection.tx.MoviesTest") +INFO - Jndi(name="java:global/EjbModule1013462002/org.superbiz.injection.tx.MoviesTest") +INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container) +INFO - Created Ejb(deployment-id=NoTransactionBean, ejb-name=NoTransactionBean, container=Default Stateless Container) +INFO - Created Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, container=Default Stateless Container) +INFO - Created Ejb(deployment-id=org.superbiz.injection.tx.MoviesTest, ejb-name=org.superbiz.injection.tx.MoviesTest, container=Default Managed Container) +INFO - Started Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container) +INFO - Started Ejb(deployment-id=NoTransactionBean, ejb-name=NoTransactionBean, container=Default Stateless Container) +INFO - Started Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, container=Default Stateless Container) +INFO - Started Ejb(deployment-id=org.superbiz.injection.tx.MoviesTest, ejb-name=org.superbiz.injection.tx.MoviesTest, container=Default Managed Container) +INFO - Deployed Application(path=/Users/dblevins/examples/movies-complete) +INFO - EJBContainer already initialized. Call ejbContainer.close() to allow reinitialization +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.418 sec + +Results : + +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 +---- + +
http://git-wip-us.apache.org/repos/asf/tomee-tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/movies-complete-meta.adoc ---------------------------------------------------------------------- diff --git a/src/main/jbake/content/examples/movies-complete-meta.adoc b/src/main/jbake/content/examples/movies-complete-meta.adoc new file mode 100755 index 0000000..a4b50a6 --- /dev/null +++ b/src/main/jbake/content/examples/movies-complete-meta.adoc @@ -0,0 +1,502 @@ += Movies Complete Meta +:jbake-date: 2016-09-06 +:jbake-type: page +:jbake-tomeepdf: +:jbake-status: published + +Example movies-complete-meta can be browsed at https://github.com/apache/tomee/tree/master/examples/movies-complete-meta + + +*Help us document this example! Click the blue pencil icon in the upper right to edit this page.* + +== AddInterceptor + + +[source,java] +---- +package org.superbiz.injection.tx; + +import javax.interceptor.AroundInvoke; +import javax.interceptor.InvocationContext; + +/** + * @version $Revision$ $Date$ + */ +public class AddInterceptor { + + @AroundInvoke + public Object invoke(InvocationContext context) throws Exception { + // Log Add + return context.proceed(); + } +} +---- + + +== Add + + +[source,java] +---- +package org.superbiz.injection.tx.api; + +import org.superbiz.injection.tx.AddInterceptor; + +import javax.annotation.security.RolesAllowed; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.interceptor.Interceptors; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Metatype +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) + +public @interface Add { + public interface $ { + + @Add + @RolesAllowed({"Employee", "Manager"}) + @TransactionAttribute(TransactionAttributeType.REQUIRED) + @Interceptors(AddInterceptor.class) + public void method(); + } +} +---- + + +== Delete + + +[source,java] +---- +package org.superbiz.injection.tx.api; + +import org.superbiz.injection.tx.DeleteInterceptor; + +import javax.annotation.security.RolesAllowed; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.interceptor.Interceptors; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Metatype +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) + +public @interface Delete { + public interface $ { + + @Delete + @RolesAllowed({"Manager"}) + @TransactionAttribute(TransactionAttributeType.MANDATORY) + @Interceptors(DeleteInterceptor.class) + public void method(); + } +} +---- + + +== Metatype + + +[source,java] +---- +package org.superbiz.injection.tx.api; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Metatype +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.ANNOTATION_TYPE) +public @interface Metatype { +} +---- + + +== MovieUnit + + +[source,java] +---- +package org.superbiz.injection.tx.api; + +import javax.persistence.PersistenceContext; +import javax.persistence.PersistenceContextType; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + + +@Metatype +@Target({ElementType.METHOD, ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) + +@PersistenceContext(name = "movie-unit", unitName = "movie-unit", type = PersistenceContextType.EXTENDED) +public @interface MovieUnit { +} +---- + + +== Read + + +[source,java] +---- +package org.superbiz.injection.tx.api; + +import javax.annotation.security.PermitAll; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Metatype +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) + +public @interface Read { + public interface $ { + + @Read + @PermitAll + @TransactionAttribute(TransactionAttributeType.SUPPORTS) + public void method(); + } +} +---- + + +== DeleteInterceptor + + +[source,java] +---- +package org.superbiz.injection.tx; + +import javax.interceptor.AroundInvoke; +import javax.interceptor.InvocationContext; + +/** + * @version $Revision$ $Date$ + */ +public class DeleteInterceptor { + + @AroundInvoke + public Object invoke(InvocationContext context) throws Exception { + // Log Delete + return context.proceed(); + } +} +---- + + +== Movie + + +[source,java] +---- +package org.superbiz.injection.tx; + +import javax.persistence.Entity; + +@Entity +public class Movie { + + private String director; + private String title; + private int year; + + public Movie() { + } + + public Movie(String director, String title, int year) { + this.director = director; + this.title = title; + this.year = year; + } + + public String getDirector() { + return director; + } + + public void setDirector(String director) { + this.director = director; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public int getYear() { + return year; + } + + public void setYear(int year) { + this.year = year; + } + +} +---- + + +== Movies + + +[source,java] +---- +package org.superbiz.injection.tx; + +import org.superbiz.injection.tx.api.Add; +import org.superbiz.injection.tx.api.Delete; +import org.superbiz.injection.tx.api.MovieUnit; +import org.superbiz.injection.tx.api.Read; + +import javax.ejb.Stateful; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import java.util.List; + +//END SNIPPET: code + +//START SNIPPET: code +@Stateful +public class Movies { + + @MovieUnit + private EntityManager entityManager; + + @Add + public void addMovie(Movie movie) throws Exception { + entityManager.persist(movie); + } + + @Delete + public void deleteMovie(Movie movie) throws Exception { + entityManager.remove(movie); + } + + @Read + public List<Movie> getMovies() throws Exception { + Query query = entityManager.createQuery("SELECT m from Movie as m"); + return query.getResultList(); + } +} +---- + + +== persistence.xml + + +[source,xml] +---- +<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> + + <persistence-unit name="movie-unit"> + <jta-data-source>movieDatabase</jta-data-source> + <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source> + <class>org.superbiz.injection.tx.Movie</class> + + <properties> + <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/> + </properties> + </persistence-unit> +</persistence> +---- + + +== MoviesTest + + +[source,java] +---- +package org.superbiz.injection.tx; + +import junit.framework.TestCase; + +import javax.annotation.security.RunAs; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.ejb.embeddable.EJBContainer; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.Callable; + +import static javax.ejb.TransactionAttributeType.REQUIRES_NEW; + +/** + * See the transaction-rollback example as it does the same thing + * via UserTransaction and shows more techniques for rollback + */ +//START SNIPPET: code +public class MoviesTest extends TestCase { + + @EJB + private Movies movies; + + @EJB(beanName = "TransactionBean") + private Caller transactionalCaller; + + @EJB(beanName = "NoTransactionBean") + private Caller nonTransactionalCaller; + + protected void setUp() throws Exception { + final Properties p = new Properties(); + p.put("movieDatabase", "new://Resource?type=DataSource"); + p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver"); + p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb"); + + EJBContainer.createEJBContainer(p).getContext().bind("inject", this); + } + + private void doWork() throws Exception { + + movies.addMovie(new Movie("Quentin Tarantino", "Reservoir Dogs", 1992)); + movies.addMovie(new Movie("Joel Coen", "Fargo", 1996)); + movies.addMovie(new Movie("Joel Coen", "The Big Lebowski", 1998)); + + List<Movie> list = movies.getMovies(); + assertEquals("List.size()", 3, list.size()); + + for (Movie movie : list) { + movies.deleteMovie(movie); + } + + assertEquals("Movies.getMovies()", 0, movies.getMovies().size()); + } + + public void testWithTransaction() throws Exception { + transactionalCaller.call(new Callable() { + public Object call() throws Exception { + doWork(); + return null; + } + }); + } + + public void testWithoutTransaction() throws Exception { + try { + nonTransactionalCaller.call(new Callable() { + public Object call() throws Exception { + doWork(); + return null; + } + }); + fail("The Movies bean should be using TransactionAttributeType.MANDATORY"); + } catch (javax.ejb.EJBException e) { + // good, our Movies bean is using TransactionAttributeType.MANDATORY as we want + } + } + + + public static interface Caller { + public <V> V call(Callable<V> callable) throws Exception; + } + + /** + * This little bit of magic allows our test code to execute in + * the scope of a container controlled transaction. + */ + @Stateless + @RunAs("Manager") + @TransactionAttribute(REQUIRES_NEW) + public static class TransactionBean implements Caller { + + public <V> V call(Callable<V> callable) throws Exception { + return callable.call(); + } + } + + @Stateless + @RunAs("Manager") + @TransactionAttribute(TransactionAttributeType.NEVER) + public static class NoTransactionBean implements Caller { + + public <V> V call(Callable<V> callable) throws Exception { + return callable.call(); + } + } +} +---- + + += Running + + + +[source] +---- +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running org.superbiz.injection.tx.MoviesTest +Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06 +http://tomee.apache.org/ +INFO - openejb.home = /Users/dblevins/examples/movies-complete-meta +INFO - openejb.base = /Users/dblevins/examples/movies-complete-meta +INFO - Using 'javax.ejb.embeddable.EJBContainer=true' +INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service) +INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager) +INFO - Configuring Service(id=movieDatabase, type=Resource, provider-id=Default JDBC Database) +INFO - Found EjbModule in classpath: /Users/dblevins/examples/movies-complete-meta/target/test-classes +INFO - Found EjbModule in classpath: /Users/dblevins/examples/movies-complete-meta/target/classes +INFO - Beginning load: /Users/dblevins/examples/movies-complete-meta/target/test-classes +INFO - Beginning load: /Users/dblevins/examples/movies-complete-meta/target/classes +INFO - Configuring enterprise application: /Users/dblevins/examples/movies-complete-meta +INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container) +INFO - Auto-creating a container for bean TransactionBean: Container(type=STATELESS, id=Default Stateless Container) +INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container) +INFO - Auto-creating a container for bean Movies: Container(type=STATEFUL, id=Default Stateful Container) +INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container) +INFO - Auto-creating a container for bean org.superbiz.injection.tx.MoviesTest: Container(type=MANAGED, id=Default Managed Container) +INFO - Configuring PersistenceUnit(name=movie-unit) +INFO - Auto-creating a Resource with id 'movieDatabaseNonJta' of type 'DataSource for 'movie-unit'. +INFO - Configuring Service(id=movieDatabaseNonJta, type=Resource, provider-id=movieDatabase) +INFO - Adjusting PersistenceUnit movie-unit <non-jta-data-source> to Resource ID 'movieDatabaseNonJta' from 'movieDatabaseUnmanaged' +INFO - Enterprise application "/Users/dblevins/examples/movies-complete-meta" loaded. +INFO - Assembling app: /Users/dblevins/examples/movies-complete-meta +INFO - PersistenceUnit(name=movie-unit, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 408ms +INFO - Jndi(name="java:global/movies-complete-meta/TransactionBean!org.superbiz.injection.tx.MoviesTest$Caller") +INFO - Jndi(name="java:global/movies-complete-meta/TransactionBean") +INFO - Jndi(name="java:global/movies-complete-meta/NoTransactionBean!org.superbiz.injection.tx.MoviesTest$Caller") +INFO - Jndi(name="java:global/movies-complete-meta/NoTransactionBean") +INFO - Jndi(name="java:global/movies-complete-meta/Movies!org.superbiz.injection.tx.Movies") +INFO - Jndi(name="java:global/movies-complete-meta/Movies") +INFO - Jndi(name="java:global/EjbModule1861413442/org.superbiz.injection.tx.MoviesTest!org.superbiz.injection.tx.MoviesTest") +INFO - Jndi(name="java:global/EjbModule1861413442/org.superbiz.injection.tx.MoviesTest") +INFO - Created Ejb(deployment-id=NoTransactionBean, ejb-name=NoTransactionBean, container=Default Stateless Container) +INFO - Created Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, container=Default Stateless Container) +INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container) +INFO - Created Ejb(deployment-id=org.superbiz.injection.tx.MoviesTest, ejb-name=org.superbiz.injection.tx.MoviesTest, container=Default Managed Container) +INFO - Started Ejb(deployment-id=NoTransactionBean, ejb-name=NoTransactionBean, container=Default Stateless Container) +INFO - Started Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, container=Default Stateless Container) +INFO - Started Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container) +INFO - Started Ejb(deployment-id=org.superbiz.injection.tx.MoviesTest, ejb-name=org.superbiz.injection.tx.MoviesTest, container=Default Managed Container) +INFO - Deployed Application(path=/Users/dblevins/examples/movies-complete-meta) +INFO - EJBContainer already initialized. Call ejbContainer.close() to allow reinitialization +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.869 sec + +Results : + +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 +---- + + http://git-wip-us.apache.org/repos/asf/tomee-tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/movies-complete.adoc ---------------------------------------------------------------------- diff --git a/src/main/jbake/content/examples/movies-complete.adoc b/src/main/jbake/content/examples/movies-complete.adoc new file mode 100755 index 0000000..42fed35 --- /dev/null +++ b/src/main/jbake/content/examples/movies-complete.adoc @@ -0,0 +1,385 @@ += Movies Complete +:jbake-date: 2016-09-06 +:jbake-type: page +:jbake-tomeepdf: +:jbake-status: published + +Example movies-complete can be browsed at https://github.com/apache/tomee/tree/master/examples/movies-complete + + +*Help us document this example! Click the blue pencil icon in the upper right to edit this page.* + +== AddInterceptor + + +[source,java] +---- +package org.superbiz.injection.tx; + +import javax.interceptor.AroundInvoke; +import javax.interceptor.InvocationContext; + +/** + * @version $Revision$ $Date$ + */ +public class AddInterceptor { + + @AroundInvoke + public Object invoke(InvocationContext context) throws Exception { + // Log Add + return context.proceed(); + } +} +---- + + +== DeleteInterceptor + + +[source,java] +---- +package org.superbiz.injection.tx; + +import javax.interceptor.AroundInvoke; +import javax.interceptor.InvocationContext; + +/** + * @version $Revision$ $Date$ + */ +public class DeleteInterceptor { + + @AroundInvoke + public Object invoke(InvocationContext context) throws Exception { + // Log Delete + return context.proceed(); + } +} +---- + + +== Movie + + +[source,java] +---- +package org.superbiz.injection.tx; + +import javax.persistence.Entity; + +@Entity +public class Movie { + + private String director; + private String title; + private int year; + + public Movie() { + } + + public Movie(String director, String title, int year) { + this.director = director; + this.title = title; + this.year = year; + } + + public String getDirector() { + return director; + } + + public void setDirector(String director) { + this.director = director; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public int getYear() { + return year; + } + + public void setYear(int year) { + this.year = year; + } + +} +---- + + +== Movies + + +[source,java] +---- +package org.superbiz.injection.tx; + +import javax.annotation.security.PermitAll; +import javax.annotation.security.RolesAllowed; +import javax.ejb.Stateful; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.interceptor.Interceptors; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.PersistenceContextType; +import javax.persistence.Query; +import java.util.List; + +//START SNIPPET: code +@Stateful +public class Movies { + + @PersistenceContext(unitName = "movie-unit", type = PersistenceContextType.TRANSACTION) + private EntityManager entityManager; + + @RolesAllowed({"Employee", "Manager"}) + @TransactionAttribute(TransactionAttributeType.REQUIRED) + @Interceptors(AddInterceptor.class) + public void addMovie(Movie movie) throws Exception { + entityManager.persist(movie); + } + + @RolesAllowed({"Manager"}) + @TransactionAttribute(TransactionAttributeType.MANDATORY) + @Interceptors(DeleteInterceptor.class) + public void deleteMovie(Movie movie) throws Exception { + entityManager.remove(movie); + } + + @PermitAll + @TransactionAttribute(TransactionAttributeType.SUPPORTS) + public List<Movie> getMovies() throws Exception { + Query query = entityManager.createQuery("SELECT m from Movie as m"); + return query.getResultList(); + } +} +---- + + +== ReadInterceptor + + +[source,java] +---- +package org.superbiz.injection.tx; + +import javax.interceptor.AroundInvoke; +import javax.interceptor.InvocationContext; + +/** + * @version $Revision$ $Date$ + */ +public class ReadInterceptor { + + @AroundInvoke + public Object invoke(InvocationContext context) throws Exception { + // Log Delete + return context.proceed(); + } +} +---- + + +== persistence.xml + + +[source,xml] +---- +<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> + + <persistence-unit name="movie-unit"> + <jta-data-source>movieDatabase</jta-data-source> + <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source> + <class>org.superbiz.injection.tx.Movie</class> + + <properties> + <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/> + </properties> + </persistence-unit> +</persistence> +---- + + +== MoviesTest + + +[source,java] +---- +package org.superbiz.injection.tx; + +import junit.framework.TestCase; + +import javax.annotation.security.RunAs; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.ejb.embeddable.EJBContainer; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.Callable; + +import static javax.ejb.TransactionAttributeType.REQUIRES_NEW; + +/** + * See the transaction-rollback example as it does the same thing + * via UserTransaction and shows more techniques for rollback + */ +//START SNIPPET: code +public class MoviesTest extends TestCase { + + @EJB + private Movies movies; + + @EJB(beanName = "TransactionBean") + private Caller transactionalCaller; + + @EJB(beanName = "NoTransactionBean") + private Caller nonTransactionalCaller; + + protected void setUp() throws Exception { + final Properties p = new Properties(); + p.put("movieDatabase", "new://Resource?type=DataSource"); + p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver"); + p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb"); + + EJBContainer.createEJBContainer(p).getContext().bind("inject", this); + } + + private void doWork() throws Exception { + + movies.addMovie(new Movie("Quentin Tarantino", "Reservoir Dogs", 1992)); + movies.addMovie(new Movie("Joel Coen", "Fargo", 1996)); + movies.addMovie(new Movie("Joel Coen", "The Big Lebowski", 1998)); + + List<Movie> list = movies.getMovies(); + assertEquals("List.size()", 3, list.size()); + + for (Movie movie : list) { + movies.deleteMovie(movie); + } + + assertEquals("Movies.getMovies()", 0, movies.getMovies().size()); + } + + public void testWithTransaction() throws Exception { + transactionalCaller.call(new Callable() { + public Object call() throws Exception { + doWork(); + return null; + } + }); + } + + public void testWithoutTransaction() throws Exception { + try { + nonTransactionalCaller.call(new Callable() { + public Object call() throws Exception { + doWork(); + return null; + } + }); + fail("The Movies bean should be using TransactionAttributeType.MANDATORY"); + } catch (javax.ejb.EJBException e) { + // good, our Movies bean is using TransactionAttributeType.MANDATORY as we want + } + } + + + public static interface Caller { + public <V> V call(Callable<V> callable) throws Exception; + } + + /** + * This little bit of magic allows our test code to execute in + * the scope of a container controlled transaction. + */ + @Stateless + @RunAs("Manager") + @TransactionAttribute(REQUIRES_NEW) + public static class TransactionBean implements Caller { + + public <V> V call(Callable<V> callable) throws Exception { + return callable.call(); + } + } + + @Stateless + @RunAs("Manager") + @TransactionAttribute(TransactionAttributeType.NEVER) + public static class NoTransactionBean implements Caller { + + public <V> V call(Callable<V> callable) throws Exception { + return callable.call(); + } + } +} +---- + + += Running + + + +[source] +---- +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running org.superbiz.injection.tx.MoviesTest +Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06 +http://tomee.apache.org/ +INFO - openejb.home = /Users/dblevins/examples/movies-complete +INFO - openejb.base = /Users/dblevins/examples/movies-complete +INFO - Using 'javax.ejb.embeddable.EJBContainer=true' +INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service) +INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager) +INFO - Configuring Service(id=movieDatabase, type=Resource, provider-id=Default JDBC Database) +INFO - Found EjbModule in classpath: /Users/dblevins/examples/movies-complete/target/classes +INFO - Found EjbModule in classpath: /Users/dblevins/examples/movies-complete/target/test-classes +INFO - Beginning load: /Users/dblevins/examples/movies-complete/target/classes +INFO - Beginning load: /Users/dblevins/examples/movies-complete/target/test-classes +INFO - Configuring enterprise application: /Users/dblevins/examples/movies-complete +INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container) +INFO - Auto-creating a container for bean Movies: Container(type=STATEFUL, id=Default Stateful Container) +INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container) +INFO - Auto-creating a container for bean TransactionBean: Container(type=STATELESS, id=Default Stateless Container) +INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container) +INFO - Auto-creating a container for bean org.superbiz.injection.tx.MoviesTest: Container(type=MANAGED, id=Default Managed Container) +INFO - Configuring PersistenceUnit(name=movie-unit) +INFO - Auto-creating a Resource with id 'movieDatabaseNonJta' of type 'DataSource for 'movie-unit'. +INFO - Configuring Service(id=movieDatabaseNonJta, type=Resource, provider-id=movieDatabase) +INFO - Adjusting PersistenceUnit movie-unit <non-jta-data-source> to Resource ID 'movieDatabaseNonJta' from 'movieDatabaseUnmanaged' +INFO - Enterprise application "/Users/dblevins/examples/movies-complete" loaded. +INFO - Assembling app: /Users/dblevins/examples/movies-complete +INFO - PersistenceUnit(name=movie-unit, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 402ms +INFO - Jndi(name="java:global/movies-complete/Movies!org.superbiz.injection.tx.Movies") +INFO - Jndi(name="java:global/movies-complete/Movies") +INFO - Jndi(name="java:global/movies-complete/TransactionBean!org.superbiz.injection.tx.MoviesTest$Caller") +INFO - Jndi(name="java:global/movies-complete/TransactionBean") +INFO - Jndi(name="java:global/movies-complete/NoTransactionBean!org.superbiz.injection.tx.MoviesTest$Caller") +INFO - Jndi(name="java:global/movies-complete/NoTransactionBean") +INFO - Jndi(name="java:global/EjbModule1013462002/org.superbiz.injection.tx.MoviesTest!org.superbiz.injection.tx.MoviesTest") +INFO - Jndi(name="java:global/EjbModule1013462002/org.superbiz.injection.tx.MoviesTest") +INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container) +INFO - Created Ejb(deployment-id=NoTransactionBean, ejb-name=NoTransactionBean, container=Default Stateless Container) +INFO - Created Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, container=Default Stateless Container) +INFO - Created Ejb(deployment-id=org.superbiz.injection.tx.MoviesTest, ejb-name=org.superbiz.injection.tx.MoviesTest, container=Default Managed Container) +INFO - Started Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container) +INFO - Started Ejb(deployment-id=NoTransactionBean, ejb-name=NoTransactionBean, container=Default Stateless Container) +INFO - Started Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, container=Default Stateless Container) +INFO - Started Ejb(deployment-id=org.superbiz.injection.tx.MoviesTest, ejb-name=org.superbiz.injection.tx.MoviesTest, container=Default Managed Container) +INFO - Deployed Application(path=/Users/dblevins/examples/movies-complete) +INFO - EJBContainer already initialized. Call ejbContainer.close() to allow reinitialization +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.418 sec + +Results : + +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 +---- + + http://git-wip-us.apache.org/repos/asf/tomee-tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/mtom.adoc ---------------------------------------------------------------------- diff --git a/src/main/jbake/content/examples/mtom.adoc b/src/main/jbake/content/examples/mtom.adoc new file mode 100755 index 0000000..b1af48a --- /dev/null +++ b/src/main/jbake/content/examples/mtom.adoc @@ -0,0 +1,8 @@ += mtom +:jbake-date: 2016-09-06 +:jbake-type: page +:jbake-tomeepdf: +:jbake-status: published + +Example mtom can be browsed at https://github.com/apache/tomee/tree/master/examples/mtom + http://git-wip-us.apache.org/repos/asf/tomee-tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/multi-jpa-provider-testing.adoc ---------------------------------------------------------------------- diff --git a/src/main/jbake/content/examples/multi-jpa-provider-testing.adoc b/src/main/jbake/content/examples/multi-jpa-provider-testing.adoc new file mode 100755 index 0000000..5862411 --- /dev/null +++ b/src/main/jbake/content/examples/multi-jpa-provider-testing.adoc @@ -0,0 +1,9 @@ += multi-jpa-provider-testing +:jbake-date: 2016-09-06 +:jbake-type: page +:jbake-tomeepdf: +:jbake-status: published + +Example multi-jpa-provider-testing can be browsed at https://github.com/apache/tomee/tree/master/examples/multi-jpa-provider-testing + +No README.md yet, be the first to contribute one! http://git-wip-us.apache.org/repos/asf/tomee-tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/multiple-arquillian-adapters.adoc ---------------------------------------------------------------------- diff --git a/src/main/jbake/content/examples/multiple-arquillian-adapters.adoc b/src/main/jbake/content/examples/multiple-arquillian-adapters.adoc new file mode 100755 index 0000000..e4f80a3 --- /dev/null +++ b/src/main/jbake/content/examples/multiple-arquillian-adapters.adoc @@ -0,0 +1,9 @@ += multiple-arquillian-adapters +:jbake-date: 2016-09-06 +:jbake-type: page +:jbake-tomeepdf: +:jbake-status: published + +Example multiple-arquillian-adapters can be browsed at https://github.com/apache/tomee/tree/master/examples/multiple-arquillian-adapters + +No README.md yet, be the first to contribute one! http://git-wip-us.apache.org/repos/asf/tomee-tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/multiple-tomee-arquillian.adoc ---------------------------------------------------------------------- diff --git a/src/main/jbake/content/examples/multiple-tomee-arquillian.adoc b/src/main/jbake/content/examples/multiple-tomee-arquillian.adoc new file mode 100755 index 0000000..940285d --- /dev/null +++ b/src/main/jbake/content/examples/multiple-tomee-arquillian.adoc @@ -0,0 +1,9 @@ += multiple-tomee-arquillian +:jbake-date: 2016-09-06 +:jbake-type: page +:jbake-tomeepdf: +:jbake-status: published + +Example multiple-tomee-arquillian can be browsed at https://github.com/apache/tomee/tree/master/examples/multiple-tomee-arquillian + +No README.md yet, be the first to contribute one! http://git-wip-us.apache.org/repos/asf/tomee-tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/myfaces-codi-demo.adoc ---------------------------------------------------------------------- diff --git a/src/main/jbake/content/examples/myfaces-codi-demo.adoc b/src/main/jbake/content/examples/myfaces-codi-demo.adoc new file mode 100755 index 0000000..6e2dc20 --- /dev/null +++ b/src/main/jbake/content/examples/myfaces-codi-demo.adoc @@ -0,0 +1,76 @@ += MyFaces CODI Demo +:jbake-date: 2016-09-06 +:jbake-type: page +:jbake-tomeepdf: +:jbake-status: published + +Example myfaces-codi-demo can be browsed at https://github.com/apache/tomee/tree/master/examples/myfaces-codi-demo + +Notice: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +<h2>Steps to run the example</h2> + +Build and start the demo: + + mvn clean package tomee:run + +Open: + + http://localhost:8080/myfaces-codi-1.0-SNAPSHOT/ + +This example shows how to improve JSF2/CDI/BV/JPA applications with features provided by Apache MyFaces CODI and ExtVal. + +<h2>Intro of MyFaces CODI and ExtVal</h2> + +The Apache MyFaces Extensions CDI project (aka CODI) hosts portable extensions for Contexts and Dependency Injection (CDI - JSR 299). CODI is a toolbox for your CDI application. Like CDI itself CODI is focused on type-safety. It is a modularized and extensible framework. So it's easy to choose the needed parts to facilitate the daily work in your project. + +MyFaces Extensions Validator (aka ExtVal) is a JSF centric validation framework which is compatible with JSF 1.x and JSF 2.x. +This example shows how it improves the default integration of Bean-Validation (JSR-303) with JSF2 as well as meta-data based cross-field validation. + + +<h2>Illustrated Features</h2> + +<h3>Apache MyFaces CODI</h3> + +<ul> + +[source,xml] +---- +<li><a href="./src/main/java/org/superbiz/myfaces/view/config/Pages.java" target="_blank">Type-safe view-config</a></li> +<li><a href="./src/main/java/org/superbiz/myfaces/view/InfoPage.java" target="_blank">Type-safe (custom) view-meta-data</a></li> +<li><a href="./src/main/java/org/superbiz/myfaces/view/MenuBean.java" target="_blank">Type-safe navigation</a></li> +<li><a href="./src/main/java/org/superbiz/myfaces/CustomJsfModuleConfig.java" target="_blank">Type-safe (specialized) config</a></li> +<li><a href="./src/main/java/org/superbiz/myfaces/CustomProjectStage.java" target="_blank">Type-safe custom project-stage</a></li> +<li><a href="./src/main/java/org/superbiz/myfaces/view/UserHolder.java" target="_blank">@WindowScoped</a></li> +<li><a href="./src/main/java/org/superbiz/myfaces/view/MenuBean.java" target="_blank">Controlling CODI scopes with WindowContext</a></li> +<li><a href="./src/main/java/org/superbiz/myfaces/view/FeedbackPage.java" target="_blank">@ViewAccessScoped</a></li> +<li><a href="./src/main/java/org/superbiz/myfaces/view/FeedbackPage.java" target="_blank">Manual conversation handling</a></li> +<li><a href="./src/main/java/org/superbiz/myfaces/view/security/LoginAccessDecisionVoter.java" target="_blank">Secured pages (AccessDecisionVoter)</a></li> +<li><a href="./src/main/java/org/superbiz/myfaces/repository/Repository.java" target="_blank">@Transactional</a></li> +<li><a href="./src/main/java/org/superbiz/myfaces/view/RegistrationPage.java" target="_blank">I18n (fluent API)</a></li> +<li><a href="./src/main/java/org/superbiz/myfaces/domain/validation/UniqueUserNameValidator.java" target="_blank">Dependency-Injection for JSR303 (BV) constraint-validators</a></li> +<li><a href="./src/main/java/org/superbiz/myfaces/DebugPhaseListener.java" target="_blank">Dependency-Injection for JSF phase-listeners</a></li> +</ul> + +<h3>Apache MyFaces ExtVal</h3> + +<ul> +<li><a href="./src/main/java/org/superbiz/myfaces/view/RegistrationPage.java" target="_blank">Cross-Field validation (@Equals)</a></li> +<li><a href="./src/main/java/org/superbiz/myfaces/view/RegistrationPage.java" target="_blank">Type-safe group-validation (@BeanValidation) for JSF action-methods</a></li> +</ul> + http://git-wip-us.apache.org/repos/asf/tomee-tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/persistence-fragment.adoc ---------------------------------------------------------------------- diff --git a/src/main/jbake/content/examples/persistence-fragment.adoc b/src/main/jbake/content/examples/persistence-fragment.adoc new file mode 100755 index 0000000..e200f41 --- /dev/null +++ b/src/main/jbake/content/examples/persistence-fragment.adoc @@ -0,0 +1,149 @@ += Persistence Fragment +:jbake-date: 2016-09-06 +:jbake-type: page +:jbake-tomeepdf: +:jbake-status: published + +Example persistence-fragment can be browsed at https://github.com/apache/tomee/tree/master/examples/persistence-fragment + + +*Help us document this example! Click the blue pencil icon in the upper right to edit this page.* + +== Movie + + +[source,java] +---- +package org.superbiz.injection.jpa; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; + +@Entity +public class Movie { + @Id + @GeneratedValue + private long id; + private String director; + private String title; + private int year; + + public Movie() { + // no-op + } + + public Movie(String director, String title, int year) { + this.director = director; + this.title = title; + this.year = year; + } + + public long getId() { + return id; + } + + public String getDirector() { + return director; + } + + public void setDirector(String director) { + this.director = director; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public int getYear() { + return year; + } + + public void setYear(int year) { + this.year = year; + } +} +---- + + +== persistence-fragment.xml + + +[source,xml] +---- +<persistence-fragment version="2.0"> + <persistence-unit-fragment name="movie-unit"> + <class>org.superbiz.injection.jpa.Movie</class> + <exclude-unlisted-classes>true</exclude-unlisted-classes> + </persistence-unit-fragment> +</persistence-fragment> +---- + + + +== MoviesTest + + +[source,java] +---- +package org.superbiz.injection.jpa; + +import org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory; +import org.junit.Test; + +import javax.ejb.embeddable.EJBContainer; +import javax.naming.Context; +import javax.persistence.EntityManagerFactory; +import javax.persistence.PersistenceUnit; +import java.util.Properties; + +import static org.junit.Assert.assertTrue; + +public class MoviesTest { + @PersistenceUnit + private EntityManagerFactory emf; + + @Test + public void test() throws Exception { + final Properties p = new Properties(); + p.put("movieDatabase", "new://Resource?type=DataSource"); + p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver"); + p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb"); + + final EJBContainer container = EJBContainer.createEJBContainer(p); + final Context context = container.getContext(); + context.bind("inject", this); + + assertTrue(((ReloadableEntityManagerFactory) emf).getManagedClasses().contains(Movie.class.getName())); + + container.close(); + } +} +---- + + +== persistence.xml + + +[source,xml] +---- +<persistence version="2.0" + xmlns="http://java.sun.com/xml/ns/persistence" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence + http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> + <persistence-unit name="movie-unit"> + <jta-data-source>movieDatabase</jta-data-source> + <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source> + <properties> + <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/> + </properties> + </persistence-unit> +</persistence> +---- + + http://git-wip-us.apache.org/repos/asf/tomee-tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/pojo-webservice.adoc ---------------------------------------------------------------------- diff --git a/src/main/jbake/content/examples/pojo-webservice.adoc b/src/main/jbake/content/examples/pojo-webservice.adoc new file mode 100755 index 0000000..019f2f6 --- /dev/null +++ b/src/main/jbake/content/examples/pojo-webservice.adoc @@ -0,0 +1,9 @@ += pojo-webservice +:jbake-date: 2016-09-06 +:jbake-type: page +:jbake-tomeepdf: +:jbake-status: published + +Example pojo-webservice can be browsed at https://github.com/apache/tomee/tree/master/examples/pojo-webservice + +No README.md yet, be the first to contribute one! http://git-wip-us.apache.org/repos/asf/tomee-tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/polling-parent.adoc ---------------------------------------------------------------------- diff --git a/src/main/jbake/content/examples/polling-parent.adoc b/src/main/jbake/content/examples/polling-parent.adoc new file mode 100755 index 0000000..9ee24f5 --- /dev/null +++ b/src/main/jbake/content/examples/polling-parent.adoc @@ -0,0 +1,39 @@ += polling-parent +:jbake-date: 2016-09-06 +:jbake-type: page +:jbake-tomeepdf: +:jbake-status: published + +Example polling-parent can be browsed at https://github.com/apache/tomee/tree/master/examples/polling-parent + += Sample # + +This sample implements a simple polling application. + +You can create polls and then vote (+1 or -1) for each poll (called Subject). + +The front is a JAX-RS front and the backend uses EJBs and JPA. + += Module # + +The application contains several modules: + +* polling-domain: entities used by the client side too +* polling-core: the middle/dao layer +* polling-web: front layer (REST services) + += What is noticeable # + +The front layer contains a MBean managed by CDI (VoteCounter) which is used by REST services to update information you +can retrieve through JMX protocol (JConsole client is fine to see it ;)). + +It manages a dynamic datasource too. It manages in the example configuration 2 clients. + +It is a simple round robin by request. That's why from the client if you simply create a poll then find it +you'll not find the persisted poll, you need to do it once again. + += Client # + +It lets you create poll, retrieve them, find the best poll and vote for any poll. + +Please type help for more information. http://git-wip-us.apache.org/repos/asf/tomee-tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/projectstage-demo.adoc ---------------------------------------------------------------------- diff --git a/src/main/jbake/content/examples/projectstage-demo.adoc b/src/main/jbake/content/examples/projectstage-demo.adoc new file mode 100755 index 0000000..2b92b3f --- /dev/null +++ b/src/main/jbake/content/examples/projectstage-demo.adoc @@ -0,0 +1,9 @@ += projectstage-demo +:jbake-date: 2016-09-06 +:jbake-type: page +:jbake-tomeepdf: +:jbake-status: published + +Example projectstage-demo can be browsed at https://github.com/apache/tomee/tree/master/examples/projectstage-demo + +No README.md yet, be the first to contribute one! http://git-wip-us.apache.org/repos/asf/tomee-tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/quartz-app.adoc ---------------------------------------------------------------------- diff --git a/src/main/jbake/content/examples/quartz-app.adoc b/src/main/jbake/content/examples/quartz-app.adoc new file mode 100755 index 0000000..aa0faf5 --- /dev/null +++ b/src/main/jbake/content/examples/quartz-app.adoc @@ -0,0 +1,263 @@ += Quartz Resource Adapter usage +:jbake-date: 2016-09-06 +:jbake-type: page +:jbake-tomeepdf: +:jbake-status: published + +Example quartz-app can be browsed at https://github.com/apache/tomee/tree/master/examples/quartz-app + + +Note this example is somewhat dated. It predates the schedule API which was added to EJB 3.1. Modern applications should use the schedule API which has many, if not all, +the same features as Quartz. In fact, Quartz is the engine that drives the `@Schedule` and `ScheduleExpression` support in OpenEJB and TomEE. + +Despite being dated from a scheduling perspective it is still an excellent reference for how to plug-in and test a custom Java EE Resource Adapter. + += Project structure + +As `.rar` files do not do well on a standard classpath structure the goal is to effectively "unwrap" the `.rar` so that its dependencies are on the classpath and its `ra.xml` file +can be found in scanned by OpenEJB. + +We do this by creating a mini maven module to represent the rar in maven terms. The `pom.xml` of the "rar module" declares all of the jars that would be inside `.rar` as maven +dependencies. The `ra.xml` file is added to the project in `src/main/resources/META-INF/ra.xml` where it will be visible to other modules. + + quartz-app + quartz-app/pom.xml + quartz-app/quartz-beans + quartz-app/quartz-beans/pom.xml + quartz-app/quartz-beans/src/main/java/org/superbiz/quartz/JobBean.java + quartz-app/quartz-beans/src/main/java/org/superbiz/quartz/JobScheduler.java + quartz-app/quartz-beans/src/main/java/org/superbiz/quartz/QuartzMdb.java + quartz-app/quartz-beans/src/main/resources/META-INF + quartz-app/quartz-beans/src/main/resources/META-INF/ejb-jar.xml + quartz-app/quartz-beans/src/test/java/org/superbiz/quartz/QuartzMdbTest.java + quartz-app/quartz-ra + quartz-app/quartz-ra/pom.xml + quartz-app/quartz-ra/src/main/resources/META-INF + quartz-app/quartz-ra/src/main/resources/META-INF/ra.xml + +== ra.xml + +The connector in question has both inbound and outbound Resource Adapters. The inbound Resource Adapter can be used to drive message driven beans (MDBs) + +the outbound Resource Adapter, `QuartzResourceAdapter`, can be injected into any component via `@Resource` and used to originate and send messages or events. + + +[source,xml] +---- +<connector 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/connector_1_5.xsd" + version="1.5"> + + <description>Quartz ResourceAdapter</description> + <display-name>Quartz ResourceAdapter</display-name> + + <vendor-name>OpenEJB</vendor-name> + <eis-type>Quartz Adapter</eis-type> + <resourceadapter-version>1.0</resourceadapter-version> + + <resourceadapter id="QuartzResourceAdapter"> + <resourceadapter-class>org.apache.openejb.resource.quartz.QuartzResourceAdapter</resourceadapter-class> + + <inbound-resourceadapter> + <messageadapter> + <messagelistener> + <messagelistener-type>org.quartz.Job</messagelistener-type> + <activationspec> + <activationspec-class>org.apache.openejb.resource.quartz.JobSpec</activationspec-class> + </activationspec> + </messagelistener> + </messageadapter> + </inbound-resourceadapter> + + </resourceadapter> +</connector> +---- + + + += Using the Outbound Resource Adapter + +Here we see the outbound resource adapter used in a stateless session bean to schedule a job that will be executed by the MDB + + +[source,java] +---- +package org.superbiz.quartz; + +import org.apache.openejb.resource.quartz.QuartzResourceAdapter; +import org.quartz.Job; +import org.quartz.JobDetail; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.quartz.Scheduler; +import org.quartz.SimpleTrigger; + +import javax.ejb.Stateless; +import javax.naming.InitialContext; +import java.util.Date; + +@Stateless +public class JobBean implements JobScheduler { + + @Override + public Date createJob() throws Exception { + + final QuartzResourceAdapter ra = (QuartzResourceAdapter) new InitialContext().lookup("java:openejb/Resource/QuartzResourceAdapter"); + final Scheduler s = ra.getScheduler(); + + //Add a job type + final JobDetail jd = new JobDetail("job1", "group1", JobBean.MyTestJob.class); + jd.getJobDataMap().put("MyJobKey", "MyJobValue"); + + //Schedule my 'test' job to run now + final SimpleTrigger trigger = new SimpleTrigger("trigger1", "group1", new Date()); + return s.scheduleJob(jd, trigger); + } + + public static class MyTestJob implements Job { + + @Override + public void execute(JobExecutionContext context) throws JobExecutionException { + System.out.println("This is a simple test job to get: " + context.getJobDetail().getJobDataMap().get("MyJobKey")); + } + } +} +---- + + += Recieving data from the Inbound Resource Adapter + + + +[source,java] +---- +package org.superbiz.quartz; + +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +import javax.ejb.ActivationConfigProperty; +import javax.ejb.MessageDriven; + +@MessageDriven(activationConfig = { + @ActivationConfigProperty(propertyName = "cronExpression", propertyValue = "* * * * * ?")}) +public class QuartzMdb implements Job { + + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + System.out.println("Executing Job"); + } +} +---- + + += Test case + + +[source,java] +---- +package org.superbiz.quartz; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import javax.naming.Context; +import javax.naming.InitialContext; +import java.util.Date; +import java.util.Properties; + +public class QuartzMdbTest { + + private static InitialContext initialContext = null; + + @BeforeClass + public static void beforeClass() throws Exception { + + if (null == initialContext) { + Properties properties = new Properties(); + properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory"); + + initialContext = new InitialContext(properties); + } + } + + @AfterClass + public static void afterClass() throws Exception { + if (null != initialContext) { + initialContext.close(); + initialContext = null; + } + } + + @Test + public void testLookup() throws Exception { + + final JobScheduler jbi = (JobScheduler) initialContext.lookup("JobBeanLocal"); + final Date d = jbi.createJob(); + Thread.sleep(500); + System.out.println("Scheduled test job should have run at: " + d.toString()); + } + + @Test + public void testMdb() throws Exception { + // Sleep 3 seconds and give quartz a chance to execute our MDB + Thread.sleep(3000); + } +} +---- + + += Running + + +[source] +---- +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running org.superbiz.quartz.QuartzMdbTest +Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06 +http://tomee.apache.org/ +INFO - openejb.home = /Users/dblevins/examples/quartz-app/quartz-beans +INFO - openejb.base = /Users/dblevins/examples/quartz-app/quartz-beans +INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service) +INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager) +INFO - Found ConnectorModule in classpath: /Users/dblevins/examples/quartz-app/quartz-ra/target/quartz-ra-1.0.jar +INFO - Found EjbModule in classpath: /Users/dblevins/examples/quartz-app/quartz-beans/target/classes +INFO - Beginning load: /Users/dblevins/examples/quartz-app/quartz-ra/target/quartz-ra-1.0.jar +INFO - Extracting jar: /Users/dblevins/examples/quartz-app/quartz-ra/target/quartz-ra-1.0.jar +INFO - Extracted path: /Users/dblevins/examples/quartz-app/quartz-ra/target/quartz-ra-1.0 +INFO - Beginning load: /Users/dblevins/examples/quartz-app/quartz-beans/target/classes +INFO - Configuring enterprise application: /Users/dblevins/examples/quartz-app/quartz-beans/classpath.ear +INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container) +INFO - Auto-creating a container for bean JobBean: Container(type=STATELESS, id=Default Stateless Container) +INFO - Configuring Service(id=QuartzResourceAdapter, type=Resource, provider-id=QuartzResourceAdapter) +INFO - Configuring Service(id=quartz-ra-1.0, type=Container, provider-id=Default MDB Container) +INFO - Enterprise application "/Users/dblevins/examples/quartz-app/quartz-beans/classpath.ear" loaded. +INFO - Assembling app: /Users/dblevins/examples/quartz-app/quartz-beans/classpath.ear +INFO - Jndi(name=JobBeanLocal) --> Ejb(deployment-id=JobBean) +INFO - Jndi(name=global/classpath.ear/quartz-beans/JobBean!org.superbiz.quartz.JobScheduler) --> Ejb(deployment-id=JobBean) +INFO - Jndi(name=global/classpath.ear/quartz-beans/JobBean) --> Ejb(deployment-id=JobBean) +INFO - Created Ejb(deployment-id=JobBean, ejb-name=JobBean, container=Default Stateless Container) +INFO - Created Ejb(deployment-id=QuartzMdb, ejb-name=QuartzMdb, container=quartz-ra-1.0) +Executing Job +INFO - Started Ejb(deployment-id=JobBean, ejb-name=JobBean, container=Default Stateless Container) +INFO - Started Ejb(deployment-id=QuartzMdb, ejb-name=QuartzMdb, container=quartz-ra-1.0) +INFO - Deployed Application(path=/Users/dblevins/examples/quartz-app/quartz-beans/classpath.ear) +This is a simple test job to get: MyJobValue +Scheduled test job should have run at: Fri Oct 28 17:05:12 PDT 2011 +Executing Job +Executing Job +Executing Job +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.971 sec + +Results : + +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 +---- + + http://git-wip-us.apache.org/repos/asf/tomee-tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/realm-in-tomee.adoc ---------------------------------------------------------------------- diff --git a/src/main/jbake/content/examples/realm-in-tomee.adoc b/src/main/jbake/content/examples/realm-in-tomee.adoc new file mode 100755 index 0000000..3a69554 --- /dev/null +++ b/src/main/jbake/content/examples/realm-in-tomee.adoc @@ -0,0 +1,45 @@ += DataSourceRealm and TomEE DataSource +:jbake-date: 2016-09-06 +:jbake-type: page +:jbake-tomeepdf: +:jbake-status: published + +Example realm-in-tomee can be browsed at https://github.com/apache/tomee/tree/master/examples/realm-in-tomee + + +== Quick start + +To test it: + + mvn clean package tomee:run + +== How does it work? + +A datasource is defined in tomee.xml: + + +[source,xml] +---- +<Resource id="myDataSource" type="DataSource" /> <!-- standard properties --> + +Then this datasource is referenced in server.xml: + +<Realm + className="org.apache.catalina.realm.DataSourceRealm" + dataSourceName="myDataSource" + userTable="users" + userNameCol="user_name" + userCredCol="user_pass" + userRoleTable="user_roles" + roleNameCol="role_name"/> + +To initialize the datasource (for the test) we used the TomEE hook which consists in providing +a file import-<datasource name>.sql. It should be in the classpath of the datasource so here it is +the TomEE classpath so we added it to lib (by default in the classloader). It simply contains the +table creations and the insertion of the "admin" "tomee" with the password "tomee". + +## Test it + +Go to http://localhost:8080/realm-in-tomee-1.1.0-SNAPSHOT/, then connect using +the login/password tomee/tomee. You should see "Home". + http://git-wip-us.apache.org/repos/asf/tomee-tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/reload-persistence-unit-properties.adoc ---------------------------------------------------------------------- diff --git a/src/main/jbake/content/examples/reload-persistence-unit-properties.adoc b/src/main/jbake/content/examples/reload-persistence-unit-properties.adoc new file mode 100755 index 0000000..8ff7150 --- /dev/null +++ b/src/main/jbake/content/examples/reload-persistence-unit-properties.adoc @@ -0,0 +1,59 @@ += Reload Persistence Unit Properties +:jbake-date: 2016-09-06 +:jbake-type: page +:jbake-tomeepdf: +:jbake-status: published + +Example reload-persistence-unit-properties can be browsed at https://github.com/apache/tomee/tree/master/examples/reload-persistence-unit-properties + + +This example aims to simulate a benchmark campaign on JPA. + +First you'll run your application then you'll realize you could need L2 cache to respect your SLA. + +So you change your persistence.xml configuration, then restart your application, +you wait a bit because you are using OpenEJB ;)...but you wait... + +So to try to go faster on long campaign simply change your configuration at runtime to test it then when it works change +your configuration file to keep the modification. + +To do it we can simply use JMX. + +OpenEJB automatically register one MBeans by entitymanager (persistence unit). + +It allows you mainly to change your persistence unit properties even if more is possible. + +== The test itself + +The test is simple: we persist an entity, we query it three times without cache then we activate cache and realize +running again our queries that one is enough to do the same. + += The output + +In the ouput we find the 3 parts described just before. + + INFO - TEST, data initialization + DEBUG - <t 1523828380, conn 93608538> executing stmnt 1615782385 CREATE TABLE Person (id BIGINT NOT NULL, name VARCHAR(255), PRIMARY KEY (id)) + DEBUG - <t 1523828380, conn 93608538> [1 ms] spent + DEBUG - <t 1523828380, conn 1506565411> executing prepstmnt 668144844 INSERT INTO Person (id, name) VALUES (?, ?) [params=?, ?] + DEBUG - <t 1523828380, conn 1506565411> [0 ms] spent + INFO - TEST, end of data initialization + + + INFO - TEST, doing some queries without cache + DEBUG - <t 1523828380, conn 1506565411> executing prepstmnt 1093240870 SELECT t0.name FROM Person t0 WHERE t0.id = ? [params=?] + DEBUG - <t 1523828380, conn 1506565411> [0 ms] spent + DEBUG - <t 1523828380, conn 1506565411> executing prepstmnt 1983702821 SELECT t0.name FROM Person t0 WHERE t0.id = ? [params=?] + DEBUG - <t 1523828380, conn 1506565411> [0 ms] spent + DEBUG - <t 1523828380, conn 1506565411> executing prepstmnt 1178041898 SELECT t0.name FROM Person t0 WHERE t0.id = ? [params=?] + DEBUG - <t 1523828380, conn 1506565411> [1 ms] spent + INFO - TEST, queries without cache done + + + INFO - TEST, doing some queries with cache + DEBUG - <t 1523828380, conn 1506565411> executing prepstmnt 1532943889 SELECT t0.name FROM Person t0 WHERE t0.id = ? [params=?] + DEBUG - <t 1523828380, conn 1506565411> [0 ms] spent + INFO - TEST, queries with cache done + + + http://git-wip-us.apache.org/repos/asf/tomee-tomee-site-generator/blob/972cc356/src/main/jbake/content/examples/resources-declared-in-webapp.adoc ---------------------------------------------------------------------- diff --git a/src/main/jbake/content/examples/resources-declared-in-webapp.adoc b/src/main/jbake/content/examples/resources-declared-in-webapp.adoc new file mode 100755 index 0000000..d0c2f4f --- /dev/null +++ b/src/main/jbake/content/examples/resources-declared-in-webapp.adoc @@ -0,0 +1,157 @@ += Resources Declared in Webapp +:jbake-date: 2016-09-06 +:jbake-type: page +:jbake-tomeepdf: +:jbake-status: published + +Example resources-declared-in-webapp can be browsed at https://github.com/apache/tomee/tree/master/examples/resources-declared-in-webapp + + +*Help us document this example! Click the blue pencil icon in the upper right to edit this page.* + +== Manager + + +[source,java] +---- +package org.superbiz.bean; + +import org.superbiz.resource.ManagerResource; + +import javax.annotation.Resource; +import javax.ejb.Singleton; + +@Singleton +public class Manager { + @Resource(name = "My Manager Team", type = ManagerResource.class) + private ManagerResource resource; + + public String work() { + return "manage a resource of type " + resource.resourceType(); + } +} +---- + + +== ManagerResource + + +[source,java] +---- +package org.superbiz.resource; + +public class ManagerResource { + public String resourceType() { + return "team"; + } +} +---- + + +== ManagerServlet + + +[source,java] +---- +package org.superbiz.servlet; + +import org.superbiz.bean.Manager; + +import javax.ejb.EJB; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +@WebServlet(name = "manager servlet", urlPatterns = "/") +public class ManagerServlet extends HttpServlet { + @EJB + private Manager manager; + + protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + resp.getOutputStream().print(manager.work()); + } +} +---- + + +== ejb-jar.xml + + +[source,xml] +---- +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<ejb-jar/> +---- + + + +== service-jar.xml + + +[source,xml] +---- +<ServiceJar> + <ServiceProvider id="ManagerResource" service="Resource" + type="org.superbiz.resource.ManagerResource" + class-name="org.superbiz.resource.ManagerResource"/> +</ServiceJar> +---- + + + +== resources.xml + + +[source,xml] +---- +<resources> + <Resource id="My Manager Team" type="org.superbiz.resource.ManagerResource" provider="org.superbiz#ManagerResource"/> +</resources> +---- + + + +== web.xml + + +[source,xml] +---- +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<web-app version="3.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-app_3_0.xsd"/> + +