15 |
16 |
17 |
--------------------------------------------------------------------------------
/jpa/ordercolumn/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/jms/jms-xa/src/main/java/org/javaee7/jms/xa/User.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jms.xa;
2 |
3 | import javax.persistence.Entity;
4 | import javax.persistence.Id;
5 | import javax.persistence.Table;
6 |
7 | @Entity
8 | @Table(name = "T_USERS")
9 | public class User {
10 |
11 | @Id
12 | private String email;
13 |
14 | public User() {
15 | }
16 |
17 | public User(String email) {
18 | this.email = email;
19 | }
20 |
21 | public String getEmail() {
22 | return email;
23 | }
24 |
25 | public void setEmail(String email) {
26 | this.email = email;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/jpa/jndi-context/src/main/resources/META-INF/load.sql:
--------------------------------------------------------------------------------
1 | INSERT INTO EMPLOYEE_JNDI_CONTEXT("ID", "NAME") VALUES (1, 'Penny')
2 | INSERT INTO EMPLOYEE_JNDI_CONTEXT("ID", "NAME") VALUES (2, 'Sheldon')
3 | INSERT INTO EMPLOYEE_JNDI_CONTEXT("ID", "NAME") VALUES (3, 'Amy')
4 | INSERT INTO EMPLOYEE_JNDI_CONTEXT("ID", "NAME") VALUES (4, 'Leonard')
5 | INSERT INTO EMPLOYEE_JNDI_CONTEXT("ID", "NAME") VALUES (5, 'Bernadette')
6 | INSERT INTO EMPLOYEE_JNDI_CONTEXT("ID", "NAME") VALUES (6, 'Raj')
7 | INSERT INTO EMPLOYEE_JNDI_CONTEXT("ID", "NAME") VALUES (7, 'Howard')
8 | INSERT INTO EMPLOYEE_JNDI_CONTEXT("ID", "NAME") VALUES (8, 'Priya')
9 |
--------------------------------------------------------------------------------
/websocket/endpoint-async/src/main/java/org/javaee7/websocket/endpoint/async/MyAsyncEndpointByteBuffer.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.websocket.endpoint.async;
2 |
3 | import java.nio.ByteBuffer;
4 | import javax.websocket.OnMessage;
5 | import javax.websocket.Session;
6 | import javax.websocket.server.ServerEndpoint;
7 |
8 | /**
9 | * @author Jacek Jackowiak
10 | */
11 | @ServerEndpoint("/bytebuffer")
12 | public class MyAsyncEndpointByteBuffer {
13 |
14 | @OnMessage
15 | public void echoByteBuffer(ByteBuffer data, Session session) {
16 | session.getAsyncRemote().sendBinary(data);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/websocket/websocket-vs-rest-payload/src/main/java/org/javaee7/websocket/websocket/vs/rest/payload/MyRestEndpoint.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.websocket.websocket.vs.rest.payload;
2 |
3 | import javax.ws.rs.Consumes;
4 | import javax.ws.rs.POST;
5 | import javax.ws.rs.Path;
6 | import javax.ws.rs.Produces;
7 |
8 | /**
9 | * REST Web Service
10 | *
11 | * @author Arun Gupta
12 | */
13 | @Path("rest")
14 | public class MyRestEndpoint {
15 |
16 | @POST
17 | @Consumes("text/plain")
18 | @Produces("text/plain")
19 | public String getXml(String payload) {
20 | return payload;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/cdi/dynamic-interceptor/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 |
5 | org.javaee7
6 | cdi
7 | 1.0-SNAPSHOT
8 |
9 |
10 | dynamic-interceptor
11 | Java EE 7 sample: cdi - dynamic interceptor
12 |
13 |
--------------------------------------------------------------------------------
/cdi/events/src/main/java/org/javaee7/cdi/events/GreetingReceiver.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.cdi.events;
2 |
3 | import javax.enterprise.context.SessionScoped;
4 | import javax.enterprise.event.Observes;
5 | import java.io.Serializable;
6 |
7 | /**
8 | * @author Radim Hanus
9 | */
10 | @SessionScoped
11 | public class GreetingReceiver implements EventReceiver, Serializable {
12 | private String greet = "Willkommen";
13 |
14 | void receive(@Observes String greet) {
15 | this.greet = greet;
16 | }
17 |
18 | @Override
19 | public String getGreet() {
20 | return greet;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/cdi/vetoed/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 | 4.0.0
7 |
8 |
9 | org.javaee7
10 | cdi
11 | 1.0-SNAPSHOT
12 |
13 |
14 | cdi-vetoed
15 | Java EE 7 Sample: cdi - vetoed
16 |
17 |
18 |
--------------------------------------------------------------------------------
/jaspic/common/src/main/java/org/javaee7/jaspic/common/BaseServletContextListener.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jaspic.common;
2 |
3 | import javax.servlet.ServletContextEvent;
4 | import javax.servlet.ServletContextListener;
5 |
6 | /**
7 | *
8 | * @author Arjan Tijms
9 | *
10 | */
11 | public class BaseServletContextListener implements ServletContextListener {
12 |
13 | @Override
14 | public void contextInitialized(ServletContextEvent arg0) {
15 | // NOOP
16 | }
17 |
18 | @Override
19 | public void contextDestroyed(ServletContextEvent arg0) {
20 | // NOOP
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/jca/connector-simple/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 |
5 | jca
6 | org.javaee7
7 | 1.0-SNAPSHOT
8 |
9 |
10 | jca-connector-simple-connector
11 | Java EE 7 Sample: jca - Connector simple
12 |
13 |
14 |
--------------------------------------------------------------------------------
/jpa/unsynchronized-pc/src/main/resources/META-INF/load.sql:
--------------------------------------------------------------------------------
1 | INSERT INTO EMPLOYEE_SCHEMA_UNSYNCHRONIZED_PC("ID", "NAME") VALUES (1, 'Penny')
2 | INSERT INTO EMPLOYEE_SCHEMA_UNSYNCHRONIZED_PC("ID", "NAME") VALUES (2, 'Sheldon')
3 | INSERT INTO EMPLOYEE_SCHEMA_UNSYNCHRONIZED_PC("ID", "NAME") VALUES (3, 'Amy')
4 | INSERT INTO EMPLOYEE_SCHEMA_UNSYNCHRONIZED_PC("ID", "NAME") VALUES (4, 'Leonard')
5 | INSERT INTO EMPLOYEE_SCHEMA_UNSYNCHRONIZED_PC("ID", "NAME") VALUES (5, 'Bernadette')
6 | INSERT INTO EMPLOYEE_SCHEMA_UNSYNCHRONIZED_PC("ID", "NAME") VALUES (6, 'Raj')
7 | INSERT INTO EMPLOYEE_SCHEMA_UNSYNCHRONIZED_PC("ID", "NAME") VALUES (7, 'Howard')
--------------------------------------------------------------------------------
/jpa/jpa-converter/src/main/resources/META-INF/load.sql:
--------------------------------------------------------------------------------
1 | INSERT INTO EMPLOYEE_SCHEMA_CONVERTER("ID", "NAME", "CARD") VALUES (1, 'Leonard', '11-22-33-44')
2 | INSERT INTO EMPLOYEE_SCHEMA_CONVERTER("ID", "NAME", "CARD") VALUES (2, 'Sheldon', '22-33-44-55')
3 | INSERT INTO EMPLOYEE_SCHEMA_CONVERTER("ID", "NAME", "CARD") VALUES (3, 'Penny', '33-44-55-66')
4 | INSERT INTO EMPLOYEE_SCHEMA_CONVERTER("ID", "NAME", "CARD") VALUES (4, 'Raj', '44-55-66-77')
5 | INSERT INTO EMPLOYEE_SCHEMA_CONVERTER("ID", "NAME", "CARD") VALUES (5, 'Howard', '55-66-77-88')
6 | INSERT INTO EMPLOYEE_SCHEMA_CONVERTER("ID", "NAME", "CARD") VALUES (6, 'Bernadette', '66-77-88-99')
--------------------------------------------------------------------------------
/websocket/binary/pom.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 | 4.0.0
5 |
6 | org.javaee7.websocket
7 | websocket-samples
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 |
12 | binary
13 | war
14 |
15 |
--------------------------------------------------------------------------------
/cdi/decorators/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 |
5 | org.javaee7
6 | cdi
7 | 1.0-SNAPSHOT
8 |
9 |
10 | cdi-decorators
11 | war
12 | Java EE 7 Sample: cdi - decorators
13 |
14 |
--------------------------------------------------------------------------------
/jaxrs/jsonp/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 |
5 | org.javaee7
6 | jaxrs
7 | 1.0-SNAPSHOT
8 |
9 |
10 | jaxrs-jsonp
11 | war
12 | Java EE 7 Sample: jaxrs - jsonp
13 |
14 |
15 |
--------------------------------------------------------------------------------
/jpa/listeners-injection/src/main/java/org/javaee7/jpa/listeners/MovieBean.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jpa.listeners;
2 |
3 | import javax.ejb.Stateless;
4 | import javax.persistence.EntityManager;
5 | import javax.persistence.PersistenceContext;
6 |
7 | /**
8 | * @author Kuba Marchwicki
9 | */
10 | @Stateless
11 | public class MovieBean {
12 | @PersistenceContext
13 | private EntityManager em;
14 |
15 | public Movie getMovieByName(String name) {
16 | return em.createNamedQuery(Movie.FIND_BY_NAME, Movie.class)
17 | .setParameter("name", name)
18 | .getSingleResult();
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/servlet/async-servlet/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | servlet
8 | 1.0-SNAPSHOT
9 |
10 |
11 | servlet-async-servlet
12 | war
13 |
14 | Java EE 7 Sample: servlet - async-servlet
15 |
16 |
--------------------------------------------------------------------------------
/ejb/stateful/src/main/java/org/javaee7/ejb/stateful/ReentrantStatefulBean.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.ejb.stateful;
2 |
3 | import javax.annotation.Resource;
4 | import javax.ejb.SessionContext;
5 | import javax.ejb.Stateful;
6 |
7 | /**
8 | *
9 | * @author Arjan Tijms
10 | *
11 | */
12 | @Stateful
13 | public class ReentrantStatefulBean {
14 |
15 | @Resource
16 | private SessionContext sessionConext;
17 |
18 | public void initialMethod() {
19 | sessionConext.getBusinessObject(ReentrantStatefulBean.class).reentrantMehthod();
20 | }
21 |
22 | public void reentrantMehthod() {
23 |
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/cdi/events/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | cdi
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | cdi-events
12 | Java EE 7 Sample: cdi - events
13 |
14 |
--------------------------------------------------------------------------------
/jaxrpc/jaxrpc-security/src/main/java/org/javaee7/jaxrpc/security/HelloService.java:
--------------------------------------------------------------------------------
1 | /** Copyright Payara Services Limited **/
2 |
3 | package org.javaee7.jaxrpc.security;
4 |
5 | import java.rmi.Remote;
6 | import java.rmi.RemoteException;
7 |
8 | /**
9 | * The mandated interface for a JAX-RPC remote web service.
10 | *
11 | *
12 | * Note the mandated extension from the {@link Remote} interface
13 | * and the service method having to throw a {@link RemoteException}.
14 | *
15 | * @author Arjan Tijms
16 | *
17 | */
18 | public interface HelloService extends Remote {
19 | String sayHello(String input) throws RemoteException;
20 | }
--------------------------------------------------------------------------------
/jaxrs/simple-get/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 |
5 | org.javaee7
6 | jaxrs
7 | 1.0-SNAPSHOT
8 |
9 |
10 | simple-get
11 | war
12 |
13 | Java EE 7 Sample: jaxrs - simple-get
14 |
15 |
16 |
--------------------------------------------------------------------------------
/jpa/default-datasource/src/main/resources/META-INF/load.sql:
--------------------------------------------------------------------------------
1 | INSERT INTO EMPLOYEE_SCHEMA_DEFAULT_DATASOURCE("NAME") VALUES ('Penny')
2 | INSERT INTO EMPLOYEE_SCHEMA_DEFAULT_DATASOURCE("NAME") VALUES ('Sheldon')
3 | INSERT INTO EMPLOYEE_SCHEMA_DEFAULT_DATASOURCE("NAME") VALUES ('Amy')
4 | INSERT INTO EMPLOYEE_SCHEMA_DEFAULT_DATASOURCE("NAME") VALUES ('Leonard')
5 | INSERT INTO EMPLOYEE_SCHEMA_DEFAULT_DATASOURCE("NAME") VALUES ('Bernadette')
6 | INSERT INTO EMPLOYEE_SCHEMA_DEFAULT_DATASOURCE("NAME") VALUES ('Raj')
7 | INSERT INTO EMPLOYEE_SCHEMA_DEFAULT_DATASOURCE("NAME") VALUES ('Howard')
8 | INSERT INTO EMPLOYEE_SCHEMA_DEFAULT_DATASOURCE("NAME") VALUES ('Priya')
--------------------------------------------------------------------------------
/batch/scheduling/src/test/java/org/javaee7/batch/samples/scheduling/MyTimerScheduleAlternative.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.batch.samples.scheduling;
2 |
3 | import javax.ejb.Schedule;
4 | import javax.ejb.Singleton;
5 | import javax.ejb.Startup;
6 |
7 | /**
8 | * @author Roberto Cortez
9 | */
10 | @Startup
11 | @Singleton
12 | public class MyTimerScheduleAlternative extends AbstractTimerBatch {
13 |
14 | @Override
15 | @Schedule(hour = "*", minute = "*", second = "*/10", persistent = false)
16 | public void myJob() {
17 | super.myJob();
18 | }
19 |
20 | @Override
21 | protected void afterRun() {
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/jaspic/dispatching-jsf-cdi/src/main/java/org/javaee7/jaspic/dispatching/bean/MyBean.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jaspic.dispatching.bean;
2 |
3 | import javax.enterprise.context.RequestScoped;
4 | import javax.inject.Inject;
5 | import javax.inject.Named;
6 | import javax.servlet.http.HttpServletRequest;
7 |
8 | @Named
9 | @RequestScoped
10 | public class MyBean {
11 |
12 | @Inject
13 | private HttpServletRequest request;
14 |
15 | public String getText() {
16 | return "Called from CDI\n";
17 | }
18 |
19 | public String getServletPath() {
20 | return request.getServletPath();
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/jaxrs/paramconverter/src/main/java/org/javaee7/jaxrs/paramconverter/MyBean.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jaxrs.paramconverter;
2 |
3 | /**
4 | * @author Xavier Coulon
5 | *
6 | */
7 | public class MyBean {
8 |
9 | private String value;
10 |
11 | /**
12 | * @return the value
13 | */
14 | public String getValue() {
15 | return value;
16 | }
17 |
18 | /**
19 | * @param value the value to set
20 | */
21 | public void setValue(String value) {
22 | this.value = value;
23 | }
24 |
25 | @Override
26 | public String toString() {
27 | return getValue();
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/jpa/jpa-converter/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | jpa
8 | 1.0-SNAPSHOT
9 |
10 |
11 | jpa-jpa-converter
12 | jar
13 |
14 | Java EE 7 Sample: jpa-converter
15 |
16 |
--------------------------------------------------------------------------------
/batch/scheduling/src/main/java/org/javaee7/batch/samples/scheduling/MyJob.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.batch.samples.scheduling;
2 |
3 | import javax.batch.runtime.BatchRuntime;
4 | import java.util.ArrayList;
5 | import java.util.List;
6 | import java.util.Properties;
7 |
8 | /**
9 | * @author arungupta
10 | */
11 | public class MyJob implements Runnable {
12 |
13 | public static List executedBatchs = new ArrayList<>();
14 |
15 | public void run() {
16 | executedBatchs.add(BatchRuntime.getJobOperator().start("myJob", new Properties()));
17 | afterRun();
18 | }
19 |
20 | protected void afterRun() {
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/cdi/decorators-priority/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 |
5 | org.javaee7
6 | cdi
7 | 1.0-SNAPSHOT
8 |
9 |
10 | cdi-decorators-priority
11 | war
12 | Java EE 7 Sample: cdi - decorators priority
13 |
14 |
--------------------------------------------------------------------------------
/cdi/instance-qualifiers/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 |
8 | cdi
9 | org.javaee7
10 | 1.0-SNAPSHOT
11 | ../pom.xml
12 |
13 |
14 | cdi-instance-qualifiers
15 | Java EE 7 Sample: cdi - instance-qualifiers
16 |
17 |
--------------------------------------------------------------------------------
/ejb/timer/src/main/java/org/javaee7/ejb/timer/Ping.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.ejb.timer;
2 |
3 | public class Ping {
4 |
5 | private String timeInfo;
6 | private long time = System.currentTimeMillis();
7 |
8 | public Ping(String s) {
9 | this.timeInfo = s;
10 | }
11 |
12 | public long getTime() {
13 | return time;
14 | }
15 |
16 | public String getTimeInfo() {
17 | return timeInfo;
18 | }
19 |
20 | @Override
21 | public String toString() {
22 | return "Ping {" +
23 | "timeInfo='" + timeInfo + '\'' +
24 | ", time=" + time +
25 | '}';
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/ejb/timer/src/main/java/org/javaee7/ejb/timer/PingsListener.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.ejb.timer;
2 |
3 | import javax.ejb.Singleton;
4 | import javax.ejb.Startup;
5 | import javax.enterprise.event.Observes;
6 | import java.util.List;
7 | import java.util.concurrent.CopyOnWriteArrayList;
8 |
9 | @Startup
10 | @Singleton
11 | public class PingsListener {
12 |
13 | final List pings = new CopyOnWriteArrayList<>();
14 |
15 | public void listen(@Observes Ping ping) {
16 | System.out.println("ping = " + ping);
17 | pings.add(ping);
18 | }
19 |
20 | public List getPings() {
21 | return pings;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/interceptor/around-construct/src/main/java/org/javaee7/interceptor/aroundconstruct/MyInterceptorBinding.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.interceptor.aroundconstruct;
2 |
3 | import javax.interceptor.InterceptorBinding;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.Target;
6 |
7 | import static java.lang.annotation.ElementType.METHOD;
8 | import static java.lang.annotation.ElementType.TYPE;
9 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
10 |
11 | /**
12 | * @author Radim Hanus
13 | */
14 | @InterceptorBinding
15 | @Retention(RUNTIME)
16 | @Target({ METHOD, TYPE })
17 | public @interface MyInterceptorBinding {
18 | }
19 |
--------------------------------------------------------------------------------
/jaxrs/simple-get/src/main/java/org/javaee7/jaxrs/simple/get/Resource.java:
--------------------------------------------------------------------------------
1 | /** Copyright Payara Services Limited **/
2 |
3 | package org.javaee7.jaxrs.simple.get;
4 |
5 | import static javax.ws.rs.core.MediaType.TEXT_PLAIN;
6 |
7 | import javax.ws.rs.GET;
8 | import javax.ws.rs.Path;
9 | import javax.ws.rs.Produces;
10 |
11 | /**
12 | * A very simple JAX-RS resource class that just returns the string "hi!"
13 | *
14 | * @author Arjan Tijms
15 | *
16 | */
17 | @Path("/resource")
18 | @Produces(TEXT_PLAIN)
19 | public class Resource {
20 |
21 | @GET
22 | @Path("hi")
23 | public String hi() {
24 | return "hi!";
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/jaxws/jaxws-endpoint-ejb/src/main/java/org/javaee7/jaxws/endpoint/ejb/EBookStoreImpl.java:
--------------------------------------------------------------------------------
1 | /** Copyright Payara Services Limited **/
2 | package org.javaee7.jaxws.endpoint.ejb;
3 |
4 | import javax.ejb.Stateless;
5 | import javax.jws.WebService;
6 |
7 | /**
8 | *
9 | * @author Fermin Gallego
10 | * @author Arjan Tijms
11 | *
12 | */
13 | @Stateless
14 | @WebService(endpointInterface = "org.javaee7.jaxws.endpoint.ejb.EBookStore")
15 | public class EBookStoreImpl implements EBookStore {
16 |
17 | @Override
18 | public String welcomeMessage(String name) {
19 | return "Welcome to EBookStore WebService, Mr/Mrs " + name;
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/jpa/schema-gen-index/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 |
5 | org.javaee7
6 | jpa
7 | 1.0-SNAPSHOT
8 |
9 |
10 | jpa-schema-gen-index
11 |
12 | war
13 | Java EE 7 Sample: jpa - schema-gen-index
14 |
15 |
--------------------------------------------------------------------------------
/batch/scheduling/src/test/java/org/javaee7/batch/samples/scheduling/MyStepListener.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.batch.samples.scheduling;
2 |
3 | import java.util.concurrent.CountDownLatch;
4 |
5 | import javax.batch.api.listener.AbstractStepListener;
6 | import javax.inject.Named;
7 |
8 | @Named
9 | public class MyStepListener extends AbstractStepListener {
10 |
11 | public static CountDownLatch countDownLatch = new CountDownLatch(3);
12 |
13 | @Override
14 | public void beforeStep() throws Exception {
15 | }
16 |
17 | @Override
18 | public void afterStep() throws Exception {
19 | countDownLatch.countDown();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/cdi/alternatives/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | cdi
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | cdi-alternatives
12 | Java EE 7 Sample: cdi - alternatives
13 |
14 |
--------------------------------------------------------------------------------
/cdi/interceptors/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | cdi
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | cdi-interceptors
12 | Java EE 7 Sample: cdi - interceptors
13 |
14 |
--------------------------------------------------------------------------------
/jaxrs/jaxrs-client/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | jaxrs
8 | 1.0-SNAPSHOT
9 |
10 |
11 | jaxrs-jaxrs-client
12 | war
13 | Java EE 7 Sample: jaxrs - jaxrs-client
14 |
15 |
16 |
--------------------------------------------------------------------------------
/jms/jms-xa/src/main/java/org/javaee7/jms/xa/DeliveryStats.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jms.xa;
2 |
3 | import java.util.concurrent.CountDownLatch;
4 |
5 | import javax.ejb.Singleton;
6 |
7 | @Singleton
8 | public class DeliveryStats {
9 |
10 | public static CountDownLatch countDownLatch = new CountDownLatch(1);
11 |
12 | private long deliveredMessagesCount;
13 |
14 | public long getDeliveredMessagesCount() {
15 | return deliveredMessagesCount;
16 | }
17 |
18 | public void messageDelivered() {
19 | deliveredMessagesCount++;
20 | }
21 |
22 | public void reset() {
23 | deliveredMessagesCount = 0L;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/jpa/jpa-converter/src/main/java/org/javaee7/jpa/converter/CreditCardConverter.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jpa.converter;
2 |
3 | import javax.persistence.AttributeConverter;
4 | import javax.persistence.Converter;
5 |
6 | /**
7 | * @author Arun Gupta
8 | */
9 | @Converter
10 | public class CreditCardConverter implements AttributeConverter {
11 |
12 | @Override
13 | public String convertToDatabaseColumn(CreditCard attribute) {
14 | return attribute.toString();
15 | }
16 |
17 | @Override
18 | public CreditCard convertToEntityAttribute(String card) {
19 | return new CreditCard(card);
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/jpa/schema-gen-scripts/src/main/resources/META-INF/load.sql:
--------------------------------------------------------------------------------
1 | INSERT INTO EMPLOYEE_SCHEMA_GEN_SCRIPTS("ID", "NAME") VALUES (1, 'Penny')
2 | INSERT INTO EMPLOYEE_SCHEMA_GEN_SCRIPTS("ID", "NAME") VALUES (2, 'Sheldon')
3 | INSERT INTO EMPLOYEE_SCHEMA_GEN_SCRIPTS("ID", "NAME") VALUES (3, 'Amy')
4 | INSERT INTO EMPLOYEE_SCHEMA_GEN_SCRIPTS("ID", "NAME") VALUES (4, 'Leonard')
5 | INSERT INTO EMPLOYEE_SCHEMA_GEN_SCRIPTS("ID", "NAME") VALUES (5, 'Bernadette')
6 | INSERT INTO EMPLOYEE_SCHEMA_GEN_SCRIPTS("ID", "NAME") VALUES (6, 'Raj')
7 | INSERT INTO EMPLOYEE_SCHEMA_GEN_SCRIPTS("ID", "NAME") VALUES (7, 'Howard')
8 | INSERT INTO EMPLOYEE_SCHEMA_GEN_SCRIPTS("ID", "NAME") VALUES (8, 'Priya')
--------------------------------------------------------------------------------
/servlet/error-mapping/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | servlet
8 | 1.0-SNAPSHOT
9 |
10 |
11 | servlet-error-mapping
12 | war
13 |
14 | Java EE 7 Sample: servlet - error-mapping
15 |
16 |
--------------------------------------------------------------------------------
/jpa/schema-gen-metadata/src/main/resources/META-INF/load.sql:
--------------------------------------------------------------------------------
1 | INSERT INTO EMPLOYEE_SCHEMA_GEN_METADATA("ID", "NAME") VALUES (1, 'Penny')
2 | INSERT INTO EMPLOYEE_SCHEMA_GEN_METADATA("ID", "NAME") VALUES (2, 'Sheldon')
3 | INSERT INTO EMPLOYEE_SCHEMA_GEN_METADATA("ID", "NAME") VALUES (3, 'Amy')
4 | INSERT INTO EMPLOYEE_SCHEMA_GEN_METADATA("ID", "NAME") VALUES (4, 'Leonard')
5 | INSERT INTO EMPLOYEE_SCHEMA_GEN_METADATA("ID", "NAME") VALUES (5, 'Bernadette')
6 | INSERT INTO EMPLOYEE_SCHEMA_GEN_METADATA("ID", "NAME") VALUES (6, 'Raj')
7 | INSERT INTO EMPLOYEE_SCHEMA_GEN_METADATA("ID", "NAME") VALUES (7, 'Howard')
8 | INSERT INTO EMPLOYEE_SCHEMA_GEN_METADATA("ID", "NAME") VALUES (8, 'Priya')
--------------------------------------------------------------------------------
/servlet/simple-servlet/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | servlet
8 | 1.0-SNAPSHOT
9 |
10 |
11 | servlet-simple-servlet
12 | war
13 |
14 | Java EE 7 Sample: servlet - simple-servlet
15 |
16 |
--------------------------------------------------------------------------------
/jms/jms-batch/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 |
5 | org.javaee7
6 | jms
7 | 1.0-SNAPSHOT
8 |
9 |
10 | jms-jms-batch
11 | Java EE 7 Sample: jms - jms-batch
12 | ItemReader reading from durable subscription
13 |
14 |
--------------------------------------------------------------------------------
/batch/flow/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 |
5 | org.javaee7
6 | batch
7 | 1.0-SNAPSHOT
8 |
9 |
10 | batch-flow
11 | war
12 | Java EE 7 Sample: batch - flow
13 | Batch DSL - Flow
14 |
15 |
16 |
--------------------------------------------------------------------------------
/cdi/decorators-builtin-beans/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 |
5 | org.javaee7
6 | cdi
7 | 1.0-SNAPSHOT
8 |
9 |
10 | cdi-decorators-builtin-beans
11 | war
12 | Java EE 7 Sample: cdi - decorators - built-in beans
13 |
14 |
--------------------------------------------------------------------------------
/ejb/async-ejb/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | ejb
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | ejb-async-ejb
12 | war
13 | Java EE 7 Sample: ejb - async-ejb
14 |
15 |
--------------------------------------------------------------------------------
/jaspic/invoke-ejb-cdi/src/main/java/org/javaee7/jaspic/invoke/bean/CDIBean.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jaspic.invoke.bean;
2 |
3 | import javax.enterprise.context.RequestScoped;
4 | import javax.inject.Inject;
5 | import javax.inject.Named;
6 | import javax.servlet.http.HttpServletRequest;
7 |
8 | @Named
9 | @RequestScoped
10 | public class CDIBean {
11 |
12 | @Inject
13 | private HttpServletRequest request;
14 |
15 | public String getText() {
16 | return "Called from CDI";
17 | }
18 |
19 | public void setTextViaInjectedRequest() {
20 | request.setAttribute("text", "Called from CDI via injected request");
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/jpa/listeners-injection/src/main/java/org/javaee7/jpa/listeners/RatingService.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jpa.listeners;
2 |
3 | import javax.ejb.Stateless;
4 | import javax.persistence.EntityManager;
5 | import javax.persistence.PersistenceContext;
6 |
7 | /**
8 | * @author Kuba Marchwicki
9 | */
10 |
11 | @Stateless
12 | public class RatingService {
13 | @PersistenceContext
14 | private EntityManager em;
15 |
16 | public Integer movieRating(String name) {
17 | return em.createNamedQuery(Rating.FIND_BY_NAME, Rating.class)
18 | .setParameter("name", name)
19 | .getSingleResult()
20 | .getRating();
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/jsf/http-get/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | jsf
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | jsf-http-get
12 | war
13 | Java EE 7 Sample: jsf - http-get
14 |
15 |
--------------------------------------------------------------------------------
/websocket/websocket-vs-rest-payload/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 | <%@page contentType="text/html" pageEncoding="UTF-8"%>
2 |
3 |
4 |
5 |
6 | REST vs WebSocket - Payload
7 |
8 |
9 |
10 |
11 | REST vs WebSocket - Payload
12 |
13 | Use Adavanced REST Client extension to send requests.
14 | Capture REST/HTTP headers using the extension.
15 | Capture WebSocket headers using Wireshark.
16 |
17 |
18 |
--------------------------------------------------------------------------------
/jaspic/README.md:
--------------------------------------------------------------------------------
1 | # Java EE 7 Samples: JASPIC - Java Authentication Service Provider Interface for Containers#
2 |
3 | The [JSR 196](https://jcp.org/en/jsr/detail?id=196) seeks to define a standard interface by which authentication modules may be integrated with containers and such that these modules may establish the authentication identities used by containers.
4 |
5 | ## Samples ##
6 |
7 | - async-authentication
8 | - basic-authentication
9 | - ejb-propagation
10 | - lifecycle
11 | - register-session
12 | - wrapping
13 |
14 | ## How to run
15 |
16 | More information on how to run can be found at:
17 |
18 |
19 |
--------------------------------------------------------------------------------
/jms/jms-xa/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | jms
7 | org.javaee7
8 | 1.0-SNAPSHOT
9 |
10 | jms-jms-xa
11 | war
12 | Java EE 7 Sample: jms - jms-xa
13 | Arquillian test for JMS XA
14 |
15 |
--------------------------------------------------------------------------------
/jpa/extended-pc/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | jpa
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | jpa-extended-pc
12 | war
13 | Java EE 7 Sample: jpa - extended-pc
14 |
15 |
--------------------------------------------------------------------------------
/jpa/jpa-converter/src/main/java/org/javaee7/jpa/converter/EmployeeRepository.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jpa.converter;
2 |
3 | import java.util.List;
4 | import javax.ejb.Stateless;
5 | import javax.persistence.EntityManager;
6 | import javax.persistence.PersistenceContext;
7 |
8 | /**
9 | * @author Arun Gupta
10 | */
11 | @Stateless
12 | public class EmployeeRepository {
13 |
14 | @PersistenceContext
15 | private EntityManager em;
16 |
17 | public void persist(Employee e) {
18 | em.persist(e);
19 | }
20 |
21 | public List all() {
22 | return em.createNamedQuery("Employee.findAll", Employee.class).getResultList();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/test-utils/src/main/java/org/javaee7/RemoteEJBContextFactory.java:
--------------------------------------------------------------------------------
1 | /** Copyright Payara Services Limited **/
2 | package org.javaee7;
3 |
4 | import java.util.Iterator;
5 | import java.util.ServiceLoader;
6 |
7 | public class RemoteEJBContextFactory {
8 |
9 | public static RemoteEJBContextProvider getProvider() {
10 |
11 | ServiceLoader loader = ServiceLoader.load(RemoteEJBContextProvider.class);
12 |
13 | Iterator providers = loader.iterator();
14 |
15 | if (!providers.hasNext()) {
16 | return null;
17 | }
18 |
19 | return providers.next();
20 |
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/websocket/chat/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | org.javaee7
5 | websocket
6 | 1.0-SNAPSHOT
7 |
8 |
9 | org.javaee7
10 | websocket-chat
11 |
12 | war
13 | Java EE 7 Sample: websocket - chat
14 |
15 |
--------------------------------------------------------------------------------
/websocket/endpoint-async/src/main/java/org/javaee7/websocket/endpoint/async/MyAsyncEndpointByteBufferClient.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.websocket.endpoint.async;
2 |
3 | import java.nio.ByteBuffer;
4 | import javax.websocket.ClientEndpoint;
5 | import javax.websocket.OnMessage;
6 |
7 | /**
8 | *
9 | * @author Jacek Jackowiak
10 | */
11 | @ClientEndpoint
12 | public class MyAsyncEndpointByteBufferClient {
13 |
14 | private ByteBuffer receivedMessage;
15 |
16 | @OnMessage
17 | public void onMessage(ByteBuffer msg) {
18 | receivedMessage = msg;
19 | }
20 |
21 | public ByteBuffer getReceivedMessage() {
22 | return receivedMessage;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/cdi/alternatives-priority/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | cdi
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | cdi-alternatives-priority
12 | Java EE 7 Sample: cdi - alternatives-priority
13 |
14 |
--------------------------------------------------------------------------------
/cdi/interceptors-priority/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | cdi
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | cdi-interceptors-priority
12 | Java EE 7 Sample: cdi - interceptors-priority
13 |
14 |
--------------------------------------------------------------------------------
/concurrency/managedexecutor/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | concurrent/myExecutor
9 |
10 |
11 | javax.enterprise.concurrent.ManagedExecutorService
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ejb/remote/roles-allowed-ssl/src/main/resources/META-INF/application.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 | myapp
8 |
9 |
10 | myEJB.jar
11 |
12 |
13 |
14 |
15 | test.war
16 | /test
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/jaxrs/beanparam/src/main/java/org/javaee7/jaxrs/beanparam/MyPathParams.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jaxrs.beanparam;
2 |
3 | import javax.ws.rs.PathParam;
4 |
5 | /**
6 | * @author xcoulon
7 | *
8 | */
9 | public class MyPathParams {
10 |
11 | @PathParam("id1")
12 | private String id1;
13 |
14 | private String id2;
15 |
16 | public String getId1() {
17 | return id1;
18 | }
19 |
20 | public void setId1(String id1) {
21 | this.id1 = id1;
22 | }
23 |
24 | public String getId2() {
25 | return id2;
26 | }
27 |
28 | @PathParam("id2")
29 | public void setId2(String id2) {
30 | this.id2 = id2;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/jaxrs/singleton/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | jaxrs
7 | org.javaee7
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | jaxrs-singleton
12 | war
13 | Java EE 7 Sample: jaxrs - singleton
14 |
15 |
--------------------------------------------------------------------------------
/jpa/aggregate-function-in-select/src/main/java/org/javaee7/jpa/aggregate_function_in_select/entity/AggregatedTestEntity.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jpa.aggregate_function_in_select.entity;
2 |
3 | /**
4 | * A very simple DTO that will be used to aggregate TestEnity to
5 | *
6 | * @author Arjan Tijms
7 | *
8 | */
9 | public class AggregatedTestEntity {
10 |
11 | private String values;
12 |
13 | public AggregatedTestEntity(String values) {
14 | this.values = values;
15 | }
16 |
17 | public String getValues() {
18 | return values;
19 | }
20 |
21 | public void setValues(String values) {
22 | this.values = values;
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/jpa/entitygraph/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | jpa
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | jpa-entitygraph
12 | war
13 | Java EE 7 Sample: jpa - entitygraph
14 |
15 |
--------------------------------------------------------------------------------
/jpa/ordercolumn/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | jpa
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | jpa-ordercolumn
12 | war
13 | Java EE 7 Sample: jpa - ordercolumn
14 |
15 |
--------------------------------------------------------------------------------
/batch/split/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 |
5 | org.javaee7
6 | batch
7 | 1.0-SNAPSHOT
8 |
9 |
10 | batch-split
11 | war
12 | Java EE 7 Sample: batch - split
13 | Batch JSL - Splitting Steps
14 |
15 |
16 |
--------------------------------------------------------------------------------
/jaxrs/beanparam/src/main/java/org/javaee7/jaxrs/beanparam/MyQueryParams.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jaxrs.beanparam;
2 |
3 | import javax.ws.rs.QueryParam;
4 |
5 | /**
6 | * @author xcoulon
7 | *
8 | */
9 | public class MyQueryParams {
10 |
11 | @QueryParam("param1")
12 | private String param1;
13 |
14 | @QueryParam("param2")
15 | private String param2;
16 |
17 | @QueryParam("param3")
18 | private String param3;
19 |
20 | public String getParam1() {
21 | return param1;
22 | }
23 |
24 | public String getParam2() {
25 | return param2;
26 | }
27 |
28 | public String getParam3() {
29 | return param3;
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/jaxws/jaxws-endpoint/src/main/java/org/javaee7/jaxws/endpoint/EBookStore.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jaxws.endpoint;
2 |
3 | import java.util.List;
4 |
5 | import javax.jws.WebMethod;
6 | import javax.jws.WebService;
7 |
8 | /**
9 | *
10 | * @author Fermin Gallego
11 | *
12 | */
13 | @WebService
14 | public interface EBookStore {
15 |
16 | @WebMethod
17 | String welcomeMessage(String name);
18 |
19 | @WebMethod
20 | List findEBooks(String text);
21 |
22 | @WebMethod
23 | EBook takeBook(String title);
24 |
25 | @WebMethod
26 | void saveBook(EBook eBook);
27 |
28 | @WebMethod
29 | EBook addAppendix(EBook eBook, int appendixPages);
30 | }
31 |
--------------------------------------------------------------------------------
/batch/decision/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 |
5 | org.javaee7
6 | batch
7 | 1.0-SNAPSHOT
8 |
9 |
10 | batch-decision
11 | war
12 | Java EE 7 Sample: batch - decision
13 | Batch DSL - Decision
14 |
15 |
16 |
--------------------------------------------------------------------------------
/jaxrs/readerwriter/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | jaxrs
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | jaxrs-readerwriter
12 | war
13 | Java EE 7 Sample: jaxrs - readerwriter
14 |
15 |
--------------------------------------------------------------------------------
/jpa/unsynchronized-pc/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | jpa
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | jpa-unsynchronized-pc
12 | war
13 | Java EE 7 Sample: jpa - unsynchronized-pc
14 |
15 |
--------------------------------------------------------------------------------
/json/object-builder/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | json
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | json-object-builder
12 | war
13 | Java EE 7 Sample: json - object-builder
14 |
15 |
--------------------------------------------------------------------------------
/batch/chunk-exception/src/main/java/org/javaee7/batch/chunk/exception/MyRetryReadListener.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.batch.chunk.exception;
2 |
3 | import javax.batch.api.chunk.listener.RetryReadListener;
4 | import javax.inject.Named;
5 |
6 | /**
7 | * @author Roberto Cortez
8 | */
9 | @Named
10 | public class MyRetryReadListener implements RetryReadListener {
11 | @Override
12 | public void onRetryReadException(Exception ex) throws Exception {
13 | ChunkExceptionRecorder.retryReadExecutions++;
14 | ChunkExceptionRecorder.chunkExceptionsCountDownLatch.countDown();
15 | System.out.println("MyRetryReadListener.onRetryReadException " + ex.getMessage());
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/interceptor/around-construct/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | interceptor
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | interceptor-around-construct
12 | Java EE 7 Sample: interceptor - around-construct
13 |
14 |
--------------------------------------------------------------------------------
/jaxrs/jaxrs-endpoint/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | jaxrs
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | jaxrs-jaxrs-endpoint
12 | war
13 | Java EE 7 Sample: jaxrs - jaxrs-endpoint
14 |
15 |
--------------------------------------------------------------------------------
/servlet/programmatic-registration/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | servlet
8 | 1.0-SNAPSHOT
9 |
10 |
11 | servlet-programmatic-registration
12 | war
13 |
14 | Java EE 7 Sample: servlet - programmatic-registration
15 |
16 |
--------------------------------------------------------------------------------
/cdi/events-conditional-reception/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | cdi
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | cdi-events-conditional-reception
12 | Java EE 7 Sample: cdi - events-conditional-reception
13 |
14 |
--------------------------------------------------------------------------------
/cdi/interceptors-priority/src/main/java/org/javaee7/cdi/interceptors/priority/MyInterceptorBinding.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.cdi.interceptors.priority;
2 |
3 | import javax.interceptor.InterceptorBinding;
4 | import java.lang.annotation.Inherited;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.Target;
7 |
8 | import static java.lang.annotation.ElementType.METHOD;
9 | import static java.lang.annotation.ElementType.TYPE;
10 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
11 |
12 | /**
13 | * @author Arun Gupta
14 | */
15 | @Inherited
16 | @InterceptorBinding
17 | @Retention(RUNTIME)
18 | @Target({ METHOD, TYPE })
19 | public @interface MyInterceptorBinding {
20 | }
21 |
--------------------------------------------------------------------------------
/jacc/contexts/src/main/java/org/javaee7/jacc/contexts/sam/SamAutoRegistrationListener.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jacc.contexts.sam;
2 |
3 | import javax.servlet.ServletContextEvent;
4 | import javax.servlet.annotation.WebListener;
5 |
6 | import org.javaee7.jaspic.common.BaseServletContextListener;
7 | import org.javaee7.jaspic.common.JaspicUtils;
8 |
9 | /**
10 | *
11 | * @author Arjan Tijms
12 | *
13 | */
14 | @WebListener
15 | public class SamAutoRegistrationListener extends BaseServletContextListener {
16 |
17 | @Override
18 | public void contextInitialized(ServletContextEvent sce) {
19 | JaspicUtils.registerSAM(sce.getServletContext(), new TestServerAuthModule());
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/jpa/default-datasource/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | jpa
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | jpa-default-datasource
12 | war
13 | Java EE 7 Sample: jpa - default-datasource
14 |
15 |
--------------------------------------------------------------------------------
/jpa/ordercolumn/src/main/java/org/javaee7/jpa/ordercolumn/entity/unidirectional/Child.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jpa.ordercolumn.entity.unidirectional;
2 |
3 | import static javax.persistence.GenerationType.IDENTITY;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.Id;
8 |
9 | @Entity
10 | public class Child {
11 |
12 | @Id
13 | @GeneratedValue(strategy = IDENTITY)
14 | private Long id;
15 |
16 | @SuppressWarnings("unused")
17 | private int dummy = 1;
18 |
19 | public Long getId() {
20 | return id;
21 | }
22 |
23 | public void setId(Long id) {
24 | this.id = id;
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/jpa/schema-gen-metadata/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | jpa
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | jpa-schema-gen-metadata
12 | war
13 | Java EE 7 Sample: jpa - schema-gen-metadata
14 |
15 |
--------------------------------------------------------------------------------
/websocket/javase-client/nbactions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | run
5 |
6 | jar
7 |
8 |
9 | process-classes
10 | org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
11 |
12 |
13 | -classpath %classpath org.javaee7.websocket.javase.client.Client
14 | java
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/batch/scheduling/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 |
5 | org.javaee7
6 | batch
7 | 1.0-SNAPSHOT
8 |
9 |
10 | batch-scheduling
11 | war
12 | Java EE 7 Sample: batch - scheduling
13 |
14 | Scheduling a Batch Job
15 |
16 |
17 |
--------------------------------------------------------------------------------
/cdi/events-conditional-reception/src/main/java/org/javaee7/cdi/events/conditional/GreetingReceiver.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.cdi.events.conditional;
2 |
3 | import javax.enterprise.context.SessionScoped;
4 | import javax.enterprise.event.Observes;
5 | import javax.enterprise.event.Reception;
6 | import java.io.Serializable;
7 |
8 | /**
9 | * @author Radim Hanus
10 | */
11 | @SessionScoped
12 | public class GreetingReceiver implements EventReceiver, Serializable {
13 | private String greet = "Willkommen";
14 |
15 | void receive(@Observes(notifyObserver = Reception.IF_EXISTS) String greet) {
16 | this.greet = greet;
17 | }
18 |
19 | @Override
20 | public String getGreet() {
21 | return greet;
22 | }
23 | }
--------------------------------------------------------------------------------
/cdi/nobeans-el-injection/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | cdi
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | cdi-nobeans-el-injection
12 | war
13 | Java EE 7 Sample: cdi - nobeans-el-injection
14 |
15 |
--------------------------------------------------------------------------------
/jaxrs/server-negotiation/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.javaee7
7 | jaxrs
8 | 1.0-SNAPSHOT
9 | ../pom.xml
10 |
11 | jaxrs-server-negotiation
12 | war
13 | Java EE 7 Sample: jaxrs - server-negotiation
14 |
15 |
--------------------------------------------------------------------------------
/jaspic/invoke-ejb-cdi/src/main/java/org/javaee7/jaspic/invoke/sam/SamAutoRegistrationListener.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jaspic.invoke.sam;
2 |
3 | import javax.servlet.ServletContextEvent;
4 | import javax.servlet.annotation.WebListener;
5 |
6 | import org.javaee7.jaspic.common.BaseServletContextListener;
7 | import org.javaee7.jaspic.common.JaspicUtils;
8 |
9 | /**
10 | *
11 | * @author Arjan Tijms
12 | *
13 | */
14 | @WebListener
15 | public class SamAutoRegistrationListener extends BaseServletContextListener {
16 |
17 | @Override
18 | public void contextInitialized(ServletContextEvent sce) {
19 | JaspicUtils.registerSAM(sce.getServletContext(), new TestServerAuthModule());
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/websocket/endpoint-wss/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | org.javaee7.websocket
6 | websocket-samples
7 | 1.0-SNAPSHOT
8 | ../pom.xml
9 |
10 |
11 | org.javaee7.websocket
12 | endpoint-wss
13 | 1.0-SNAPSHOT
14 | war
15 |
16 |
--------------------------------------------------------------------------------
/batch/README.md:
--------------------------------------------------------------------------------
1 | # Java EE 7 Samples: Batch #
2 |
3 | The [JSR 352](https://jcp.org/en/jsr/detail?id=352) specifies a programming model for batch applications and a runtime for scheduling and executing jobs.
4 |
5 | ## Samples ##
6 |
7 | - batchlet-simple
8 | - chunk-checkpoint
9 | - chunk-csv-database
10 | - chunk-exception
11 | - chunk-mapper
12 | - chunk-optional-processor
13 | - chunk-partition
14 | - chunk-simple
15 | - decision
16 | - flow
17 | - batch-listeners
18 | - multiple-steps
19 | - split
20 | - chunk-simple-nobeans
21 | - scheduling
22 |
23 | ## How to run
24 |
25 | More information on how to run can be found at:
26 |
27 |
28 |
--------------------------------------------------------------------------------
/jaspic/dispatching/src/main/java/org/javaee7/jaspic/dispatching/sam/SamAutoRegistrationListener.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jaspic.dispatching.sam;
2 |
3 | import javax.servlet.ServletContextEvent;
4 | import javax.servlet.annotation.WebListener;
5 |
6 | import org.javaee7.jaspic.common.BaseServletContextListener;
7 | import org.javaee7.jaspic.common.JaspicUtils;
8 |
9 | /**
10 | *
11 | * @author Arjan Tijms
12 | *
13 | */
14 | @WebListener
15 | public class SamAutoRegistrationListener extends BaseServletContextListener {
16 |
17 | @Override
18 | public void contextInitialized(ServletContextEvent sce) {
19 | JaspicUtils.registerSAM(sce.getServletContext(), new TestServerAuthModule());
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/jaspic/lifecycle/src/main/java/org/javaee7/jaspic/lifecycle/sam/SamAutoRegistrationListener.java:
--------------------------------------------------------------------------------
1 | package org.javaee7.jaspic.lifecycle.sam;
2 |
3 | import javax.servlet.ServletContextEvent;
4 | import javax.servlet.annotation.WebListener;
5 |
6 | import org.javaee7.jaspic.common.BaseServletContextListener;
7 | import org.javaee7.jaspic.common.JaspicUtils;
8 |
9 | /**
10 | *
11 | * @author Arjan Tijms
12 | *
13 | */
14 | @WebListener
15 | public class SamAutoRegistrationListener extends BaseServletContextListener {
16 |
17 | @Override
18 | public void contextInitialized(ServletContextEvent sce) {
19 | JaspicUtils.registerSAM(sce.getServletContext(), new TestLifecycleAuthModule());
20 | }
21 |
22 | }
--------------------------------------------------------------------------------