From 43f34d7fb80c17db727cc85425f5074018a177bf Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 13 Sep 2013 09:21:13 -0700 Subject: [PATCH 001/995] Adding/Updating --- batch/pom.xml | 2 +- cdi/pom.xml | 3 ++- concurrency/pom.xml | 1 + ejb/pom.xml | 1 + el/pom.xml | 1 + extra/pom.xml | 1 + javamail/pom.xml | 1 + jaxrs/pom.xml | 3 ++- jca/pom.xml | 4 +++- jms/pom.xml | 1 + jpa/pom.xml | 2 ++ jsf/pom.xml | 1 + json/pom.xml | 1 + jta/pom.xml | 1 + servlet/pom.xml | 1 + validation/pom.xml | 3 ++- websocket/pom.xml | 3 ++- 17 files changed, 24 insertions(+), 6 deletions(-) diff --git a/batch/pom.xml b/batch/pom.xml index d8f716669..9a99f5eac 100644 --- a/batch/pom.xml +++ b/batch/pom.xml @@ -12,7 +12,7 @@ batch-samples 1.0-SNAPSHOT pom - ${project.artifactId} + Java EE 7 Batch Samples batchlet-simple diff --git a/cdi/pom.xml b/cdi/pom.xml index 5272a0feb..27ecc5d6c 100644 --- a/cdi/pom.xml +++ b/cdi/pom.xml @@ -12,6 +12,7 @@ cdi-samples 1.0-SNAPSHOT pom + Java EE 7 CDI Samples vetoed @@ -28,4 +29,4 @@ beanmanager extension - \ No newline at end of file + diff --git a/concurrency/pom.xml b/concurrency/pom.xml index 7fa2a525b..e1dd765f8 100644 --- a/concurrency/pom.xml +++ b/concurrency/pom.xml @@ -13,6 +13,7 @@ concurrency-samples 1.0-SNAPSHOT pom + Java EE 7 Concurrency Samples dynamicproxy diff --git a/ejb/pom.xml b/ejb/pom.xml index 37d1e25b6..ea36b19c5 100644 --- a/ejb/pom.xml +++ b/ejb/pom.xml @@ -12,6 +12,7 @@ ejb-samples 1.0-SNAPSHOT pom + Java EE 7 EJB Samples embeddable diff --git a/el/pom.xml b/el/pom.xml index dbe3763b7..8ec44494e 100644 --- a/el/pom.xml +++ b/el/pom.xml @@ -12,6 +12,7 @@ el-samples 1.0-SNAPSHOT pom + Java EE 7 Expression Language Samples standalone diff --git a/extra/pom.xml b/extra/pom.xml index 05bf900f4..d20b73443 100644 --- a/extra/pom.xml +++ b/extra/pom.xml @@ -12,6 +12,7 @@ extra-samples 1.0-SNAPSHOT pom + Java EE 7 Extra Samples quartz diff --git a/javamail/pom.xml b/javamail/pom.xml index d3be414df..42b4750fb 100644 --- a/javamail/pom.xml +++ b/javamail/pom.xml @@ -12,6 +12,7 @@ javamail-samples 1.0-SNAPSHOT pom + Java EE 7 JavaMail Samples definition diff --git a/jaxrs/pom.xml b/jaxrs/pom.xml index 647eeb7cd..729242f8d 100644 --- a/jaxrs/pom.xml +++ b/jaxrs/pom.xml @@ -12,6 +12,7 @@ jaxrs-samples 1.0-SNAPSHOT pom + Java EE 7 JAX-RS Samples @@ -51,4 +52,4 @@ readerwriter-injection - \ No newline at end of file + diff --git a/jca/pom.xml b/jca/pom.xml index 13299f54c..31c1fd6f5 100644 --- a/jca/pom.xml +++ b/jca/pom.xml @@ -12,7 +12,9 @@ jca-samples 1.0-SNAPSHOT pom + Java EE 7 JCA Samples + connector-simple - \ No newline at end of file + diff --git a/jms/pom.xml b/jms/pom.xml index e3c93d8bc..e7e5ac73f 100644 --- a/jms/pom.xml +++ b/jms/pom.xml @@ -12,6 +12,7 @@ jms-samples 1.0-SNAPSHOT pom + Java EE 7 JMS Samples send-receive-simple diff --git a/jpa/pom.xml b/jpa/pom.xml index 155a202bc..e0155348d 100644 --- a/jpa/pom.xml +++ b/jpa/pom.xml @@ -12,6 +12,8 @@ jpa-samples 1.0-SNAPSHOT pom + Java EE 7 JPA Samples + criteria entitygraph diff --git a/jsf/pom.xml b/jsf/pom.xml index c51670290..8c40bddac 100644 --- a/jsf/pom.xml +++ b/jsf/pom.xml @@ -13,6 +13,7 @@ jsf-samples 1.0-SNAPSHOT pom + Java EE 7 JSF Samples ajax diff --git a/json/pom.xml b/json/pom.xml index 7b07e4325..21eb04a8c 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -12,6 +12,7 @@ json-samples 1.0-SNAPSHOT pom + Java EE 7 JSON-P Samples object-builder diff --git a/jta/pom.xml b/jta/pom.xml index 5171ebb55..ba8a4bed9 100644 --- a/jta/pom.xml +++ b/jta/pom.xml @@ -12,6 +12,7 @@ jta-samples 1.0-SNAPSHOT pom + Java EE 7 JTA Samples transactional diff --git a/servlet/pom.xml b/servlet/pom.xml index 9bbc68994..02c01f57f 100644 --- a/servlet/pom.xml +++ b/servlet/pom.xml @@ -13,6 +13,7 @@ servlet-samples 1.0-SNAPSHOT pom + Java EE 7 Servlet Samples cookies diff --git a/validation/pom.xml b/validation/pom.xml index c08629815..b60a89801 100644 --- a/validation/pom.xml +++ b/validation/pom.xml @@ -13,10 +13,11 @@ validation-samples 1.0-SNAPSHOT pom + Java EE 7 Bean Validation Samples methods custom-constraint - \ No newline at end of file + diff --git a/websocket/pom.xml b/websocket/pom.xml index 293ea1e8d..eaf577ba1 100644 --- a/websocket/pom.xml +++ b/websocket/pom.xml @@ -12,6 +12,7 @@ websocket-samples 1.0-SNAPSHOT pom + Java EE 7 WebSocket Samples binary @@ -47,4 +48,4 @@ endpoint-singleton - \ No newline at end of file + From bf0198ba17556b2846d4a79a456af3f4d89eeb1d Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 13 Sep 2013 09:48:55 -0700 Subject: [PATCH 002/995] Moving json/twitter-search to extra/twitter-search --- extra/pom.xml | 7 ++++--- {json => extra}/twitter-search/pom.xml | 6 +++--- .../org/javaee7/extra}/twitter/search/TestServlet.java | 2 +- .../org/javaee7/extra}/twitter/search/TwitterSearch.java | 2 +- .../twitter-search/src/main/webapp/WEB-INF/beans.xml | 0 {json => extra}/twitter-search/src/main/webapp/index.jsp | 0 json/pom.xml | 1 - 7 files changed, 9 insertions(+), 9 deletions(-) rename {json => extra}/twitter-search/pom.xml (87%) rename {json/twitter-search/src/main/java/org/javaee7/json => extra/twitter-search/src/main/java/org/javaee7/extra}/twitter/search/TestServlet.java (99%) rename {json/twitter-search/src/main/java/org/javaee7/json => extra/twitter-search/src/main/java/org/javaee7/extra}/twitter/search/TwitterSearch.java (98%) rename {json => extra}/twitter-search/src/main/webapp/WEB-INF/beans.xml (100%) rename {json => extra}/twitter-search/src/main/webapp/index.jsp (100%) diff --git a/extra/pom.xml b/extra/pom.xml index d20b73443..438105413 100644 --- a/extra/pom.xml +++ b/extra/pom.xml @@ -14,7 +14,8 @@ pom Java EE 7 Extra Samples - - quartz - + + quartz + twitter-search + diff --git a/json/twitter-search/pom.xml b/extra/twitter-search/pom.xml similarity index 87% rename from json/twitter-search/pom.xml rename to extra/twitter-search/pom.xml index edc6f6d02..75aa4ef73 100644 --- a/json/twitter-search/pom.xml +++ b/extra/twitter-search/pom.xml @@ -2,13 +2,13 @@ 4.0.0 - org.javaee7.json - json-samples + org.javaee7.extra + extra-samples 1.0-SNAPSHOT ../pom.xml - org.javaee7.json + org.javaee7.extra twitter-search 1.0-SNAPSHOT war diff --git a/json/twitter-search/src/main/java/org/javaee7/json/twitter/search/TestServlet.java b/extra/twitter-search/src/main/java/org/javaee7/extra/twitter/search/TestServlet.java similarity index 99% rename from json/twitter-search/src/main/java/org/javaee7/json/twitter/search/TestServlet.java rename to extra/twitter-search/src/main/java/org/javaee7/extra/twitter/search/TestServlet.java index 2b367100f..57dac711d 100644 --- a/json/twitter-search/src/main/java/org/javaee7/json/twitter/search/TestServlet.java +++ b/extra/twitter-search/src/main/java/org/javaee7/extra/twitter/search/TestServlet.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.json.twitter.search; +package org.javaee7.extra.twitter.search; import java.io.IOException; import java.io.PrintWriter; diff --git a/json/twitter-search/src/main/java/org/javaee7/json/twitter/search/TwitterSearch.java b/extra/twitter-search/src/main/java/org/javaee7/extra/twitter/search/TwitterSearch.java similarity index 98% rename from json/twitter-search/src/main/java/org/javaee7/json/twitter/search/TwitterSearch.java rename to extra/twitter-search/src/main/java/org/javaee7/extra/twitter/search/TwitterSearch.java index 3eb2713a2..6d851356a 100644 --- a/json/twitter-search/src/main/java/org/javaee7/json/twitter/search/TwitterSearch.java +++ b/extra/twitter-search/src/main/java/org/javaee7/extra/twitter/search/TwitterSearch.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.json.twitter.search; +package org.javaee7.extra.twitter.search; import javax.inject.Inject; import org.glassfish.samples.twitter.api.SearchResults; diff --git a/json/twitter-search/src/main/webapp/WEB-INF/beans.xml b/extra/twitter-search/src/main/webapp/WEB-INF/beans.xml similarity index 100% rename from json/twitter-search/src/main/webapp/WEB-INF/beans.xml rename to extra/twitter-search/src/main/webapp/WEB-INF/beans.xml diff --git a/json/twitter-search/src/main/webapp/index.jsp b/extra/twitter-search/src/main/webapp/index.jsp similarity index 100% rename from json/twitter-search/src/main/webapp/index.jsp rename to extra/twitter-search/src/main/webapp/index.jsp diff --git a/json/pom.xml b/json/pom.xml index 21eb04a8c..f26dceda3 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -19,7 +19,6 @@ object-reader streaming-generate streaming-parser - twitter-search From ef28aaedbf2d60581725606f377323acb364f83f Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 13 Sep 2013 10:20:26 -0700 Subject: [PATCH 003/995] Naming the Servlets appropriately --- ...let.java => ExecutorInvokeAllServlet.java} | 6 ++--- ...let.java => ExecutorInvokeAnyServlet.java} | 6 ++--- ...IServlet.java => ExecutorJNDIServlet.java} | 6 ++--- ...vlet.java => ExecutorListenerServlet.java} | 4 +-- ...vlet.java => ExecutorResourceServlet.java} | 4 +-- ...> ExecutorTaskWithTransactionServlet.java} | 4 +-- ....java => ManagedExecutorInEJBServlet.java} | 8 +++--- .../concurrency/executor/MyCallableTask.java | 2 +- .../concurrency/executor/MyRunnableTask.java | 2 +- .../executor/MyTaskWithTransaction.java | 25 ++++--------------- .../executor/src/main/webapp/index.jsp | 16 ++++++------ 11 files changed, 33 insertions(+), 50 deletions(-) rename concurrency/executor/src/main/java/org/javaee7/concurrency/executor/{TestInvokeAllServlet.java => ExecutorInvokeAllServlet.java} (96%) rename concurrency/executor/src/main/java/org/javaee7/concurrency/executor/{TestInvokeAnyServlet.java => ExecutorInvokeAnyServlet.java} (96%) rename concurrency/executor/src/main/java/org/javaee7/concurrency/executor/{TestJNDIServlet.java => ExecutorJNDIServlet.java} (96%) rename concurrency/executor/src/main/java/org/javaee7/concurrency/executor/{TestListenerServlet.java => ExecutorListenerServlet.java} (97%) rename concurrency/executor/src/main/java/org/javaee7/concurrency/executor/{TestResourceServlet.java => ExecutorResourceServlet.java} (97%) rename concurrency/executor/src/main/java/org/javaee7/concurrency/executor/{TestTransactionServlet.java => ExecutorTaskWithTransactionServlet.java} (97%) rename concurrency/executor/src/main/java/org/javaee7/concurrency/executor/{TestEJBServlet.java => ManagedExecutorInEJBServlet.java} (95%) diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestInvokeAllServlet.java b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorInvokeAllServlet.java similarity index 96% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestInvokeAllServlet.java rename to concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorInvokeAllServlet.java index 73a5c9cc0..ffe00daea 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestInvokeAllServlet.java +++ b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorInvokeAllServlet.java @@ -60,8 +60,8 @@ /** * @author Arun Gupta */ -@WebServlet(urlPatterns = {"/TestInvokeAllServlet"}) -public class TestInvokeAllServlet extends HttpServlet { +@WebServlet(urlPatterns = {"/ExecutorInvokeAllServlet"}) +public class ExecutorInvokeAllServlet extends HttpServlet { // @Resource(name = "concurrent/myExecutor2") @Resource(name = "DefaultManagedExecutorService") @@ -100,7 +100,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re out.format("got response: %d
", f.get().getId()); } } catch (InterruptedException | ExecutionException ex) { - Logger.getLogger(TestInvokeAllServlet.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(ExecutorInvokeAllServlet.class.getName()).log(Level.SEVERE, null, ex); } out.println("

Check server.log for output"); diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestInvokeAnyServlet.java b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorInvokeAnyServlet.java similarity index 96% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestInvokeAnyServlet.java rename to concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorInvokeAnyServlet.java index e1d34a674..4be7eea3b 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestInvokeAnyServlet.java +++ b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorInvokeAnyServlet.java @@ -58,8 +58,8 @@ /** * @author Arun Gupta */ -@WebServlet(urlPatterns = {"/TestInvokeAnyServlet"}) -public class TestInvokeAnyServlet extends HttpServlet { +@WebServlet(urlPatterns = {"/ExecutorInvokeAnyServlet"}) +public class ExecutorInvokeAnyServlet extends HttpServlet { // @Resource(name = "concurrent/myExecutor2") @Resource(name = "DefaultManagedExecutorService") @@ -96,7 +96,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re Product result = executor.invokeAny(tasks); out.format("got response: %d", result.getId()); } catch (InterruptedException | ExecutionException ex) { - Logger.getLogger(TestInvokeAnyServlet.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(ExecutorInvokeAnyServlet.class.getName()).log(Level.SEVERE, null, ex); } out.println("

Check server.log for output"); diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestJNDIServlet.java b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorJNDIServlet.java similarity index 96% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestJNDIServlet.java rename to concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorJNDIServlet.java index 2372e231d..27be2d2f7 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestJNDIServlet.java +++ b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorJNDIServlet.java @@ -55,8 +55,8 @@ /** * @author Arun Gupta */ -@WebServlet(urlPatterns = {"/TestJNDIServlet"}) -public class TestJNDIServlet extends HttpServlet { +@WebServlet(urlPatterns = {"/ExecutorJNDIServlet"}) +public class ExecutorJNDIServlet extends HttpServlet { /** * Processes requests for both HTTP @@ -92,7 +92,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re executor.submit(new MyCallableTask(i)); } } catch (NamingException ex) { - Logger.getLogger(TestResourceServlet.class.getName()).log(Level.SEVERE, null, ex); + Logger.getAnonymousLogger().log(Level.SEVERE, null, ex); } out.println("all tasks submitted

"); out.println("Check server.log for output from the task."); diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestListenerServlet.java b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorListenerServlet.java similarity index 97% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestListenerServlet.java rename to concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorListenerServlet.java index 0493ff29d..6fe2f0a28 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestListenerServlet.java +++ b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorListenerServlet.java @@ -52,8 +52,8 @@ /** * @author Arun Gupta */ -@WebServlet(urlPatterns = {"/TestListenerServlet"}) -public class TestListenerServlet extends HttpServlet { +@WebServlet(urlPatterns = {"/ExecutorListenerServlet"}) +public class ExecutorListenerServlet extends HttpServlet { // @Resource(name = "concurrent/myExecutor2") @Resource(name = "DefaultManagedExecutorService") diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestResourceServlet.java b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorResourceServlet.java similarity index 97% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestResourceServlet.java rename to concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorResourceServlet.java index f2b2deb14..ab9554258 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestResourceServlet.java +++ b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorResourceServlet.java @@ -53,8 +53,8 @@ /** * @author Arun Gupta */ -@WebServlet(urlPatterns = {"/TestResourceServlet"}) -public class TestResourceServlet extends HttpServlet { +@WebServlet(urlPatterns = {"/ExecutorResourceServlet"}) +public class ExecutorResourceServlet extends HttpServlet { // @Resource(name = "concurrent/myExecutor2") // @Resource(name = "DefaultManagedExecutorService") diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestTransactionServlet.java b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorTaskWithTransactionServlet.java similarity index 97% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestTransactionServlet.java rename to concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorTaskWithTransactionServlet.java index ae976b050..2baf2e0a1 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestTransactionServlet.java +++ b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorTaskWithTransactionServlet.java @@ -52,8 +52,8 @@ /** * @author Arun Gupta */ -@WebServlet(urlPatterns = {"/TestTransactionServlet"}) -public class TestTransactionServlet extends HttpServlet { +@WebServlet(urlPatterns = {"/ExecutorTaskWithTransactionServlet"}) +public class ExecutorTaskWithTransactionServlet extends HttpServlet { // @Resource(name = "concurrent/myExecutor2") @Resource(name = "DefaultManagedExecutorService") diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestEJBServlet.java b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ManagedExecutorInEJBServlet.java similarity index 95% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestEJBServlet.java rename to concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ManagedExecutorInEJBServlet.java index c0f113838..ce0744e7e 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestEJBServlet.java +++ b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ManagedExecutorInEJBServlet.java @@ -52,8 +52,8 @@ * * @author Arun */ -@WebServlet(urlPatterns = {"/TestEJBServlet"}) -public class TestEJBServlet extends HttpServlet { +@WebServlet(urlPatterns = {"/ManagedExecutorInEJBServlet"}) +public class ManagedExecutorInEJBServlet extends HttpServlet { @EJB TestBean bean; @@ -81,9 +81,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re out.println("

Run managed threads in EJB

"); out.println("Submitting tasks using ManagedExecutorService in EJB
"); bean.run(); - out.println("all tasks submitted

"); - out.println("Check server.log for output from the task."); - + out.println("

Check server.log for output from the task."); out.println(""); out.println(""); } diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyCallableTask.java b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyCallableTask.java index bd51eae2c..6267db00e 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyCallableTask.java +++ b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyCallableTask.java @@ -62,7 +62,7 @@ public Product call() { Thread.sleep(2000); System.out.format("%d (callable): complete", id); } catch (InterruptedException ex) { - Logger.getLogger(TestResourceServlet.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(ExecutorResourceServlet.class.getName()).log(Level.SEVERE, null, ex); } return new Product(id); } diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyRunnableTask.java b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyRunnableTask.java index b87a484cf..e7cac4352 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyRunnableTask.java +++ b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyRunnableTask.java @@ -61,7 +61,7 @@ public void run() { Thread.sleep(2000); System.out.format("%d (runnable): complete", id); } catch (InterruptedException ex) { - Logger.getLogger(TestResourceServlet.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(ExecutorResourceServlet.class.getName()).log(Level.SEVERE, null, ex); } } } diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyTaskWithTransaction.java b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyTaskWithTransaction.java index 1f1c49988..023f57670 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyTaskWithTransaction.java +++ b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyTaskWithTransaction.java @@ -48,13 +48,14 @@ import javax.transaction.NotSupportedException; import javax.transaction.RollbackException; import javax.transaction.SystemException; +import javax.transaction.Transactional; import javax.transaction.UserTransaction; /** * @author Arun Gupta */ public class MyTaskWithTransaction implements Runnable { - + private int id; public MyTaskWithTransaction() { @@ -73,26 +74,10 @@ public void setId(int id) { } // @Resource UserTransaction tx; - @Override + @Transactional public void run() { - - try { - InitialContext context = new InitialContext(); - UserTransaction tx = (UserTransaction)context.lookup("java:comp/UserTransaction"); - - try { - System.out.format("%d (transaction): tx.start", id); - tx.begin(); - System.out.format("%d (transaction): running", id); - tx.commit(); - System.out.format("%d (transaction): tx.commit", id); - } catch (NotSupportedException | SystemException | RollbackException | HeuristicMixedException | HeuristicRollbackException | SecurityException | IllegalStateException ex) { - Logger.getLogger(MyTaskWithTransaction.class.getName()).log(Level.SEVERE, null, ex); - } - } catch (NamingException ex) { - Logger.getLogger(MyTaskWithTransaction.class.getName()).log(Level.SEVERE, null, ex); - } + System.out.format("%d (within a transaction): running", id); } - + } diff --git a/concurrency/executor/src/main/webapp/index.jsp b/concurrency/executor/src/main/webapp/index.jsp index d396b2811..92336138c 100644 --- a/concurrency/executor/src/main/webapp/index.jsp +++ b/concurrency/executor/src/main/webapp/index.jsp @@ -47,17 +47,17 @@ - Concurrency Utilities for Java EE + Concurrency Utilities for Java EE : ManagedExecutor

Concurrency Utilities for Java EE : ManagedExecutor

- Get ManagedExecutor using @Resource (in Servlet)
- Get ManagedExecutor using JNDI Context (in Servlet)
- Run managed threads in EJB
- Submit tasks using invokeAll
- Submit tasks using invokeAny
- Submit tasks with ManagedTaskListener
- Run task with a UserTransaction
+ Get ManagedExecutor using @Resource (in Servlet)
+ Get ManagedExecutor using JNDI Context (in Servlet)
+ Run managed threads in EJB
+ Submit tasks using invokeAll
+ Submit tasks using invokeAny
+ Submit tasks with ManagedTaskListener
+ Run task with a UserTransaction
From 4d6b6baa34dbe7cbcd4fcaad7db1e743daf5b59c Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 13 Sep 2013 10:59:08 -0700 Subject: [PATCH 004/995] Getting the ManagedExecutor from web.xml --- .../org/javaee7/concurrency/executor/ExecutorJNDIServlet.java | 4 ++-- concurrency/executor/src/main/webapp/WEB-INF/web.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorJNDIServlet.java b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorJNDIServlet.java index 27be2d2f7..168bc71c1 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorJNDIServlet.java +++ b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorJNDIServlet.java @@ -83,8 +83,8 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re try { InitialContext ctx = new InitialContext(); -// ManagedExecutorService executor = (ManagedExecutorService) ctx.lookup("java:comp/env/concurrent/myExecutor2"); - ManagedExecutorService executor = (ManagedExecutorService) ctx.lookup("java:comp/DefaultManagedExecutorService"); + ManagedExecutorService executor = (ManagedExecutorService) ctx.lookup("java:comp/env/concurrent/myExecutor2"); +// ManagedExecutorService executor = (ManagedExecutorService) ctx.lookup("java:comp/DefaultManagedExecutorService"); for (int i = 0; i < 5; i++) { out.format("submitting runnable(%d)
", i); executor.submit(new MyRunnableTask(i)); diff --git a/concurrency/executor/src/main/webapp/WEB-INF/web.xml b/concurrency/executor/src/main/webapp/WEB-INF/web.xml index 58a527849..d22b467af 100644 --- a/concurrency/executor/src/main/webapp/WEB-INF/web.xml +++ b/concurrency/executor/src/main/webapp/WEB-INF/web.xml @@ -4,12 +4,12 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> - + From beb845ffadc8c1dc62b6c65eb13d99e9c09910a4 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 13 Sep 2013 13:11:31 -0700 Subject: [PATCH 005/995] Using transport.sendMessage instead of transport.send did the trick. Thanks Bill! --- .../javamail/definition/AnnotatedEmailServlet.java | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/javamail/definition/src/main/java/org/javaee7/javamail/definition/AnnotatedEmailServlet.java b/javamail/definition/src/main/java/org/javaee7/javamail/definition/AnnotatedEmailServlet.java index 29c9c53ce..93183b205 100644 --- a/javamail/definition/src/main/java/org/javaee7/javamail/definition/AnnotatedEmailServlet.java +++ b/javamail/definition/src/main/java/org/javaee7/javamail/definition/AnnotatedEmailServlet.java @@ -47,10 +47,8 @@ import javax.mail.MailSessionDefinition; import javax.mail.Message; import javax.mail.MessagingException; -import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; -import javax.mail.URLName; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.servlet.ServletException; @@ -66,14 +64,7 @@ @MailSessionDefinition(name = "java:comp/myMailSession", host = "smtp.gmail.com", transportProtocol = "smtps", -// host = "stbeehive.oracle.com", - // transportProtocol = "smtps", properties = { - // "mail.smtp.host=smtp.gmail.com", - // "mail.smtp.host=stbeehive.oracle.com", - // "mail.smtp.ssl.enable=true", - // "mail.smtp.auth=true", -// "mail.transport.protocol=smtps", "mail.debug=true" }) public class AnnotatedEmailServlet extends HttpServlet { @@ -119,11 +110,9 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re + Calendar.getInstance().getTime()); message.setText("Java EE 7 is cool!"); -// session.setPasswordAuthentication(new URLName("smtp", "stbeehive.oracle.com", -1, "/", creds.getFrom(), creds.getTo()), -// new PasswordAuthentication(creds.getFrom(), creds.getPassword())); Transport t = session.getTransport(); t.connect(creds.getFrom(), creds.getPassword()); - t.send(message, message.getAllRecipients()); + t.sendMessage(message, message.getAllRecipients()); out.println("message sent!"); From 6acf2e3bb4bd25f1465ab7d9d7b84e2ff7cecdc0 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 13 Sep 2013 13:11:54 -0700 Subject: [PATCH 006/995] Fixing the property names, although commented --- .../javamail/definition/ProgrammaticEmailServlet.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/javamail/definition/src/main/java/org/javaee7/javamail/definition/ProgrammaticEmailServlet.java b/javamail/definition/src/main/java/org/javaee7/javamail/definition/ProgrammaticEmailServlet.java index 691b9136d..b218bf8ca 100644 --- a/javamail/definition/src/main/java/org/javaee7/javamail/definition/ProgrammaticEmailServlet.java +++ b/javamail/definition/src/main/java/org/javaee7/javamail/definition/ProgrammaticEmailServlet.java @@ -88,7 +88,6 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re Properties props = new Properties(); props.put("mail.smtp.host", "smtp.gmail.com"); -// props.put("mail.smtp.host", "stbeehive.oracle.com"); props.put("mail.smtp.ssl.enable", "true"); props.put("mail.smtp.auth", "true"); props.put("mail.transport.protocol", "smtp"); @@ -120,8 +119,8 @@ protected PasswordAuthentication getPasswordAuthentication() { message.setText("Java EE 7 is cool!"); // Transport t = session.getTransport(); -// t.connect(creds.getProperty("username"), creds.getProperty("password")); -// t.send(message); +// t.connect(creds.getFrom(), creds.getTo()); +// t.sendMessage(message, message.getAllRecipients()); Transport.send(message, message.getAllRecipients()); out.println("message sent!"); From c3c402a28674082f93deb32281a9cc11598b9fba Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 13 Sep 2013 15:27:21 -0700 Subject: [PATCH 007/995] Default ManagedExecutor can be accessed using @Resource without specifying any name --- .../ExecutorResourceNoNameServlet.java | 141 ++++++++++++++++++ .../executor/src/main/webapp/index.jsp | 1 + 2 files changed, 142 insertions(+) create mode 100644 concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorResourceNoNameServlet.java diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorResourceNoNameServlet.java b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorResourceNoNameServlet.java new file mode 100644 index 000000000..4e1c75c11 --- /dev/null +++ b/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorResourceNoNameServlet.java @@ -0,0 +1,141 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.concurrency.executor; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.concurrent.Future; +import javax.annotation.Resource; +import javax.enterprise.concurrent.ManagedExecutorService; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @author Arun Gupta + */ +@WebServlet(urlPatterns = {"/ExecutorResourceNoNameServlet"}) +public class ExecutorResourceNoNameServlet extends HttpServlet { + + @Resource + ManagedExecutorService executor; + + + /** + * Processes requests for both HTTP + * GET and + * POST methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + try (PrintWriter out = response.getWriter()) { + out.println(""); + out.println(""); + out.println("Servlet TestServlet"); + out.println(""); + out.println(""); + out.println("

Get ManagedExecutor using @Resource with no name

"); + + System.out.println("Getting ManagedExecutorService using @Resource with no name"); + for (int i = 0; i < 5; i++) { + out.format("submitting runnable(%d)
", i); + Future f = executor.submit(new MyRunnableTask(i)); + out.format("executing runnable(%d)
", i); + executor.execute(new MyRunnableTask(i)); + out.format("submitting callable(%d)
", i); + Future f2 = executor.submit(new MyCallableTask(i)); + } + out.println("all tasks submitted

"); + out.println("Check server.log for output from the task."); + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP + * GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP + * POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/concurrency/executor/src/main/webapp/index.jsp b/concurrency/executor/src/main/webapp/index.jsp index 92336138c..760d7de0f 100644 --- a/concurrency/executor/src/main/webapp/index.jsp +++ b/concurrency/executor/src/main/webapp/index.jsp @@ -53,6 +53,7 @@

Concurrency Utilities for Java EE : ManagedExecutor

Get ManagedExecutor using @Resource (in Servlet)
+ Get ManagedExecutor using @Resource (in Servlet, no name specified)
Get ManagedExecutor using JNDI Context (in Servlet)
Run managed threads in EJB
Submit tasks using invokeAll
From e84bd4527b3e0f02699f860df8022e636366fda6 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 13 Sep 2013 15:36:31 -0700 Subject: [PATCH 008/995] Renaming the directory and artifactId --- concurrency/{executor => managedexecutor}/nb-configuration.xml | 0 concurrency/{executor => managedexecutor}/pom.xml | 3 ++- .../concurrency/managedexecutor}/ExecutorInvokeAllServlet.java | 2 +- .../concurrency/managedexecutor}/ExecutorInvokeAnyServlet.java | 2 +- .../concurrency/managedexecutor}/ExecutorJNDIServlet.java | 2 +- .../concurrency/managedexecutor}/ExecutorListenerServlet.java | 2 +- .../managedexecutor}/ExecutorResourceNoNameServlet.java | 2 +- .../concurrency/managedexecutor}/ExecutorResourceServlet.java | 2 +- .../managedexecutor}/ExecutorTaskWithTransactionServlet.java | 2 +- .../managedexecutor}/ManagedExecutorInEJBServlet.java | 2 +- .../javaee7/concurrency/managedexecutor}/MyCallableTask.java | 2 +- .../javaee7/concurrency/managedexecutor}/MyRunnableTask.java | 2 +- .../concurrency/managedexecutor}/MyTaskWithListener.java | 2 +- .../concurrency/managedexecutor}/MyTaskWithTransaction.java | 2 +- .../javaee7/concurrency/managedexecutor}/MyWaitingTask.java | 2 +- .../java/org/javaee7/concurrency/managedexecutor}/Product.java | 2 +- .../org/javaee7/concurrency/managedexecutor}/TestBean.java | 2 +- .../src/main/webapp/WEB-INF/web.xml | 0 .../{executor => managedexecutor}/src/main/webapp/index.jsp | 0 19 files changed, 17 insertions(+), 16 deletions(-) rename concurrency/{executor => managedexecutor}/nb-configuration.xml (100%) rename concurrency/{executor => managedexecutor}/pom.xml (88%) rename concurrency/{executor/src/main/java/org/javaee7/concurrency/executor => managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor}/ExecutorInvokeAllServlet.java (99%) rename concurrency/{executor/src/main/java/org/javaee7/concurrency/executor => managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor}/ExecutorInvokeAnyServlet.java (99%) rename concurrency/{executor/src/main/java/org/javaee7/concurrency/executor => managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor}/ExecutorJNDIServlet.java (99%) rename concurrency/{executor/src/main/java/org/javaee7/concurrency/executor => managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor}/ExecutorListenerServlet.java (99%) rename concurrency/{executor/src/main/java/org/javaee7/concurrency/executor => managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor}/ExecutorResourceNoNameServlet.java (99%) rename concurrency/{executor/src/main/java/org/javaee7/concurrency/executor => managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor}/ExecutorResourceServlet.java (99%) rename concurrency/{executor/src/main/java/org/javaee7/concurrency/executor => managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor}/ExecutorTaskWithTransactionServlet.java (99%) rename concurrency/{executor/src/main/java/org/javaee7/concurrency/executor => managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor}/ManagedExecutorInEJBServlet.java (99%) rename concurrency/{executor/src/main/java/org/javaee7/concurrency/executor => managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor}/MyCallableTask.java (98%) rename concurrency/{executor/src/main/java/org/javaee7/concurrency/executor => managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor}/MyRunnableTask.java (98%) rename concurrency/{executor/src/main/java/org/javaee7/concurrency/executor => managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor}/MyTaskWithListener.java (98%) rename concurrency/{executor/src/main/java/org/javaee7/concurrency/executor => managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor}/MyTaskWithTransaction.java (98%) rename concurrency/{executor/src/main/java/org/javaee7/concurrency/executor => managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor}/MyWaitingTask.java (97%) rename concurrency/{executor/src/main/java/org/javaee7/concurrency/executor => managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor}/Product.java (97%) rename concurrency/{executor/src/main/java/org/javaee7/concurrency/executor => managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor}/TestBean.java (98%) rename concurrency/{executor => managedexecutor}/src/main/webapp/WEB-INF/web.xml (100%) rename concurrency/{executor => managedexecutor}/src/main/webapp/index.jsp (100%) diff --git a/concurrency/executor/nb-configuration.xml b/concurrency/managedexecutor/nb-configuration.xml similarity index 100% rename from concurrency/executor/nb-configuration.xml rename to concurrency/managedexecutor/nb-configuration.xml diff --git a/concurrency/executor/pom.xml b/concurrency/managedexecutor/pom.xml similarity index 88% rename from concurrency/executor/pom.xml rename to concurrency/managedexecutor/pom.xml index cbd978a3f..440dc0ace 100644 --- a/concurrency/executor/pom.xml +++ b/concurrency/managedexecutor/pom.xml @@ -9,7 +9,8 @@ org.javaee7.concurrency - executor + managedexecutor 1.0-SNAPSHOT war + managedexecutor diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorInvokeAllServlet.java b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorInvokeAllServlet.java similarity index 99% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorInvokeAllServlet.java rename to concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorInvokeAllServlet.java index ffe00daea..e9a553f48 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorInvokeAllServlet.java +++ b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorInvokeAllServlet.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.concurrency.executor; +package org.javaee7.concurrency.managedexecutor; import java.io.IOException; import java.io.PrintWriter; diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorInvokeAnyServlet.java b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorInvokeAnyServlet.java similarity index 99% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorInvokeAnyServlet.java rename to concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorInvokeAnyServlet.java index 4be7eea3b..3463f5f4b 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorInvokeAnyServlet.java +++ b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorInvokeAnyServlet.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.concurrency.executor; +package org.javaee7.concurrency.managedexecutor; import java.io.IOException; import java.io.PrintWriter; diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorJNDIServlet.java b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorJNDIServlet.java similarity index 99% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorJNDIServlet.java rename to concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorJNDIServlet.java index 168bc71c1..489caa8dd 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorJNDIServlet.java +++ b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorJNDIServlet.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.concurrency.executor; +package org.javaee7.concurrency.managedexecutor; import java.io.IOException; import java.io.PrintWriter; diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorListenerServlet.java b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorListenerServlet.java similarity index 99% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorListenerServlet.java rename to concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorListenerServlet.java index 6fe2f0a28..05695de43 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorListenerServlet.java +++ b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorListenerServlet.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.concurrency.executor; +package org.javaee7.concurrency.managedexecutor; import java.io.IOException; import java.io.PrintWriter; diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorResourceNoNameServlet.java b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorResourceNoNameServlet.java similarity index 99% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorResourceNoNameServlet.java rename to concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorResourceNoNameServlet.java index 4e1c75c11..9ee01d66d 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorResourceNoNameServlet.java +++ b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorResourceNoNameServlet.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.concurrency.executor; +package org.javaee7.concurrency.managedexecutor; import java.io.IOException; import java.io.PrintWriter; diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorResourceServlet.java b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorResourceServlet.java similarity index 99% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorResourceServlet.java rename to concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorResourceServlet.java index ab9554258..2e1d3caec 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorResourceServlet.java +++ b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorResourceServlet.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.concurrency.executor; +package org.javaee7.concurrency.managedexecutor; import java.io.IOException; import java.io.PrintWriter; diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorTaskWithTransactionServlet.java b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorTaskWithTransactionServlet.java similarity index 99% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorTaskWithTransactionServlet.java rename to concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorTaskWithTransactionServlet.java index 2baf2e0a1..889a05ced 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ExecutorTaskWithTransactionServlet.java +++ b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ExecutorTaskWithTransactionServlet.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.concurrency.executor; +package org.javaee7.concurrency.managedexecutor; import java.io.IOException; import java.io.PrintWriter; diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ManagedExecutorInEJBServlet.java b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ManagedExecutorInEJBServlet.java similarity index 99% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ManagedExecutorInEJBServlet.java rename to concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ManagedExecutorInEJBServlet.java index ce0744e7e..db651e4c4 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/ManagedExecutorInEJBServlet.java +++ b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/ManagedExecutorInEJBServlet.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.concurrency.executor; +package org.javaee7.concurrency.managedexecutor; import java.io.IOException; import java.io.PrintWriter; diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyCallableTask.java b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/MyCallableTask.java similarity index 98% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyCallableTask.java rename to concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/MyCallableTask.java index 6267db00e..0761dd48c 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyCallableTask.java +++ b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/MyCallableTask.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.concurrency.executor; +package org.javaee7.concurrency.managedexecutor; import java.util.concurrent.Callable; import java.util.logging.Level; diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyRunnableTask.java b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/MyRunnableTask.java similarity index 98% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyRunnableTask.java rename to concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/MyRunnableTask.java index e7cac4352..48dfb2c9b 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyRunnableTask.java +++ b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/MyRunnableTask.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.concurrency.executor; +package org.javaee7.concurrency.managedexecutor; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyTaskWithListener.java b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/MyTaskWithListener.java similarity index 98% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyTaskWithListener.java rename to concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/MyTaskWithListener.java index 52b30579e..b2c90d02b 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyTaskWithListener.java +++ b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/MyTaskWithListener.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.concurrency.executor; +package org.javaee7.concurrency.managedexecutor; import java.util.Map; import java.util.concurrent.Future; diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyTaskWithTransaction.java b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/MyTaskWithTransaction.java similarity index 98% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyTaskWithTransaction.java rename to concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/MyTaskWithTransaction.java index 023f57670..f42619f73 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyTaskWithTransaction.java +++ b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/MyTaskWithTransaction.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.concurrency.executor; +package org.javaee7.concurrency.managedexecutor; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyWaitingTask.java b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/MyWaitingTask.java similarity index 97% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyWaitingTask.java rename to concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/MyWaitingTask.java index bcd3a07c7..00531f35c 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/MyWaitingTask.java +++ b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/MyWaitingTask.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.concurrency.executor; +package org.javaee7.concurrency.managedexecutor; /** * @author Arun Gupta diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/Product.java b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/Product.java similarity index 97% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/Product.java rename to concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/Product.java index b9466a6f6..66e8a6e3a 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/Product.java +++ b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/Product.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.concurrency.executor; +package org.javaee7.concurrency.managedexecutor; /** * @author Arun Gupta diff --git a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestBean.java b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/TestBean.java similarity index 98% rename from concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestBean.java rename to concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/TestBean.java index 9fbde5279..8ceb1f5aa 100644 --- a/concurrency/executor/src/main/java/org/javaee7/concurrency/executor/TestBean.java +++ b/concurrency/managedexecutor/src/main/java/org/javaee7/concurrency/managedexecutor/TestBean.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.concurrency.executor; +package org.javaee7.concurrency.managedexecutor; import javax.annotation.Resource; import javax.ejb.Stateless; diff --git a/concurrency/executor/src/main/webapp/WEB-INF/web.xml b/concurrency/managedexecutor/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from concurrency/executor/src/main/webapp/WEB-INF/web.xml rename to concurrency/managedexecutor/src/main/webapp/WEB-INF/web.xml diff --git a/concurrency/executor/src/main/webapp/index.jsp b/concurrency/managedexecutor/src/main/webapp/index.jsp similarity index 100% rename from concurrency/executor/src/main/webapp/index.jsp rename to concurrency/managedexecutor/src/main/webapp/index.jsp From ca795591b8898e430214c408b360b4ca3d582b4e Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 13 Sep 2013 15:42:25 -0700 Subject: [PATCH 009/995] Changing schedule to managedscheduledexecutor, also changed the servlet names to be more intuitive --- .../nb-configuration.xml | 18 ++ concurrency/managedscheduledexecutor/pom.xml | 16 ++ .../MyCallableTask.java | 71 ++++++++ .../MyRunnableTask.java | 57 +++++++ .../managedscheduledexecutor/MyTrigger.java | 61 +++++++ .../managedscheduledexecutor/Product.java | 62 +++++++ .../ScheduleFixedRateServlet.java | 140 +++++++++++++++ .../ScheduleServlet.java | 160 ++++++++++++++++++ .../ScheduleWithFixedDelayServlet.java | 135 +++++++++++++++ .../TestTriggerServlet.java | 133 +++++++++++++++ .../src/main/webapp/index.jsp | 59 +++++++ 11 files changed, 912 insertions(+) create mode 100644 concurrency/managedscheduledexecutor/nb-configuration.xml create mode 100644 concurrency/managedscheduledexecutor/pom.xml create mode 100644 concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/MyCallableTask.java create mode 100644 concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/MyRunnableTask.java create mode 100644 concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/MyTrigger.java create mode 100644 concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/Product.java create mode 100644 concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/ScheduleFixedRateServlet.java create mode 100644 concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/ScheduleServlet.java create mode 100644 concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/ScheduleWithFixedDelayServlet.java create mode 100644 concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/TestTriggerServlet.java create mode 100644 concurrency/managedscheduledexecutor/src/main/webapp/index.jsp diff --git a/concurrency/managedscheduledexecutor/nb-configuration.xml b/concurrency/managedscheduledexecutor/nb-configuration.xml new file mode 100644 index 000000000..e38c5dc5a --- /dev/null +++ b/concurrency/managedscheduledexecutor/nb-configuration.xml @@ -0,0 +1,18 @@ + + + + + + gfv3ee6 + + diff --git a/concurrency/managedscheduledexecutor/pom.xml b/concurrency/managedscheduledexecutor/pom.xml new file mode 100644 index 000000000..8ef884bf0 --- /dev/null +++ b/concurrency/managedscheduledexecutor/pom.xml @@ -0,0 +1,16 @@ + + 4.0.0 + + org.javaee7.concurrency + concurrency-samples + 1.0-SNAPSHOT + ../pom.xml + + + org.javaee7.concurrency + managedscheduledexecutor + 1.0-SNAPSHOT + war + managedscheduledexecutor + diff --git a/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/MyCallableTask.java b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/MyCallableTask.java new file mode 100644 index 000000000..ae0a6be92 --- /dev/null +++ b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/MyCallableTask.java @@ -0,0 +1,71 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.concurrency.managedscheduledexecutor; + +import java.util.concurrent.Callable; + +/** + * @author Arun Gupta + */ +public class MyCallableTask implements Callable { + + private int id; + + public MyCallableTask() { + } + + public MyCallableTask(int id) { + this.id = id; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + @Override + public Product call() { + System.out.println("Running Callable Task: " + id); + return new Product(id); + } +} diff --git a/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/MyRunnableTask.java b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/MyRunnableTask.java new file mode 100644 index 000000000..fe0cf107c --- /dev/null +++ b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/MyRunnableTask.java @@ -0,0 +1,57 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.concurrency.managedscheduledexecutor; + +/** + * @author Arun Gupta + */ +public class MyRunnableTask implements Runnable { + + private int id; + + public MyRunnableTask(int id) { + this.id = id; + } + + @Override + public void run() { + System.out.println("Running Runnable Task: " + id); + } +} diff --git a/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/MyTrigger.java b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/MyTrigger.java new file mode 100644 index 000000000..5b45e3c5c --- /dev/null +++ b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/MyTrigger.java @@ -0,0 +1,61 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.concurrency.managedscheduledexecutor; + +import java.util.Date; +import javax.enterprise.concurrent.LastExecution; +import javax.enterprise.concurrent.Trigger; + +/** + * @author Arun Gupta + */ +public class MyTrigger implements Trigger { + + @Override + public Date getNextRunTime(LastExecution le, Date date) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public boolean skipRun(LastExecution le, Date date) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + +} diff --git a/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/Product.java b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/Product.java new file mode 100644 index 000000000..25e625d20 --- /dev/null +++ b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/Product.java @@ -0,0 +1,62 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.concurrency.managedscheduledexecutor; + +/** + * @author Arun Gupta + */ +public class Product { + private int id; + + public Product() { + } + + public Product(int id) { + this.id = id; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } +} diff --git a/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/ScheduleFixedRateServlet.java b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/ScheduleFixedRateServlet.java new file mode 100644 index 000000000..73fe6f921 --- /dev/null +++ b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/ScheduleFixedRateServlet.java @@ -0,0 +1,140 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.concurrency.managedscheduledexecutor; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.concurrent.TimeUnit; +import javax.annotation.Resource; +import javax.enterprise.concurrent.ManagedScheduledExecutorService; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @author Arun Gupta + */ +@WebServlet(urlPatterns = {"/ScheduleFixedRateServlet"}) +public class ScheduleFixedRateServlet extends HttpServlet { + +// @Resource(name = "concurrent/myScheduledExecutor2") + @Resource(name = "DefaultManagedScheduledExecutorService") + ManagedScheduledExecutorService executor; + + /** + * Processes requests for both HTTP + * GET and + * POST methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + try (PrintWriter out = response.getWriter()) { + out.println(""); + out.println(""); + out.println(""); + out.println("Schedule at fixed rate"); + out.println(""); + out.println(""); + out.println("

Schedule at fixed rate

"); +// ScheduledFuture f = executor.scheduleAtFixedRate(new MyRunnableTask(5), 2, 3, TimeUnit.SECONDS); +// try { +// Thread.sleep(1000); +// } catch (InterruptedException ex) { +// Logger.getLogger(TestScheduleFixedRateServlet.class.getName()).log(Level.SEVERE, null, ex); +// } +// f.cancel(true); + + executor.scheduleWithFixedDelay(new MyRunnableTask(5), 2, 3, TimeUnit.SECONDS); + System.out.println("Runnable Task completed"); + out.println("

Check server.log for output"); + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP + * GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP + * POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// +} diff --git a/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/ScheduleServlet.java b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/ScheduleServlet.java new file mode 100644 index 000000000..c0f6628a3 --- /dev/null +++ b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/ScheduleServlet.java @@ -0,0 +1,160 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.concurrency.managedscheduledexecutor; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.annotation.Resource; +import javax.enterprise.concurrent.ManagedScheduledExecutorService; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + * @author arungup + */ +@WebServlet(urlPatterns = {"/ScheduleServlet"}) +public class ScheduleServlet extends HttpServlet { + +// @Resource(name = "concurrent/myScheduledExecutor2") + @Resource(name = "DefaultManagedScheduledExecutorService") + ManagedScheduledExecutorService executor; + + /** + * Processes requests for both HTTP + * GET and + * POST methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + try (PrintWriter out = response.getWriter()) { + out.println(""); + out.println(""); + out.println(""); + out.println("Schedule using Callable after 5 seconds"); + out.println(""); + out.println(""); + out.println("

Schedule using Callable after 5 seconds

"); + out.println("

Scheduling tasks using Callable

"); + ScheduledFuture future = executor.schedule(new MyCallableTask(5), 5, TimeUnit.SECONDS); + while (true) { + if (future.isDone()) { + break; + } else { + System.out.println("Checking Callable Future, waiting for 1 sec"); + Thread.sleep(1000); + } + } + out.println("Callable Task completed: " + future.get().getId()); + + out.println("

Scheduling tasks using Runnable

"); + ScheduledFuture f = executor.schedule(new MyRunnableTask(10), 5, TimeUnit.SECONDS); + while (true) { + if (f.isDone()) { + break; + } else { + System.out.println("Checking Runnable Future, waiting for 1 sec"); + Thread.sleep(1000); + } + } + out.println("Runnable Task completed: " + future.get().getId()); + out.println("

Check server.log for output"); + out.println(""); + out.println(""); + } catch (InterruptedException | ExecutionException ex) { + Logger.getLogger(ScheduleServlet.class.getName()).log(Level.SEVERE, null, ex); + } + } + + // + /** + * Handles the HTTP + * GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP + * POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// +} diff --git a/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/ScheduleWithFixedDelayServlet.java b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/ScheduleWithFixedDelayServlet.java new file mode 100644 index 000000000..bbe40d5cf --- /dev/null +++ b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/ScheduleWithFixedDelayServlet.java @@ -0,0 +1,135 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.concurrency.managedscheduledexecutor; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.concurrent.TimeUnit; +import javax.annotation.Resource; +import javax.enterprise.concurrent.ManagedScheduledExecutorService; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @author Arun Gupta + */ +@WebServlet(urlPatterns = {"/ScheduleWithFixedDelayServlet"}) +public class ScheduleWithFixedDelayServlet extends HttpServlet { + +// @Resource(name = "concurrent/myScheduledExecutor2") +// @Resource(name = "DefaultManagedScheduledExecutorService") + @Resource + ManagedScheduledExecutorService executor; + + /** + * Processes requests for both HTTP + * GET and + * POST methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + try (PrintWriter out = response.getWriter()) { + out.println(""); + out.println(""); + out.println(""); + out.println("Schedule with fixed delay"); + out.println(""); + out.println(""); + out.println("

Schedule tasks with fixed delay

"); + + executor.scheduleWithFixedDelay(new MyRunnableTask(5), 2, 3, TimeUnit.SECONDS); + out.println("

Check server.log for output"); + System.out.println("Runnable Task submitted"); + + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP + * GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP + * POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// +} diff --git a/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/TestTriggerServlet.java b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/TestTriggerServlet.java new file mode 100644 index 000000000..808761ec7 --- /dev/null +++ b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/TestTriggerServlet.java @@ -0,0 +1,133 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.concurrency.managedscheduledexecutor; + +import java.io.IOException; +import java.io.PrintWriter; +import javax.annotation.Resource; +import javax.enterprise.concurrent.ManagedScheduledExecutorService; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @author Arun Gupta + */ +@WebServlet(urlPatterns = {"/TestTriggerServlet"}) +public class TestTriggerServlet extends HttpServlet { + +// @Resource(name = "concurrent/myScheduledExecutor2") + @Resource(name = "DefaultManagedScheduledExecutorService") + ManagedScheduledExecutorService executor; + + /** + * Processes requests for both HTTP + * GET and + * POST methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + try (PrintWriter out = response.getWriter()) { + out.println(""); + out.println(""); + out.println(""); + out.println("Servlet TestServlet"); + out.println(""); + out.println(""); + out.println("

Schedule tasks with a trigger

"); + for (int i=0; i<5; i++) { + executor.schedule(new MyRunnableTask(i), new MyTrigger()); + } + out.println("

Check server.log for output"); + + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP + * GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP + * POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// +} diff --git a/concurrency/managedscheduledexecutor/src/main/webapp/index.jsp b/concurrency/managedscheduledexecutor/src/main/webapp/index.jsp new file mode 100644 index 000000000..449a20efa --- /dev/null +++ b/concurrency/managedscheduledexecutor/src/main/webapp/index.jsp @@ -0,0 +1,59 @@ + + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + + Concurrency Utilities for Java EE : ManagedScheduledExecutor + + +

Concurrency Utilities for Java EE : ManagedScheduledExecutor

+ + Schedule using Callable after 5 seconds
+ Schedule at fixed rate
+ Schedule with fixed delay
+ + From 49c114298935cffe666c0ac7e7f4667b258c411c Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 13 Sep 2013 16:00:34 -0700 Subject: [PATCH 010/995] Changing thread to manageablethreas, also added a new sample to show how default ManagedThreadFactory can be obtained using @Resource without specifying the name --- .../manageablethread/nb-configuration.xml | 18 +++ concurrency/manageablethread/pom.xml | 16 ++ .../concurrency/manageablethread/MyTask.java | 57 +++++++ .../manageablethread/TestJNDIServlet.java | 142 ++++++++++++++++++ .../TestResourceNoNameServlet.java | 135 +++++++++++++++++ .../manageablethread/TestResourceServlet.java | 136 +++++++++++++++++ .../src/main/webapp/index.jsp | 59 ++++++++ 7 files changed, 563 insertions(+) create mode 100644 concurrency/manageablethread/nb-configuration.xml create mode 100644 concurrency/manageablethread/pom.xml create mode 100644 concurrency/manageablethread/src/main/java/org/javaee7/concurrency/manageablethread/MyTask.java create mode 100644 concurrency/manageablethread/src/main/java/org/javaee7/concurrency/manageablethread/TestJNDIServlet.java create mode 100644 concurrency/manageablethread/src/main/java/org/javaee7/concurrency/manageablethread/TestResourceNoNameServlet.java create mode 100644 concurrency/manageablethread/src/main/java/org/javaee7/concurrency/manageablethread/TestResourceServlet.java create mode 100644 concurrency/manageablethread/src/main/webapp/index.jsp diff --git a/concurrency/manageablethread/nb-configuration.xml b/concurrency/manageablethread/nb-configuration.xml new file mode 100644 index 000000000..e38c5dc5a --- /dev/null +++ b/concurrency/manageablethread/nb-configuration.xml @@ -0,0 +1,18 @@ + + + + + + gfv3ee6 + + diff --git a/concurrency/manageablethread/pom.xml b/concurrency/manageablethread/pom.xml new file mode 100644 index 000000000..d9552c7b6 --- /dev/null +++ b/concurrency/manageablethread/pom.xml @@ -0,0 +1,16 @@ + + 4.0.0 + + org.javaee7.concurrency + concurrency-samples + 1.0-SNAPSHOT + ../pom.xml + + + org.javaee7.concurrency + manageablethread + 1.0-SNAPSHOT + war + manageablethread + diff --git a/concurrency/manageablethread/src/main/java/org/javaee7/concurrency/manageablethread/MyTask.java b/concurrency/manageablethread/src/main/java/org/javaee7/concurrency/manageablethread/MyTask.java new file mode 100644 index 000000000..7ea2b878b --- /dev/null +++ b/concurrency/manageablethread/src/main/java/org/javaee7/concurrency/manageablethread/MyTask.java @@ -0,0 +1,57 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.concurrency.manageablethread; + +/** + * @author Arun Gupta + */ +public class MyTask implements Runnable { + + private int id; + + public MyTask(int id) { + this.id = id; + } + + @Override + public void run() { + System.out.println("Running Task: " + id); + } +} diff --git a/concurrency/manageablethread/src/main/java/org/javaee7/concurrency/manageablethread/TestJNDIServlet.java b/concurrency/manageablethread/src/main/java/org/javaee7/concurrency/manageablethread/TestJNDIServlet.java new file mode 100644 index 000000000..ee0c209a6 --- /dev/null +++ b/concurrency/manageablethread/src/main/java/org/javaee7/concurrency/manageablethread/TestJNDIServlet.java @@ -0,0 +1,142 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.concurrency.manageablethread; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.enterprise.concurrent.ManagedThreadFactory; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @author Arun Gupta + */ +@WebServlet(urlPatterns = {"/TestJNDIServlet"}) +public class TestJNDIServlet extends HttpServlet { + + /** + * Processes requests for both HTTP + * GET and + * POST methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + try (PrintWriter out = response.getWriter()) { + out.println(""); + out.println(""); + out.println(""); + out.println("Servlet TestJNDIServlet"); + out.println(""); + out.println(""); + out.println("

Getting ManagedThreadFactory using JNDI lookup

"); + try { + InitialContext ctx = new InitialContext(); + + ManagedThreadFactory factory = (ManagedThreadFactory) ctx.lookup("java:comp/DefaultManagedThreadFactory"); +// ManagedExecutorService executor = (ManagedExecutorService) ctx.lookup("concurrent/myExecutor"); + out.println("Getting ManageableThread
"); + Thread thread = factory.newThread(new MyTask(2)); + out.println("Starting thread
"); + thread.start(); + out.println("Thread started

"); + } catch (NamingException ex) { + Logger.getLogger(TestResourceServlet.class.getName()).log(Level.SEVERE, null, ex); + } + out.println("all tasks submitted

"); + out.println("Check server.log for output from the task."); + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP + * GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP + * POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// +} diff --git a/concurrency/manageablethread/src/main/java/org/javaee7/concurrency/manageablethread/TestResourceNoNameServlet.java b/concurrency/manageablethread/src/main/java/org/javaee7/concurrency/manageablethread/TestResourceNoNameServlet.java new file mode 100644 index 000000000..09ceb81b2 --- /dev/null +++ b/concurrency/manageablethread/src/main/java/org/javaee7/concurrency/manageablethread/TestResourceNoNameServlet.java @@ -0,0 +1,135 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.concurrency.manageablethread; + +import java.io.IOException; +import java.io.PrintWriter; +import javax.annotation.Resource; +import javax.enterprise.concurrent.ManagedThreadFactory; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @author Arun Gupta + */ +@WebServlet(urlPatterns = {"/TestResourceNoNameServlet"}) +public class TestResourceNoNameServlet extends HttpServlet { + + @Resource + ManagedThreadFactory factory; + + + /** + * Processes requests for both HTTP + * GET and + * POST methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + try (PrintWriter out = response.getWriter()) { + out.println(""); + out.println(""); + out.println("Getting ManagedThreadFactory using @Resource with no name"); + out.println(""); + out.println(""); + out.println("

Getting ManagedThreadFactory using @Resource with no name

"); + + out.println("Getting ManageableThread
"); + Thread thread = factory.newThread(new MyTask(1)); + out.println("Starting thread
"); + thread.start(); + out.println("Thread started

"); + out.println("Check server.log for output from the task."); + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP + * GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP + * POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/concurrency/manageablethread/src/main/java/org/javaee7/concurrency/manageablethread/TestResourceServlet.java b/concurrency/manageablethread/src/main/java/org/javaee7/concurrency/manageablethread/TestResourceServlet.java new file mode 100644 index 000000000..83c3329c3 --- /dev/null +++ b/concurrency/manageablethread/src/main/java/org/javaee7/concurrency/manageablethread/TestResourceServlet.java @@ -0,0 +1,136 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.concurrency.manageablethread; + +import java.io.IOException; +import java.io.PrintWriter; +import javax.annotation.Resource; +import javax.enterprise.concurrent.ManagedThreadFactory; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @author Arun Gupta + */ +@WebServlet(urlPatterns = {"/TestResourceServlet"}) +public class TestResourceServlet extends HttpServlet { + +// @Resource(name = "concurrent/myFactory") + @Resource(name = "DefaultManagedThreadFactory") + ManagedThreadFactory factory; + + + /** + * Processes requests for both HTTP + * GET and + * POST methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + try (PrintWriter out = response.getWriter()) { + out.println(""); + out.println(""); + out.println("Servlet TestServlet"); + out.println(""); + out.println(""); + out.println("

Getting ManagedThreadFactory using @Resource

"); + + out.println("Getting ManageableThread
"); + Thread thread = factory.newThread(new MyTask(1)); + out.println("Starting thread
"); + thread.start(); + out.println("Thread started

"); + out.println("Check server.log for output from the task."); + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP + * GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP + * POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/concurrency/manageablethread/src/main/webapp/index.jsp b/concurrency/manageablethread/src/main/webapp/index.jsp new file mode 100644 index 000000000..62be6c265 --- /dev/null +++ b/concurrency/manageablethread/src/main/webapp/index.jsp @@ -0,0 +1,59 @@ + + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + + Concurrency Utilities for Java EE : ManageableThread and ManagedThreadFactory + + +

Concurrency Utilities for Java EE : ManageableThread and ManagedThreadFactory

+ + Create a new ManagebleThread and run (using @Resource)
+ Create a new ManagebleThread and run (using @Resource, with no name)
+ Create a new ManagebleThread and run (using JNDI)
+ + From 58f1848ca1d58805949780247a55bbf03eb95c2e Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Sat, 14 Sep 2013 20:46:49 -0700 Subject: [PATCH 011/995] Changing to scheduleAtFixedRate --- .../ScheduleFixedRateServlet.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/ScheduleFixedRateServlet.java b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/ScheduleFixedRateServlet.java index 73fe6f921..4c0bf71f3 100644 --- a/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/ScheduleFixedRateServlet.java +++ b/concurrency/managedscheduledexecutor/src/main/java/org/javaee7/concurrency/managedscheduledexecutor/ScheduleFixedRateServlet.java @@ -41,6 +41,7 @@ import java.io.IOException; import java.io.PrintWriter; +import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import javax.annotation.Resource; import javax.enterprise.concurrent.ManagedScheduledExecutorService; @@ -81,15 +82,15 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re out.println(""); out.println(""); out.println("

Schedule at fixed rate

"); -// ScheduledFuture f = executor.scheduleAtFixedRate(new MyRunnableTask(5), 2, 3, TimeUnit.SECONDS); -// try { -// Thread.sleep(1000); -// } catch (InterruptedException ex) { -// Logger.getLogger(TestScheduleFixedRateServlet.class.getName()).log(Level.SEVERE, null, ex); -// } -// f.cancel(true); - - executor.scheduleWithFixedDelay(new MyRunnableTask(5), 2, 3, TimeUnit.SECONDS); + ScheduledFuture f = executor.scheduleAtFixedRate(new MyRunnableTask(5), 2, 3, TimeUnit.SECONDS); +//// try { +//// Thread.sleep(1000); +//// } catch (InterruptedException ex) { +//// Logger.getLogger(TestScheduleFixedRateServlet.class.getName()).log(Level.SEVERE, null, ex); +//// } +//// f.cancel(true); +// +// executor.scheduleWithFixedDelay(new MyRunnableTask(5), 2, 3, TimeUnit.SECONDS); System.out.println("Runnable Task completed"); out.println("

Check server.log for output"); out.println(""); From 7534080a602ef1b1bbcb13e17becfa467ff68181 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Sat, 14 Sep 2013 20:46:57 -0700 Subject: [PATCH 012/995] FIxing the module names --- concurrency/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/concurrency/pom.xml b/concurrency/pom.xml index e1dd765f8..fd2c32e12 100644 --- a/concurrency/pom.xml +++ b/concurrency/pom.xml @@ -16,10 +16,10 @@ Java EE 7 Concurrency Samples + managedexecutor + managedscheduledexecutor + manageablethread dynamicproxy - executor - schedule - threads From 91214142628b072b31e253d04c0844b190f75abc Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Sun, 15 Sep 2013 08:51:10 -0700 Subject: [PATCH 013/995] Fixed the module name --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b1af2bfcf..3f48238cf 100644 --- a/pom.xml +++ b/pom.xml @@ -60,7 +60,7 @@ servlet validation websocket - extras + extra
From e6ca20be6873011ba0fab24d01f61afb0a2f1e9c Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Sun, 15 Sep 2013 08:51:49 -0700 Subject: [PATCH 014/995] Removing stale module --- concurrency/schedule/pom.xml | 15 -- .../concurrency/schedule/MyCallableTask.java | 71 -------- .../concurrency/schedule/MyRunnableTask.java | 57 ------- .../concurrency/schedule/MyTrigger.java | 61 ------- .../javaee7/concurrency/schedule/Product.java | 62 ------- .../TestScheduleFixedRateServlet.java | 140 --------------- .../schedule/TestScheduleServlet.java | 160 ------------------ .../TestScheduleWithFixedDelayServlet.java | 134 --------------- .../schedule/TestTriggerServlet.java | 133 --------------- .../schedule/src/main/webapp/index.jsp | 59 ------- concurrency/threads/nb-configuration.xml | 18 -- concurrency/threads/pom.xml | 15 -- .../javaee7/concurrency/threads/MyTask.java | 57 ------- .../concurrency/threads/TestJNDIServlet.java | 142 ---------------- .../threads/TestResourceServlet.java | 136 --------------- concurrency/threads/src/main/webapp/index.jsp | 58 ------- 16 files changed, 1318 deletions(-) delete mode 100644 concurrency/schedule/pom.xml delete mode 100644 concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/MyCallableTask.java delete mode 100644 concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/MyRunnableTask.java delete mode 100644 concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/MyTrigger.java delete mode 100644 concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/Product.java delete mode 100644 concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/TestScheduleFixedRateServlet.java delete mode 100644 concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/TestScheduleServlet.java delete mode 100644 concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/TestScheduleWithFixedDelayServlet.java delete mode 100644 concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/TestTriggerServlet.java delete mode 100644 concurrency/schedule/src/main/webapp/index.jsp delete mode 100644 concurrency/threads/nb-configuration.xml delete mode 100644 concurrency/threads/pom.xml delete mode 100644 concurrency/threads/src/main/java/org/javaee7/concurrency/threads/MyTask.java delete mode 100644 concurrency/threads/src/main/java/org/javaee7/concurrency/threads/TestJNDIServlet.java delete mode 100644 concurrency/threads/src/main/java/org/javaee7/concurrency/threads/TestResourceServlet.java delete mode 100644 concurrency/threads/src/main/webapp/index.jsp diff --git a/concurrency/schedule/pom.xml b/concurrency/schedule/pom.xml deleted file mode 100644 index 865d4751c..000000000 --- a/concurrency/schedule/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - 4.0.0 - - org.javaee7.concurrency - concurrency-samples - 1.0-SNAPSHOT - ../pom.xml - - - org.javaee7.concurrency - schedule - 1.0-SNAPSHOT - war - diff --git a/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/MyCallableTask.java b/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/MyCallableTask.java deleted file mode 100644 index e345ab9fd..000000000 --- a/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/MyCallableTask.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package org.javaee7.concurrency.schedule; - -import java.util.concurrent.Callable; - -/** - * @author Arun Gupta - */ -public class MyCallableTask implements Callable { - - private int id; - - public MyCallableTask() { - } - - public MyCallableTask(int id) { - this.id = id; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - @Override - public Product call() { - System.out.println("Running Callable Task: " + id); - return new Product(id); - } -} diff --git a/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/MyRunnableTask.java b/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/MyRunnableTask.java deleted file mode 100644 index f40048331..000000000 --- a/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/MyRunnableTask.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package org.javaee7.concurrency.schedule; - -/** - * @author Arun Gupta - */ -public class MyRunnableTask implements Runnable { - - private int id; - - public MyRunnableTask(int id) { - this.id = id; - } - - @Override - public void run() { - System.out.println("Running Runnable Task: " + id); - } -} diff --git a/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/MyTrigger.java b/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/MyTrigger.java deleted file mode 100644 index 272fefe45..000000000 --- a/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/MyTrigger.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package org.javaee7.concurrency.schedule; - -import java.util.Date; -import javax.enterprise.concurrent.LastExecution; -import javax.enterprise.concurrent.Trigger; - -/** - * @author Arun Gupta - */ -public class MyTrigger implements Trigger { - - @Override - public Date getNextRunTime(LastExecution le, Date date) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public boolean skipRun(LastExecution le, Date date) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - -} diff --git a/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/Product.java b/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/Product.java deleted file mode 100644 index b5b50f0eb..000000000 --- a/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/Product.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package org.javaee7.concurrency.schedule; - -/** - * @author Arun Gupta - */ -public class Product { - private int id; - - public Product() { - } - - public Product(int id) { - this.id = id; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } -} diff --git a/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/TestScheduleFixedRateServlet.java b/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/TestScheduleFixedRateServlet.java deleted file mode 100644 index 9d02416b3..000000000 --- a/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/TestScheduleFixedRateServlet.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package org.javaee7.concurrency.schedule; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.concurrent.TimeUnit; -import javax.annotation.Resource; -import javax.enterprise.concurrent.ManagedScheduledExecutorService; -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author Arun Gupta - */ -@WebServlet(urlPatterns = {"/TestScheduleFixedRateServlet"}) -public class TestScheduleFixedRateServlet extends HttpServlet { - -// @Resource(name = "concurrent/myScheduledExecutor2") - @Resource(name = "DefaultManagedScheduledExecutorService") - ManagedScheduledExecutorService executor; - - /** - * Processes requests for both HTTP - * GET and - * POST methods. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - protected void processRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - response.setContentType("text/html;charset=UTF-8"); - try (PrintWriter out = response.getWriter()) { - out.println(""); - out.println(""); - out.println(""); - out.println("Schedule at fixed rate"); - out.println(""); - out.println(""); - out.println("

Schedule at fixed rate

"); -// ScheduledFuture f = executor.scheduleAtFixedRate(new MyRunnableTask(5), 2, 3, TimeUnit.SECONDS); -// try { -// Thread.sleep(1000); -// } catch (InterruptedException ex) { -// Logger.getLogger(TestScheduleFixedRateServlet.class.getName()).log(Level.SEVERE, null, ex); -// } -// f.cancel(true); - - executor.scheduleWithFixedDelay(new MyRunnableTask(5), 2, 3, TimeUnit.SECONDS); - System.out.println("Runnable Task completed"); - out.println("

Check server.log for output"); - out.println(""); - out.println(""); - } - } - - // - /** - * Handles the HTTP - * GET method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Handles the HTTP - * POST method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Returns a short description of the servlet. - * - * @return a String containing servlet description - */ - @Override - public String getServletInfo() { - return "Short description"; - }// -} diff --git a/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/TestScheduleServlet.java b/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/TestScheduleServlet.java deleted file mode 100644 index a2da94b29..000000000 --- a/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/TestScheduleServlet.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package org.javaee7.concurrency.schedule; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.annotation.Resource; -import javax.enterprise.concurrent.ManagedScheduledExecutorService; -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * - * @author arungup - */ -@WebServlet(urlPatterns = {"/TestScheduleServlet"}) -public class TestScheduleServlet extends HttpServlet { - -// @Resource(name = "concurrent/myScheduledExecutor2") - @Resource(name = "DefaultManagedScheduledExecutorService") - ManagedScheduledExecutorService executor; - - /** - * Processes requests for both HTTP - * GET and - * POST methods. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - protected void processRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - response.setContentType("text/html;charset=UTF-8"); - try (PrintWriter out = response.getWriter()) { - out.println(""); - out.println(""); - out.println(""); - out.println("Schedule using Callable after 5 seconds"); - out.println(""); - out.println(""); - out.println("

Schedule using Callable after 5 seconds

"); - out.println("

Scheduling tasks using Callable

"); - ScheduledFuture future = executor.schedule(new MyCallableTask(5), 5, TimeUnit.SECONDS); - while (true) { - if (future.isDone()) { - break; - } else { - System.out.println("Checking Callable Future, waiting for 1 sec"); - Thread.sleep(1000); - } - } - out.println("Callable Task completed: " + future.get().getId()); - - out.println("

Scheduling tasks using Runnable

"); - ScheduledFuture f = executor.schedule(new MyRunnableTask(10), 5, TimeUnit.SECONDS); - while (true) { - if (f.isDone()) { - break; - } else { - System.out.println("Checking Runnable Future, waiting for 1 sec"); - Thread.sleep(1000); - } - } - out.println("Runnable Task completed: " + future.get().getId()); - out.println("

Check server.log for output"); - out.println(""); - out.println(""); - } catch (InterruptedException | ExecutionException ex) { - Logger.getLogger(TestScheduleServlet.class.getName()).log(Level.SEVERE, null, ex); - } - } - - // - /** - * Handles the HTTP - * GET method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Handles the HTTP - * POST method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Returns a short description of the servlet. - * - * @return a String containing servlet description - */ - @Override - public String getServletInfo() { - return "Short description"; - }// -} diff --git a/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/TestScheduleWithFixedDelayServlet.java b/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/TestScheduleWithFixedDelayServlet.java deleted file mode 100644 index aeb13b966..000000000 --- a/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/TestScheduleWithFixedDelayServlet.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package org.javaee7.concurrency.schedule; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.concurrent.TimeUnit; -import javax.annotation.Resource; -import javax.enterprise.concurrent.ManagedScheduledExecutorService; -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author Arun Gupta - */ -@WebServlet(urlPatterns = {"/TestScheduleWithFixedDelayServlet"}) -public class TestScheduleWithFixedDelayServlet extends HttpServlet { - -// @Resource(name = "concurrent/myScheduledExecutor2") - @Resource(name = "DefaultManagedScheduledExecutorService") - ManagedScheduledExecutorService executor; - - /** - * Processes requests for both HTTP - * GET and - * POST methods. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - protected void processRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - response.setContentType("text/html;charset=UTF-8"); - try (PrintWriter out = response.getWriter()) { - out.println(""); - out.println(""); - out.println(""); - out.println("Schedule with fixed delay"); - out.println(""); - out.println(""); - out.println("

Schedule tasks with fixed delay

"); - - executor.scheduleWithFixedDelay(new MyRunnableTask(5), 2, 3, TimeUnit.SECONDS); - out.println("

Check server.log for output"); - System.out.println("Runnable Task submitted"); - - out.println(""); - out.println(""); - } - } - - // - /** - * Handles the HTTP - * GET method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Handles the HTTP - * POST method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Returns a short description of the servlet. - * - * @return a String containing servlet description - */ - @Override - public String getServletInfo() { - return "Short description"; - }// -} diff --git a/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/TestTriggerServlet.java b/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/TestTriggerServlet.java deleted file mode 100644 index 3a034f763..000000000 --- a/concurrency/schedule/src/main/java/org/javaee7/concurrency/schedule/TestTriggerServlet.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package org.javaee7.concurrency.schedule; - -import java.io.IOException; -import java.io.PrintWriter; -import javax.annotation.Resource; -import javax.enterprise.concurrent.ManagedScheduledExecutorService; -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author Arun Gupta - */ -@WebServlet(urlPatterns = {"/TestTriggerServlet"}) -public class TestTriggerServlet extends HttpServlet { - -// @Resource(name = "concurrent/myScheduledExecutor2") - @Resource(name = "DefaultManagedScheduledExecutorService") - ManagedScheduledExecutorService executor; - - /** - * Processes requests for both HTTP - * GET and - * POST methods. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - protected void processRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - response.setContentType("text/html;charset=UTF-8"); - try (PrintWriter out = response.getWriter()) { - out.println(""); - out.println(""); - out.println(""); - out.println("Servlet TestServlet"); - out.println(""); - out.println(""); - out.println("

Schedule tasks with a trigger

"); - for (int i=0; i<5; i++) { - executor.schedule(new MyRunnableTask(i), new MyTrigger()); - } - out.println("

Check server.log for output"); - - out.println(""); - out.println(""); - } - } - - // - /** - * Handles the HTTP - * GET method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Handles the HTTP - * POST method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Returns a short description of the servlet. - * - * @return a String containing servlet description - */ - @Override - public String getServletInfo() { - return "Short description"; - }// -} diff --git a/concurrency/schedule/src/main/webapp/index.jsp b/concurrency/schedule/src/main/webapp/index.jsp deleted file mode 100644 index 6ef9da3bf..000000000 --- a/concurrency/schedule/src/main/webapp/index.jsp +++ /dev/null @@ -1,59 +0,0 @@ - - -<%@page contentType="text/html" pageEncoding="UTF-8"%> - - - - - - Concurrency Utilities for Java EE - - -

Concurrency Utilities for Java EE : ManagedExecutor

- - Schedule using Callable after 5 seconds
- Schedule at fixed rate
- Schedule with fixed delay
- - diff --git a/concurrency/threads/nb-configuration.xml b/concurrency/threads/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/concurrency/threads/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/concurrency/threads/pom.xml b/concurrency/threads/pom.xml deleted file mode 100644 index 7f0ac285c..000000000 --- a/concurrency/threads/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - 4.0.0 - - org.javaee7.concurrency - concurrency-samples - 1.0-SNAPSHOT - ../pom.xml - - - org.javaee7.concurrency - threads - 1.0-SNAPSHOT - war - diff --git a/concurrency/threads/src/main/java/org/javaee7/concurrency/threads/MyTask.java b/concurrency/threads/src/main/java/org/javaee7/concurrency/threads/MyTask.java deleted file mode 100644 index c09f6ca3b..000000000 --- a/concurrency/threads/src/main/java/org/javaee7/concurrency/threads/MyTask.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package org.javaee7.concurrency.threads; - -/** - * @author Arun Gupta - */ -public class MyTask implements Runnable { - - private int id; - - public MyTask(int id) { - this.id = id; - } - - @Override - public void run() { - System.out.println("Running Task: " + id); - } -} diff --git a/concurrency/threads/src/main/java/org/javaee7/concurrency/threads/TestJNDIServlet.java b/concurrency/threads/src/main/java/org/javaee7/concurrency/threads/TestJNDIServlet.java deleted file mode 100644 index bbfd991fb..000000000 --- a/concurrency/threads/src/main/java/org/javaee7/concurrency/threads/TestJNDIServlet.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package org.javaee7.concurrency.threads; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.enterprise.concurrent.ManagedThreadFactory; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author Arun Gupta - */ -@WebServlet(urlPatterns = {"/TestJNDIServlet"}) -public class TestJNDIServlet extends HttpServlet { - - /** - * Processes requests for both HTTP - * GET and - * POST methods. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - protected void processRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - response.setContentType("text/html;charset=UTF-8"); - try (PrintWriter out = response.getWriter()) { - out.println(""); - out.println(""); - out.println(""); - out.println("Servlet TestJNDIServlet"); - out.println(""); - out.println(""); - out.println("

Getting ManagedThreadFactory using JNDI lookup

"); - try { - InitialContext ctx = new InitialContext(); - - ManagedThreadFactory factory = (ManagedThreadFactory) ctx.lookup("java:comp/DefaultManagedThreadFactory"); -// ManagedExecutorService executor = (ManagedExecutorService) ctx.lookup("concurrent/myExecutor"); - out.println("Getting ManageableThread
"); - Thread thread = factory.newThread(new MyTask(2)); - out.println("Starting thread
"); - thread.start(); - out.println("Thread started

"); - } catch (NamingException ex) { - Logger.getLogger(TestResourceServlet.class.getName()).log(Level.SEVERE, null, ex); - } - out.println("all tasks submitted

"); - out.println("Check server.log for output from the task."); - out.println(""); - out.println(""); - } - } - - // - /** - * Handles the HTTP - * GET method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Handles the HTTP - * POST method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Returns a short description of the servlet. - * - * @return a String containing servlet description - */ - @Override - public String getServletInfo() { - return "Short description"; - }// -} diff --git a/concurrency/threads/src/main/java/org/javaee7/concurrency/threads/TestResourceServlet.java b/concurrency/threads/src/main/java/org/javaee7/concurrency/threads/TestResourceServlet.java deleted file mode 100644 index 9dccfd4d9..000000000 --- a/concurrency/threads/src/main/java/org/javaee7/concurrency/threads/TestResourceServlet.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package org.javaee7.concurrency.threads; - -import java.io.IOException; -import java.io.PrintWriter; -import javax.annotation.Resource; -import javax.enterprise.concurrent.ManagedThreadFactory; -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author Arun Gupta - */ -@WebServlet(urlPatterns = {"/TestResourceServlet"}) -public class TestResourceServlet extends HttpServlet { - -// @Resource(name = "concurrent/myFactory") - @Resource(name = "DefaultManagedThreadFactory") - ManagedThreadFactory factory; - - - /** - * Processes requests for both HTTP - * GET and - * POST methods. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - protected void processRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - response.setContentType("text/html;charset=UTF-8"); - try (PrintWriter out = response.getWriter()) { - out.println(""); - out.println(""); - out.println("Servlet TestServlet"); - out.println(""); - out.println(""); - out.println("

Getting ManagedThreadFactory using @Resource

"); - - out.println("Getting ManageableThread
"); - Thread thread = factory.newThread(new MyTask(1)); - out.println("Starting thread
"); - thread.start(); - out.println("Thread started

"); - out.println("Check server.log for output from the task."); - out.println(""); - out.println(""); - } - } - - // - /** - * Handles the HTTP - * GET method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Handles the HTTP - * POST method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Returns a short description of the servlet. - * - * @return a String containing servlet description - */ - @Override - public String getServletInfo() { - return "Short description"; - }// - -} diff --git a/concurrency/threads/src/main/webapp/index.jsp b/concurrency/threads/src/main/webapp/index.jsp deleted file mode 100644 index 1f32ad35f..000000000 --- a/concurrency/threads/src/main/webapp/index.jsp +++ /dev/null @@ -1,58 +0,0 @@ - - -<%@page contentType="text/html" pageEncoding="UTF-8"%> - - - - - - Concurrency Utilities for Java EE : ManagedThreadFactory - - -

Concurrency Utilities for Java EE : ManagedThreadFactory

- - Create a new ManagebleThread and run (using @Resource)
- Create a new ManagebleThread and run (using JNDI)
- - From f9276a6f70f88b820e5bd896a2ed61f06e27a5e0 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Sun, 15 Sep 2013 08:53:16 -0700 Subject: [PATCH 015/995] Changing to all style beans.xml --- .../src/main/webapp/WEB-INF/beans.xml | 52 +++++++++++++++++-- .../src/main/webapp/WEB-INF/beans.xml | 52 +++++++++++++++++-- 2 files changed, 96 insertions(+), 8 deletions(-) diff --git a/jta/tx-exception/src/main/webapp/WEB-INF/beans.xml b/jta/tx-exception/src/main/webapp/WEB-INF/beans.xml index 4ca8195be..aa81c7c3c 100644 --- a/jta/tx-exception/src/main/webapp/WEB-INF/beans.xml +++ b/jta/tx-exception/src/main/webapp/WEB-INF/beans.xml @@ -1,5 +1,49 @@ - - + + + \ No newline at end of file diff --git a/jta/user-transaction/src/main/webapp/WEB-INF/beans.xml b/jta/user-transaction/src/main/webapp/WEB-INF/beans.xml index 4ca8195be..aa81c7c3c 100644 --- a/jta/user-transaction/src/main/webapp/WEB-INF/beans.xml +++ b/jta/user-transaction/src/main/webapp/WEB-INF/beans.xml @@ -1,5 +1,49 @@ - - + + + \ No newline at end of file From 4529f40baa2fbff16a9f38f1b2629335e1cd1b3d Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Sun, 15 Sep 2013 08:54:36 -0700 Subject: [PATCH 016/995] Adding NetBeans confgiguration file --- jpa/schema-gen/nb-configuration.xml | 18 ++++++++++++++++++ jpa/storedprocedure/nb-configuration.xml | 18 ++++++++++++++++++ websocket/binary/nb-configuration.xml | 18 ++++++++++++++++++ websocket/encoder/nb-configuration.xml | 18 ++++++++++++++++++ .../nb-configuration.xml | 18 ++++++++++++++++++ websocket/injection/nb-configuration.xml | 18 ++++++++++++++++++ 6 files changed, 108 insertions(+) create mode 100644 jpa/schema-gen/nb-configuration.xml create mode 100644 jpa/storedprocedure/nb-configuration.xml create mode 100644 websocket/binary/nb-configuration.xml create mode 100644 websocket/encoder/nb-configuration.xml create mode 100644 websocket/endpoint-programmatic-async/nb-configuration.xml create mode 100644 websocket/injection/nb-configuration.xml diff --git a/jpa/schema-gen/nb-configuration.xml b/jpa/schema-gen/nb-configuration.xml new file mode 100644 index 000000000..e38c5dc5a --- /dev/null +++ b/jpa/schema-gen/nb-configuration.xml @@ -0,0 +1,18 @@ + + + + + + gfv3ee6 + + diff --git a/jpa/storedprocedure/nb-configuration.xml b/jpa/storedprocedure/nb-configuration.xml new file mode 100644 index 000000000..e38c5dc5a --- /dev/null +++ b/jpa/storedprocedure/nb-configuration.xml @@ -0,0 +1,18 @@ + + + + + + gfv3ee6 + + diff --git a/websocket/binary/nb-configuration.xml b/websocket/binary/nb-configuration.xml new file mode 100644 index 000000000..e38c5dc5a --- /dev/null +++ b/websocket/binary/nb-configuration.xml @@ -0,0 +1,18 @@ + + + + + + gfv3ee6 + + diff --git a/websocket/encoder/nb-configuration.xml b/websocket/encoder/nb-configuration.xml new file mode 100644 index 000000000..e38c5dc5a --- /dev/null +++ b/websocket/encoder/nb-configuration.xml @@ -0,0 +1,18 @@ + + + + + + gfv3ee6 + + diff --git a/websocket/endpoint-programmatic-async/nb-configuration.xml b/websocket/endpoint-programmatic-async/nb-configuration.xml new file mode 100644 index 000000000..e38c5dc5a --- /dev/null +++ b/websocket/endpoint-programmatic-async/nb-configuration.xml @@ -0,0 +1,18 @@ + + + + + + gfv3ee6 + + diff --git a/websocket/injection/nb-configuration.xml b/websocket/injection/nb-configuration.xml new file mode 100644 index 000000000..e38c5dc5a --- /dev/null +++ b/websocket/injection/nb-configuration.xml @@ -0,0 +1,18 @@ + + + + + + gfv3ee6 + + From 21ecf7db2340ae965828a806ce9420a0df48050a Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Sun, 15 Sep 2013 08:55:18 -0700 Subject: [PATCH 017/995] Adding NetBeans configuration file --- .../endpoint-security/nb-configuration.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 websocket/endpoint-security/nb-configuration.xml diff --git a/websocket/endpoint-security/nb-configuration.xml b/websocket/endpoint-security/nb-configuration.xml new file mode 100644 index 000000000..e38c5dc5a --- /dev/null +++ b/websocket/endpoint-security/nb-configuration.xml @@ -0,0 +1,18 @@ + + + + + + gfv3ee6 + + From 6d9bbf9f441dbe73d8b051bb68eedaca905b987f Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Sun, 15 Sep 2013 08:55:51 -0700 Subject: [PATCH 018/995] Adding .gitignore --- .gitignore | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..7c0e5a651 --- /dev/null +++ b/.gitignore @@ -0,0 +1,120 @@ +/jaxrs/resource-validation/target/ +/jaxrs/mapping-exceptions/target/ +/jaxrs/server-negotiation/target/ +/jaxrs/async-client/target/ +/batch/flow/target/ +/batch/batchlet-simple/target/ +/batch/chunk-checkpoint/target/ +/batch/chunk-exception/target/ +/batch/chunk-mapper/target/ +/batch/decision/target/ +/batch/listeners/target/ +/batch/multiple-steps/target/ +/batch/split/target/ +/batch/chunk-simple-nobeans/target/ +/json/object-builder/target/ +/json/object-reader/target/ +/json/streaming-generate/target/ +/json/streaming-parser/target/ +/websocket/binary/target/ +/websocket/whiteboard/target/ +/cdi/vetoed/target/ +/cdi/pkg-level/target/ +/cdi/decorators/target/ +/cdi/bean-discovery-all/target/ +/cdi/bean-discovery-none/target/ +/cdi/bean-discovery-annotated/target/ +/cdi/exclude-filter/target/ +/cdi/built-in/target/ +/cdi/interceptors/target/ +/cdi/nobeans-xml/target/ +/cdi/beansxml-noversion/target/ +/cdi/beanmanager/target/ +/concurrency/dynamicproxy/target/ +/concurrency/executor/target/ +/concurrency/schedule/target/ +/concurrency/threads/target/ +/websocket/chat/target/ +/websocket/encoder/target/ +/websocket/encoder-client/target/ +/websocket/encoder-programmatic/target/ +/websocket/endpoint/target/ +/websocket/endpoint-async/target/ +/jaxrs/endpoint/target/ +/jaxrs/client/target/ +/jsf/server-extension/target/ +/jaxrs/jaxrs-endpoint/target/ +/jaxrs/jaxrs-client/target/ +/jsf/http-get/target/ +/websocket/endpoint-javatypes/target/ +/websocket/endpoint-config/target/ +/websocket/endpoint-programmatic/target/ +/websocket/endpoint-programmatic-async/target/ +/websocket/endpoint-programmatic-config/target/ +/websocket/endpoint-programmatic-injection/target/ +/websocket/endpoint-security/target/ +/websocket/httpsession/target/ +/websocket/injection/target/ +/websocket/messagesize/target/ +/websocket/parameters/target/ +/websocket/websocket-vs-rest/target/ +/websocket/subprotocol/target/ +/websocket/websocket-client/target/ +/websocket/websocket-client-config/target/ +/websocket/websocket-client-programmatic/target/ +/websocket/websocket-client-programmatic-config/target/ +/websocket/websocket-client-programmatic-encoders/target/ +/websocket/javase-client/target/ +/ejb/stateful/target/ +/jpa/pu-typesafe/target/ +/jpa/criteria/target/ +/jta/transactional/target/ +/jta/transaction-scope/target/ +/jta/tx-exception/target/ +/ejb/stateless/target/ +/servlet/cookies/target/ +/jpa/schema-gen-scripts/target/ +/jta/user-transaction/target/ +/ejb/singleton/target/ +/ejb/lifecycle/singleton/target/ +/servlet/async-servlet/target/ +/jms/send-receive-simple/target/ +/jms/send-receive/target/ +/servlet/error-mapping/target/ +/servlet/event-listeners/target/ +/servlet/metadata-complete/target/ +/servlet/nonblocking/target/ +/servlet/resource-packaging/target/ +/servlet/servlet-filters/target/ +/servlet/web-fragment/target/ +/servlet/servlet-security/target/ +/jsf/flows-simple/target/ +/jsf/flows-mixed/target/ +/jaxrs/client-negotiation/target/ +/jpa/schema-gen-scripts-generate/target/ +/jaxrs/readerwriter-injection/target/ +/jsf/flows-programmatic/target/ +/jsf/flows-declarative/target/ +/javamail/definition/target/ +/jta/transactional-scope/target/ +/cdi/extension-impl/target/ +/cdi/extension/target/ +/batch/chunk-csv-database/target/ +/batch/chunk-optional-processor/target/ +/batch/chunk-partition/target/ +/jpa/listeners/target/ +/jpa/multiple-pu/target/ +/json/twitter-search/target/ +/jsf/radio-buttons/target/ +/jsf/viewscoped/target/ +/ejb/lifecycle/target/ +/jpa/schema-gen/target/ +/jpa/storedprocedure/target/ +/jsf/contracts/target/ +/jsf/contracts-library/target/ +/jsf/file-upload/target/ +/extra/quartz/target/ +/extra/twitter-search/target/ +/concurrency/managedexecutor/target/ +/concurrency/managedscheduledexecutor/target/ +/concurrency/manageablethread/target/ \ No newline at end of file From a03b017d6c00d37187849560fd7ac3236f8b5430 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Sun, 15 Sep 2013 09:15:36 -0700 Subject: [PATCH 019/995] Added some more explanation on how to run the samples --- README.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5dcd706f1..d4cf064a2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,32 @@ Java EE 7 Samples ================= -This workspace will provide different Java EE 7 Samples. +This workspace consists of Java EE 7 Samples. They are divided in different directories, one for each JSR. + +How to run ? +============ +How I run the samples ? +----------------------- + +1. Open the sample in NetBeans 7.4 beta+ +2. Click on "Run" (sample is built and deployed, main page shows up) +3. Main page tells what the feature is about and what to do to execute the sample and see the output + +Alternative way +--------------- +1. mvn clean package +2. asadmin deploy target/XXX.war +3. Access http://localhost:8080/XXX/ (main page shows up) +4. Same as 3 in the previous one + +TBD +--- + +1. Configure GlassFish Embedded to run the samples automatically +2. Configure Cargo to run the samples + +List of Samples +=============== The following script will generate the complete list of samples. From add599926e15062b01f92c39f694fa835fa98725 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Sun, 15 Sep 2013 09:17:42 -0700 Subject: [PATCH 020/995] Formatting updated --- README.md | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index d4cf064a2..971f8b2db 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,27 @@ -Java EE 7 Samples -================= +# Java EE 7 Samples # This workspace consists of Java EE 7 Samples. They are divided in different directories, one for each JSR. -How to run ? -============ -How I run the samples ? ------------------------ +## How to run ? ## + +### How I run them ? ### 1. Open the sample in NetBeans 7.4 beta+ 2. Click on "Run" (sample is built and deployed, main page shows up) 3. Main page tells what the feature is about and what to do to execute the sample and see the output -Alternative way ---------------- +### Alternative way ### 1. mvn clean package 2. asadmin deploy target/XXX.war 3. Access http://localhost:8080/XXX/ (main page shows up) 4. Same as 3 in the previous one -TBD ---- +### TBD ### 1. Configure GlassFish Embedded to run the samples automatically 2. Configure Cargo to run the samples -List of Samples -=============== +## List of Samples ## The following script will generate the complete list of samples. From 6c7d1f16715fb565833c2a34cac9a6d03eb15193 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Mon, 16 Sep 2013 15:30:48 -0700 Subject: [PATCH 021/995] Added Cargo instructions --- README.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 971f8b2db..9aedf3dbf 100644 --- a/README.md +++ b/README.md @@ -8,18 +8,27 @@ This workspace consists of Java EE 7 Samples. They are divided in different dire 1. Open the sample in NetBeans 7.4 beta+ 2. Click on "Run" (sample is built and deployed, main page shows up) -3. Main page tells what the feature is about and what to do to execute the sample and see the output +3. Main page provides feature name, what to do to run the sample, and displays the output -### Alternative way ### -1. mvn clean package -2. asadmin deploy target/XXX.war +### Cargo ### + +1. In one terminal, anywhere in the project with a pom.xml: "mvn cargo:run" to start GlassFish server +2. In another terminal, in the actual sample directory + 1. ``mvn package cargo:deploy`` to deploy for the first time + 2. ``mvn package cargo:redeploy`` to redeploy (or use this all the time) + 3. ``mvn cargo:undeploy`` to undeploy +3. Check for application name printed by Cargo output. Access the application at http://localhost:8080/ +4. Same as 3 in the first one + +### Manual ### +1. ``mvn clean package`` +2. ``asadmin deploy target/XXX.war`` to deploy the WAR file 3. Access http://localhost:8080/XXX/ (main page shows up) -4. Same as 3 in the previous one +4. Same as 3 in the first one ### TBD ### 1. Configure GlassFish Embedded to run the samples automatically -2. Configure Cargo to run the samples ## List of Samples ## From e1c339b362a21a24ffcbae2122483659cee765e5 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Mon, 16 Sep 2013 15:31:24 -0700 Subject: [PATCH 022/995] Added Cargo plugin --- pom.xml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pom.xml b/pom.xml index 3f48238cf..ae6370b80 100644 --- a/pom.xml +++ b/pom.xml @@ -9,6 +9,8 @@ Java EE 7 Samples + glassfish4x + /Users/arungup/tools/glassfish/4.0/final/glassfish4 gfv3ee6 @@ -40,6 +42,23 @@ false + + org.codehaus.cargo + cargo-maven2-plugin + 1.4.4 + true + + + ${cargo.container.id} + installed + ${glassfish.home} + + + standalone + ${glassfish.home}/glassfish/domains + + + From a9c3ede20cf8f0f5bc7a3c897bcebf07557ad69f Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Mon, 16 Sep 2013 15:32:35 -0700 Subject: [PATCH 023/995] Added a statement about glassfish.home --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9aedf3dbf..0944c3358 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ This workspace consists of Java EE 7 Samples. They are divided in different dire ### Cargo ### +Make sure to edit ``glassfish.home`` property value in the top-level pom.xml. + 1. In one terminal, anywhere in the project with a pom.xml: "mvn cargo:run" to start GlassFish server 2. In another terminal, in the actual sample directory 1. ``mvn package cargo:deploy`` to deploy for the first time From 9444acfb19cb1ff14357ae8f4639b70648d941d4 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Mon, 16 Sep 2013 16:15:58 -0700 Subject: [PATCH 024/995] Adding profiles to run on GlassFish and Wildfly --- pom.xml | 76 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 19 deletions(-) diff --git a/pom.xml b/pom.xml index ae6370b80..1b9a69ef5 100644 --- a/pom.xml +++ b/pom.xml @@ -9,9 +9,10 @@ Java EE 7 Samples - glassfish4x + glassfish4x /Users/arungup/tools/glassfish/4.0/final/glassfish4 - gfv3ee6 + wildfly8x + /Users/arungup/tools/wildfly/wildfly-8.0.0.Alpha4 @@ -42,25 +43,62 @@ false - - org.codehaus.cargo - cargo-maven2-plugin - 1.4.4 - true - - - ${cargo.container.id} - installed - ${glassfish.home} - - - standalone - ${glassfish.home}/glassfish/domains - - - + + + + glassfish + + true + + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.4.4 + true + + + ${cargo.container.glassfish.id} + installed + ${glassfish.home} + + + standalone + ${glassfish.home}/glassfish/domains + + + + + + + + wildfly + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.4.4 + true + + + ${cargo.container.wildfly.id} + installed + ${wildfly.home} + + + standalone + ${wildfly.home}/glassfish/domains + + + + + + + batch From c59e267a3ae76267fb7e77a28294ad40554dc86f Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Mon, 16 Sep 2013 16:16:16 -0700 Subject: [PATCH 025/995] Adding instructions on how to run on GlassFish and Wildfly --- README.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0944c3358..cef96f457 100644 --- a/README.md +++ b/README.md @@ -6,32 +6,31 @@ This workspace consists of Java EE 7 Samples. They are divided in different dire ### How I run them ? ### -1. Open the sample in NetBeans 7.4 beta+ -2. Click on "Run" (sample is built and deployed, main page shows up) -3. Main page provides feature name, what to do to run the sample, and displays the output +1. Open the sample in NetBeans 7.4 beta+ (Download from [http://bits.netbeans.org/dev/nightly/latest/]) +2. Click on "Run" (sample is built and deployed on GlassFish 4, main page shows up) +3. Main page provides feature name, how to run the sample, and displays the output ### Cargo ### -Make sure to edit ``glassfish.home`` property value in the top-level pom.xml. +By default, all samples are deployed on GlassFish 4. They can be deployed on Widlfly 8 by adding ``-P wildfly`` to all maven commands. + +Make sure to edit ``glassfish.home`` or ``wildfly.home`` property value in the top-level pom.xml to point to your local GlassFish or Wildfly installations respectively. 1. In one terminal, anywhere in the project with a pom.xml: "mvn cargo:run" to start GlassFish server 2. In another terminal, in the actual sample directory 1. ``mvn package cargo:deploy`` to deploy for the first time - 2. ``mvn package cargo:redeploy`` to redeploy (or use this all the time) + 2. ``mvn package cargo:redeploy`` to redeploy subsequently 3. ``mvn cargo:undeploy`` to undeploy 3. Check for application name printed by Cargo output. Access the application at http://localhost:8080/ 4. Same as 3 in the first one ### Manual ### + 1. ``mvn clean package`` 2. ``asadmin deploy target/XXX.war`` to deploy the WAR file 3. Access http://localhost:8080/XXX/ (main page shows up) 4. Same as 3 in the first one -### TBD ### - -1. Configure GlassFish Embedded to run the samples automatically - ## List of Samples ## The following script will generate the complete list of samples. From f08fc4e2b73a2e7ef2f5b417f9121272dda16d64 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Mon, 16 Sep 2013 16:21:55 -0700 Subject: [PATCH 026/995] Cleaned up some instructions --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cef96f457..e477feb95 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,9 @@ This workspace consists of Java EE 7 Samples. They are divided in different dire ### Cargo ### -By default, all samples are deployed on GlassFish 4. They can be deployed on Widlfly 8 by adding ``-P wildfly`` to all maven commands. +By default, all samples are deployed on GlassFish 4. They can be deployed on Widlfly 8 by adding ``-P wildfly`` to all maven commands. Make sure to edit ``glassfish.home`` or ``wildfly.home`` property value in the top-level ``pom.xml`` to point to your local GlassFish or Wildfly directory respectively. -Make sure to edit ``glassfish.home`` or ``wildfly.home`` property value in the top-level pom.xml to point to your local GlassFish or Wildfly installations respectively. - -1. In one terminal, anywhere in the project with a pom.xml: "mvn cargo:run" to start GlassFish server +1. In one terminal, anywhere in the project with a ``pom.xml``: ``mvn cargo:run`` to start GlassFish server or ``mvn -P wildfly`` to start Wildfly server. They are both configured to run on port 8080 so only one can run at a given time. 2. In another terminal, in the actual sample directory 1. ``mvn package cargo:deploy`` to deploy for the first time 2. ``mvn package cargo:redeploy`` to redeploy subsequently @@ -27,7 +25,7 @@ Make sure to edit ``glassfish.home`` or ``wildfly.home`` property value in the t ### Manual ### 1. ``mvn clean package`` -2. ``asadmin deploy target/XXX.war`` to deploy the WAR file +2. Deploy on GlassFish using ``asadmin deploy target/XXX.war`` or deploy on Wildfly using ``TBD`` 3. Access http://localhost:8080/XXX/ (main page shows up) 4. Same as 3 in the first one From cf801e67d25ce96bf42aebb46727f74aeba18067 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Mon, 16 Sep 2013 16:24:24 -0700 Subject: [PATCH 027/995] Adding more clarifications --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e477feb95..fd2e2e5ad 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,20 @@ # Java EE 7 Samples # -This workspace consists of Java EE 7 Samples. They are divided in different directories, one for each JSR. +This workspace consists of Java EE 7 Samples. They are categorized in different directories, one for each JSR. ## How to run ? ## ### How I run them ? ### -1. Open the sample in NetBeans 7.4 beta+ (Download from [http://bits.netbeans.org/dev/nightly/latest/]) +1. Open the sample in NetBeans 7.4 beta+ (Download from http://bits.netbeans.org/dev/nightly/latest) 2. Click on "Run" (sample is built and deployed on GlassFish 4, main page shows up) 3. Main page provides feature name, how to run the sample, and displays the output ### Cargo ### -By default, all samples are deployed on GlassFish 4. They can be deployed on Widlfly 8 by adding ``-P wildfly`` to all maven commands. Make sure to edit ``glassfish.home`` or ``wildfly.home`` property value in the top-level ``pom.xml`` to point to your local GlassFish or Wildfly directory respectively. +By default, all samples are deployed on GlassFish 4. They can be deployed on Widlfly 8 by adding ``-P wildfly`` to all maven commands. Make sure to edit ``glassfish.home`` or ``wildfly.home`` property value in the top-level ``pom.xml`` to point to your local GlassFish or Wildfly directory respectively. Only one profile can be active at a given time otherwise there will be port conflicts. -1. In one terminal, anywhere in the project with a ``pom.xml``: ``mvn cargo:run`` to start GlassFish server or ``mvn -P wildfly`` to start Wildfly server. They are both configured to run on port 8080 so only one can run at a given time. +1. In one terminal, anywhere in the project with a ``pom.xml``: ``mvn cargo:run`` to start GlassFish server or ``mvn -P wildfly`` to start Wildfly server. 2. In another terminal, in the actual sample directory 1. ``mvn package cargo:deploy`` to deploy for the first time 2. ``mvn package cargo:redeploy`` to redeploy subsequently From d29f9d1179d4188d9f5c07dc51fa4ff28326ab05 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Mon, 16 Sep 2013 16:25:58 -0700 Subject: [PATCH 028/995] Removed sample lists, it can be dynamically generated --- README.md | 159 +----------------------------------------------------- 1 file changed, 2 insertions(+), 157 deletions(-) diff --git a/README.md b/README.md index fd2e2e5ad..52f7ac37a 100644 --- a/README.md +++ b/README.md @@ -35,162 +35,7 @@ The following script will generate the complete list of samples. find . -name pom.xml -depth 3 -maxdepth 3 | sed 's|\./||g' | sed 's|\/pom.xml||g' +There are 161 samples as of 9/16. + I don't plan to write any formal documentation, let the code talk. [Java EE 7 Essentials](http://www.amazon.com/Java-EE-Essentials-Arun-Gupta/dp/1449370179/) refer to some of these samples and provide an extensive explanation. -+ batch/batchlet-simple -+ batch/chunk-checkpoint -+ batch/chunk-csv-database -+ batch/chunk-csv-database.clean -+ batch/chunk-exception -+ batch/chunk-mapper -+ batch/chunk-optional-processor -+ batch/chunk-partition -+ batch/chunk-simple -+ batch/chunk-simple-nobeans -+ batch/decision -+ batch/flow -+ batch/listeners -+ batch/multiple-steps -+ batch/split -+ cdi/bean-discovery-all -+ cdi/bean-discovery-annotated -+ cdi/bean-discovery-none -+ cdi/beanmanager -+ cdi/beansxml-noversion -+ cdi/built-in -+ cdi/decorators -+ cdi/exclude-filter -+ cdi/interceptors -+ cdi/nobeans-xml -+ cdi/pkg-level -+ cdi/vetoed -+ concurrency/dynamicproxy -+ concurrency/executor -+ concurrency/schedule -+ concurrency/threads -+ ejb/embeddable -+ ejb/lifecycle -+ ejb/singleton -+ ejb/stateful -+ ejb/stateless -+ ejb/timer -+ el/standalone -+ javamail/definition -+ jaxrs/async-client -+ jaxrs/async-server -+ jaxrs/beanvalidation -+ jaxrs/client-negotiation -+ jaxrs/dynamicfilter -+ jaxrs/filter -+ jaxrs/filter-interceptor -+ jaxrs/interceptor -+ jaxrs/invocation -+ jaxrs/invocation-async -+ jaxrs/jaxrs-client -+ jaxrs/jaxrs-endpoint -+ jaxrs/jsonp -+ jaxrs/link -+ jaxrs/mapping-exceptions -+ jaxrs/moxy -+ jaxrs/readerwriter -+ jaxrs/readerwriter-json -+ jaxrs/request-binding -+ jaxrs/resource-validation -+ jaxrs/server-negotiation -+ jaxrs/server-sent-event -+ jaxrs/singleton-annotation -+ jaxrs/singleton-application -+ jaxrs/singleton-application.old -+ jca/connector-simple -+ jms/jmscontext-cdi -+ jms/send-receive -+ jms/send-receive-simple -+ jms/temp-destination -+ jpa/criteria -+ jpa/entitygraph -+ jpa/jndi-context -+ jpa/listeners -+ jpa/locking-optimistic -+ jpa/locking-pessimistic -+ jpa/multiple-pu -+ jpa/native-sql -+ jpa/native-sql-resultset-mapping -+ jpa/pu-typesafe -+ jpa/schema-gen -+ jpa/schema-gen-scripts -+ jpa/schema-gen-scripts-external -+ jpa/schema-gen-scripts-generate -+ jpa/storedprocedure -+ jsf/ajax -+ jsf/bean-validation -+ jsf/components -+ jsf/composite-component -+ jsf/contracts -+ jsf/contracts-library -+ jsf/contracts-library-impl -+ jsf/file-upload -+ jsf/flows-declarative -+ jsf/flows-mixed -+ jsf/flows-programmatic -+ jsf/flows-simple -+ jsf/http-get -+ jsf/passthrough -+ jsf/radio-buttons -+ jsf/resource-handling -+ jsf/server-extension -+ jsf/simple-facelet -+ jsf/viewscoped -+ json/object-builder -+ json/object-reader -+ json/streaming-generate -+ json/streaming-parser -+ json/twitter-search -+ jta/transaction-scope -+ jta/transactional -+ jta/tx-exception -+ jta/user-transaction -+ servlet/async-servlet -+ servlet/cookies -+ servlet/error-mapping -+ servlet/event-listeners -+ servlet/file-upload -+ servlet/form-based-security -+ servlet/metadata-complete -+ servlet/nonblocking -+ servlet/protocol-handler -+ servlet/resource-packaging -+ servlet/servlet-filters -+ servlet/servlet-security -+ servlet/web-fragment -+ validation/custom-constraint -+ validation/methods -+ websocket/binary -+ websocket/chat -+ websocket/encoder -+ websocket/encoder-client -+ websocket/encoder-programmatic -+ websocket/endpoint -+ websocket/endpoint-async -+ websocket/endpoint-config -+ websocket/endpoint-javatypes -+ websocket/endpoint-partial -+ websocket/endpoint-programmatic -+ websocket/endpoint-programmatic-async -+ websocket/endpoint-programmatic-config -+ websocket/endpoint-programmatic-injection -+ websocket/endpoint-programmatic-partial -+ websocket/endpoint-security -+ websocket/httpsession -+ websocket/injection -+ websocket/javase-client -+ websocket/messagesize -+ websocket/parameters -+ websocket/properties -+ websocket/subprotocol -+ websocket/websocket-client -+ websocket/websocket-client-config -+ websocket/websocket-client-programmatic -+ websocket/websocket-client-programmatic-config -+ websocket/websocket-client-programmatic-encoders -+ websocket/websocket-vs-rest -+ websocket/whiteboard From 42cd4184e0f94192c442e1136b7f609a993d8014 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Mon, 16 Sep 2013 16:33:16 -0700 Subject: [PATCH 029/995] Formatting --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 52f7ac37a..0f034de08 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ By default, all samples are deployed on GlassFish 4. They can be deployed on Wid The following script will generate the complete list of samples. -find . -name pom.xml -depth 3 -maxdepth 3 | sed 's|\./||g' | sed 's|\/pom.xml||g' +``find . -name pom.xml -depth 3 -maxdepth 3 | sed 's|\./||g' | sed 's|\/pom.xml||g'`` There are 161 samples as of 9/16. From a7211266857308dfdda90f5b852c5c3a35869612 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Mon, 16 Sep 2013 16:41:19 -0700 Subject: [PATCH 030/995] Improving output messages, adding copyrights and @author --- .../batch/batchlet/simple/TestServlet.java | 2 +- .../batch/chunk/checkpoint/TestServlet.java | 2 +- .../batch/chunk/csv/database/TestServlet.java | 2 +- .../batch/chunk/exception/TestServlet.java | 2 +- .../sample/chunk/mapper/TestServlet.java | 2 +- .../chunk/optional/processor/TestServlet.java | 43 +++++++++++++++++-- .../sample/chunk/partition/TestServlet.java | 2 +- .../chunk/simple/nobeans/TestServlet.java | 6 +-- .../javaee7/batch/listeners/TestServlet.java | 2 +- .../org/javaee7/batch/split/TestServlet.java | 6 +-- 10 files changed, 52 insertions(+), 17 deletions(-) diff --git a/batch/batchlet-simple/src/main/java/org/javaee7/batch/batchlet/simple/TestServlet.java b/batch/batchlet-simple/src/main/java/org/javaee7/batch/batchlet/simple/TestServlet.java index 18e6e1ff4..f1d474b1b 100644 --- a/batch/batchlet-simple/src/main/java/org/javaee7/batch/batchlet/simple/TestServlet.java +++ b/batch/batchlet-simple/src/main/java/org/javaee7/batch/batchlet/simple/TestServlet.java @@ -84,7 +84,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re out.println("Got the job operator: " + jo + "
"); jo.start("myJob", new Properties()); out.println("Job submitted
"); - out.println("

Check server.log for output"); + out.println("

Check server.log for output, also look at \"myJob.xml\" for Job XML."); out.println(""); out.println(""); } catch (JobStartException ex) { diff --git a/batch/chunk-checkpoint/src/main/java/org/javaee7/batch/chunk/checkpoint/TestServlet.java b/batch/chunk-checkpoint/src/main/java/org/javaee7/batch/chunk/checkpoint/TestServlet.java index ef104148b..568b108f2 100644 --- a/batch/chunk-checkpoint/src/main/java/org/javaee7/batch/chunk/checkpoint/TestServlet.java +++ b/batch/chunk-checkpoint/src/main/java/org/javaee7/batch/chunk/checkpoint/TestServlet.java @@ -89,7 +89,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re Logger.getLogger(TestServlet.class.getName()).log(Level.SEVERE, null, ex); } out.println("Job submitted
"); - out.println("Check server.log for output"); + out.println("

Check server.log for output, also look at \"myJob.xml\" for Job XML."); out.println(""); out.println(""); } catch (JobStartException ex) { diff --git a/batch/chunk-csv-database/src/main/java/org/javaee7/batch/chunk/csv/database/TestServlet.java b/batch/chunk-csv-database/src/main/java/org/javaee7/batch/chunk/csv/database/TestServlet.java index 3299a1ada..f66898eed 100644 --- a/batch/chunk-csv-database/src/main/java/org/javaee7/batch/chunk/csv/database/TestServlet.java +++ b/batch/chunk-csv-database/src/main/java/org/javaee7/batch/chunk/csv/database/TestServlet.java @@ -87,7 +87,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re JobOperator jo = BatchRuntime.getJobOperator(); long jid = jo.start("myJob", new Properties()); out.println("Job submitted: " + jid + "
"); - out.println("Check server.log for output"); + out.println("

Check server.log for output, also look at \"myJob.xml\" for Job XML."); out.println(""); out.println(""); } catch (JobStartException | JobSecurityException ex) { diff --git a/batch/chunk-exception/src/main/java/org/javaee7/batch/chunk/exception/TestServlet.java b/batch/chunk-exception/src/main/java/org/javaee7/batch/chunk/exception/TestServlet.java index 84f9addea..b2f077c06 100644 --- a/batch/chunk-exception/src/main/java/org/javaee7/batch/chunk/exception/TestServlet.java +++ b/batch/chunk-exception/src/main/java/org/javaee7/batch/chunk/exception/TestServlet.java @@ -89,7 +89,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re Logger.getLogger(TestServlet.class.getName()).log(Level.SEVERE, null, ex); } out.println("Job submitted"); - out.println("

Check server.log for output"); + out.println("

Check server.log for output, also look at \"myJob.xml\" for Job XML."); out.println(""); out.println(""); } catch (JobStartException ex) { diff --git a/batch/chunk-mapper/src/main/java/org/javaee7/batch/sample/chunk/mapper/TestServlet.java b/batch/chunk-mapper/src/main/java/org/javaee7/batch/sample/chunk/mapper/TestServlet.java index 3bb6e4ad7..3699d8e6b 100644 --- a/batch/chunk-mapper/src/main/java/org/javaee7/batch/sample/chunk/mapper/TestServlet.java +++ b/batch/chunk-mapper/src/main/java/org/javaee7/batch/sample/chunk/mapper/TestServlet.java @@ -95,7 +95,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re for (String j : jo.getJobNames()) { out.println("--> " + j + "
"); } - out.println("

Check server.log for output"); + out.println("

Check server.log for output, also look at \"myJob.xml\" for Job XML."); out.println(""); out.println(""); } catch (JobStartException | JobSecurityException ex) { diff --git a/batch/chunk-optional-processor/src/main/java/org/javaee7/batch/chunk/optional/processor/TestServlet.java b/batch/chunk-optional-processor/src/main/java/org/javaee7/batch/chunk/optional/processor/TestServlet.java index 60f1c462e..a9a0e17aa 100644 --- a/batch/chunk-optional-processor/src/main/java/org/javaee7/batch/chunk/optional/processor/TestServlet.java +++ b/batch/chunk-optional-processor/src/main/java/org/javaee7/batch/chunk/optional/processor/TestServlet.java @@ -1,6 +1,41 @@ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. */ package org.javaee7.batch.chunk.optional.processor; @@ -20,8 +55,7 @@ import javax.servlet.http.HttpServletResponse; /** - * - * @author arungup + * @author Arun Gupta */ @WebServlet(urlPatterns = {"/TestServlet"}) public class TestServlet extends HttpServlet { @@ -55,6 +89,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re Logger.getLogger(TestServlet.class.getName()).log(Level.SEVERE, null, ex); } out.println("Job submitted
"); + out.println("

Check server.log for output, also look at \"myJob.xml\" for Job XML."); out.println(""); out.println(""); } catch (JobStartException ex) { diff --git a/batch/chunk-partition/src/main/java/org/javaee7/batch/sample/chunk/partition/TestServlet.java b/batch/chunk-partition/src/main/java/org/javaee7/batch/sample/chunk/partition/TestServlet.java index 989fa34ac..0a6d2b2d8 100644 --- a/batch/chunk-partition/src/main/java/org/javaee7/batch/sample/chunk/partition/TestServlet.java +++ b/batch/chunk-partition/src/main/java/org/javaee7/batch/sample/chunk/partition/TestServlet.java @@ -95,7 +95,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re for (String j : jo.getJobNames()) { out.println("--> " + j + "
"); } - out.println("

Check \"server.log\" for out"); + out.println("

Check server.log for output, also look at \"myJob.xml\" for Job XML."); out.println(""); out.println(""); } catch (JobStartException | JobSecurityException ex) { diff --git a/batch/chunk-simple-nobeans/src/main/java/org/javaee7/batch/samples/chunk/simple/nobeans/TestServlet.java b/batch/chunk-simple-nobeans/src/main/java/org/javaee7/batch/samples/chunk/simple/nobeans/TestServlet.java index 5b3650ef8..29ec54c08 100644 --- a/batch/chunk-simple-nobeans/src/main/java/org/javaee7/batch/samples/chunk/simple/nobeans/TestServlet.java +++ b/batch/chunk-simple-nobeans/src/main/java/org/javaee7/batch/samples/chunk/simple/nobeans/TestServlet.java @@ -77,10 +77,10 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re try (PrintWriter out = response.getWriter()) { out.println(""); out.println(""); - out.println("Servlet TestServlet"); + out.println("Batch - No beans.xml, default injection of beans"); out.println(""); out.println(""); - out.println("

Servlet TestServlet at " + request.getContextPath() + "

"); + out.println("

Batch - No beans.xml, default injection of beans

"); out.println("About to start the job
"); JobOperator jo = BatchRuntime.getJobOperator(); out.println("Got the job operator: " + jo + "
"); @@ -95,7 +95,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re for (String j : jo.getJobNames()) { out.println("--> " + j + "
"); } - out.println("

Check server.log for output"); + out.println("

Check server.log for output, also look at \"myJob.xml\" for Job XML."); out.println(""); out.println(""); } catch (JobStartException | JobSecurityException ex) { diff --git a/batch/listeners/src/main/java/org/javaee7/batch/listeners/TestServlet.java b/batch/listeners/src/main/java/org/javaee7/batch/listeners/TestServlet.java index fe3c04e97..921b31e9a 100644 --- a/batch/listeners/src/main/java/org/javaee7/batch/listeners/TestServlet.java +++ b/batch/listeners/src/main/java/org/javaee7/batch/listeners/TestServlet.java @@ -90,7 +90,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re Logger.getLogger(TestServlet.class.getName()).log(Level.SEVERE, null, ex); } out.println("Job submitted
"); - out.println("

Check server.log for output"); + out.println("

Check server.log for output, also look at \"myJob.xml\" for Job XML."); out.println(""); out.println(""); } catch (JobStartException ex) { diff --git a/batch/split/src/main/java/org/javaee7/batch/split/TestServlet.java b/batch/split/src/main/java/org/javaee7/batch/split/TestServlet.java index 94e062c94..c47b60b5d 100644 --- a/batch/split/src/main/java/org/javaee7/batch/split/TestServlet.java +++ b/batch/split/src/main/java/org/javaee7/batch/split/TestServlet.java @@ -76,17 +76,17 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re try (PrintWriter out = response.getWriter()) { out.println(""); out.println(""); - out.println("Servlet TestServlet"); + out.println("Batch Split"); out.println(""); out.println(""); - out.println("

Servlet TestServlet at " + request.getContextPath() + "

"); + out.println("

Batch Split

"); out.println("About to start the job
"); JobOperator jo = BatchRuntime.getJobOperator(); out.println("Got the job operator: " + jo + "
"); long jid = jo.start("myJob", new Properties()); out.println("Job submitted: " + jid + "
"); out.println(jo.getJobInstanceCount("myJob") + " job instance found
"); - out.println("

Check server.log for output"); + out.println("

Check server.log for output, also look at \"myJob.xml\" for Job XML."); out.println(""); out.println(""); } catch (JobStartException | JobSecurityException ex) { From 400200c5b4b499c525eae4612411bfb789553873 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Mon, 16 Sep 2013 16:46:57 -0700 Subject: [PATCH 031/995] Forgot to include some files - Improving output messages, adding copyrights and @author --- .../java/org/javaee7/batch/chunk/simple/TestServlet.java | 2 +- .../main/java/org/javaee7/batch/decision/TestServlet.java | 6 +++--- .../src/main/java/org/javaee7/batch/flow/TestServlet.java | 4 ++-- .../java/org/javaee7/batch/multiple/steps/TestServlet.java | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/batch/chunk-simple/src/main/java/org/javaee7/batch/chunk/simple/TestServlet.java b/batch/chunk-simple/src/main/java/org/javaee7/batch/chunk/simple/TestServlet.java index c3ae6230c..66b28bb7c 100644 --- a/batch/chunk-simple/src/main/java/org/javaee7/batch/chunk/simple/TestServlet.java +++ b/batch/chunk-simple/src/main/java/org/javaee7/batch/chunk/simple/TestServlet.java @@ -95,7 +95,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re for (String j : jo.getJobNames()) { out.println("--> " + j + "
"); } - out.println("

Check server.log for output."); + out.println("

Check server.log for output, also look at \"myJob.xml\" for Job XML."); out.println(""); out.println(""); } catch (JobStartException | JobSecurityException ex) { diff --git a/batch/decision/src/main/java/org/javaee7/batch/decision/TestServlet.java b/batch/decision/src/main/java/org/javaee7/batch/decision/TestServlet.java index ca117a2fe..57903af31 100644 --- a/batch/decision/src/main/java/org/javaee7/batch/decision/TestServlet.java +++ b/batch/decision/src/main/java/org/javaee7/batch/decision/TestServlet.java @@ -76,16 +76,16 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re try (PrintWriter out = response.getWriter()) { out.println(""); out.println(""); - out.println("Servlet TestServlet"); + out.println("Batch Decision"); out.println(""); out.println(""); - out.println("

Servlet TestServlet at " + request.getContextPath() + "

"); + out.println("

Batch Decision

"); out.println("About to start the job
"); JobOperator jo = BatchRuntime.getJobOperator(); out.println("Got the job operator: " + jo + "
"); jo.start("myJob", new Properties()); out.println("Job submitted
"); - out.println("

Check server.log for output"); + out.println("

Check server.log for output, also look at \"myJob.xml\" for Job XML."); out.println(""); out.println(""); } catch (JobStartException | JobSecurityException ex) { diff --git a/batch/flow/src/main/java/org/javaee7/batch/flow/TestServlet.java b/batch/flow/src/main/java/org/javaee7/batch/flow/TestServlet.java index 153462358..e18f4741c 100644 --- a/batch/flow/src/main/java/org/javaee7/batch/flow/TestServlet.java +++ b/batch/flow/src/main/java/org/javaee7/batch/flow/TestServlet.java @@ -76,10 +76,10 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re try (PrintWriter out = response.getWriter()) { out.println(""); out.println(""); - out.println("Servlet TestServlet"); + out.println("Batch Flow"); out.println(""); out.println(""); - out.println("

Servlet TestServlet at " + request.getContextPath() + "

"); + out.println("

Batch Flow

"); out.println("About to start the job
"); JobOperator jo = BatchRuntime.getJobOperator(); out.println("Got the job operator: " + jo + "
"); diff --git a/batch/multiple-steps/src/main/java/org/javaee7/batch/multiple/steps/TestServlet.java b/batch/multiple-steps/src/main/java/org/javaee7/batch/multiple/steps/TestServlet.java index c3a495044..b1b78bec7 100644 --- a/batch/multiple-steps/src/main/java/org/javaee7/batch/multiple/steps/TestServlet.java +++ b/batch/multiple-steps/src/main/java/org/javaee7/batch/multiple/steps/TestServlet.java @@ -76,17 +76,17 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re try (PrintWriter out = response.getWriter()) { out.println(""); out.println(""); - out.println("Servlet TestServlet"); + out.println("Batch Multiple Steps"); out.println(""); out.println(""); - out.println("

Servlet TestServlet at " + request.getContextPath() + "

"); + out.println("

Batch Multiple Steps

"); out.println("About to start the job
"); JobOperator jo = BatchRuntime.getJobOperator(); out.println("Got the job operator: " + jo + "
"); long jid = jo.start("myJob", new Properties()); out.println("Job submitted: " + jid + "
"); out.println(jo.getJobInstanceCount("myJob") + " job instance found
"); - out.println("

Check server.log for output"); + out.println("

Check server.log for output, also look at \"myJob.xml\" for Job XML."); out.println(""); out.println(""); } catch (JobStartException | JobSecurityException ex) { From ff950e62f3ea3c40588ecca444ee57421a4d9236 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Tue, 17 Sep 2013 12:53:18 -0700 Subject: [PATCH 032/995] Cleaning up titles --- batch/batchlet-simple/src/main/webapp/index.jsp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/batch/batchlet-simple/src/main/webapp/index.jsp b/batch/batchlet-simple/src/main/webapp/index.jsp index e341b6611..a5e50da94 100644 --- a/batch/batchlet-simple/src/main/webapp/index.jsp +++ b/batch/batchlet-simple/src/main/webapp/index.jsp @@ -46,10 +46,10 @@ - Batch - Simple Batchlet! + Batch - Simple Batchlet -

Batch - Simple Batchlet!

+

Batch - Simple Batchlet

Start the job. From c77ae3373d8d22411c8d3234caa8d26248228cd6 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Tue, 17 Sep 2013 12:54:02 -0700 Subject: [PATCH 033/995] Cleaning up output messages --- .../java/org/javaee7/batch/batchlet/simple/TestServlet.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/batch/batchlet-simple/src/main/java/org/javaee7/batch/batchlet/simple/TestServlet.java b/batch/batchlet-simple/src/main/java/org/javaee7/batch/batchlet/simple/TestServlet.java index f1d474b1b..45947a212 100644 --- a/batch/batchlet-simple/src/main/java/org/javaee7/batch/batchlet/simple/TestServlet.java +++ b/batch/batchlet-simple/src/main/java/org/javaee7/batch/batchlet/simple/TestServlet.java @@ -75,10 +75,10 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re try (PrintWriter out = response.getWriter()) { out.println(""); out.println(""); - out.println("Servlet TestServlet"); + out.println("Starting a Batchlet"); out.println(""); out.println(""); - out.println("

Servlet TestServlet at " + request.getContextPath() + "

"); + out.println("

Starting a Batchlet

"); out.println("About to start the job
"); JobOperator jo = BatchRuntime.getJobOperator(); out.println("Got the job operator: " + jo + "
"); From 959b80600c538a16c85ab9691ef0055281634064 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Tue, 17 Sep 2013 12:58:39 -0700 Subject: [PATCH 034/995] Cleaning up titles --- batch/chunk-checkpoint/src/main/webapp/index.jsp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/batch/chunk-checkpoint/src/main/webapp/index.jsp b/batch/chunk-checkpoint/src/main/webapp/index.jsp index bd988f900..262bd8592 100644 --- a/batch/chunk-checkpoint/src/main/webapp/index.jsp +++ b/batch/chunk-checkpoint/src/main/webapp/index.jsp @@ -46,10 +46,10 @@ - Batch - Custom Checkpoint! + Batch - Custom Checkpoint -

Batch - Custom Checkpoint!

+

Batch - Custom Checkpoint

Start the job. From 013eb6375191abbe0332f95ecaa71c76ce13f8e0 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Tue, 17 Sep 2013 12:59:28 -0700 Subject: [PATCH 035/995] Removing NetBeans configuration files --- batch/batchlet-simple/nb-configuration.xml | 18 ------------------ batch/chunk-checkpoint/nb-configuration.xml | 18 ------------------ 2 files changed, 36 deletions(-) delete mode 100644 batch/batchlet-simple/nb-configuration.xml delete mode 100644 batch/chunk-checkpoint/nb-configuration.xml diff --git a/batch/batchlet-simple/nb-configuration.xml b/batch/batchlet-simple/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/batch/batchlet-simple/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/batch/chunk-checkpoint/nb-configuration.xml b/batch/chunk-checkpoint/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/batch/chunk-checkpoint/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - From 09f0d4b5ced436e39d515b18f8de2cccd370a52e Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Tue, 17 Sep 2013 13:00:03 -0700 Subject: [PATCH 036/995] Adding NetBeans deployment hints --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 1b9a69ef5..ec4011670 100644 --- a/pom.xml +++ b/pom.xml @@ -13,6 +13,7 @@ /Users/arungup/tools/glassfish/4.0/final/glassfish4 wildfly8x /Users/arungup/tools/wildfly/wildfly-8.0.0.Alpha4 + gfv3ee6 From 9f6c7a54be9aefffcd09deffdcfabbaf4ff3f8c1 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Tue, 17 Sep 2013 13:01:16 -0700 Subject: [PATCH 037/995] Removing NetBeans configuration file --- cdi/bean-discovery-all/nb-configuration.xml | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 cdi/bean-discovery-all/nb-configuration.xml diff --git a/cdi/bean-discovery-all/nb-configuration.xml b/cdi/bean-discovery-all/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/cdi/bean-discovery-all/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - From 199fb310942863fc8c6f7f0c71e709499b50097c Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Tue, 17 Sep 2013 13:03:00 -0700 Subject: [PATCH 038/995] Cleaning up output messages --- .../main/java/org/javaee7/cdi/interceptors/TestServlet.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cdi/interceptors/src/main/java/org/javaee7/cdi/interceptors/TestServlet.java b/cdi/interceptors/src/main/java/org/javaee7/cdi/interceptors/TestServlet.java index 9ca240eaf..8f2d08ced 100644 --- a/cdi/interceptors/src/main/java/org/javaee7/cdi/interceptors/TestServlet.java +++ b/cdi/interceptors/src/main/java/org/javaee7/cdi/interceptors/TestServlet.java @@ -73,12 +73,12 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re out.println(""); out.println(""); out.println(""); - out.println("Servlet TestServlet"); + out.println("CDI Interceptors"); out.println(""); out.println(""); - out.println("

Servlet TestServlet at " + request.getContextPath() + "

"); + out.println("

CDI Interceptors

"); out.println(greeting.greet("Duke")); - out.println("

Look for output in server.log"); + out.println("

Look for output in \"server.log\"."); out.println(""); out.println(""); } From c811ff93db0f3ecdb6c43539968ec8c95dfec1d3 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Tue, 17 Sep 2013 13:05:19 -0700 Subject: [PATCH 039/995] Removing NetBeans configuration file --- .gitignore | 3 ++- batch/chunk-csv-database/nb-configuration.xml | 18 ----------------- batch/chunk-exception/nb-configuration.xml | 18 ----------------- batch/chunk-mapper/nb-configuration.xml | 18 ----------------- .../nb-configuration.xml | 18 ----------------- batch/chunk-partition/nb-configuration.xml | 18 ----------------- .../chunk-simple-nobeans/nb-configuration.xml | 18 ----------------- batch/decision/nb-configuration.xml | 18 ----------------- batch/flow/nb-configuration.xml | 18 ----------------- batch/multiple-steps/nb-configuration.xml | 18 ----------------- batch/split/nb-configuration.xml | 18 ----------------- .../nb-configuration.xml | 18 ----------------- cdi/bean-discovery-none/nb-configuration.xml | 18 ----------------- cdi/beanmanager/nb-configuration.xml | 19 ------------------ cdi/beansxml-noversion/nb-configuration.xml | 18 ----------------- cdi/built-in/nb-configuration.xml | 18 ----------------- cdi/decorators/nb-configuration.xml | 18 ----------------- cdi/exclude-filter/nb-configuration.xml | 18 ----------------- cdi/extension-impl/nb-configuration.xml | 18 ----------------- cdi/extension/nb-configuration.xml | 18 ----------------- cdi/interceptors/nb-configuration.xml | 18 ----------------- cdi/nobeans-xml/nb-configuration.xml | 18 ----------------- cdi/pkg-level/nb-configuration.xml | 18 ----------------- cdi/vetoed/nb-configuration.xml | 18 ----------------- concurrency/dynamicproxy/nb-configuration.xml | 18 ----------------- .../manageablethread/nb-configuration.xml | 18 ----------------- .../managedexecutor/nb-configuration.xml | 18 ----------------- .../nb-configuration.xml | 18 ----------------- ejb/lifecycle/nb-configuration.xml | 18 ----------------- ejb/singleton/nb-configuration.xml | 18 ----------------- ejb/stateful/nb-configuration.xml | 18 ----------------- ejb/stateless/nb-configuration.xml | 18 ----------------- ejb/timer/nb-configuration.xml | 18 ----------------- el/standalone/nb-configuration.xml | 18 ----------------- extra/quartz/nb-configuration.xml | 18 ----------------- javamail/definition/nb-configuration.xml | 18 ----------------- jaxrs/async-client/nb-configuration.xml | 19 ------------------ jaxrs/async-server/nb-configuration.xml | 19 ------------------ jaxrs/beanvalidation/nb-configuration.xml | 19 ------------------ jaxrs/client-negotiation/nb-configuration.xml | 19 ------------------ jaxrs/dynamicfilter/nb-configuration.xml | 19 ------------------ jaxrs/filter-interceptor/nb-configuration.xml | 19 ------------------ jaxrs/filter/nb-configuration.xml | 19 ------------------ jaxrs/interceptor/nb-configuration.xml | 19 ------------------ jaxrs/invocation-async/nb-configuration.xml | 18 ----------------- jaxrs/invocation/nb-configuration.xml | 19 ------------------ jaxrs/jaxrs-client/nb-configuration.xml | 19 ------------------ jaxrs/jaxrs-endpoint/nb-configuration.xml | 19 ------------------ jaxrs/jsonp/nb-configuration.xml | 19 ------------------ jaxrs/link/nb-configuration.xml | 18 ----------------- jaxrs/mapping-exceptions/nb-configuration.xml | 19 ------------------ jaxrs/moxy/nb-configuration.xml | 19 ------------------ .../nb-configuration.xml | 19 ------------------ jaxrs/readerwriter-json/nb-configuration.xml | 19 ------------------ jaxrs/readerwriter/nb-configuration.xml | 19 ------------------ jaxrs/request-binding/nb-configuration.xml | 19 ------------------ .../resource-validation/nb-configuration.xml | 19 ------------------ jaxrs/server-negotiation/nb-configuration.xml | 19 ------------------ jaxrs/server-sent-event/nb-configuration.xml | 19 ------------------ .../singleton-annotation/nb-configuration.xml | 20 ------------------- .../nb-configuration.xml | 20 ------------------- .../nb-configuration.xml | 20 ------------------- jms/jmscontext-cdi/nb-configuration.xml | 18 ----------------- jms/send-receive-simple/nb-configuration.xml | 18 ----------------- jms/send-receive/nb-configuration.xml | 18 ----------------- jpa/criteria/nb-configuration.xml | 18 ----------------- jpa/entitygraph/nb-configuration.xml | 18 ----------------- jpa/listeners/nb-configuration.xml | 18 ----------------- jpa/locking-optimistic/nb-configuration.xml | 18 ----------------- jpa/locking-pessimistic/nb-configuration.xml | 18 ----------------- jpa/multiple-pu/nb-configuration.xml | 18 ----------------- .../nb-configuration.xml | 18 ----------------- jpa/native-sql/nb-configuration.xml | 18 ----------------- jpa/pu-typesafe/nb-configuration.xml | 18 ----------------- .../nb-configuration.xml | 18 ----------------- .../nb-configuration.xml | 18 ----------------- jpa/schema-gen-scripts/nb-configuration.xml | 18 ----------------- jpa/schema-gen/nb-configuration.xml | 18 ----------------- jpa/storedprocedure/nb-configuration.xml | 18 ----------------- jsf/ajax/nb-configuration.xml | 18 ----------------- jsf/bean-validation/nb-configuration.xml | 18 ----------------- jsf/components/nb-configuration.xml | 18 ----------------- jsf/composite-component/nb-configuration.xml | 18 ----------------- jsf/contracts-library/nb-configuration.xml | 18 ----------------- jsf/file-upload/nb-configuration.xml | 18 ----------------- jsf/flows-declarative/nb-configuration.xml | 18 ----------------- jsf/flows-programmatic/nb-configuration.xml | 18 ----------------- jsf/flows-simple/nb-configuration.xml | 18 ----------------- jsf/http-get/nb-configuration.xml | 18 ----------------- jsf/passthrough/nb-configuration.xml | 18 ----------------- jsf/radio-buttons/nb-configuration.xml | 18 ----------------- jsf/resource-handling/nb-configuration.xml | 19 ------------------ jsf/server-extension/nb-configuration.xml | 18 ----------------- jsf/simple-facelet/nb-configuration.xml | 19 ------------------ jsf/viewscoped/nb-configuration.xml | 18 ----------------- json/object-builder/nb-configuration.xml | 18 ----------------- json/object-reader/nb-configuration.xml | 18 ----------------- json/streaming-generate/nb-configuration.xml | 18 ----------------- json/streaming-parser/nb-configuration.xml | 18 ----------------- jta/transaction-scope/nb-configuration.xml | 18 ----------------- jta/transactional/nb-configuration.xml | 18 ----------------- jta/tx-exception/nb-configuration.xml | 18 ----------------- jta/user-transaction/nb-configuration.xml | 18 ----------------- servlet/async-servlet/nb-configuration.xml | 18 ----------------- servlet/cookies/nb-configuration.xml | 18 ----------------- servlet/error-mapping/nb-configuration.xml | 18 ----------------- servlet/event-listeners/nb-configuration.xml | 18 ----------------- servlet/file-upload/nb-configuration.xml | 18 ----------------- .../form-based-security/nb-configuration.xml | 18 ----------------- .../metadata-complete/nb-configuration.xml | 18 ----------------- servlet/nonblocking/nb-configuration.xml | 18 ----------------- servlet/protocol-handler/nb-configuration.xml | 18 ----------------- .../resource-packaging/nb-configuration.xml | 18 ----------------- servlet/servlet-filters/nb-configuration.xml | 18 ----------------- servlet/servlet-security/nb-configuration.xml | 18 ----------------- servlet/web-fragment/nb-configuration.xml | 18 ----------------- .../custom-constraint/nb-configuration.xml | 19 ------------------ validation/methods/nb-configuration.xml | 18 ----------------- websocket/binary/nb-configuration.xml | 18 ----------------- websocket/chat/nb-configuration.xml | 18 ----------------- websocket/encoder-client/nb-configuration.xml | 18 ----------------- .../encoder-programmatic/nb-configuration.xml | 18 ----------------- websocket/encoder/nb-configuration.xml | 18 ----------------- websocket/endpoint-async/nb-configuration.xml | 18 ----------------- .../endpoint-config/nb-configuration.xml | 18 ----------------- .../endpoint-javatypes/nb-configuration.xml | 18 ----------------- .../nb-configuration.xml | 18 ----------------- .../nb-configuration.xml | 19 ------------------ .../nb-configuration.xml | 18 ----------------- .../nb-configuration.xml | 18 ----------------- .../endpoint-security/nb-configuration.xml | 18 ----------------- .../endpoint-singleton/nb-configuration.xml | 18 ----------------- websocket/endpoint/nb-configuration.xml | 18 ----------------- websocket/httpsession/nb-configuration.xml | 18 ----------------- websocket/injection/nb-configuration.xml | 18 ----------------- websocket/messagesize/nb-configuration.xml | 18 ----------------- websocket/parameters/nb-configuration.xml | 18 ----------------- websocket/properties/nb-configuration.xml | 18 ----------------- websocket/subprotocol/nb-configuration.xml | 18 ----------------- .../nb-configuration.xml | 18 ----------------- .../nb-configuration.xml | 18 ----------------- .../nb-configuration.xml | 18 ----------------- .../nb-configuration.xml | 18 ----------------- .../websocket-client/nb-configuration.xml | 18 ----------------- .../websocket-vs-rest/nb-configuration.xml | 19 ------------------ websocket/whiteboard/nb-configuration.xml | 18 ----------------- 146 files changed, 2 insertions(+), 2644 deletions(-) delete mode 100644 batch/chunk-csv-database/nb-configuration.xml delete mode 100644 batch/chunk-exception/nb-configuration.xml delete mode 100644 batch/chunk-mapper/nb-configuration.xml delete mode 100644 batch/chunk-optional-processor/nb-configuration.xml delete mode 100644 batch/chunk-partition/nb-configuration.xml delete mode 100644 batch/chunk-simple-nobeans/nb-configuration.xml delete mode 100644 batch/decision/nb-configuration.xml delete mode 100644 batch/flow/nb-configuration.xml delete mode 100644 batch/multiple-steps/nb-configuration.xml delete mode 100644 batch/split/nb-configuration.xml delete mode 100644 cdi/bean-discovery-annotated/nb-configuration.xml delete mode 100644 cdi/bean-discovery-none/nb-configuration.xml delete mode 100644 cdi/beanmanager/nb-configuration.xml delete mode 100644 cdi/beansxml-noversion/nb-configuration.xml delete mode 100644 cdi/built-in/nb-configuration.xml delete mode 100644 cdi/decorators/nb-configuration.xml delete mode 100644 cdi/exclude-filter/nb-configuration.xml delete mode 100644 cdi/extension-impl/nb-configuration.xml delete mode 100644 cdi/extension/nb-configuration.xml delete mode 100644 cdi/interceptors/nb-configuration.xml delete mode 100644 cdi/nobeans-xml/nb-configuration.xml delete mode 100644 cdi/pkg-level/nb-configuration.xml delete mode 100644 cdi/vetoed/nb-configuration.xml delete mode 100644 concurrency/dynamicproxy/nb-configuration.xml delete mode 100644 concurrency/manageablethread/nb-configuration.xml delete mode 100644 concurrency/managedexecutor/nb-configuration.xml delete mode 100644 concurrency/managedscheduledexecutor/nb-configuration.xml delete mode 100644 ejb/lifecycle/nb-configuration.xml delete mode 100644 ejb/singleton/nb-configuration.xml delete mode 100644 ejb/stateful/nb-configuration.xml delete mode 100644 ejb/stateless/nb-configuration.xml delete mode 100644 ejb/timer/nb-configuration.xml delete mode 100644 el/standalone/nb-configuration.xml delete mode 100644 extra/quartz/nb-configuration.xml delete mode 100644 javamail/definition/nb-configuration.xml delete mode 100644 jaxrs/async-client/nb-configuration.xml delete mode 100644 jaxrs/async-server/nb-configuration.xml delete mode 100644 jaxrs/beanvalidation/nb-configuration.xml delete mode 100644 jaxrs/client-negotiation/nb-configuration.xml delete mode 100644 jaxrs/dynamicfilter/nb-configuration.xml delete mode 100644 jaxrs/filter-interceptor/nb-configuration.xml delete mode 100644 jaxrs/filter/nb-configuration.xml delete mode 100644 jaxrs/interceptor/nb-configuration.xml delete mode 100644 jaxrs/invocation-async/nb-configuration.xml delete mode 100644 jaxrs/invocation/nb-configuration.xml delete mode 100644 jaxrs/jaxrs-client/nb-configuration.xml delete mode 100644 jaxrs/jaxrs-endpoint/nb-configuration.xml delete mode 100644 jaxrs/jsonp/nb-configuration.xml delete mode 100644 jaxrs/link/nb-configuration.xml delete mode 100644 jaxrs/mapping-exceptions/nb-configuration.xml delete mode 100644 jaxrs/moxy/nb-configuration.xml delete mode 100644 jaxrs/readerwriter-injection/nb-configuration.xml delete mode 100644 jaxrs/readerwriter-json/nb-configuration.xml delete mode 100644 jaxrs/readerwriter/nb-configuration.xml delete mode 100644 jaxrs/request-binding/nb-configuration.xml delete mode 100644 jaxrs/resource-validation/nb-configuration.xml delete mode 100644 jaxrs/server-negotiation/nb-configuration.xml delete mode 100644 jaxrs/server-sent-event/nb-configuration.xml delete mode 100644 jaxrs/singleton-annotation/nb-configuration.xml delete mode 100644 jaxrs/singleton-application.old/nb-configuration.xml delete mode 100644 jaxrs/singleton-application/nb-configuration.xml delete mode 100644 jms/jmscontext-cdi/nb-configuration.xml delete mode 100644 jms/send-receive-simple/nb-configuration.xml delete mode 100644 jms/send-receive/nb-configuration.xml delete mode 100644 jpa/criteria/nb-configuration.xml delete mode 100644 jpa/entitygraph/nb-configuration.xml delete mode 100644 jpa/listeners/nb-configuration.xml delete mode 100644 jpa/locking-optimistic/nb-configuration.xml delete mode 100644 jpa/locking-pessimistic/nb-configuration.xml delete mode 100644 jpa/multiple-pu/nb-configuration.xml delete mode 100644 jpa/native-sql-resultset-mapping/nb-configuration.xml delete mode 100644 jpa/native-sql/nb-configuration.xml delete mode 100644 jpa/pu-typesafe/nb-configuration.xml delete mode 100644 jpa/schema-gen-scripts-external/nb-configuration.xml delete mode 100644 jpa/schema-gen-scripts-generate/nb-configuration.xml delete mode 100644 jpa/schema-gen-scripts/nb-configuration.xml delete mode 100644 jpa/schema-gen/nb-configuration.xml delete mode 100644 jpa/storedprocedure/nb-configuration.xml delete mode 100644 jsf/ajax/nb-configuration.xml delete mode 100644 jsf/bean-validation/nb-configuration.xml delete mode 100644 jsf/components/nb-configuration.xml delete mode 100644 jsf/composite-component/nb-configuration.xml delete mode 100644 jsf/contracts-library/nb-configuration.xml delete mode 100644 jsf/file-upload/nb-configuration.xml delete mode 100644 jsf/flows-declarative/nb-configuration.xml delete mode 100644 jsf/flows-programmatic/nb-configuration.xml delete mode 100644 jsf/flows-simple/nb-configuration.xml delete mode 100644 jsf/http-get/nb-configuration.xml delete mode 100644 jsf/passthrough/nb-configuration.xml delete mode 100644 jsf/radio-buttons/nb-configuration.xml delete mode 100644 jsf/resource-handling/nb-configuration.xml delete mode 100644 jsf/server-extension/nb-configuration.xml delete mode 100644 jsf/simple-facelet/nb-configuration.xml delete mode 100644 jsf/viewscoped/nb-configuration.xml delete mode 100644 json/object-builder/nb-configuration.xml delete mode 100644 json/object-reader/nb-configuration.xml delete mode 100644 json/streaming-generate/nb-configuration.xml delete mode 100644 json/streaming-parser/nb-configuration.xml delete mode 100644 jta/transaction-scope/nb-configuration.xml delete mode 100644 jta/transactional/nb-configuration.xml delete mode 100644 jta/tx-exception/nb-configuration.xml delete mode 100644 jta/user-transaction/nb-configuration.xml delete mode 100644 servlet/async-servlet/nb-configuration.xml delete mode 100644 servlet/cookies/nb-configuration.xml delete mode 100644 servlet/error-mapping/nb-configuration.xml delete mode 100644 servlet/event-listeners/nb-configuration.xml delete mode 100644 servlet/file-upload/nb-configuration.xml delete mode 100644 servlet/form-based-security/nb-configuration.xml delete mode 100644 servlet/metadata-complete/nb-configuration.xml delete mode 100644 servlet/nonblocking/nb-configuration.xml delete mode 100644 servlet/protocol-handler/nb-configuration.xml delete mode 100644 servlet/resource-packaging/nb-configuration.xml delete mode 100644 servlet/servlet-filters/nb-configuration.xml delete mode 100644 servlet/servlet-security/nb-configuration.xml delete mode 100644 servlet/web-fragment/nb-configuration.xml delete mode 100644 validation/custom-constraint/nb-configuration.xml delete mode 100644 validation/methods/nb-configuration.xml delete mode 100644 websocket/binary/nb-configuration.xml delete mode 100644 websocket/chat/nb-configuration.xml delete mode 100644 websocket/encoder-client/nb-configuration.xml delete mode 100644 websocket/encoder-programmatic/nb-configuration.xml delete mode 100644 websocket/encoder/nb-configuration.xml delete mode 100644 websocket/endpoint-async/nb-configuration.xml delete mode 100644 websocket/endpoint-config/nb-configuration.xml delete mode 100644 websocket/endpoint-javatypes/nb-configuration.xml delete mode 100644 websocket/endpoint-programmatic-async/nb-configuration.xml delete mode 100644 websocket/endpoint-programmatic-config/nb-configuration.xml delete mode 100644 websocket/endpoint-programmatic-injection/nb-configuration.xml delete mode 100644 websocket/endpoint-programmatic/nb-configuration.xml delete mode 100644 websocket/endpoint-security/nb-configuration.xml delete mode 100644 websocket/endpoint-singleton/nb-configuration.xml delete mode 100644 websocket/endpoint/nb-configuration.xml delete mode 100644 websocket/httpsession/nb-configuration.xml delete mode 100644 websocket/injection/nb-configuration.xml delete mode 100644 websocket/messagesize/nb-configuration.xml delete mode 100644 websocket/parameters/nb-configuration.xml delete mode 100644 websocket/properties/nb-configuration.xml delete mode 100644 websocket/subprotocol/nb-configuration.xml delete mode 100644 websocket/websocket-client-config/nb-configuration.xml delete mode 100644 websocket/websocket-client-programmatic-config/nb-configuration.xml delete mode 100644 websocket/websocket-client-programmatic-encoders/nb-configuration.xml delete mode 100644 websocket/websocket-client-programmatic/nb-configuration.xml delete mode 100644 websocket/websocket-client/nb-configuration.xml delete mode 100644 websocket/websocket-vs-rest/nb-configuration.xml delete mode 100644 websocket/whiteboard/nb-configuration.xml diff --git a/.gitignore b/.gitignore index 7c0e5a651..4da7b0943 100644 --- a/.gitignore +++ b/.gitignore @@ -117,4 +117,5 @@ /extra/twitter-search/target/ /concurrency/managedexecutor/target/ /concurrency/managedscheduledexecutor/target/ -/concurrency/manageablethread/target/ \ No newline at end of file +/concurrency/manageablethread/target/ +/batch/chunk-simple/target/ \ No newline at end of file diff --git a/batch/chunk-csv-database/nb-configuration.xml b/batch/chunk-csv-database/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/batch/chunk-csv-database/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/batch/chunk-exception/nb-configuration.xml b/batch/chunk-exception/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/batch/chunk-exception/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/batch/chunk-mapper/nb-configuration.xml b/batch/chunk-mapper/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/batch/chunk-mapper/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/batch/chunk-optional-processor/nb-configuration.xml b/batch/chunk-optional-processor/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/batch/chunk-optional-processor/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/batch/chunk-partition/nb-configuration.xml b/batch/chunk-partition/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/batch/chunk-partition/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/batch/chunk-simple-nobeans/nb-configuration.xml b/batch/chunk-simple-nobeans/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/batch/chunk-simple-nobeans/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/batch/decision/nb-configuration.xml b/batch/decision/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/batch/decision/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/batch/flow/nb-configuration.xml b/batch/flow/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/batch/flow/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/batch/multiple-steps/nb-configuration.xml b/batch/multiple-steps/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/batch/multiple-steps/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/batch/split/nb-configuration.xml b/batch/split/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/batch/split/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/cdi/bean-discovery-annotated/nb-configuration.xml b/cdi/bean-discovery-annotated/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/cdi/bean-discovery-annotated/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/cdi/bean-discovery-none/nb-configuration.xml b/cdi/bean-discovery-none/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/cdi/bean-discovery-none/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/cdi/beanmanager/nb-configuration.xml b/cdi/beanmanager/nb-configuration.xml deleted file mode 100644 index 2edcd9286..000000000 --- a/cdi/beanmanager/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - 1.6-web - gfv3ee6 - - diff --git a/cdi/beansxml-noversion/nb-configuration.xml b/cdi/beansxml-noversion/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/cdi/beansxml-noversion/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/cdi/built-in/nb-configuration.xml b/cdi/built-in/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/cdi/built-in/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/cdi/decorators/nb-configuration.xml b/cdi/decorators/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/cdi/decorators/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/cdi/exclude-filter/nb-configuration.xml b/cdi/exclude-filter/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/cdi/exclude-filter/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/cdi/extension-impl/nb-configuration.xml b/cdi/extension-impl/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/cdi/extension-impl/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/cdi/extension/nb-configuration.xml b/cdi/extension/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/cdi/extension/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/cdi/interceptors/nb-configuration.xml b/cdi/interceptors/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/cdi/interceptors/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/cdi/nobeans-xml/nb-configuration.xml b/cdi/nobeans-xml/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/cdi/nobeans-xml/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/cdi/pkg-level/nb-configuration.xml b/cdi/pkg-level/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/cdi/pkg-level/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/cdi/vetoed/nb-configuration.xml b/cdi/vetoed/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/cdi/vetoed/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/concurrency/dynamicproxy/nb-configuration.xml b/concurrency/dynamicproxy/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/concurrency/dynamicproxy/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/concurrency/manageablethread/nb-configuration.xml b/concurrency/manageablethread/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/concurrency/manageablethread/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/concurrency/managedexecutor/nb-configuration.xml b/concurrency/managedexecutor/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/concurrency/managedexecutor/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/concurrency/managedscheduledexecutor/nb-configuration.xml b/concurrency/managedscheduledexecutor/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/concurrency/managedscheduledexecutor/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/ejb/lifecycle/nb-configuration.xml b/ejb/lifecycle/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/ejb/lifecycle/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/ejb/singleton/nb-configuration.xml b/ejb/singleton/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/ejb/singleton/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/ejb/stateful/nb-configuration.xml b/ejb/stateful/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/ejb/stateful/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/ejb/stateless/nb-configuration.xml b/ejb/stateless/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/ejb/stateless/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/ejb/timer/nb-configuration.xml b/ejb/timer/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/ejb/timer/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/el/standalone/nb-configuration.xml b/el/standalone/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/el/standalone/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/extra/quartz/nb-configuration.xml b/extra/quartz/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/extra/quartz/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/javamail/definition/nb-configuration.xml b/javamail/definition/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/javamail/definition/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jaxrs/async-client/nb-configuration.xml b/jaxrs/async-client/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/async-client/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/async-server/nb-configuration.xml b/jaxrs/async-server/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/async-server/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/beanvalidation/nb-configuration.xml b/jaxrs/beanvalidation/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/beanvalidation/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/client-negotiation/nb-configuration.xml b/jaxrs/client-negotiation/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/client-negotiation/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/dynamicfilter/nb-configuration.xml b/jaxrs/dynamicfilter/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/dynamicfilter/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/filter-interceptor/nb-configuration.xml b/jaxrs/filter-interceptor/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/filter-interceptor/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/filter/nb-configuration.xml b/jaxrs/filter/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/filter/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/interceptor/nb-configuration.xml b/jaxrs/interceptor/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/interceptor/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/invocation-async/nb-configuration.xml b/jaxrs/invocation-async/nb-configuration.xml deleted file mode 100644 index 4da1f6c9b..000000000 --- a/jaxrs/invocation-async/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - ide - - diff --git a/jaxrs/invocation/nb-configuration.xml b/jaxrs/invocation/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/invocation/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/jaxrs-client/nb-configuration.xml b/jaxrs/jaxrs-client/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/jaxrs-client/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/jaxrs-endpoint/nb-configuration.xml b/jaxrs/jaxrs-endpoint/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/jaxrs-endpoint/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/jsonp/nb-configuration.xml b/jaxrs/jsonp/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/jsonp/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/link/nb-configuration.xml b/jaxrs/link/nb-configuration.xml deleted file mode 100644 index 4da1f6c9b..000000000 --- a/jaxrs/link/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - ide - - diff --git a/jaxrs/mapping-exceptions/nb-configuration.xml b/jaxrs/mapping-exceptions/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/mapping-exceptions/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/moxy/nb-configuration.xml b/jaxrs/moxy/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/moxy/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/readerwriter-injection/nb-configuration.xml b/jaxrs/readerwriter-injection/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/readerwriter-injection/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/readerwriter-json/nb-configuration.xml b/jaxrs/readerwriter-json/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/readerwriter-json/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/readerwriter/nb-configuration.xml b/jaxrs/readerwriter/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/readerwriter/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/request-binding/nb-configuration.xml b/jaxrs/request-binding/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/request-binding/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/resource-validation/nb-configuration.xml b/jaxrs/resource-validation/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/resource-validation/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/server-negotiation/nb-configuration.xml b/jaxrs/server-negotiation/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/server-negotiation/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/server-sent-event/nb-configuration.xml b/jaxrs/server-sent-event/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/jaxrs/server-sent-event/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/jaxrs/singleton-annotation/nb-configuration.xml b/jaxrs/singleton-annotation/nb-configuration.xml deleted file mode 100644 index 186bd512c..000000000 --- a/jaxrs/singleton-annotation/nb-configuration.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - 1.7-web - gfv3ee6 - ide - - diff --git a/jaxrs/singleton-application.old/nb-configuration.xml b/jaxrs/singleton-application.old/nb-configuration.xml deleted file mode 100644 index 186bd512c..000000000 --- a/jaxrs/singleton-application.old/nb-configuration.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - 1.7-web - gfv3ee6 - ide - - diff --git a/jaxrs/singleton-application/nb-configuration.xml b/jaxrs/singleton-application/nb-configuration.xml deleted file mode 100644 index 186bd512c..000000000 --- a/jaxrs/singleton-application/nb-configuration.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - 1.7-web - gfv3ee6 - ide - - diff --git a/jms/jmscontext-cdi/nb-configuration.xml b/jms/jmscontext-cdi/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jms/jmscontext-cdi/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jms/send-receive-simple/nb-configuration.xml b/jms/send-receive-simple/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jms/send-receive-simple/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jms/send-receive/nb-configuration.xml b/jms/send-receive/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jms/send-receive/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jpa/criteria/nb-configuration.xml b/jpa/criteria/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jpa/criteria/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jpa/entitygraph/nb-configuration.xml b/jpa/entitygraph/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jpa/entitygraph/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jpa/listeners/nb-configuration.xml b/jpa/listeners/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jpa/listeners/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jpa/locking-optimistic/nb-configuration.xml b/jpa/locking-optimistic/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jpa/locking-optimistic/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jpa/locking-pessimistic/nb-configuration.xml b/jpa/locking-pessimistic/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jpa/locking-pessimistic/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jpa/multiple-pu/nb-configuration.xml b/jpa/multiple-pu/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jpa/multiple-pu/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jpa/native-sql-resultset-mapping/nb-configuration.xml b/jpa/native-sql-resultset-mapping/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jpa/native-sql-resultset-mapping/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jpa/native-sql/nb-configuration.xml b/jpa/native-sql/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jpa/native-sql/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jpa/pu-typesafe/nb-configuration.xml b/jpa/pu-typesafe/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jpa/pu-typesafe/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jpa/schema-gen-scripts-external/nb-configuration.xml b/jpa/schema-gen-scripts-external/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jpa/schema-gen-scripts-external/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jpa/schema-gen-scripts-generate/nb-configuration.xml b/jpa/schema-gen-scripts-generate/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jpa/schema-gen-scripts-generate/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jpa/schema-gen-scripts/nb-configuration.xml b/jpa/schema-gen-scripts/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jpa/schema-gen-scripts/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jpa/schema-gen/nb-configuration.xml b/jpa/schema-gen/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jpa/schema-gen/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jpa/storedprocedure/nb-configuration.xml b/jpa/storedprocedure/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jpa/storedprocedure/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jsf/ajax/nb-configuration.xml b/jsf/ajax/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jsf/ajax/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jsf/bean-validation/nb-configuration.xml b/jsf/bean-validation/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jsf/bean-validation/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jsf/components/nb-configuration.xml b/jsf/components/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jsf/components/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jsf/composite-component/nb-configuration.xml b/jsf/composite-component/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jsf/composite-component/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jsf/contracts-library/nb-configuration.xml b/jsf/contracts-library/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jsf/contracts-library/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jsf/file-upload/nb-configuration.xml b/jsf/file-upload/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jsf/file-upload/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jsf/flows-declarative/nb-configuration.xml b/jsf/flows-declarative/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jsf/flows-declarative/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jsf/flows-programmatic/nb-configuration.xml b/jsf/flows-programmatic/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jsf/flows-programmatic/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jsf/flows-simple/nb-configuration.xml b/jsf/flows-simple/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jsf/flows-simple/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jsf/http-get/nb-configuration.xml b/jsf/http-get/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jsf/http-get/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jsf/passthrough/nb-configuration.xml b/jsf/passthrough/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jsf/passthrough/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jsf/radio-buttons/nb-configuration.xml b/jsf/radio-buttons/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jsf/radio-buttons/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jsf/resource-handling/nb-configuration.xml b/jsf/resource-handling/nb-configuration.xml deleted file mode 100644 index acb1fbf63..000000000 --- a/jsf/resource-handling/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - gfv3ee6 - Facelets - - diff --git a/jsf/server-extension/nb-configuration.xml b/jsf/server-extension/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jsf/server-extension/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jsf/simple-facelet/nb-configuration.xml b/jsf/simple-facelet/nb-configuration.xml deleted file mode 100644 index acb1fbf63..000000000 --- a/jsf/simple-facelet/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - gfv3ee6 - Facelets - - diff --git a/jsf/viewscoped/nb-configuration.xml b/jsf/viewscoped/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jsf/viewscoped/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/json/object-builder/nb-configuration.xml b/json/object-builder/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/json/object-builder/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/json/object-reader/nb-configuration.xml b/json/object-reader/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/json/object-reader/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/json/streaming-generate/nb-configuration.xml b/json/streaming-generate/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/json/streaming-generate/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/json/streaming-parser/nb-configuration.xml b/json/streaming-parser/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/json/streaming-parser/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jta/transaction-scope/nb-configuration.xml b/jta/transaction-scope/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jta/transaction-scope/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jta/transactional/nb-configuration.xml b/jta/transactional/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jta/transactional/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jta/tx-exception/nb-configuration.xml b/jta/tx-exception/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jta/tx-exception/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/jta/user-transaction/nb-configuration.xml b/jta/user-transaction/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/jta/user-transaction/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/servlet/async-servlet/nb-configuration.xml b/servlet/async-servlet/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/servlet/async-servlet/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/servlet/cookies/nb-configuration.xml b/servlet/cookies/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/servlet/cookies/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/servlet/error-mapping/nb-configuration.xml b/servlet/error-mapping/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/servlet/error-mapping/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/servlet/event-listeners/nb-configuration.xml b/servlet/event-listeners/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/servlet/event-listeners/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/servlet/file-upload/nb-configuration.xml b/servlet/file-upload/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/servlet/file-upload/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/servlet/form-based-security/nb-configuration.xml b/servlet/form-based-security/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/servlet/form-based-security/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/servlet/metadata-complete/nb-configuration.xml b/servlet/metadata-complete/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/servlet/metadata-complete/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/servlet/nonblocking/nb-configuration.xml b/servlet/nonblocking/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/servlet/nonblocking/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/servlet/protocol-handler/nb-configuration.xml b/servlet/protocol-handler/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/servlet/protocol-handler/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/servlet/resource-packaging/nb-configuration.xml b/servlet/resource-packaging/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/servlet/resource-packaging/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/servlet/servlet-filters/nb-configuration.xml b/servlet/servlet-filters/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/servlet/servlet-filters/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/servlet/servlet-security/nb-configuration.xml b/servlet/servlet-security/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/servlet/servlet-security/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/servlet/web-fragment/nb-configuration.xml b/servlet/web-fragment/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/servlet/web-fragment/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/validation/custom-constraint/nb-configuration.xml b/validation/custom-constraint/nb-configuration.xml deleted file mode 100644 index 7c3067b41..000000000 --- a/validation/custom-constraint/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - 1.7-web - gfv3ee6 - - diff --git a/validation/methods/nb-configuration.xml b/validation/methods/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/validation/methods/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/binary/nb-configuration.xml b/websocket/binary/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/binary/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/chat/nb-configuration.xml b/websocket/chat/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/chat/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/encoder-client/nb-configuration.xml b/websocket/encoder-client/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/encoder-client/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/encoder-programmatic/nb-configuration.xml b/websocket/encoder-programmatic/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/encoder-programmatic/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/encoder/nb-configuration.xml b/websocket/encoder/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/encoder/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/endpoint-async/nb-configuration.xml b/websocket/endpoint-async/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/endpoint-async/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/endpoint-config/nb-configuration.xml b/websocket/endpoint-config/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/endpoint-config/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/endpoint-javatypes/nb-configuration.xml b/websocket/endpoint-javatypes/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/endpoint-javatypes/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/endpoint-programmatic-async/nb-configuration.xml b/websocket/endpoint-programmatic-async/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/endpoint-programmatic-async/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/endpoint-programmatic-config/nb-configuration.xml b/websocket/endpoint-programmatic-config/nb-configuration.xml deleted file mode 100644 index 7c3067b41..000000000 --- a/websocket/endpoint-programmatic-config/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - 1.7-web - gfv3ee6 - - diff --git a/websocket/endpoint-programmatic-injection/nb-configuration.xml b/websocket/endpoint-programmatic-injection/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/endpoint-programmatic-injection/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/endpoint-programmatic/nb-configuration.xml b/websocket/endpoint-programmatic/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/endpoint-programmatic/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/endpoint-security/nb-configuration.xml b/websocket/endpoint-security/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/endpoint-security/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/endpoint-singleton/nb-configuration.xml b/websocket/endpoint-singleton/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/endpoint-singleton/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/endpoint/nb-configuration.xml b/websocket/endpoint/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/endpoint/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/httpsession/nb-configuration.xml b/websocket/httpsession/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/httpsession/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/injection/nb-configuration.xml b/websocket/injection/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/injection/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/messagesize/nb-configuration.xml b/websocket/messagesize/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/messagesize/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/parameters/nb-configuration.xml b/websocket/parameters/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/parameters/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/properties/nb-configuration.xml b/websocket/properties/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/properties/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/subprotocol/nb-configuration.xml b/websocket/subprotocol/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/subprotocol/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/websocket-client-config/nb-configuration.xml b/websocket/websocket-client-config/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/websocket-client-config/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/websocket-client-programmatic-config/nb-configuration.xml b/websocket/websocket-client-programmatic-config/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/websocket-client-programmatic-config/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/websocket-client-programmatic-encoders/nb-configuration.xml b/websocket/websocket-client-programmatic-encoders/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/websocket-client-programmatic-encoders/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/websocket-client-programmatic/nb-configuration.xml b/websocket/websocket-client-programmatic/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/websocket-client-programmatic/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/websocket-client/nb-configuration.xml b/websocket/websocket-client/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/websocket-client/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - diff --git a/websocket/websocket-vs-rest/nb-configuration.xml b/websocket/websocket-vs-rest/nb-configuration.xml deleted file mode 100644 index 38c192ec6..000000000 --- a/websocket/websocket-vs-rest/nb-configuration.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - ide - gfv3ee6 - - diff --git a/websocket/whiteboard/nb-configuration.xml b/websocket/whiteboard/nb-configuration.xml deleted file mode 100644 index e38c5dc5a..000000000 --- a/websocket/whiteboard/nb-configuration.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - gfv3ee6 - - From e995668906f39416c4b2377490fac08b8a02e61c Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Tue, 17 Sep 2013 14:55:38 -0700 Subject: [PATCH 040/995] Adding links to NetBeans nightly --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0f034de08..dcdf59deb 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,13 @@ This workspace consists of Java EE 7 Samples. They are categorized in different directories, one for each JSR. +I don't plan to write any formal documentation, read the code. [Java EE 7 Essentials](http://www.amazon.com/Java-EE-Essentials-Arun-Gupta/dp/1449370179/) refer to some of these samples and provide an extensive explanation. However if you are interested in adding javadocs, send a pull request. + ## How to run ? ## ### How I run them ? ### -1. Open the sample in NetBeans 7.4 beta+ (Download from http://bits.netbeans.org/dev/nightly/latest) +1. Open the sample in [NetBeans 7.4 nightly](http://bits.netbeans.org/dev/nightly/latest) 2. Click on "Run" (sample is built and deployed on GlassFish 4, main page shows up) 3. Main page provides feature name, how to run the sample, and displays the output @@ -37,5 +39,3 @@ The following script will generate the complete list of samples. There are 161 samples as of 9/16. -I don't plan to write any formal documentation, let the code talk. [Java EE 7 Essentials](http://www.amazon.com/Java-EE-Essentials-Arun-Gupta/dp/1449370179/) refer to some of these samples and provide an extensive explanation. - From fbba4ef1dc09d3e25ef1083a4bdbf54b4a090b36 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Tue, 17 Sep 2013 15:00:09 -0700 Subject: [PATCH 041/995] slight typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dcdf59deb..e22afafeb 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This workspace consists of Java EE 7 Samples. They are categorized in different directories, one for each JSR. -I don't plan to write any formal documentation, read the code. [Java EE 7 Essentials](http://www.amazon.com/Java-EE-Essentials-Arun-Gupta/dp/1449370179/) refer to some of these samples and provide an extensive explanation. However if you are interested in adding javadocs, send a pull request. +I don't plan to write any formal documentation, read the code. The [Java EE 7 Essentials](http://www.amazon.com/Java-EE-Essentials-Arun-Gupta/dp/1449370179/) book refer to some of these samples and provide an explanation. However if you are interested in adding javadocs, send a pull request. ## How to run ? ## From 1f5abf4bd4c7442f8a9b6caa90bba43d8102ac27 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Wed, 18 Sep 2013 17:24:49 -0700 Subject: [PATCH 042/995] Adding Tomcat configuration --- pom.xml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ec4011670..e3ab7b1cb 100644 --- a/pom.xml +++ b/pom.xml @@ -13,6 +13,8 @@ /Users/arungup/tools/glassfish/4.0/final/glassfish4 wildfly8x /Users/arungup/tools/wildfly/wildfly-8.0.0.Alpha4 + tomcat8x + /Users/arungup/tools/tomcat/apache-tomcat-8.0.0-RC1 gfv3ee6 @@ -92,7 +94,31 @@ standalone - ${wildfly.home}/glassfish/domains + ${wildfly.home} + + + + + + + + tomcat + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.4.4 + true + + + ${cargo.container.tomcat.id} + installed + ${tomcat.home} + + + standalone + ${tomcat.home}/temp From 9c3df5c04d979925e360c570b5c386f0757fe662 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 20 Sep 2013 08:53:29 -0700 Subject: [PATCH 043/995] Removing redundant imports --- .../main/java/org/javaee7/jaxrs/readerwriter/json/MyReader.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/jaxrs/readerwriter-json/src/main/java/org/javaee7/jaxrs/readerwriter/json/MyReader.java b/jaxrs/readerwriter-json/src/main/java/org/javaee7/jaxrs/readerwriter/json/MyReader.java index 5b8d1b32e..189fb0f49 100644 --- a/jaxrs/readerwriter-json/src/main/java/org/javaee7/jaxrs/readerwriter/json/MyReader.java +++ b/jaxrs/readerwriter-json/src/main/java/org/javaee7/jaxrs/readerwriter/json/MyReader.java @@ -43,8 +43,6 @@ import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.json.Json; import javax.json.stream.JsonParser; import javax.ws.rs.Consumes; From fcc596b2f03925751217595262e0bd17c680eccf Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 20 Sep 2013 08:54:13 -0700 Subject: [PATCH 044/995] Removing redundant attributes from @WebServlet --- .../java/org/javaee7/jaxrs/readerwriter/json/TestServlet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jaxrs/readerwriter-json/src/main/java/org/javaee7/jaxrs/readerwriter/json/TestServlet.java b/jaxrs/readerwriter-json/src/main/java/org/javaee7/jaxrs/readerwriter/json/TestServlet.java index 117c32828..f54afda77 100644 --- a/jaxrs/readerwriter-json/src/main/java/org/javaee7/jaxrs/readerwriter/json/TestServlet.java +++ b/jaxrs/readerwriter-json/src/main/java/org/javaee7/jaxrs/readerwriter/json/TestServlet.java @@ -55,7 +55,7 @@ /** * @author Arun Gupta */ -@WebServlet(name = "TestServlet", urlPatterns = {"/TestServlet"}) +@WebServlet(urlPatterns = {"/TestServlet"}) public class TestServlet extends HttpServlet { /** From 48c9a3caecbcaf758df9602326bcfd02cfc386be Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 20 Sep 2013 09:12:51 -0700 Subject: [PATCH 045/995] Adding @Produces --- .../java/org/javaee7/jaxrs/readerwriter/json/MyResource.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jaxrs/readerwriter-json/src/main/java/org/javaee7/jaxrs/readerwriter/json/MyResource.java b/jaxrs/readerwriter-json/src/main/java/org/javaee7/jaxrs/readerwriter/json/MyResource.java index 139ca1c82..2d95bebd0 100644 --- a/jaxrs/readerwriter-json/src/main/java/org/javaee7/jaxrs/readerwriter/json/MyResource.java +++ b/jaxrs/readerwriter-json/src/main/java/org/javaee7/jaxrs/readerwriter/json/MyResource.java @@ -42,6 +42,7 @@ import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; +import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; /** @@ -50,6 +51,7 @@ @Path("endpoint") public class MyResource { @POST + @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public MyObject echoObject(MyObject mo) { return mo; From e17ac323d0bf2b3cc824dbed598d7553acb00433 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 20 Sep 2013 09:58:53 -0700 Subject: [PATCH 046/995] Starting work on a new sample to show CDI scopes --- cdi/scopes/pom.xml | 16 +++ .../cdi/bean/scopes/ClientServlet.java | 126 +++++++++++++++++ .../bean/scopes/MyApplicationScopedBean.java | 52 +++++++ .../cdi/bean/scopes/MyRequestScopedBean.java | 52 +++++++ .../cdi/bean/scopes/MySessionScopedBean.java | 52 +++++++ .../bean/scopes/MySingletonScopedBean.java | 52 +++++++ .../cdi/bean/scopes/ServerServlet.java | 132 ++++++++++++++++++ cdi/scopes/src/main/webapp/WEB-INF/beans.xml | 49 +++++++ cdi/scopes/src/main/webapp/index.jsp | 55 ++++++++ 9 files changed, 586 insertions(+) create mode 100644 cdi/scopes/pom.xml create mode 100644 cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/ClientServlet.java create mode 100644 cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/MyApplicationScopedBean.java create mode 100644 cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/MyRequestScopedBean.java create mode 100644 cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/MySessionScopedBean.java create mode 100644 cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/MySingletonScopedBean.java create mode 100644 cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/ServerServlet.java create mode 100644 cdi/scopes/src/main/webapp/WEB-INF/beans.xml create mode 100644 cdi/scopes/src/main/webapp/index.jsp diff --git a/cdi/scopes/pom.xml b/cdi/scopes/pom.xml new file mode 100644 index 000000000..bf36f6a14 --- /dev/null +++ b/cdi/scopes/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + + org.javaee7.cdi + cdi-samples + 1.0-SNAPSHOT + ../pom.xml + + + org.javaee7.cdi + scopes + 1.0-SNAPSHOT + war + scopes + diff --git a/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/ClientServlet.java b/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/ClientServlet.java new file mode 100644 index 000000000..6b6a1e29d --- /dev/null +++ b/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/ClientServlet.java @@ -0,0 +1,126 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.cdi.bean.scopes; + +import java.io.IOException; +import java.io.PrintWriter; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + * @author arungup + */ +@WebServlet(urlPatterns = {"/ClientServlet"}) +public class ClientServlet extends HttpServlet { + + /** + * Processes requests for both HTTP GET and POST + * methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + try (PrintWriter out = response.getWriter()) { + out.println(""); + out.println(""); + out.println(""); + out.println("CDI Scopes"); + out.println(""); + out.println(""); + out.println("

CDI Scopes

"); + RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/ServerServlet"); + out.println("

First request

"); + dispatcher.include(request, response); + out.println("

Second request

"); + dispatcher.include(request, response); + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// +} diff --git a/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/MyApplicationScopedBean.java b/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/MyApplicationScopedBean.java new file mode 100644 index 000000000..85f17b193 --- /dev/null +++ b/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/MyApplicationScopedBean.java @@ -0,0 +1,52 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.cdi.bean.scopes; + +import javax.enterprise.context.RequestScoped; + +/** + * @author Arun Gupta + */ +@RequestScoped +public class MyApplicationScopedBean { + public String getID() { + return this + ""; + } +} diff --git a/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/MyRequestScopedBean.java b/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/MyRequestScopedBean.java new file mode 100644 index 000000000..49ae6d2fa --- /dev/null +++ b/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/MyRequestScopedBean.java @@ -0,0 +1,52 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.cdi.bean.scopes; + +import javax.enterprise.context.RequestScoped; + +/** + * @author Arun Gupta + */ +@RequestScoped +public class MyRequestScopedBean { + public String getID() { + return this + ""; + } +} diff --git a/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/MySessionScopedBean.java b/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/MySessionScopedBean.java new file mode 100644 index 000000000..46632758c --- /dev/null +++ b/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/MySessionScopedBean.java @@ -0,0 +1,52 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.cdi.bean.scopes; + +import javax.enterprise.context.RequestScoped; + +/** + * @author Arun Gupta + */ +@RequestScoped +public class MySessionScopedBean { + public String getID() { + return this + ""; + } +} diff --git a/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/MySingletonScopedBean.java b/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/MySingletonScopedBean.java new file mode 100644 index 000000000..fffaf8218 --- /dev/null +++ b/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/MySingletonScopedBean.java @@ -0,0 +1,52 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.cdi.bean.scopes; + +import javax.enterprise.context.RequestScoped; + +/** + * @author Arun Gupta + */ +@RequestScoped +public class MySingletonScopedBean { + public String getID() { + return this + ""; + } +} diff --git a/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/ServerServlet.java b/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/ServerServlet.java new file mode 100644 index 000000000..055d4ae5d --- /dev/null +++ b/cdi/scopes/src/main/java/org/javaee7/cdi/bean/scopes/ServerServlet.java @@ -0,0 +1,132 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.cdi.bean.scopes; + +import java.io.IOException; +import java.io.PrintWriter; +import javax.inject.Inject; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + * @author arungup + */ +@WebServlet(urlPatterns = {"/ServerServlet"}) +public class ServerServlet extends HttpServlet { + + @Inject MyRequestScopedBean requestBean; + @Inject MyRequestScopedBean requestBean2; + + @Inject MySessionScopedBean sessionBean; + @Inject MySessionScopedBean sessionBean2; + + @Inject MyApplicationScopedBean applicationBean; + @Inject MySingletonScopedBean singletonBean; + + + /** + * Processes requests for both HTTP + * GET and + * POST methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + try (PrintWriter out = response.getWriter()) { + out.println("Request-scoped bean"); + out.println("

(1): " + requestBean.getID()); + out.println("
(2): " + requestBean2.getID()); + out.println("

Session-scoped bean"); + out.println("

(1): " + sessionBean.getID()); + out.println("
(2): " + sessionBean2.getID()); + out.println("

Application-scoped bean: " + applicationBean.getID()); + out.println("

Singleton-scoped bean: " + singletonBean.getID()); + } + } + + // + /** + * Handles the HTTP + * GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP + * POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// +} diff --git a/cdi/scopes/src/main/webapp/WEB-INF/beans.xml b/cdi/scopes/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 000000000..aa81c7c3c --- /dev/null +++ b/cdi/scopes/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,49 @@ + + + + \ No newline at end of file diff --git a/cdi/scopes/src/main/webapp/index.jsp b/cdi/scopes/src/main/webapp/index.jsp new file mode 100644 index 000000000..d69c19f6b --- /dev/null +++ b/cdi/scopes/src/main/webapp/index.jsp @@ -0,0 +1,55 @@ + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + + CDI : Scopes + + +

CDI : Scopes

+ Invoke the Greeting. + + From acd761a7314f10ca8f379a8e0aac67508cb60c80 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 20 Sep 2013 09:59:22 -0700 Subject: [PATCH 047/995] Added the new sample --- cdi/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/cdi/pom.xml b/cdi/pom.xml index 27ecc5d6c..bf10b1f41 100644 --- a/cdi/pom.xml +++ b/cdi/pom.xml @@ -28,5 +28,6 @@ beansxml-noversion beanmanager extension + scopes
From bb3d42fedea03dadbac225ba14807563a4652d02 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 20 Sep 2013 14:55:13 -0700 Subject: [PATCH 048/995] Adding a final qualifier --- .../main/java/org/javaee7/jaxrs/readerwriter/MyResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jaxrs/readerwriter/src/main/java/org/javaee7/jaxrs/readerwriter/MyResource.java b/jaxrs/readerwriter/src/main/java/org/javaee7/jaxrs/readerwriter/MyResource.java index a524d4758..f1b49bfc6 100644 --- a/jaxrs/readerwriter/src/main/java/org/javaee7/jaxrs/readerwriter/MyResource.java +++ b/jaxrs/readerwriter/src/main/java/org/javaee7/jaxrs/readerwriter/MyResource.java @@ -48,7 +48,7 @@ */ @Path("fruits") public class MyResource { - private String[] response = { "apple", "banana", "mango" }; + private final String[] response = { "apple", "banana", "mango" }; @POST @Consumes(value=MyObject.MIME_TYPE) From 679c6e8941ad43278d4df26d1d34f1c219895978 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 20 Sep 2013 14:56:56 -0700 Subject: [PATCH 049/995] Removing redundant attributes from @WebServlet --- .../main/java/org/javaee7/jaxrs/readerwriter/TestServlet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jaxrs/readerwriter/src/main/java/org/javaee7/jaxrs/readerwriter/TestServlet.java b/jaxrs/readerwriter/src/main/java/org/javaee7/jaxrs/readerwriter/TestServlet.java index d1c95fe63..9c026f866 100644 --- a/jaxrs/readerwriter/src/main/java/org/javaee7/jaxrs/readerwriter/TestServlet.java +++ b/jaxrs/readerwriter/src/main/java/org/javaee7/jaxrs/readerwriter/TestServlet.java @@ -54,7 +54,7 @@ /** * @author Arun Gupta */ -@WebServlet(name = "TestServlet", urlPatterns = {"/TestServlet"}) +@WebServlet(urlPatterns = {"/TestServlet"}) public class TestServlet extends HttpServlet { /** From da779601a9ab05152dc42066e6d8b46c711a8a29 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 20 Sep 2013 14:58:45 -0700 Subject: [PATCH 050/995] Adding better output messages --- .../org/javaee7/jaxrs/readerwriter/TestServlet.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/jaxrs/readerwriter/src/main/java/org/javaee7/jaxrs/readerwriter/TestServlet.java b/jaxrs/readerwriter/src/main/java/org/javaee7/jaxrs/readerwriter/TestServlet.java index 9c026f866..51369f5f1 100644 --- a/jaxrs/readerwriter/src/main/java/org/javaee7/jaxrs/readerwriter/TestServlet.java +++ b/jaxrs/readerwriter/src/main/java/org/javaee7/jaxrs/readerwriter/TestServlet.java @@ -73,10 +73,10 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re PrintWriter out = response.getWriter(); out.println(""); out.println(""); - out.println("Servlet TestServlet"); + out.println("JAX-RS Entity Providers"); out.println(""); out.println(""); - out.println("

Servlet TestServlet at " + request.getContextPath() + "

"); + out.println("

JAX-RS Entity Providers

"); Client client = ClientBuilder.newClient(); client .register(MyReader.class) @@ -88,18 +88,20 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re + request.getServerPort() + request.getContextPath() + "/webresources/fruits"); - System.out.println("POST request"); + out.println("

POST request

"); + out.println("Sending an object of custom mimetype"); String fruit = target .request() .post(Entity.entity(new MyObject(1), MyObject.MIME_TYPE), String.class); - out.println("Received response: " + fruit + "

"); + out.println("Received response (with custom mime type): " + fruit + "

"); + out.println("Another POST..."); fruit = target .path("fruitInt") .request() .post(Entity.text("1"), String.class); out.println("Received response: " + fruit + "

"); - out.println("Check server.log for client/server interceptor output."); + out.println("Check \"server.log\" for client/server interceptor output."); out.println(""); out.println(""); } From d31a0b11e0289b14f899944e0bc98c8c619cbe46 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 20 Sep 2013 14:59:57 -0700 Subject: [PATCH 051/995] Better formatting of output messages --- .../java/org/javaee7/jaxrs/readerwriter/TestServlet.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jaxrs/readerwriter/src/main/java/org/javaee7/jaxrs/readerwriter/TestServlet.java b/jaxrs/readerwriter/src/main/java/org/javaee7/jaxrs/readerwriter/TestServlet.java index 51369f5f1..6e1d34772 100644 --- a/jaxrs/readerwriter/src/main/java/org/javaee7/jaxrs/readerwriter/TestServlet.java +++ b/jaxrs/readerwriter/src/main/java/org/javaee7/jaxrs/readerwriter/TestServlet.java @@ -93,15 +93,15 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re String fruit = target .request() .post(Entity.entity(new MyObject(1), MyObject.MIME_TYPE), String.class); - out.println("Received response (with custom mime type): " + fruit + "

"); - out.println("Another POST..."); + out.println("
Received response (with custom mime type): " + fruit + "

"); + out.println("

Another POST request

"); fruit = target .path("fruitInt") .request() .post(Entity.text("1"), String.class); - out.println("Received response: " + fruit + "

"); + out.println("
Received response: " + fruit); - out.println("Check \"server.log\" for client/server interceptor output."); + out.println("

Check \"server.log\" for client/server interceptor output."); out.println(""); out.println(""); } From 4ba03ea997b1e7f49f7e26a2f79b4fb01eeaa586 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 27 Sep 2013 14:52:58 -0700 Subject: [PATCH 052/995] Interim capability to start the database server as well (still not working) --- pom.xml | 53 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index e3ab7b1cb..de772b4fb 100644 --- a/pom.xml +++ b/pom.xml @@ -25,6 +25,12 @@ 7.0 provided + + org.apache.derby + derby + 10.8.2.2 + provided +
@@ -46,6 +52,31 @@ false + + org.codehaus.cargo + cargo-maven2-plugin + 1.4.5-SNAPSHOT + + + + + org.apache.derby + derby + + + + ${project.build.directory}/derby + + + + + + cargo.datasource.driver=org.apache.derby.jdbc.EmbeddedDriver| cargo.datasource.url=jdbc:derby:derbyDB;create=true| cargo.datasource.jndi=jdbc/__default| cargo.datasource.username=APP| cargo.datasource.password=APP + + + + + @@ -60,18 +91,30 @@ org.codehaus.cargo cargo-maven2-plugin - 1.4.4 + 1.4.5-SNAPSHOT true ${cargo.container.glassfish.id} installed ${glassfish.home} + + org.glassfish.main.distributions + glassfish + 4.0 + - + + + org.apache.derby + derby + none + + + @@ -84,7 +127,7 @@ org.codehaus.cargo cargo-maven2-plugin - 1.4.4 + 1.4.5-SNAPSHOT true @@ -108,7 +151,7 @@ org.codehaus.cargo cargo-maven2-plugin - 1.4.4 + 1.4.5-SNAPSHOT true From 15abba871a5f9f6253e0dc7f8a1649dd6ee2cc4f Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 27 Sep 2013 15:31:17 -0700 Subject: [PATCH 053/995] Adding snapshot repositories for Cargo (now working) --- pom.xml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/pom.xml b/pom.xml index de772b4fb..0fa1122e5 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,34 @@ provided + + + + codehaus-snapshots + Codehaus Snapshots + http://nexus.codehaus.org/snapshots/ + + false + + + true + + + + + + + codehaus-snapshots + Codehaus Snapshots + http://nexus.codehaus.org/snapshots/ + + false + + + true + + + From 5159b1587703d559c341ce5890ea4e3917adcbd2 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Sun, 29 Sep 2013 07:54:53 -0700 Subject: [PATCH 054/995] Cleaned by S. Ali Tomken to be Cargo-compatible --- pom.xml | 428 +++++++++++++++++++++++++++----------------------------- 1 file changed, 207 insertions(+), 221 deletions(-) diff --git a/pom.xml b/pom.xml index 0fa1122e5..b44bbaec6 100644 --- a/pom.xml +++ b/pom.xml @@ -1,221 +1,207 @@ - - 4.0.0 - - org.javaee7 - javaee7-samples - 1.0-SNAPSHOT - pom - Java EE 7 Samples - - - glassfish4x - /Users/arungup/tools/glassfish/4.0/final/glassfish4 - wildfly8x - /Users/arungup/tools/wildfly/wildfly-8.0.0.Alpha4 - tomcat8x - /Users/arungup/tools/tomcat/apache-tomcat-8.0.0-RC1 - gfv3ee6 - - - - - javax - javaee-api - 7.0 - provided - - - org.apache.derby - derby - 10.8.2.2 - provided - - - - - - codehaus-snapshots - Codehaus Snapshots - http://nexus.codehaus.org/snapshots/ - - false - - - true - - - - - - - codehaus-snapshots - Codehaus Snapshots - http://nexus.codehaus.org/snapshots/ - - false - - - true - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.7 - 1.7 - - - - org.apache.maven.plugins - maven-war-plugin - 2.1.1 - - false - - - - org.codehaus.cargo - cargo-maven2-plugin - 1.4.5-SNAPSHOT - - - - - org.apache.derby - derby - - - - ${project.build.directory}/derby - - - - - - cargo.datasource.driver=org.apache.derby.jdbc.EmbeddedDriver| cargo.datasource.url=jdbc:derby:derbyDB;create=true| cargo.datasource.jndi=jdbc/__default| cargo.datasource.username=APP| cargo.datasource.password=APP - - - - - - - - - - - glassfish - - true - - - - - org.codehaus.cargo - cargo-maven2-plugin - 1.4.5-SNAPSHOT - true - - - ${cargo.container.glassfish.id} - installed - ${glassfish.home} - - org.glassfish.main.distributions - glassfish - 4.0 - - - - - org.apache.derby - derby - none - - - - - - - - - - wildfly - - - - org.codehaus.cargo - cargo-maven2-plugin - 1.4.5-SNAPSHOT - true - - - ${cargo.container.wildfly.id} - installed - ${wildfly.home} - - - standalone - ${wildfly.home} - - - - - - - - tomcat - - - - org.codehaus.cargo - cargo-maven2-plugin - 1.4.5-SNAPSHOT - true - - - ${cargo.container.tomcat.id} - installed - ${tomcat.home} - - - standalone - ${tomcat.home}/temp - - - - - - - - - - batch - cdi - concurrency - ejb - el - javamail - jaxrs - jca - jms - jpa - jta - jsf - json - servlet - validation - websocket - extra - - - + + 4.0.0 + + org.javaee7 + javaee7-samples + 1.0-SNAPSHOT + pom + Java EE 7 Samples + + + glassfish4x + wildfly8x + tomcat8x + gfv3ee6 + + + + + javax + javaee-api + 7.0 + provided + + + org.apache.derby + derby + 10.8.2.2 + provided + + + + + + codehaus-snapshots + Codehaus Snapshots + http://nexus.codehaus.org/snapshots/ + + false + + + true + + + + + + + codehaus-snapshots + Codehaus Snapshots + http://nexus.codehaus.org/snapshots/ + + false + + + true + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-war-plugin + 2.1.1 + + false + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.4.5-SNAPSHOT + + + + + org.apache.derby + derby + + + + ${project.build.directory}/derby + + + + + + cargo.datasource.driver=org.apache.derby.jdbc.EmbeddedDriver| + cargo.datasource.url=jdbc:derby:derbyDB;create=true| + cargo.datasource.jndi=jdbc/__default| + cargo.datasource.username=APP| + cargo.datasource.password=APP + + + + + + + + + + + glassfish + + true + + + + + org.codehaus.cargo + cargo-maven2-plugin + + + ${cargo.container.glassfish.id} + + org.glassfish.main.distributions + glassfish + 4.0 + + + + org.apache.derby + derby + none + + + + + + + + + + wildfly + + + + org.codehaus.cargo + cargo-maven2-plugin + + + ${cargo.container.wildfly.id} + + org.wildfly + wildfly-dist + 8.0.0.Alpha4 + + + + + + + + + tomcat + + + + org.codehaus.cargo + cargo-maven2-plugin + + + ${cargo.container.tomcat.id} + + http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.0-RC3/bin/apache-tomcat-8.0.0-RC3.zip + + + + + + + + + + + batch + cdi + concurrency + ejb + el + javamail + jaxrs + jca + jms + jpa + jta + jsf + json + servlet + validation + websocket + extra + + + + From dbfcc73f045ce0cc323d51c0d0a6987e4b7bc0fb Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Mon, 30 Sep 2013 13:09:16 -0700 Subject: [PATCH 055/995] Adding to - this will ensure a clean archive name is generated --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index b44bbaec6..19ce671ac 100644 --- a/pom.xml +++ b/pom.xml @@ -59,6 +59,7 @@ + ${project.artifactId} org.apache.maven.plugins From 963f38f22311b9fa329215d7f673a0c10d167ddd Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Mon, 30 Sep 2013 14:54:30 -0700 Subject: [PATCH 056/995] Added pre-installed versions of GlassFish and Wildfly. Also added WebLogic profile, although none of the samples would run on it right now as the DD are Java EE 7 compliant. --- pom.xml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/pom.xml b/pom.xml index 19ce671ac..d688cba82 100644 --- a/pom.xml +++ b/pom.xml @@ -10,8 +10,12 @@ glassfish4x + /Users/arungup/tools/glassfish/4.0/final/glassfish4 wildfly8x + /Users/arungup/tools/wildfly/wildfly-8.0.0.Alpha4 tomcat8x + weblogic12x + /Users/arungup/tools/weblogic/12c/wlserver gfv3ee6 @@ -121,14 +125,20 @@ org.codehaus.cargo cargo-maven2-plugin + 1.4.5-SNAPSHOT ${cargo.container.glassfish.id} + installed + ${cargo.container.glassfish.home} + org.apache.derby @@ -152,11 +162,16 @@ ${cargo.container.wildfly.id} + installed + ${cargo.container.wildfly.home} + @@ -182,6 +197,24 @@ + + weblogic + + + + org.codehaus.cargo + cargo-maven2-plugin + + + ${cargo.container.weblogic.id} + installed + ${cargo.container.weblogic.home} + + + + + + From 800b82e65b4ece2711d31a8bc9b938cf2560f8bd Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Mon, 30 Sep 2013 16:33:58 -0700 Subject: [PATCH 057/995] New sample to show basic usage of Mongo in a Java EE application --- extra/mongo/pom.xml | 28 ++++ .../java/org/javaee7/extra/mongo/Person.java | 104 +++++++++++++ .../extra/mongo/PersonSessionBean.java | 127 +++++++++++++++ .../org/javaee7/extra/mongo/TestServlet.java | 146 ++++++++++++++++++ extra/mongo/src/main/webapp/WEB-INF/beans.xml | 49 ++++++ .../src/main/webapp/WEB-INF/template.xhtml | 26 ++++ extra/mongo/src/main/webapp/WEB-INF/web.xml | 24 +++ extra/mongo/src/main/webapp/index.xhtml | 25 +++ .../main/webapp/resources/css/cssLayout.css | 61 ++++++++ .../src/main/webapp/resources/css/default.css | 29 ++++ extra/mongo/src/main/webapp/show.xhtml | 22 +++ 11 files changed, 641 insertions(+) create mode 100644 extra/mongo/pom.xml create mode 100644 extra/mongo/src/main/java/org/javaee7/extra/mongo/Person.java create mode 100644 extra/mongo/src/main/java/org/javaee7/extra/mongo/PersonSessionBean.java create mode 100644 extra/mongo/src/main/java/org/javaee7/extra/mongo/TestServlet.java create mode 100644 extra/mongo/src/main/webapp/WEB-INF/beans.xml create mode 100644 extra/mongo/src/main/webapp/WEB-INF/template.xhtml create mode 100644 extra/mongo/src/main/webapp/WEB-INF/web.xml create mode 100644 extra/mongo/src/main/webapp/index.xhtml create mode 100644 extra/mongo/src/main/webapp/resources/css/cssLayout.css create mode 100644 extra/mongo/src/main/webapp/resources/css/default.css create mode 100644 extra/mongo/src/main/webapp/show.xhtml diff --git a/extra/mongo/pom.xml b/extra/mongo/pom.xml new file mode 100644 index 000000000..00fd31e5b --- /dev/null +++ b/extra/mongo/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + + org.javaee7.extra + extra-samples + 1.0-SNAPSHOT + ../pom.xml + + + org.javaee7.extra + mongo + 1.0-SNAPSHOT + war + + + + org.mongodb + mongo-java-driver + 1.3 + + + de.flapdoodle.embed + de.flapdoodle.embed.mongo + 1.36 + + + diff --git a/extra/mongo/src/main/java/org/javaee7/extra/mongo/Person.java b/extra/mongo/src/main/java/org/javaee7/extra/mongo/Person.java new file mode 100644 index 000000000..7b4620f3e --- /dev/null +++ b/extra/mongo/src/main/java/org/javaee7/extra/mongo/Person.java @@ -0,0 +1,104 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.mongo; + +import com.mongodb.BasicDBObject; +import com.mongodb.DBObject; +import javax.enterprise.inject.Model; +import javax.validation.constraints.Size; + +/** + * @author Arun Gupta + */ +@Model +public class Person { + + @Size(min = 1, max = 20) + private String name; + + private int age; + + public Person() { + } + + public Person(String name, int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public BasicDBObject toDBObject() { + BasicDBObject doc = new BasicDBObject(); + + doc.put("name", name); + doc.put("age", age); + + return doc; + } + + public static Person fromDBObject(DBObject doc) { + Person m = new Person(); + + m.name = (String) doc.get("name"); + m.age = (int) doc.get("age"); + + return m; + } + + @Override + public String toString() { + return name + ", " + age; + } +} diff --git a/extra/mongo/src/main/java/org/javaee7/extra/mongo/PersonSessionBean.java b/extra/mongo/src/main/java/org/javaee7/extra/mongo/PersonSessionBean.java new file mode 100644 index 000000000..504fbf884 --- /dev/null +++ b/extra/mongo/src/main/java/org/javaee7/extra/mongo/PersonSessionBean.java @@ -0,0 +1,127 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.mongo; + +import com.mongodb.BasicDBObject; +import com.mongodb.DB; +import com.mongodb.DBCollection; +import com.mongodb.DBCursor; +import com.mongodb.DBObject; +import com.mongodb.Mongo; +import com.mongodb.MongoException; +import de.flapdoodle.embed.mongo.MongodExecutable; +import de.flapdoodle.embed.mongo.MongodProcess; +import de.flapdoodle.embed.mongo.MongodStarter; +import de.flapdoodle.embed.mongo.config.MongodConfigBuilder; +import de.flapdoodle.embed.mongo.config.Net; +import de.flapdoodle.embed.mongo.distribution.Version; +import de.flapdoodle.embed.process.runtime.Network; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.ejb.Stateless; +import javax.inject.Inject; +import javax.inject.Named; + +/** + * @author Arun Gupta + */ +@Named +@Stateless +public class PersonSessionBean { + + @Inject + Person person; + + DBCollection personCollection; + + private MongodExecutable mongodExe; + private MongodProcess mongod; + private final int MONGO_PORT = 12345; + + @PostConstruct + private void initDB() { + try { + // Start embedded Mongo + MongodStarter runtime = MongodStarter.getDefaultInstance(); + mongodExe = runtime.prepare(new MongodConfigBuilder() + .version(Version.Main.PRODUCTION) + .net(new Net(MONGO_PORT, Network.localhostIsIPv6())) + .build()); + mongod = mongodExe.start(); + + // Get an instance of Mongo + Mongo m = new Mongo("localhost", MONGO_PORT); + DB db = m.getDB("personDB"); + personCollection = db.getCollection("persons"); + if (personCollection == null) { + personCollection = db.createCollection("persons", null); + } + } catch (MongoException | IOException ex) { + Logger.getLogger(PersonSessionBean.class.getName()).log(Level.SEVERE, null, ex); + } + } + + @PreDestroy + private void stopDB() { + mongod.stop(); + mongodExe.stop(); + } + + public void createPerson() { + BasicDBObject doc = person.toDBObject(); + personCollection.insert(doc); + } + + public List getPersons() { + List persons = new ArrayList(); + DBCursor cur = personCollection.find(); + System.out.println("getPersons: Found " + cur.length() + " person(s)"); + for (DBObject dbo : cur.toArray()) { + persons.add(Person.fromDBObject(dbo)); + } + + return persons; + } +} diff --git a/extra/mongo/src/main/java/org/javaee7/extra/mongo/TestServlet.java b/extra/mongo/src/main/java/org/javaee7/extra/mongo/TestServlet.java new file mode 100644 index 000000000..7236eadfb --- /dev/null +++ b/extra/mongo/src/main/java/org/javaee7/extra/mongo/TestServlet.java @@ -0,0 +1,146 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.mongo; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @author Arun Gupta + */ +@WebServlet(urlPatterns = {"/TestServlet"}) +public class TestServlet extends HttpServlet { + + /** + * Processes requests for both HTTP GET and POST + * methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + try (PrintWriter out = response.getWriter()) { + out.println(""); + out.println(""); + out.println(""); + out.println("Mongo with Java EE 7"); + out.println(""); + out.println(""); + out.println("

Mongo with Java EE 7

"); + +// Mongo m = new Mongo(); +// DB db = m.getDB("movieDB"); +// DBCollection coll = db.getCollection("test"); +// if (coll == null) { +// System.out.println("Creating a new test collection"); +// coll = db.createCollection("test", null); +// } +// BasicDBObject bdbo = new BasicDBObject(); +// bdbo.put("name", "mario"); +// coll.insert(bdbo); +// bdbo.clear(); +// bdbo.put("name", "luigi"); +// coll.insert(bdbo); +// +// out.println("Found " + coll.getCount() + " elements
"); +// DBCursor cur = coll.find(); +// for (DBObject o : cur.toArray()) { +// out.println(o.get("name") + "
"); +// } + + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet + (HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost + (HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo + + () { + return "Short description"; + }// + } diff --git a/extra/mongo/src/main/webapp/WEB-INF/beans.xml b/extra/mongo/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 000000000..aa81c7c3c --- /dev/null +++ b/extra/mongo/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,49 @@ + + + + \ No newline at end of file diff --git a/extra/mongo/src/main/webapp/WEB-INF/template.xhtml b/extra/mongo/src/main/webapp/WEB-INF/template.xhtml new file mode 100644 index 000000000..dd1a75ece --- /dev/null +++ b/extra/mongo/src/main/webapp/WEB-INF/template.xhtml @@ -0,0 +1,26 @@ + + + + + + + + + Mongo using Java EE 7 + + + + +
+

Mongo using Java EE 7

+
+ +
+ Content +
+ +
+ + diff --git a/extra/mongo/src/main/webapp/WEB-INF/web.xml b/extra/mongo/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..c5e7c7381 --- /dev/null +++ b/extra/mongo/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/extra/mongo/src/main/webapp/index.xhtml b/extra/mongo/src/main/webapp/index.xhtml new file mode 100644 index 000000000..db1c9bca4 --- /dev/null +++ b/extra/mongo/src/main/webapp/index.xhtml @@ -0,0 +1,25 @@ + + + + + + + + + + + Name:
+ Age:
+ +
+
+ +
+ + + diff --git a/extra/mongo/src/main/webapp/resources/css/cssLayout.css b/extra/mongo/src/main/webapp/resources/css/cssLayout.css new file mode 100644 index 000000000..8ee7cebe3 --- /dev/null +++ b/extra/mongo/src/main/webapp/resources/css/cssLayout.css @@ -0,0 +1,61 @@ + +#top { + position: relative; + background-color: #036fab; + color: white; + padding: 5px; + margin: 0px 0px 10px 0px; +} + +#bottom { + position: relative; + background-color: #c2dfef; + padding: 5px; + margin: 10px 0px 0px 0px; +} + +#left { + float: left; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +#right { + float: right; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +.center_content { + position: relative; + background-color: #dddddd; + padding: 5px; +} + +.left_content { + background-color: #dddddd; + padding: 5px; + margin-left: 170px; +} + +.right_content { + background-color: #dddddd; + padding: 5px; + margin: 0px 170px 0px 170px; +} + +#top a:link, #top a:visited { + color: white; + font-weight : bold; + text-decoration: none; +} + +#top a:link:hover, #top a:visited:hover { + color: black; + font-weight : bold; + text-decoration : underline; +} + + diff --git a/extra/mongo/src/main/webapp/resources/css/default.css b/extra/mongo/src/main/webapp/resources/css/default.css new file mode 100644 index 000000000..6cbc3d18e --- /dev/null +++ b/extra/mongo/src/main/webapp/resources/css/default.css @@ -0,0 +1,29 @@ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/extra/mongo/src/main/webapp/show.xhtml b/extra/mongo/src/main/webapp/show.xhtml new file mode 100644 index 000000000..19203f612 --- /dev/null +++ b/extra/mongo/src/main/webapp/show.xhtml @@ -0,0 +1,22 @@ + + + + + + + + + + + Name#{p.name} + Age#{p.age} + + + + + + + From 8575f61212509c301fda4345bfd56e638fd6a598 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Mon, 30 Sep 2013 16:34:11 -0700 Subject: [PATCH 058/995] Adding mongo module --- extra/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/extra/pom.xml b/extra/pom.xml index 438105413..5d49f9138 100644 --- a/extra/pom.xml +++ b/extra/pom.xml @@ -17,5 +17,6 @@ quartz twitter-search + mongo From b90ae0b100d976798ce6b0b9646eb3a40e9fd156 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Wed, 2 Oct 2013 11:11:40 -0700 Subject: [PATCH 059/995] Removing a redundant parentheses --- .../src/main/java/org/javaee7/jpa/schemagen/Employee.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jpa/schema-gen/src/main/java/org/javaee7/jpa/schemagen/Employee.java b/jpa/schema-gen/src/main/java/org/javaee7/jpa/schemagen/Employee.java index 2f4dc4d38..fd1cb84af 100644 --- a/jpa/schema-gen/src/main/java/org/javaee7/jpa/schemagen/Employee.java +++ b/jpa/schema-gen/src/main/java/org/javaee7/jpa/schemagen/Employee.java @@ -52,7 +52,7 @@ /** * @author Arun Gupta */ -@Entity() +@Entity @Table(name = "EMPLOYEE_SCHEMA_GEN") @NamedQueries({ @NamedQuery(name = "Employee.findAll", query = "SELECT e FROM Employee e") From 77b6dc95ffc42c0be3c1b34bc92b074c43cff4e3 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Wed, 2 Oct 2013 11:12:35 -0700 Subject: [PATCH 060/995] Adding better output messages --- .../org/javaee7/batch/chunk/csv/database/TestServlet.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/batch/chunk-csv-database/src/main/java/org/javaee7/batch/chunk/csv/database/TestServlet.java b/batch/chunk-csv-database/src/main/java/org/javaee7/batch/chunk/csv/database/TestServlet.java index f66898eed..77f5fb77f 100644 --- a/batch/chunk-csv-database/src/main/java/org/javaee7/batch/chunk/csv/database/TestServlet.java +++ b/batch/chunk-csv-database/src/main/java/org/javaee7/batch/chunk/csv/database/TestServlet.java @@ -80,10 +80,10 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re try (PrintWriter out = response.getWriter()) { out.println(""); out.println(""); - out.println("Servlet TestServlet"); + out.println("CSV-to-Database Chunk Job"); out.println(""); out.println(""); - out.println("

Running the job

"); + out.println("

CSV-to-Database Chunk Job

"); JobOperator jo = BatchRuntime.getJobOperator(); long jid = jo.start("myJob", new Properties()); out.println("Job submitted: " + jid + "
"); From 6d0a1b4a4f199503f953ea33cd038dd3c1a416f4 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Wed, 2 Oct 2013 11:12:51 -0700 Subject: [PATCH 061/995] Removing redundant imports --- .../java/org/javaee7/batch/chunk/csv/database/MyItemWriter.java | 1 - 1 file changed, 1 deletion(-) diff --git a/batch/chunk-csv-database/src/main/java/org/javaee7/batch/chunk/csv/database/MyItemWriter.java b/batch/chunk-csv-database/src/main/java/org/javaee7/batch/chunk/csv/database/MyItemWriter.java index 7c8a810bb..70cccce70 100644 --- a/batch/chunk-csv-database/src/main/java/org/javaee7/batch/chunk/csv/database/MyItemWriter.java +++ b/batch/chunk-csv-database/src/main/java/org/javaee7/batch/chunk/csv/database/MyItemWriter.java @@ -44,7 +44,6 @@ import javax.inject.Named; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; -import javax.transaction.Transactional; /** * @author Arun Gupta From e75eef0a7563f690bad2d09a2b8d0418ab5b5094 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Wed, 2 Oct 2013 14:59:40 -0700 Subject: [PATCH 062/995] Explicitly specifying application/* media type --- .../java/org/javaee7/jaxrs/server/negotiation/TestServlet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jaxrs/server-negotiation/src/main/java/org/javaee7/jaxrs/server/negotiation/TestServlet.java b/jaxrs/server-negotiation/src/main/java/org/javaee7/jaxrs/server/negotiation/TestServlet.java index a0b9b236d..6a804779a 100644 --- a/jaxrs/server-negotiation/src/main/java/org/javaee7/jaxrs/server/negotiation/TestServlet.java +++ b/jaxrs/server-negotiation/src/main/java/org/javaee7/jaxrs/server/negotiation/TestServlet.java @@ -90,7 +90,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re // GET out.print("GETTing...
"); - String string = target.request().get(String.class); + String string = target.request().accept("application/*").get(String.class); out.format("GOT the representation: " + string); out.format("

Did you get the JSON representation ?"); out.println("

... done.
"); From 44ecab6db022e33d2e74183c434809c3d7b3bc19 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Wed, 2 Oct 2013 15:00:43 -0700 Subject: [PATCH 063/995] "mvn embedded-glassfish run" to run the samples in embedded GlassFish. TBD: how to connect with database. --- pom.xml | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/pom.xml b/pom.xml index d688cba82..7f3ca6bb4 100644 --- a/pom.xml +++ b/pom.xml @@ -111,6 +111,48 @@
+ + org.glassfish.embedded + maven-embedded-glassfish-plugin + 4.0 + + target/${project.artifactId}.war + 8080 + + 8181 + + + + + org.glassfish.main.common + simple-glassfish-api + 4.0 + + + org.glassfish.main.extras + glassfish-embedded-all + 4.0 + + + + + start + integration-test + + start + deploy + + + + stop + post-integration-test + + undeploy + stop + + + + From 0d8444d4716e798cdf2f7d0c4c879fbed928c75d Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Wed, 2 Oct 2013 16:31:14 -0700 Subject: [PATCH 064/995] Fixing a variable name --- .../src/main/java/org/javaee7/extra/mongo/Person.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extra/mongo/src/main/java/org/javaee7/extra/mongo/Person.java b/extra/mongo/src/main/java/org/javaee7/extra/mongo/Person.java index 7b4620f3e..eb9c48f21 100644 --- a/extra/mongo/src/main/java/org/javaee7/extra/mongo/Person.java +++ b/extra/mongo/src/main/java/org/javaee7/extra/mongo/Person.java @@ -89,12 +89,12 @@ public BasicDBObject toDBObject() { } public static Person fromDBObject(DBObject doc) { - Person m = new Person(); + Person p = new Person(); - m.name = (String) doc.get("name"); - m.age = (int) doc.get("age"); + p.name = (String) doc.get("name"); + p.age = (int) doc.get("age"); - return m; + return p; } @Override From 05e77c3e02d37f226414e74a72e30dd111635f00 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Wed, 2 Oct 2013 17:22:05 -0700 Subject: [PATCH 065/995] New Couchbase sample - getBulk does not seem to be returning correct values, needs further investigation --- extra/couchbase/pom.xml | 23 ++++ .../org/javaee7/extra/couchbase/Person.java | 86 +++++++++++++ .../extra/couchbase/PersonSessionBean.java | 114 ++++++++++++++++++ .../src/main/webapp/WEB-INF/beans.xml | 49 ++++++++ .../src/main/webapp/WEB-INF/template.xhtml | 26 ++++ .../couchbase/src/main/webapp/WEB-INF/web.xml | 24 ++++ extra/couchbase/src/main/webapp/index.xhtml | 37 ++++++ .../main/webapp/resources/css/cssLayout.css | 61 ++++++++++ .../src/main/webapp/resources/css/default.css | 29 +++++ extra/couchbase/src/main/webapp/show.xhtml | 22 ++++ 10 files changed, 471 insertions(+) create mode 100644 extra/couchbase/pom.xml create mode 100644 extra/couchbase/src/main/java/org/javaee7/extra/couchbase/Person.java create mode 100644 extra/couchbase/src/main/java/org/javaee7/extra/couchbase/PersonSessionBean.java create mode 100644 extra/couchbase/src/main/webapp/WEB-INF/beans.xml create mode 100644 extra/couchbase/src/main/webapp/WEB-INF/template.xhtml create mode 100644 extra/couchbase/src/main/webapp/WEB-INF/web.xml create mode 100644 extra/couchbase/src/main/webapp/index.xhtml create mode 100644 extra/couchbase/src/main/webapp/resources/css/cssLayout.css create mode 100644 extra/couchbase/src/main/webapp/resources/css/default.css create mode 100644 extra/couchbase/src/main/webapp/show.xhtml diff --git a/extra/couchbase/pom.xml b/extra/couchbase/pom.xml new file mode 100644 index 000000000..9f4768057 --- /dev/null +++ b/extra/couchbase/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + org.javaee7.extra + extra-samples + 1.0-SNAPSHOT + ../pom.xml + + + org.javaee7.extra + couchbase + 1.0-SNAPSHOT + war + + + + com.couchbase.client + couchbase-client + 1.2.0 + + + diff --git a/extra/couchbase/src/main/java/org/javaee7/extra/couchbase/Person.java b/extra/couchbase/src/main/java/org/javaee7/extra/couchbase/Person.java new file mode 100644 index 000000000..690c2ebb7 --- /dev/null +++ b/extra/couchbase/src/main/java/org/javaee7/extra/couchbase/Person.java @@ -0,0 +1,86 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.couchbase; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Named; +import javax.validation.constraints.Size; + +/** + * @author Arun Gupta + */ +@Named +@ApplicationScoped +public class Person { + + @Size(min = 1, max = 20) + private String name; + + private int age; + + public Person() { + } + + public Person(String name, int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + @Override + public String toString() { + return name + ", " + age; + } +} diff --git a/extra/couchbase/src/main/java/org/javaee7/extra/couchbase/PersonSessionBean.java b/extra/couchbase/src/main/java/org/javaee7/extra/couchbase/PersonSessionBean.java new file mode 100644 index 000000000..bef1549ee --- /dev/null +++ b/extra/couchbase/src/main/java/org/javaee7/extra/couchbase/PersonSessionBean.java @@ -0,0 +1,114 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.couchbase; + +import com.couchbase.client.CouchbaseClient; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +/** + * @author Arun Gupta + */ +@Named +@Singleton +public class PersonSessionBean { + + @Inject + Person person; + + CouchbaseClient client; + + Set set = new HashSet<>(); + + @PostConstruct + private void initDB() { + try { + // Get an instance of Couchbase + List hosts = Arrays.asList( + new URI("http://localhost:8091/pools") + ); + + // Get an instance of Couchbase + // Name of the Bucket to connect to + String bucket = "default"; + + // Password of the bucket (empty) string if none + String password = ""; + + // Connect to the Cluster + client = new CouchbaseClient(hosts, bucket, password); + } catch (URISyntaxException | IOException ex) { + Logger.getLogger(PersonSessionBean.class.getName()).log(Level.SEVERE, null, ex); + } + } + + @PreDestroy + private void stopDB() { + client.shutdown(); + } + + public void createPerson() { + client.set(person.getName(), person); + set.add(person.getName()); + } + + public List getPersons() { + List persons = new ArrayList(); + Map map = client.getBulk(set.iterator()); + for (String key : map.keySet()) { + persons.add((Person)map.get(key)); + } + return persons; + } +} diff --git a/extra/couchbase/src/main/webapp/WEB-INF/beans.xml b/extra/couchbase/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 000000000..aa81c7c3c --- /dev/null +++ b/extra/couchbase/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,49 @@ + + + + \ No newline at end of file diff --git a/extra/couchbase/src/main/webapp/WEB-INF/template.xhtml b/extra/couchbase/src/main/webapp/WEB-INF/template.xhtml new file mode 100644 index 000000000..9eb7c0652 --- /dev/null +++ b/extra/couchbase/src/main/webapp/WEB-INF/template.xhtml @@ -0,0 +1,26 @@ + + + + + + + + + Couchbase using Java EE 7 + + + + +
+

Couchbase using Java EE 7

+
+ +
+ Content +
+ +
+ + diff --git a/extra/couchbase/src/main/webapp/WEB-INF/web.xml b/extra/couchbase/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..c5e7c7381 --- /dev/null +++ b/extra/couchbase/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/extra/couchbase/src/main/webapp/index.xhtml b/extra/couchbase/src/main/webapp/index.xhtml new file mode 100644 index 000000000..16b846aef --- /dev/null +++ b/extra/couchbase/src/main/webapp/index.xhtml @@ -0,0 +1,37 @@ + + + + + + + + + + + Name:
+ Age:
+ +
+
+ Make sure to start Couchbase server. Confirm by visiting pools and look for output as: + +
+"pools": [
+    {
+        "name": "default",
+        "uri": "/pools/default?uuid=21041e11772b15d7c64f3451e1293215",
+        "streamingUri": "/poolsStreaming/default?uuid=21041e11772b15d7c64f3451e1293215"
+    }
+],
+                
+
+ +
+ + + diff --git a/extra/couchbase/src/main/webapp/resources/css/cssLayout.css b/extra/couchbase/src/main/webapp/resources/css/cssLayout.css new file mode 100644 index 000000000..8ee7cebe3 --- /dev/null +++ b/extra/couchbase/src/main/webapp/resources/css/cssLayout.css @@ -0,0 +1,61 @@ + +#top { + position: relative; + background-color: #036fab; + color: white; + padding: 5px; + margin: 0px 0px 10px 0px; +} + +#bottom { + position: relative; + background-color: #c2dfef; + padding: 5px; + margin: 10px 0px 0px 0px; +} + +#left { + float: left; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +#right { + float: right; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +.center_content { + position: relative; + background-color: #dddddd; + padding: 5px; +} + +.left_content { + background-color: #dddddd; + padding: 5px; + margin-left: 170px; +} + +.right_content { + background-color: #dddddd; + padding: 5px; + margin: 0px 170px 0px 170px; +} + +#top a:link, #top a:visited { + color: white; + font-weight : bold; + text-decoration: none; +} + +#top a:link:hover, #top a:visited:hover { + color: black; + font-weight : bold; + text-decoration : underline; +} + + diff --git a/extra/couchbase/src/main/webapp/resources/css/default.css b/extra/couchbase/src/main/webapp/resources/css/default.css new file mode 100644 index 000000000..6cbc3d18e --- /dev/null +++ b/extra/couchbase/src/main/webapp/resources/css/default.css @@ -0,0 +1,29 @@ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/extra/couchbase/src/main/webapp/show.xhtml b/extra/couchbase/src/main/webapp/show.xhtml new file mode 100644 index 000000000..19203f612 --- /dev/null +++ b/extra/couchbase/src/main/webapp/show.xhtml @@ -0,0 +1,22 @@ + + + + + + + + + + + Name#{p.name} + Age#{p.age} + + + + + + + From 52b4b7c4356c06f92178e6ccb4ed22ce58730f80 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Wed, 2 Oct 2013 17:22:15 -0700 Subject: [PATCH 066/995] Adding couchbase module --- extra/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/extra/pom.xml b/extra/pom.xml index 5d49f9138..6e78376ca 100644 --- a/extra/pom.xml +++ b/extra/pom.xml @@ -18,5 +18,6 @@ quartz twitter-search mongo + couchbase
From 0ba5d04c7cdea62e726743122f572cbdfdc430ed Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 09:50:32 -0700 Subject: [PATCH 067/995] Making the object serializable so that it can be persisted in Couchbase --- .../src/main/java/org/javaee7/extra/couchbase/Person.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extra/couchbase/src/main/java/org/javaee7/extra/couchbase/Person.java b/extra/couchbase/src/main/java/org/javaee7/extra/couchbase/Person.java index 690c2ebb7..1a72e8409 100644 --- a/extra/couchbase/src/main/java/org/javaee7/extra/couchbase/Person.java +++ b/extra/couchbase/src/main/java/org/javaee7/extra/couchbase/Person.java @@ -39,6 +39,7 @@ */ package org.javaee7.extra.couchbase; +import java.io.Serializable; import javax.enterprise.context.ApplicationScoped; import javax.inject.Named; import javax.validation.constraints.Size; @@ -48,7 +49,7 @@ */ @Named @ApplicationScoped -public class Person { +public class Person implements Serializable { @Size(min = 1, max = 20) private String name; From 6a0def18faa6a0581d645b040baeb977db7af82c Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 09:50:51 -0700 Subject: [PATCH 068/995] Persisting object instance instead of proxy --- .../java/org/javaee7/extra/couchbase/PersonSessionBean.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/couchbase/src/main/java/org/javaee7/extra/couchbase/PersonSessionBean.java b/extra/couchbase/src/main/java/org/javaee7/extra/couchbase/PersonSessionBean.java index bef1549ee..e4fb4ccf6 100644 --- a/extra/couchbase/src/main/java/org/javaee7/extra/couchbase/PersonSessionBean.java +++ b/extra/couchbase/src/main/java/org/javaee7/extra/couchbase/PersonSessionBean.java @@ -99,7 +99,7 @@ private void stopDB() { } public void createPerson() { - client.set(person.getName(), person); + client.set(person.getName(), new Person(person.getName(), person.getAge())); set.add(person.getName()); } From 31392a6b136a2f2d23b47f835834b128d90081d2 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 09:51:16 -0700 Subject: [PATCH 069/995] Adding Back button and some formatting --- extra/couchbase/src/main/webapp/index.xhtml | 5 ++--- extra/couchbase/src/main/webapp/show.xhtml | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/extra/couchbase/src/main/webapp/index.xhtml b/extra/couchbase/src/main/webapp/index.xhtml index 16b846aef..daf471c32 100644 --- a/extra/couchbase/src/main/webapp/index.xhtml +++ b/extra/couchbase/src/main/webapp/index.xhtml @@ -11,11 +11,10 @@ Name:
- Age:
+ Age:

+ value="Add"/>

Make sure to start Couchbase server. Confirm by visiting pools and look for output as: diff --git a/extra/couchbase/src/main/webapp/show.xhtml b/extra/couchbase/src/main/webapp/show.xhtml index 19203f612..8f1d60f31 100644 --- a/extra/couchbase/src/main/webapp/show.xhtml +++ b/extra/couchbase/src/main/webapp/show.xhtml @@ -14,6 +14,11 @@ Name#{p.name} Age#{p.age} +

+ + + +
From 12a236eb4147bc2d8dc5fe58a395e325707e811d Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 14:05:31 -0700 Subject: [PATCH 070/995] New sample that shows Redis and Java EE integration --- extra/redis/pom.xml | 23 +++++ .../java/org/javaee7/extra/redis/Person.java | 92 +++++++++++++++++++ .../extra/redis/PersonSessionBean.java | 90 ++++++++++++++++++ extra/redis/src/main/webapp/WEB-INF/beans.xml | 49 ++++++++++ .../src/main/webapp/WEB-INF/template.xhtml | 26 ++++++ extra/redis/src/main/webapp/WEB-INF/web.xml | 24 +++++ extra/redis/src/main/webapp/index.xhtml | 28 ++++++ .../main/webapp/resources/css/cssLayout.css | 61 ++++++++++++ .../src/main/webapp/resources/css/default.css | 29 ++++++ extra/redis/src/main/webapp/show.xhtml | 29 ++++++ 10 files changed, 451 insertions(+) create mode 100644 extra/redis/pom.xml create mode 100644 extra/redis/src/main/java/org/javaee7/extra/redis/Person.java create mode 100644 extra/redis/src/main/java/org/javaee7/extra/redis/PersonSessionBean.java create mode 100644 extra/redis/src/main/webapp/WEB-INF/beans.xml create mode 100644 extra/redis/src/main/webapp/WEB-INF/template.xhtml create mode 100644 extra/redis/src/main/webapp/WEB-INF/web.xml create mode 100644 extra/redis/src/main/webapp/index.xhtml create mode 100644 extra/redis/src/main/webapp/resources/css/cssLayout.css create mode 100644 extra/redis/src/main/webapp/resources/css/default.css create mode 100644 extra/redis/src/main/webapp/show.xhtml diff --git a/extra/redis/pom.xml b/extra/redis/pom.xml new file mode 100644 index 000000000..ce6b57832 --- /dev/null +++ b/extra/redis/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + org.javaee7.extra + extra-samples + 1.0-SNAPSHOT + ../pom.xml + + + org.javaee7.extra + redis + 1.0-SNAPSHOT + war + + + + redis.clients + jedis + 2.2.0 + + + diff --git a/extra/redis/src/main/java/org/javaee7/extra/redis/Person.java b/extra/redis/src/main/java/org/javaee7/extra/redis/Person.java new file mode 100644 index 000000000..83a5781fd --- /dev/null +++ b/extra/redis/src/main/java/org/javaee7/extra/redis/Person.java @@ -0,0 +1,92 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.redis; + +import java.util.StringTokenizer; +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Named; +import javax.validation.constraints.Size; + +/** + * @author Arun Gupta + */ +@Named +@ApplicationScoped +public class Person { + + @Size(min = 1, max = 20) + private String name; + + private int age; + + public Person() { + } + + public Person(String name, int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + @Override + public String toString() { + return name + ", " + age; + } + + public static Person fromString(String string) { + StringTokenizer tokens = new StringTokenizer(string, ","); + return new Person(tokens.nextToken(), Integer.parseInt(tokens.nextToken().trim())); + } +} diff --git a/extra/redis/src/main/java/org/javaee7/extra/redis/PersonSessionBean.java b/extra/redis/src/main/java/org/javaee7/extra/redis/PersonSessionBean.java new file mode 100644 index 000000000..efdd3b669 --- /dev/null +++ b/extra/redis/src/main/java/org/javaee7/extra/redis/PersonSessionBean.java @@ -0,0 +1,90 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.redis; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.ejb.Stateless; +import javax.inject.Inject; +import javax.inject.Named; +import redis.clients.jedis.Jedis; + +/** + * @author Arun Gupta + */ +@Named +@Stateless +public class PersonSessionBean { + + @Inject + Person person; + + Jedis jedis; + + Set set = new HashSet<>(); + + @PostConstruct + private void initDB() { +// Start embedded Redis + jedis = new Jedis("localhost", 6379); + } + + @PreDestroy + private void stopDB() { + jedis.shutdown(); + } + + public void createPerson() { + jedis.set(person.getName(), new Person(person.getName(), person.getAge()).toString()); + set.add(person.getName()); + } + + public List getPersons() { + List persons = new ArrayList<>(); + for (String key : set) { + persons.add(Person.fromString(jedis.get(key))); + } + return persons; + } +} diff --git a/extra/redis/src/main/webapp/WEB-INF/beans.xml b/extra/redis/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 000000000..aa81c7c3c --- /dev/null +++ b/extra/redis/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,49 @@ + + + + \ No newline at end of file diff --git a/extra/redis/src/main/webapp/WEB-INF/template.xhtml b/extra/redis/src/main/webapp/WEB-INF/template.xhtml new file mode 100644 index 000000000..c0d6c22b3 --- /dev/null +++ b/extra/redis/src/main/webapp/WEB-INF/template.xhtml @@ -0,0 +1,26 @@ + + + + + + + + + Redis using Java EE 7 + + + + +
+

Redis using Java EE 7

+
+ +
+ Content +
+ +
+ + diff --git a/extra/redis/src/main/webapp/WEB-INF/web.xml b/extra/redis/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..c5e7c7381 --- /dev/null +++ b/extra/redis/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/extra/redis/src/main/webapp/index.xhtml b/extra/redis/src/main/webapp/index.xhtml new file mode 100644 index 000000000..0adf58b04 --- /dev/null +++ b/extra/redis/src/main/webapp/index.xhtml @@ -0,0 +1,28 @@ + + + + + + + + + + + Name:
+ Age:

+ +
+
+ Make sure to download latest stable release, compile, and run it. Look for a message like: + +
* The server is now ready to accept connections on port 6379
+
+ +
+ + + diff --git a/extra/redis/src/main/webapp/resources/css/cssLayout.css b/extra/redis/src/main/webapp/resources/css/cssLayout.css new file mode 100644 index 000000000..8ee7cebe3 --- /dev/null +++ b/extra/redis/src/main/webapp/resources/css/cssLayout.css @@ -0,0 +1,61 @@ + +#top { + position: relative; + background-color: #036fab; + color: white; + padding: 5px; + margin: 0px 0px 10px 0px; +} + +#bottom { + position: relative; + background-color: #c2dfef; + padding: 5px; + margin: 10px 0px 0px 0px; +} + +#left { + float: left; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +#right { + float: right; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +.center_content { + position: relative; + background-color: #dddddd; + padding: 5px; +} + +.left_content { + background-color: #dddddd; + padding: 5px; + margin-left: 170px; +} + +.right_content { + background-color: #dddddd; + padding: 5px; + margin: 0px 170px 0px 170px; +} + +#top a:link, #top a:visited { + color: white; + font-weight : bold; + text-decoration: none; +} + +#top a:link:hover, #top a:visited:hover { + color: black; + font-weight : bold; + text-decoration : underline; +} + + diff --git a/extra/redis/src/main/webapp/resources/css/default.css b/extra/redis/src/main/webapp/resources/css/default.css new file mode 100644 index 000000000..6cbc3d18e --- /dev/null +++ b/extra/redis/src/main/webapp/resources/css/default.css @@ -0,0 +1,29 @@ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/extra/redis/src/main/webapp/show.xhtml b/extra/redis/src/main/webapp/show.xhtml new file mode 100644 index 000000000..342b4446b --- /dev/null +++ b/extra/redis/src/main/webapp/show.xhtml @@ -0,0 +1,29 @@ + + + + + + + + + + + Name#{p.name} + Age#{p.age} + +

+ + + + +
+ +
+ + + From c73b40556a946fa05de3e887e9ae4262afde842d Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 14:05:45 -0700 Subject: [PATCH 071/995] Adding redis module --- extra/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/extra/pom.xml b/extra/pom.xml index 6e78376ca..775db0336 100644 --- a/extra/pom.xml +++ b/extra/pom.xml @@ -19,5 +19,6 @@ twitter-search mongo couchbase + redis
From d87cc280026b5317a98610b86ae23baab567a5fe Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 14:11:11 -0700 Subject: [PATCH 072/995] Moving NoSQL samples to a separate module --- .../org/javaee7/extra/mongo/TestServlet.java | 146 ------------------ extra/{ => nosql}/couchbase/pom.xml | 6 +- .../org/javaee7/extra/couchbase/Person.java | 0 .../extra/couchbase/PersonSessionBean.java | 0 .../src/main/webapp/WEB-INF/beans.xml | 0 .../src/main/webapp/WEB-INF/template.xhtml | 0 .../couchbase/src/main/webapp/WEB-INF/web.xml | 0 .../couchbase/src/main/webapp/index.xhtml | 0 .../main/webapp/resources/css/cssLayout.css | 0 .../src/main/webapp/resources/css/default.css | 0 .../couchbase/src/main/webapp/show.xhtml | 0 extra/{ => nosql}/mongo/pom.xml | 6 +- .../java/org/javaee7/extra/mongo/Person.java | 0 .../extra/mongo/PersonSessionBean.java | 0 .../mongo/src/main/webapp/WEB-INF/beans.xml | 0 .../src/main/webapp/WEB-INF/template.xhtml | 0 .../mongo/src/main/webapp/WEB-INF/web.xml | 0 .../mongo/src/main/webapp/index.xhtml | 0 .../main/webapp/resources/css/cssLayout.css | 0 .../src/main/webapp/resources/css/default.css | 0 .../mongo/src/main/webapp/show.xhtml | 0 extra/nosql/pom.xml | 22 +++ extra/{ => nosql}/redis/pom.xml | 6 +- .../java/org/javaee7/extra/redis/Person.java | 0 .../extra/redis/PersonSessionBean.java | 0 .../redis/src/main/webapp/WEB-INF/beans.xml | 0 .../src/main/webapp/WEB-INF/template.xhtml | 0 .../redis/src/main/webapp/WEB-INF/web.xml | 0 .../redis/src/main/webapp/index.xhtml | 0 .../main/webapp/resources/css/cssLayout.css | 0 .../src/main/webapp/resources/css/default.css | 0 .../redis/src/main/webapp/show.xhtml | 0 extra/pom.xml | 4 +- 33 files changed, 32 insertions(+), 158 deletions(-) delete mode 100644 extra/mongo/src/main/java/org/javaee7/extra/mongo/TestServlet.java rename extra/{ => nosql}/couchbase/pom.xml (81%) rename extra/{ => nosql}/couchbase/src/main/java/org/javaee7/extra/couchbase/Person.java (100%) rename extra/{ => nosql}/couchbase/src/main/java/org/javaee7/extra/couchbase/PersonSessionBean.java (100%) rename extra/{ => nosql}/couchbase/src/main/webapp/WEB-INF/beans.xml (100%) rename extra/{ => nosql}/couchbase/src/main/webapp/WEB-INF/template.xhtml (100%) rename extra/{ => nosql}/couchbase/src/main/webapp/WEB-INF/web.xml (100%) rename extra/{ => nosql}/couchbase/src/main/webapp/index.xhtml (100%) rename extra/{ => nosql}/couchbase/src/main/webapp/resources/css/cssLayout.css (100%) rename extra/{ => nosql}/couchbase/src/main/webapp/resources/css/default.css (100%) rename extra/{ => nosql}/couchbase/src/main/webapp/show.xhtml (100%) rename extra/{ => nosql}/mongo/pom.xml (83%) rename extra/{ => nosql}/mongo/src/main/java/org/javaee7/extra/mongo/Person.java (100%) rename extra/{ => nosql}/mongo/src/main/java/org/javaee7/extra/mongo/PersonSessionBean.java (100%) rename extra/{ => nosql}/mongo/src/main/webapp/WEB-INF/beans.xml (100%) rename extra/{ => nosql}/mongo/src/main/webapp/WEB-INF/template.xhtml (100%) rename extra/{ => nosql}/mongo/src/main/webapp/WEB-INF/web.xml (100%) rename extra/{ => nosql}/mongo/src/main/webapp/index.xhtml (100%) rename extra/{ => nosql}/mongo/src/main/webapp/resources/css/cssLayout.css (100%) rename extra/{ => nosql}/mongo/src/main/webapp/resources/css/default.css (100%) rename extra/{ => nosql}/mongo/src/main/webapp/show.xhtml (100%) create mode 100644 extra/nosql/pom.xml rename extra/{ => nosql}/redis/pom.xml (80%) rename extra/{ => nosql}/redis/src/main/java/org/javaee7/extra/redis/Person.java (100%) rename extra/{ => nosql}/redis/src/main/java/org/javaee7/extra/redis/PersonSessionBean.java (100%) rename extra/{ => nosql}/redis/src/main/webapp/WEB-INF/beans.xml (100%) rename extra/{ => nosql}/redis/src/main/webapp/WEB-INF/template.xhtml (100%) rename extra/{ => nosql}/redis/src/main/webapp/WEB-INF/web.xml (100%) rename extra/{ => nosql}/redis/src/main/webapp/index.xhtml (100%) rename extra/{ => nosql}/redis/src/main/webapp/resources/css/cssLayout.css (100%) rename extra/{ => nosql}/redis/src/main/webapp/resources/css/default.css (100%) rename extra/{ => nosql}/redis/src/main/webapp/show.xhtml (100%) diff --git a/extra/mongo/src/main/java/org/javaee7/extra/mongo/TestServlet.java b/extra/mongo/src/main/java/org/javaee7/extra/mongo/TestServlet.java deleted file mode 100644 index 7236eadfb..000000000 --- a/extra/mongo/src/main/java/org/javaee7/extra/mongo/TestServlet.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package org.javaee7.extra.mongo; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author Arun Gupta - */ -@WebServlet(urlPatterns = {"/TestServlet"}) -public class TestServlet extends HttpServlet { - - /** - * Processes requests for both HTTP GET and POST - * methods. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - protected void processRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - response.setContentType("text/html;charset=UTF-8"); - try (PrintWriter out = response.getWriter()) { - out.println(""); - out.println(""); - out.println(""); - out.println("Mongo with Java EE 7"); - out.println(""); - out.println(""); - out.println("

Mongo with Java EE 7

"); - -// Mongo m = new Mongo(); -// DB db = m.getDB("movieDB"); -// DBCollection coll = db.getCollection("test"); -// if (coll == null) { -// System.out.println("Creating a new test collection"); -// coll = db.createCollection("test", null); -// } -// BasicDBObject bdbo = new BasicDBObject(); -// bdbo.put("name", "mario"); -// coll.insert(bdbo); -// bdbo.clear(); -// bdbo.put("name", "luigi"); -// coll.insert(bdbo); -// -// out.println("Found " + coll.getCount() + " elements
"); -// DBCursor cur = coll.find(); -// for (DBObject o : cur.toArray()) { -// out.println(o.get("name") + "
"); -// } - - out.println(""); - out.println(""); - } - } - - // - /** - * Handles the HTTP GET method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doGet - (HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Handles the HTTP POST method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doPost - (HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Returns a short description of the servlet. - * - * @return a String containing servlet description - */ - @Override - public String getServletInfo - - () { - return "Short description"; - }// - } diff --git a/extra/couchbase/pom.xml b/extra/nosql/couchbase/pom.xml similarity index 81% rename from extra/couchbase/pom.xml rename to extra/nosql/couchbase/pom.xml index 9f4768057..3e19cae10 100644 --- a/extra/couchbase/pom.xml +++ b/extra/nosql/couchbase/pom.xml @@ -2,13 +2,13 @@ 4.0.0 - org.javaee7.extra - extra-samples + org.javaee7.extra.nosql + extra-nosql-samples 1.0-SNAPSHOT ../pom.xml - org.javaee7.extra + org.javaee7.extra.nosql couchbase 1.0-SNAPSHOT war diff --git a/extra/couchbase/src/main/java/org/javaee7/extra/couchbase/Person.java b/extra/nosql/couchbase/src/main/java/org/javaee7/extra/couchbase/Person.java similarity index 100% rename from extra/couchbase/src/main/java/org/javaee7/extra/couchbase/Person.java rename to extra/nosql/couchbase/src/main/java/org/javaee7/extra/couchbase/Person.java diff --git a/extra/couchbase/src/main/java/org/javaee7/extra/couchbase/PersonSessionBean.java b/extra/nosql/couchbase/src/main/java/org/javaee7/extra/couchbase/PersonSessionBean.java similarity index 100% rename from extra/couchbase/src/main/java/org/javaee7/extra/couchbase/PersonSessionBean.java rename to extra/nosql/couchbase/src/main/java/org/javaee7/extra/couchbase/PersonSessionBean.java diff --git a/extra/couchbase/src/main/webapp/WEB-INF/beans.xml b/extra/nosql/couchbase/src/main/webapp/WEB-INF/beans.xml similarity index 100% rename from extra/couchbase/src/main/webapp/WEB-INF/beans.xml rename to extra/nosql/couchbase/src/main/webapp/WEB-INF/beans.xml diff --git a/extra/couchbase/src/main/webapp/WEB-INF/template.xhtml b/extra/nosql/couchbase/src/main/webapp/WEB-INF/template.xhtml similarity index 100% rename from extra/couchbase/src/main/webapp/WEB-INF/template.xhtml rename to extra/nosql/couchbase/src/main/webapp/WEB-INF/template.xhtml diff --git a/extra/couchbase/src/main/webapp/WEB-INF/web.xml b/extra/nosql/couchbase/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from extra/couchbase/src/main/webapp/WEB-INF/web.xml rename to extra/nosql/couchbase/src/main/webapp/WEB-INF/web.xml diff --git a/extra/couchbase/src/main/webapp/index.xhtml b/extra/nosql/couchbase/src/main/webapp/index.xhtml similarity index 100% rename from extra/couchbase/src/main/webapp/index.xhtml rename to extra/nosql/couchbase/src/main/webapp/index.xhtml diff --git a/extra/couchbase/src/main/webapp/resources/css/cssLayout.css b/extra/nosql/couchbase/src/main/webapp/resources/css/cssLayout.css similarity index 100% rename from extra/couchbase/src/main/webapp/resources/css/cssLayout.css rename to extra/nosql/couchbase/src/main/webapp/resources/css/cssLayout.css diff --git a/extra/couchbase/src/main/webapp/resources/css/default.css b/extra/nosql/couchbase/src/main/webapp/resources/css/default.css similarity index 100% rename from extra/couchbase/src/main/webapp/resources/css/default.css rename to extra/nosql/couchbase/src/main/webapp/resources/css/default.css diff --git a/extra/couchbase/src/main/webapp/show.xhtml b/extra/nosql/couchbase/src/main/webapp/show.xhtml similarity index 100% rename from extra/couchbase/src/main/webapp/show.xhtml rename to extra/nosql/couchbase/src/main/webapp/show.xhtml diff --git a/extra/mongo/pom.xml b/extra/nosql/mongo/pom.xml similarity index 83% rename from extra/mongo/pom.xml rename to extra/nosql/mongo/pom.xml index 00fd31e5b..793d799c6 100644 --- a/extra/mongo/pom.xml +++ b/extra/nosql/mongo/pom.xml @@ -2,13 +2,13 @@ 4.0.0 - org.javaee7.extra - extra-samples + org.javaee7.extra.nosql + extra-nosql-samples 1.0-SNAPSHOT ../pom.xml - org.javaee7.extra + org.javaee7.extra.nosql mongo 1.0-SNAPSHOT war diff --git a/extra/mongo/src/main/java/org/javaee7/extra/mongo/Person.java b/extra/nosql/mongo/src/main/java/org/javaee7/extra/mongo/Person.java similarity index 100% rename from extra/mongo/src/main/java/org/javaee7/extra/mongo/Person.java rename to extra/nosql/mongo/src/main/java/org/javaee7/extra/mongo/Person.java diff --git a/extra/mongo/src/main/java/org/javaee7/extra/mongo/PersonSessionBean.java b/extra/nosql/mongo/src/main/java/org/javaee7/extra/mongo/PersonSessionBean.java similarity index 100% rename from extra/mongo/src/main/java/org/javaee7/extra/mongo/PersonSessionBean.java rename to extra/nosql/mongo/src/main/java/org/javaee7/extra/mongo/PersonSessionBean.java diff --git a/extra/mongo/src/main/webapp/WEB-INF/beans.xml b/extra/nosql/mongo/src/main/webapp/WEB-INF/beans.xml similarity index 100% rename from extra/mongo/src/main/webapp/WEB-INF/beans.xml rename to extra/nosql/mongo/src/main/webapp/WEB-INF/beans.xml diff --git a/extra/mongo/src/main/webapp/WEB-INF/template.xhtml b/extra/nosql/mongo/src/main/webapp/WEB-INF/template.xhtml similarity index 100% rename from extra/mongo/src/main/webapp/WEB-INF/template.xhtml rename to extra/nosql/mongo/src/main/webapp/WEB-INF/template.xhtml diff --git a/extra/mongo/src/main/webapp/WEB-INF/web.xml b/extra/nosql/mongo/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from extra/mongo/src/main/webapp/WEB-INF/web.xml rename to extra/nosql/mongo/src/main/webapp/WEB-INF/web.xml diff --git a/extra/mongo/src/main/webapp/index.xhtml b/extra/nosql/mongo/src/main/webapp/index.xhtml similarity index 100% rename from extra/mongo/src/main/webapp/index.xhtml rename to extra/nosql/mongo/src/main/webapp/index.xhtml diff --git a/extra/mongo/src/main/webapp/resources/css/cssLayout.css b/extra/nosql/mongo/src/main/webapp/resources/css/cssLayout.css similarity index 100% rename from extra/mongo/src/main/webapp/resources/css/cssLayout.css rename to extra/nosql/mongo/src/main/webapp/resources/css/cssLayout.css diff --git a/extra/mongo/src/main/webapp/resources/css/default.css b/extra/nosql/mongo/src/main/webapp/resources/css/default.css similarity index 100% rename from extra/mongo/src/main/webapp/resources/css/default.css rename to extra/nosql/mongo/src/main/webapp/resources/css/default.css diff --git a/extra/mongo/src/main/webapp/show.xhtml b/extra/nosql/mongo/src/main/webapp/show.xhtml similarity index 100% rename from extra/mongo/src/main/webapp/show.xhtml rename to extra/nosql/mongo/src/main/webapp/show.xhtml diff --git a/extra/nosql/pom.xml b/extra/nosql/pom.xml new file mode 100644 index 000000000..b11f5f7f6 --- /dev/null +++ b/extra/nosql/pom.xml @@ -0,0 +1,22 @@ + + + 4.0.0 + + org.javaee7.extra + extra-samples + 1.0-SNAPSHOT + ../pom.xml + + + org.javaee7.extra.nosql + extra-nosql-samples + 1.0-SNAPSHOT + pom + Java EE 7 Extra NoSQL Samples + + + mongo + couchbase + redis + + diff --git a/extra/redis/pom.xml b/extra/nosql/redis/pom.xml similarity index 80% rename from extra/redis/pom.xml rename to extra/nosql/redis/pom.xml index ce6b57832..bb38e5f06 100644 --- a/extra/redis/pom.xml +++ b/extra/nosql/redis/pom.xml @@ -2,13 +2,13 @@ 4.0.0 - org.javaee7.extra - extra-samples + org.javaee7.extra.nosql + extra-nosql-samples 1.0-SNAPSHOT ../pom.xml - org.javaee7.extra + org.javaee7.extra.nosql redis 1.0-SNAPSHOT war diff --git a/extra/redis/src/main/java/org/javaee7/extra/redis/Person.java b/extra/nosql/redis/src/main/java/org/javaee7/extra/redis/Person.java similarity index 100% rename from extra/redis/src/main/java/org/javaee7/extra/redis/Person.java rename to extra/nosql/redis/src/main/java/org/javaee7/extra/redis/Person.java diff --git a/extra/redis/src/main/java/org/javaee7/extra/redis/PersonSessionBean.java b/extra/nosql/redis/src/main/java/org/javaee7/extra/redis/PersonSessionBean.java similarity index 100% rename from extra/redis/src/main/java/org/javaee7/extra/redis/PersonSessionBean.java rename to extra/nosql/redis/src/main/java/org/javaee7/extra/redis/PersonSessionBean.java diff --git a/extra/redis/src/main/webapp/WEB-INF/beans.xml b/extra/nosql/redis/src/main/webapp/WEB-INF/beans.xml similarity index 100% rename from extra/redis/src/main/webapp/WEB-INF/beans.xml rename to extra/nosql/redis/src/main/webapp/WEB-INF/beans.xml diff --git a/extra/redis/src/main/webapp/WEB-INF/template.xhtml b/extra/nosql/redis/src/main/webapp/WEB-INF/template.xhtml similarity index 100% rename from extra/redis/src/main/webapp/WEB-INF/template.xhtml rename to extra/nosql/redis/src/main/webapp/WEB-INF/template.xhtml diff --git a/extra/redis/src/main/webapp/WEB-INF/web.xml b/extra/nosql/redis/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from extra/redis/src/main/webapp/WEB-INF/web.xml rename to extra/nosql/redis/src/main/webapp/WEB-INF/web.xml diff --git a/extra/redis/src/main/webapp/index.xhtml b/extra/nosql/redis/src/main/webapp/index.xhtml similarity index 100% rename from extra/redis/src/main/webapp/index.xhtml rename to extra/nosql/redis/src/main/webapp/index.xhtml diff --git a/extra/redis/src/main/webapp/resources/css/cssLayout.css b/extra/nosql/redis/src/main/webapp/resources/css/cssLayout.css similarity index 100% rename from extra/redis/src/main/webapp/resources/css/cssLayout.css rename to extra/nosql/redis/src/main/webapp/resources/css/cssLayout.css diff --git a/extra/redis/src/main/webapp/resources/css/default.css b/extra/nosql/redis/src/main/webapp/resources/css/default.css similarity index 100% rename from extra/redis/src/main/webapp/resources/css/default.css rename to extra/nosql/redis/src/main/webapp/resources/css/default.css diff --git a/extra/redis/src/main/webapp/show.xhtml b/extra/nosql/redis/src/main/webapp/show.xhtml similarity index 100% rename from extra/redis/src/main/webapp/show.xhtml rename to extra/nosql/redis/src/main/webapp/show.xhtml diff --git a/extra/pom.xml b/extra/pom.xml index 775db0336..3538abb30 100644 --- a/extra/pom.xml +++ b/extra/pom.xml @@ -17,8 +17,6 @@ quartz twitter-search - mongo - couchbase - redis + nosql From e7ad02df7d049c4ed90b854a67a412a7dff0e972 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 14:13:54 -0700 Subject: [PATCH 073/995] Fixing the package name --- .../java/org/javaee7/extra/{ => nosql}/couchbase/Person.java | 2 +- .../javaee7/extra/{ => nosql}/couchbase/PersonSessionBean.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename extra/nosql/couchbase/src/main/java/org/javaee7/extra/{ => nosql}/couchbase/Person.java (98%) rename extra/nosql/couchbase/src/main/java/org/javaee7/extra/{ => nosql}/couchbase/PersonSessionBean.java (98%) diff --git a/extra/nosql/couchbase/src/main/java/org/javaee7/extra/couchbase/Person.java b/extra/nosql/couchbase/src/main/java/org/javaee7/extra/nosql/couchbase/Person.java similarity index 98% rename from extra/nosql/couchbase/src/main/java/org/javaee7/extra/couchbase/Person.java rename to extra/nosql/couchbase/src/main/java/org/javaee7/extra/nosql/couchbase/Person.java index 1a72e8409..fa3c3e477 100644 --- a/extra/nosql/couchbase/src/main/java/org/javaee7/extra/couchbase/Person.java +++ b/extra/nosql/couchbase/src/main/java/org/javaee7/extra/nosql/couchbase/Person.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.extra.couchbase; +package org.javaee7.extra.nosql.couchbase; import java.io.Serializable; import javax.enterprise.context.ApplicationScoped; diff --git a/extra/nosql/couchbase/src/main/java/org/javaee7/extra/couchbase/PersonSessionBean.java b/extra/nosql/couchbase/src/main/java/org/javaee7/extra/nosql/couchbase/PersonSessionBean.java similarity index 98% rename from extra/nosql/couchbase/src/main/java/org/javaee7/extra/couchbase/PersonSessionBean.java rename to extra/nosql/couchbase/src/main/java/org/javaee7/extra/nosql/couchbase/PersonSessionBean.java index e4fb4ccf6..1c591a168 100644 --- a/extra/nosql/couchbase/src/main/java/org/javaee7/extra/couchbase/PersonSessionBean.java +++ b/extra/nosql/couchbase/src/main/java/org/javaee7/extra/nosql/couchbase/PersonSessionBean.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.extra.couchbase; +package org.javaee7.extra.nosql.couchbase; import com.couchbase.client.CouchbaseClient; import java.io.IOException; From b6c5a686d6fef71458976769ef42abbafe49db5a Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 14:14:11 -0700 Subject: [PATCH 074/995] Fixing the package name --- .../main/java/org/javaee7/extra/{ => nosql}/mongo/Person.java | 2 +- .../org/javaee7/extra/{ => nosql}/mongo/PersonSessionBean.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename extra/nosql/mongo/src/main/java/org/javaee7/extra/{ => nosql}/mongo/Person.java (98%) rename extra/nosql/mongo/src/main/java/org/javaee7/extra/{ => nosql}/mongo/PersonSessionBean.java (99%) diff --git a/extra/nosql/mongo/src/main/java/org/javaee7/extra/mongo/Person.java b/extra/nosql/mongo/src/main/java/org/javaee7/extra/nosql/mongo/Person.java similarity index 98% rename from extra/nosql/mongo/src/main/java/org/javaee7/extra/mongo/Person.java rename to extra/nosql/mongo/src/main/java/org/javaee7/extra/nosql/mongo/Person.java index eb9c48f21..52c203032 100644 --- a/extra/nosql/mongo/src/main/java/org/javaee7/extra/mongo/Person.java +++ b/extra/nosql/mongo/src/main/java/org/javaee7/extra/nosql/mongo/Person.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.extra.mongo; +package org.javaee7.extra.nosql.mongo; import com.mongodb.BasicDBObject; import com.mongodb.DBObject; diff --git a/extra/nosql/mongo/src/main/java/org/javaee7/extra/mongo/PersonSessionBean.java b/extra/nosql/mongo/src/main/java/org/javaee7/extra/nosql/mongo/PersonSessionBean.java similarity index 99% rename from extra/nosql/mongo/src/main/java/org/javaee7/extra/mongo/PersonSessionBean.java rename to extra/nosql/mongo/src/main/java/org/javaee7/extra/nosql/mongo/PersonSessionBean.java index 504fbf884..64ab51cda 100644 --- a/extra/nosql/mongo/src/main/java/org/javaee7/extra/mongo/PersonSessionBean.java +++ b/extra/nosql/mongo/src/main/java/org/javaee7/extra/nosql/mongo/PersonSessionBean.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.extra.mongo; +package org.javaee7.extra.nosql.mongo; import com.mongodb.BasicDBObject; import com.mongodb.DB; From 40e21237069b2dc9e8a69ccad2a190ee227ce6ec Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 14:14:22 -0700 Subject: [PATCH 075/995] Fixing the package name --- .../main/java/org/javaee7/extra/{ => nosql}/redis/Person.java | 2 +- .../org/javaee7/extra/{ => nosql}/redis/PersonSessionBean.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename extra/nosql/redis/src/main/java/org/javaee7/extra/{ => nosql}/redis/Person.java (98%) rename extra/nosql/redis/src/main/java/org/javaee7/extra/{ => nosql}/redis/PersonSessionBean.java (98%) diff --git a/extra/nosql/redis/src/main/java/org/javaee7/extra/redis/Person.java b/extra/nosql/redis/src/main/java/org/javaee7/extra/nosql/redis/Person.java similarity index 98% rename from extra/nosql/redis/src/main/java/org/javaee7/extra/redis/Person.java rename to extra/nosql/redis/src/main/java/org/javaee7/extra/nosql/redis/Person.java index 83a5781fd..dfbee998a 100644 --- a/extra/nosql/redis/src/main/java/org/javaee7/extra/redis/Person.java +++ b/extra/nosql/redis/src/main/java/org/javaee7/extra/nosql/redis/Person.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.extra.redis; +package org.javaee7.extra.nosql.redis; import java.util.StringTokenizer; import javax.enterprise.context.ApplicationScoped; diff --git a/extra/nosql/redis/src/main/java/org/javaee7/extra/redis/PersonSessionBean.java b/extra/nosql/redis/src/main/java/org/javaee7/extra/nosql/redis/PersonSessionBean.java similarity index 98% rename from extra/nosql/redis/src/main/java/org/javaee7/extra/redis/PersonSessionBean.java rename to extra/nosql/redis/src/main/java/org/javaee7/extra/nosql/redis/PersonSessionBean.java index efdd3b669..5f6884bdf 100644 --- a/extra/nosql/redis/src/main/java/org/javaee7/extra/redis/PersonSessionBean.java +++ b/extra/nosql/redis/src/main/java/org/javaee7/extra/nosql/redis/PersonSessionBean.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -package org.javaee7.extra.redis; +package org.javaee7.extra.nosql.redis; import java.util.ArrayList; import java.util.HashSet; From 772dfcec54e52af97ed01ad9c00f372d3c3759f3 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 16:26:45 -0700 Subject: [PATCH 076/995] Added a new profile to download s source and javadoc bundles from Maven repository --- pom.xml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/pom.xml b/pom.xml index 7f3ca6bb4..a47a3bf76 100644 --- a/pom.xml +++ b/pom.xml @@ -257,6 +257,32 @@ + + javadocs + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.8 + + + sources + process-resources + + sources + resolve + + + javadoc + false + + + + + + + From 0689f22dd0a89c07d16796a8b1ebf95f6a64a2b5 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 17:32:29 -0700 Subject: [PATCH 077/995] New sample to show Cassandra usage --- extra/nosql/cassandra/pom.xml | 23 ++++ .../javaee7/extra/nosql/cassandra/Person.java | 92 +++++++++++++ .../nosql/cassandra/PersonSessionBean.java | 127 ++++++++++++++++++ .../src/main/webapp/WEB-INF/beans.xml | 49 +++++++ .../src/main/webapp/WEB-INF/template.xhtml | 26 ++++ .../cassandra/src/main/webapp/WEB-INF/web.xml | 24 ++++ .../cassandra/src/main/webapp/index.xhtml | 43 ++++++ .../main/webapp/resources/css/cssLayout.css | 61 +++++++++ .../src/main/webapp/resources/css/default.css | 29 ++++ .../cassandra/src/main/webapp/show.xhtml | 27 ++++ extra/nosql/pom.xml | 1 + 11 files changed, 502 insertions(+) create mode 100644 extra/nosql/cassandra/pom.xml create mode 100644 extra/nosql/cassandra/src/main/java/org/javaee7/extra/nosql/cassandra/Person.java create mode 100644 extra/nosql/cassandra/src/main/java/org/javaee7/extra/nosql/cassandra/PersonSessionBean.java create mode 100644 extra/nosql/cassandra/src/main/webapp/WEB-INF/beans.xml create mode 100644 extra/nosql/cassandra/src/main/webapp/WEB-INF/template.xhtml create mode 100644 extra/nosql/cassandra/src/main/webapp/WEB-INF/web.xml create mode 100644 extra/nosql/cassandra/src/main/webapp/index.xhtml create mode 100644 extra/nosql/cassandra/src/main/webapp/resources/css/cssLayout.css create mode 100644 extra/nosql/cassandra/src/main/webapp/resources/css/default.css create mode 100644 extra/nosql/cassandra/src/main/webapp/show.xhtml diff --git a/extra/nosql/cassandra/pom.xml b/extra/nosql/cassandra/pom.xml new file mode 100644 index 000000000..cf5864490 --- /dev/null +++ b/extra/nosql/cassandra/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + org.javaee7.extra.nosql + extra-nosql-samples + 1.0-SNAPSHOT + ../pom.xml + + + org.javaee7.extra.nosql + cassandra + 1.0-SNAPSHOT + war + + + + com.datastax.cassandra + cassandra-driver-core + 2.0.0-beta2 + + + diff --git a/extra/nosql/cassandra/src/main/java/org/javaee7/extra/nosql/cassandra/Person.java b/extra/nosql/cassandra/src/main/java/org/javaee7/extra/nosql/cassandra/Person.java new file mode 100644 index 000000000..eb527a41e --- /dev/null +++ b/extra/nosql/cassandra/src/main/java/org/javaee7/extra/nosql/cassandra/Person.java @@ -0,0 +1,92 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.nosql.cassandra; + +import java.util.StringTokenizer; +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Named; +import javax.validation.constraints.Size; + +/** + * @author Arun Gupta + */ +@Named +@ApplicationScoped +public class Person { + + @Size(min = 1, max = 20) + private String name; + + private int age; + + public Person() { + } + + public Person(String name, int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + @Override + public String toString() { + return name + ", " + age; + } + + public static Person fromString(String string) { + StringTokenizer tokens = new StringTokenizer(string, ","); + return new Person(tokens.nextToken(), Integer.parseInt(tokens.nextToken().trim())); + } +} diff --git a/extra/nosql/cassandra/src/main/java/org/javaee7/extra/nosql/cassandra/PersonSessionBean.java b/extra/nosql/cassandra/src/main/java/org/javaee7/extra/nosql/cassandra/PersonSessionBean.java new file mode 100644 index 000000000..23d0677e6 --- /dev/null +++ b/extra/nosql/cassandra/src/main/java/org/javaee7/extra/nosql/cassandra/PersonSessionBean.java @@ -0,0 +1,127 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.nosql.cassandra; + +import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.Host; +import com.datastax.driver.core.Metadata; +import com.datastax.driver.core.ResultSet; +import com.datastax.driver.core.Row; +import com.datastax.driver.core.Session; +import com.datastax.driver.core.exceptions.AlreadyExistsException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.ejb.Singleton; +import javax.inject.Inject; +import javax.inject.Named; + +/** + * @author Arun Gupta + */ +@Named +@Singleton +public class PersonSessionBean { + + @Inject + Person person; + + Set set = new HashSet<>(); + + private Cluster cluster; + private Session session; + + @PostConstruct + private void initDB() { + cluster = Cluster.builder() + .addContactPoint("localhost") + // .withSSL() // Uncomment if using client to node encryption + .build(); + Metadata metadata = cluster.getMetadata(); + System.out.printf("Connected to cluster: %s\n", metadata.getClusterName()); + for (Host host : metadata.getAllHosts()) { + System.out.printf("Datacenter: %s; Host: %s; Rack: %s\n", + host.getDatacenter(), host.getAddress(), host.getRack()); + } + session = cluster.connect(); + try { + session.execute("CREATE KEYSPACE test WITH replication " + + "= {'class':'SimpleStrategy', 'replication_factor':3};"); + } catch (AlreadyExistsException e) { + System.out.println(e.getLocalizedMessage() + " ... keep moving!"); + } + try { + session.execute( + "CREATE TABLE test.person (" + + "name text PRIMARY KEY," + + "age int" + + ");"); + } catch (AlreadyExistsException e) { + System.out.println(e.getLocalizedMessage() + " ... keep moving!"); + } + } + + @PreDestroy + private void stopDB() { + cluster.shutdown(); + } + + public void createPerson() { + session.execute( + "INSERT INTO test.person (name, age) " + + "VALUES (" + + "'" + person.getName() + "'," + + person.getAge() + ")" + + ";"); +// set.add(person.getName()); + } + + public List getPersons() { + List persons = new ArrayList<>(); + ResultSet results = session.execute("SELECT * FROM test.person;"); + for (Row row : results) { + persons.add(new Person(row.getString("name"), row.getInt("age"))); + } + return persons; + } +} diff --git a/extra/nosql/cassandra/src/main/webapp/WEB-INF/beans.xml b/extra/nosql/cassandra/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 000000000..aa81c7c3c --- /dev/null +++ b/extra/nosql/cassandra/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,49 @@ + + + + \ No newline at end of file diff --git a/extra/nosql/cassandra/src/main/webapp/WEB-INF/template.xhtml b/extra/nosql/cassandra/src/main/webapp/WEB-INF/template.xhtml new file mode 100644 index 000000000..82f183175 --- /dev/null +++ b/extra/nosql/cassandra/src/main/webapp/WEB-INF/template.xhtml @@ -0,0 +1,26 @@ + + + + + + + + + Cassandra using Java EE 7 + + + + +
+

Cassandra using Java EE 7

+
+ +
+ Content +
+ +
+ + diff --git a/extra/nosql/cassandra/src/main/webapp/WEB-INF/web.xml b/extra/nosql/cassandra/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..c5e7c7381 --- /dev/null +++ b/extra/nosql/cassandra/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/extra/nosql/cassandra/src/main/webapp/index.xhtml b/extra/nosql/cassandra/src/main/webapp/index.xhtml new file mode 100644 index 000000000..f9d6dd768 --- /dev/null +++ b/extra/nosql/cassandra/src/main/webapp/index.xhtml @@ -0,0 +1,43 @@ + + + + + + + + + + + Name:
+ Age:

+ +
+
+
    +
  • Make sure to download latest Cassandra server and untar.
  • +
  • Follow the instructions in the bundled README.txt to start the server: +
      +
    • sudo mkdir -p /var/log/cassandra
    • +
    • sudo chown -R `whoami` /var/log/cassandra
    • +
    • sudo mkdir -p /var/lib/cassandra
    • +
    • sudo chown -R `whoami` /var/lib/cassandra
    • +
    • bin/cassandra -f
    +
  • +
  • Look for message as: +
    +INFO 16:39:08,258 Binding thrift service to localhost/127.0.0.1:9160
    +INFO 16:39:08,266 Using synchronous/threadpool thrift server on localhost : 9160
    +INFO 16:39:08,293 Listening for thrift clients...
    +                        
    +
  • +
+
+ +
+ + + diff --git a/extra/nosql/cassandra/src/main/webapp/resources/css/cssLayout.css b/extra/nosql/cassandra/src/main/webapp/resources/css/cssLayout.css new file mode 100644 index 000000000..8ee7cebe3 --- /dev/null +++ b/extra/nosql/cassandra/src/main/webapp/resources/css/cssLayout.css @@ -0,0 +1,61 @@ + +#top { + position: relative; + background-color: #036fab; + color: white; + padding: 5px; + margin: 0px 0px 10px 0px; +} + +#bottom { + position: relative; + background-color: #c2dfef; + padding: 5px; + margin: 10px 0px 0px 0px; +} + +#left { + float: left; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +#right { + float: right; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +.center_content { + position: relative; + background-color: #dddddd; + padding: 5px; +} + +.left_content { + background-color: #dddddd; + padding: 5px; + margin-left: 170px; +} + +.right_content { + background-color: #dddddd; + padding: 5px; + margin: 0px 170px 0px 170px; +} + +#top a:link, #top a:visited { + color: white; + font-weight : bold; + text-decoration: none; +} + +#top a:link:hover, #top a:visited:hover { + color: black; + font-weight : bold; + text-decoration : underline; +} + + diff --git a/extra/nosql/cassandra/src/main/webapp/resources/css/default.css b/extra/nosql/cassandra/src/main/webapp/resources/css/default.css new file mode 100644 index 000000000..6cbc3d18e --- /dev/null +++ b/extra/nosql/cassandra/src/main/webapp/resources/css/default.css @@ -0,0 +1,29 @@ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/extra/nosql/cassandra/src/main/webapp/show.xhtml b/extra/nosql/cassandra/src/main/webapp/show.xhtml new file mode 100644 index 000000000..8f1d60f31 --- /dev/null +++ b/extra/nosql/cassandra/src/main/webapp/show.xhtml @@ -0,0 +1,27 @@ + + + + + + + + + + + Name#{p.name} + Age#{p.age} + +

+ + + + +
+ +
+ + + diff --git a/extra/nosql/pom.xml b/extra/nosql/pom.xml index b11f5f7f6..f00b553af 100644 --- a/extra/nosql/pom.xml +++ b/extra/nosql/pom.xml @@ -18,5 +18,6 @@ mongo couchbase redis + cassandra
From 3ca5d0639a6f7d8c9e64da676e3622b3366c5b52 Mon Sep 17 00:00:00 2001 From: Michael Figuiere Date: Thu, 3 Oct 2013 19:01:53 -0700 Subject: [PATCH 078/995] Uses PreparedStatements instead of contatenated strings. Replaces AlreadyExistsException with "IF NOT EXISTS" DDL statements added in Cassandra 2.0. --- .../nosql/cassandra/PersonSessionBean.java | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/extra/nosql/cassandra/src/main/java/org/javaee7/extra/nosql/cassandra/PersonSessionBean.java b/extra/nosql/cassandra/src/main/java/org/javaee7/extra/nosql/cassandra/PersonSessionBean.java index 23d0677e6..649d01e1d 100644 --- a/extra/nosql/cassandra/src/main/java/org/javaee7/extra/nosql/cassandra/PersonSessionBean.java +++ b/extra/nosql/cassandra/src/main/java/org/javaee7/extra/nosql/cassandra/PersonSessionBean.java @@ -42,14 +42,16 @@ import com.datastax.driver.core.Cluster; import com.datastax.driver.core.Host; import com.datastax.driver.core.Metadata; +import com.datastax.driver.core.PreparedStatement; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; import com.datastax.driver.core.Session; -import com.datastax.driver.core.exceptions.AlreadyExistsException; + import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; + import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.ejb.Singleton; @@ -71,6 +73,9 @@ public class PersonSessionBean { private Cluster cluster; private Session session; + private PreparedStatement selectAllPersons; + private PreparedStatement insertPerson; + @PostConstruct private void initDB() { cluster = Cluster.builder() @@ -84,21 +89,19 @@ private void initDB() { host.getDatacenter(), host.getAddress(), host.getRack()); } session = cluster.connect(); - try { - session.execute("CREATE KEYSPACE test WITH replication " - + "= {'class':'SimpleStrategy', 'replication_factor':3};"); - } catch (AlreadyExistsException e) { - System.out.println(e.getLocalizedMessage() + " ... keep moving!"); - } - try { + session.execute("CREATE KEYSPACE IF NOT EXISTS test WITH replication " + + "= {'class':'SimpleStrategy', 'replication_factor':1};"); + session.execute( - "CREATE TABLE test.person (" + "CREATE TABLE IF NOT EXISTS test.person (" + "name text PRIMARY KEY," + "age int" + ");"); - } catch (AlreadyExistsException e) { - System.out.println(e.getLocalizedMessage() + " ... keep moving!"); - } + + selectAllPersons = session.prepare("SELECT * FROM test.person"); + insertPerson = session.prepare( + "INSERT INTO test.person (name, age) VALUES (?, ?);" + ); } @PreDestroy @@ -107,18 +110,13 @@ private void stopDB() { } public void createPerson() { - session.execute( - "INSERT INTO test.person (name, age) " - + "VALUES (" - + "'" + person.getName() + "'," - + person.getAge() + ")" - + ";"); -// set.add(person.getName()); + session.execute(insertPerson.bind(person.getName(), person.getAge())); +// set.add(person.getName()); } public List getPersons() { List persons = new ArrayList<>(); - ResultSet results = session.execute("SELECT * FROM test.person;"); + ResultSet results = session.execute(selectAllPersons.bind()); for (Row row : results) { persons.add(new Person(row.getString("name"), row.getInt("age"))); } From 12cffb361b1bc3b62f964129632e8bb9b6af7fd0 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 22:06:07 -0700 Subject: [PATCH 079/995] Removing some redundant code --- .../org/javaee7/extra/nosql/cassandra/PersonSessionBean.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/extra/nosql/cassandra/src/main/java/org/javaee7/extra/nosql/cassandra/PersonSessionBean.java b/extra/nosql/cassandra/src/main/java/org/javaee7/extra/nosql/cassandra/PersonSessionBean.java index 649d01e1d..5cf4c67d2 100644 --- a/extra/nosql/cassandra/src/main/java/org/javaee7/extra/nosql/cassandra/PersonSessionBean.java +++ b/extra/nosql/cassandra/src/main/java/org/javaee7/extra/nosql/cassandra/PersonSessionBean.java @@ -48,9 +48,7 @@ import com.datastax.driver.core.Session; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; @@ -68,8 +66,6 @@ public class PersonSessionBean { @Inject Person person; - Set set = new HashSet<>(); - private Cluster cluster; private Session session; @@ -111,7 +107,6 @@ private void stopDB() { public void createPerson() { session.execute(insertPerson.bind(person.getName(), person.getAge())); -// set.add(person.getName()); } public List getPersons() { From bfc51422b58d5e3e87a14dd80236a676de39294b Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 22:19:04 -0700 Subject: [PATCH 080/995] Adding navigation to the previous page --- extra/nosql/mongo/src/main/webapp/show.xhtml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extra/nosql/mongo/src/main/webapp/show.xhtml b/extra/nosql/mongo/src/main/webapp/show.xhtml index 19203f612..5ffc5aae0 100644 --- a/extra/nosql/mongo/src/main/webapp/show.xhtml +++ b/extra/nosql/mongo/src/main/webapp/show.xhtml @@ -14,6 +14,10 @@ Name#{p.name} Age#{p.age} +

+ + + From ee5b4c4dd3e37716732dd180cdc5ab0bd42bf70e Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 22:19:21 -0700 Subject: [PATCH 081/995] Adding instructions to download, configure and start Mongo --- extra/nosql/mongo/src/main/webapp/index.xhtml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extra/nosql/mongo/src/main/webapp/index.xhtml b/extra/nosql/mongo/src/main/webapp/index.xhtml index db1c9bca4..aaf6bc1f3 100644 --- a/extra/nosql/mongo/src/main/webapp/index.xhtml +++ b/extra/nosql/mongo/src/main/webapp/index.xhtml @@ -17,6 +17,13 @@ title="Add" value="Submit"/> +
+ Make sure to download Mongo. Follow the quick start to start the server: +
    +
  • sudo mkdir -p /data/db
  • +
  • sudo chown `id -u` /data/db
  • +
  • ./bin/mongod
  • +
From e9714584600488f98bfa879b6f6b193b6da9e6dc Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 22:20:35 -0700 Subject: [PATCH 082/995] Removing the usage of embedded Mongo, asking the users to explicitly start Mongo --- .../extra/nosql/mongo/PersonSessionBean.java | 35 +++---------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/extra/nosql/mongo/src/main/java/org/javaee7/extra/nosql/mongo/PersonSessionBean.java b/extra/nosql/mongo/src/main/java/org/javaee7/extra/nosql/mongo/PersonSessionBean.java index 64ab51cda..0532ed813 100644 --- a/extra/nosql/mongo/src/main/java/org/javaee7/extra/nosql/mongo/PersonSessionBean.java +++ b/extra/nosql/mongo/src/main/java/org/javaee7/extra/nosql/mongo/PersonSessionBean.java @@ -45,21 +45,12 @@ import com.mongodb.DBCursor; import com.mongodb.DBObject; import com.mongodb.Mongo; -import com.mongodb.MongoException; -import de.flapdoodle.embed.mongo.MongodExecutable; -import de.flapdoodle.embed.mongo.MongodProcess; -import de.flapdoodle.embed.mongo.MongodStarter; -import de.flapdoodle.embed.mongo.config.MongodConfigBuilder; -import de.flapdoodle.embed.mongo.config.Net; -import de.flapdoodle.embed.mongo.distribution.Version; -import de.flapdoodle.embed.process.runtime.Network; -import java.io.IOException; +import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; import javax.ejb.Stateless; import javax.inject.Inject; import javax.inject.Named; @@ -76,39 +67,21 @@ public class PersonSessionBean { DBCollection personCollection; - private MongodExecutable mongodExe; - private MongodProcess mongod; - private final int MONGO_PORT = 12345; - @PostConstruct private void initDB() { - try { - // Start embedded Mongo - MongodStarter runtime = MongodStarter.getDefaultInstance(); - mongodExe = runtime.prepare(new MongodConfigBuilder() - .version(Version.Main.PRODUCTION) - .net(new Net(MONGO_PORT, Network.localhostIsIPv6())) - .build()); - mongod = mongodExe.start(); - + try { // Get an instance of Mongo - Mongo m = new Mongo("localhost", MONGO_PORT); + Mongo m = new Mongo("localhost", 27017); DB db = m.getDB("personDB"); personCollection = db.getCollection("persons"); if (personCollection == null) { personCollection = db.createCollection("persons", null); } - } catch (MongoException | IOException ex) { + } catch (UnknownHostException ex) { Logger.getLogger(PersonSessionBean.class.getName()).log(Level.SEVERE, null, ex); } } - @PreDestroy - private void stopDB() { - mongod.stop(); - mongodExe.stop(); - } - public void createPerson() { BasicDBObject doc = person.toDBObject(); personCollection.insert(doc); From a488d82c80b82f6ede0dab47b5636a1d328d6574 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 22:20:51 -0700 Subject: [PATCH 083/995] Removing the redundant dependency --- extra/nosql/mongo/pom.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/extra/nosql/mongo/pom.xml b/extra/nosql/mongo/pom.xml index 793d799c6..152582c7c 100644 --- a/extra/nosql/mongo/pom.xml +++ b/extra/nosql/mongo/pom.xml @@ -19,10 +19,5 @@ mongo-java-driver 1.3 - - de.flapdoodle.embed - de.flapdoodle.embed.mongo - 1.36 -
From cbd39b89f4e1d9393ccf2fa8eec8f7116ddb42c7 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 3 Oct 2013 22:30:19 -0700 Subject: [PATCH 084/995] Samples can run using Embedded GlassFish using "embedded-glassfish" profile --- pom.xml | 91 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 49 insertions(+), 42 deletions(-) diff --git a/pom.xml b/pom.xml index a47a3bf76..72dd86b90 100644 --- a/pom.xml +++ b/pom.xml @@ -111,48 +111,6 @@ - - org.glassfish.embedded - maven-embedded-glassfish-plugin - 4.0 - - target/${project.artifactId}.war - 8080 - - 8181 - - - - - org.glassfish.main.common - simple-glassfish-api - 4.0 - - - org.glassfish.main.extras - glassfish-embedded-all - 4.0 - - - - - start - integration-test - - start - deploy - - - - stop - post-integration-test - - undeploy - stop - - - - @@ -194,6 +152,55 @@ + + embedded-glassfish + + + + org.glassfish.embedded + maven-embedded-glassfish-plugin + 4.0 + + target/${project.artifactId}.war + 8080 + + 8181 + + + + + org.glassfish.main.common + simple-glassfish-api + 4.0 + + + org.glassfish.main.extras + glassfish-embedded-all + 4.0 + + + + + start + integration-test + + start + deploy + + + + stop + post-integration-test + + undeploy + stop + + + + + + + wildfly From fa5c17910442ae3f76f06e6bf39264ba15730a56 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 4 Oct 2013 17:40:58 -0700 Subject: [PATCH 085/995] Starting work on Neo4j sample --- extra/nosql/neo4j/pom.xml | 23 +++ .../extra/nosql/neo4j/BackingBean.java | 119 ++++++++++++++ .../org/javaee7/extra/nosql/neo4j/Person.java | 90 +++++++++++ .../extra/nosql/neo4j/PersonSessionBean.java | 148 ++++++++++++++++++ .../neo4j/src/main/webapp/WEB-INF/beans.xml | 49 ++++++ .../src/main/webapp/WEB-INF/template.xhtml | 26 +++ .../neo4j/src/main/webapp/WEB-INF/web.xml | 24 +++ extra/nosql/neo4j/src/main/webapp/index.xhtml | 36 +++++ .../main/webapp/resources/css/cssLayout.css | 61 ++++++++ .../src/main/webapp/resources/css/default.css | 29 ++++ extra/nosql/neo4j/src/main/webapp/show.xhtml | 28 ++++ 11 files changed, 633 insertions(+) create mode 100644 extra/nosql/neo4j/pom.xml create mode 100644 extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/BackingBean.java create mode 100644 extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/Person.java create mode 100644 extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/PersonSessionBean.java create mode 100644 extra/nosql/neo4j/src/main/webapp/WEB-INF/beans.xml create mode 100644 extra/nosql/neo4j/src/main/webapp/WEB-INF/template.xhtml create mode 100644 extra/nosql/neo4j/src/main/webapp/WEB-INF/web.xml create mode 100644 extra/nosql/neo4j/src/main/webapp/index.xhtml create mode 100644 extra/nosql/neo4j/src/main/webapp/resources/css/cssLayout.css create mode 100644 extra/nosql/neo4j/src/main/webapp/resources/css/default.css create mode 100644 extra/nosql/neo4j/src/main/webapp/show.xhtml diff --git a/extra/nosql/neo4j/pom.xml b/extra/nosql/neo4j/pom.xml new file mode 100644 index 000000000..3abd78f3d --- /dev/null +++ b/extra/nosql/neo4j/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + org.javaee7.extra.nosql + extra-nosql-samples + 1.0-SNAPSHOT + ../pom.xml + + + org.javaee7.extra.nosql + neo4j + 1.0-SNAPSHOT + war + + + + org.neo4j + neo4j + 2.0.0-M05 + + + diff --git a/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/BackingBean.java b/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/BackingBean.java new file mode 100644 index 000000000..2b13229f8 --- /dev/null +++ b/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/BackingBean.java @@ -0,0 +1,119 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.nosql.neo4j; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Named; +import javax.validation.constraints.Size; + +/** + * @author Arun Gupta + */ +@Named +@ApplicationScoped +public class BackingBean { + + @Size(min = 1, max = 20) + private String name; + + private int age; + + private String name2; + + private int age2; + + private String relationship; + + public BackingBean() { + } + + public BackingBean(String name, int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public String getName2() { + return name2; + } + + public void setName2(String name2) { + this.name2 = name2; + } + + public int getAge2() { + return age2; + } + + public void setAge2(int age2) { + this.age2 = age2; + } + + public String getRelationship() { + return relationship; + } + + public void setRelationship(String relationship) { + this.relationship = relationship; + } + + public String person1String() { + return name + ", " + age; + } + + public String person2String() { + return name2 + ", " + age2; + } +} diff --git a/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/Person.java b/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/Person.java new file mode 100644 index 000000000..cf4323903 --- /dev/null +++ b/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/Person.java @@ -0,0 +1,90 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.nosql.neo4j; + +import java.util.StringTokenizer; +import javax.validation.constraints.Size; + +/** + * @author Arun Gupta + */ +public class Person { + + @Size(min = 1, max = 20) + private String name; + + private int age; + + public Person() { + } + + public Person(String name, int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + @Override + public String toString() { + return name + ", " + age; + } + + public static final Person fromString(String string) { + StringTokenizer tokens = new StringTokenizer(string, ","); + Person p = new Person(tokens.nextToken(), Integer.parseInt(tokens.nextToken().trim())); + + return p; + } +} diff --git a/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/PersonSessionBean.java b/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/PersonSessionBean.java new file mode 100644 index 000000000..f86b4bc00 --- /dev/null +++ b/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/PersonSessionBean.java @@ -0,0 +1,148 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.nosql.neo4j; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.attribute.FileAttribute; +import java.nio.file.attribute.PosixFilePermission; +import java.nio.file.attribute.PosixFilePermissions; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; +import org.neo4j.graphdb.GraphDatabaseService; +import org.neo4j.graphdb.Node; +import org.neo4j.graphdb.Relationship; +import org.neo4j.graphdb.RelationshipType; +import org.neo4j.graphdb.Transaction; +import org.neo4j.graphdb.factory.GraphDatabaseFactory; + +/** + * @author Arun Gupta + */ +@Named +@Singleton +public class PersonSessionBean { + + @Inject + BackingBean backingBean; + + GraphDatabaseService graphDb; + Node firstNode; + Node secondNode; + + private static enum RelTypes implements RelationshipType { + + SPOUSE, BROTHER, SISTER + } + + Set set = new HashSet<>(); + + @PostConstruct + private void initDB() { + try { + Path tempDir = Files.createTempDirectory("test-neo4j"); +// Set perms = PosixFilePermissions.fromString("rwxr-x---"); +// FileAttribute> attr = PosixFilePermissions.asFileAttribute(perms); +// Files.createDirectories(DB_PATH, attr); + graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(tempDir.toString()); + try (Transaction tx = graphDb.beginTx()) { + firstNode = graphDb.createNode(); + secondNode = graphDb.createNode(); + } + } catch (IOException ex) { + Logger.getLogger(PersonSessionBean.class.getName()).log(Level.SEVERE, null, ex); + } + } + + @PreDestroy + private void stopDB() { + graphDb.shutdown(); + } + + public void createPerson() { + try (Transaction tx = graphDb.beginTx()) { + firstNode.setProperty(backingBean.getName(), backingBean.person1String()); + secondNode.setProperty(backingBean.getName2(), backingBean.person2String()); + switch (backingBean.getRelationship()) { + case "spouse": + firstNode.createRelationshipTo(secondNode, RelTypes.SPOUSE); + break; + case "brother": + firstNode.createRelationshipTo(secondNode, RelTypes.BROTHER); + break; + case "sister": + firstNode.createRelationshipTo(secondNode, RelTypes.SISTER); + break; + } + tx.success(); + } + } + + public List getPersons() { + List beans = new ArrayList(); + for (String key : firstNode.getPropertyKeys()) { + BackingBean bean = new BackingBean(); + Person p = Person.fromString((String)firstNode.getProperty(key)); + bean.setName(p.getName()); + bean.setAge(p.getAge()); + for (Relationship r : firstNode.getRelationships(RelTypes.SPOUSE, RelTypes.SISTER, RelTypes.BROTHER)) { + if (r.isType(RelTypes.SPOUSE)) { + bean.setRelationship("spouse"); + } else if (r.isType(RelTypes.SISTER)) { + bean.setRelationship("sister"); + } else if (r.isType(RelTypes.BROTHER)) { + bean.setRelationship("brother"); + } + } + beans.add(bean); + } + return beans; + } +} diff --git a/extra/nosql/neo4j/src/main/webapp/WEB-INF/beans.xml b/extra/nosql/neo4j/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 000000000..aa81c7c3c --- /dev/null +++ b/extra/nosql/neo4j/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,49 @@ + + + + \ No newline at end of file diff --git a/extra/nosql/neo4j/src/main/webapp/WEB-INF/template.xhtml b/extra/nosql/neo4j/src/main/webapp/WEB-INF/template.xhtml new file mode 100644 index 000000000..9eb7c0652 --- /dev/null +++ b/extra/nosql/neo4j/src/main/webapp/WEB-INF/template.xhtml @@ -0,0 +1,26 @@ + + + + + + + + + Couchbase using Java EE 7 + + + + +
+

Couchbase using Java EE 7

+
+ +
+ Content +
+ +
+ + diff --git a/extra/nosql/neo4j/src/main/webapp/WEB-INF/web.xml b/extra/nosql/neo4j/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..c5e7c7381 --- /dev/null +++ b/extra/nosql/neo4j/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/extra/nosql/neo4j/src/main/webapp/index.xhtml b/extra/nosql/neo4j/src/main/webapp/index.xhtml new file mode 100644 index 000000000..6995adb2a --- /dev/null +++ b/extra/nosql/neo4j/src/main/webapp/index.xhtml @@ -0,0 +1,36 @@ + + + + + + + + + + + Name:
+ Age:

+ Related as: + + + + +

+ + Name2:
+ Age2:

+ +
+
+ Download Neo4j Community version. Untar and start the server as "bin/neo4j start". +
+ +
+ + + diff --git a/extra/nosql/neo4j/src/main/webapp/resources/css/cssLayout.css b/extra/nosql/neo4j/src/main/webapp/resources/css/cssLayout.css new file mode 100644 index 000000000..8ee7cebe3 --- /dev/null +++ b/extra/nosql/neo4j/src/main/webapp/resources/css/cssLayout.css @@ -0,0 +1,61 @@ + +#top { + position: relative; + background-color: #036fab; + color: white; + padding: 5px; + margin: 0px 0px 10px 0px; +} + +#bottom { + position: relative; + background-color: #c2dfef; + padding: 5px; + margin: 10px 0px 0px 0px; +} + +#left { + float: left; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +#right { + float: right; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +.center_content { + position: relative; + background-color: #dddddd; + padding: 5px; +} + +.left_content { + background-color: #dddddd; + padding: 5px; + margin-left: 170px; +} + +.right_content { + background-color: #dddddd; + padding: 5px; + margin: 0px 170px 0px 170px; +} + +#top a:link, #top a:visited { + color: white; + font-weight : bold; + text-decoration: none; +} + +#top a:link:hover, #top a:visited:hover { + color: black; + font-weight : bold; + text-decoration : underline; +} + + diff --git a/extra/nosql/neo4j/src/main/webapp/resources/css/default.css b/extra/nosql/neo4j/src/main/webapp/resources/css/default.css new file mode 100644 index 000000000..6cbc3d18e --- /dev/null +++ b/extra/nosql/neo4j/src/main/webapp/resources/css/default.css @@ -0,0 +1,29 @@ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/extra/nosql/neo4j/src/main/webapp/show.xhtml b/extra/nosql/neo4j/src/main/webapp/show.xhtml new file mode 100644 index 000000000..48b1ea71c --- /dev/null +++ b/extra/nosql/neo4j/src/main/webapp/show.xhtml @@ -0,0 +1,28 @@ + + + + + + + + + + + Name#{p.name} + Age#{p.age} + Relationship#{p.relationship} + +

+ + + + +
+ +
+ + + From cacbe635fdd3be2122e8123d5d9f402f3c86ed00 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 4 Oct 2013 23:12:18 -0700 Subject: [PATCH 086/995] Marking transactions for committing during close --- .../extra/nosql/neo4j/PersonSessionBean.java | 39 +++++++++---------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/PersonSessionBean.java b/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/PersonSessionBean.java index f86b4bc00..f4e2ffba7 100644 --- a/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/PersonSessionBean.java +++ b/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/PersonSessionBean.java @@ -42,9 +42,6 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.attribute.FileAttribute; -import java.nio.file.attribute.PosixFilePermission; -import java.nio.file.attribute.PosixFilePermissions; import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -78,7 +75,6 @@ public class PersonSessionBean { Node secondNode; private static enum RelTypes implements RelationshipType { - SPOUSE, BROTHER, SISTER } @@ -88,15 +84,13 @@ private static enum RelTypes implements RelationshipType { private void initDB() { try { Path tempDir = Files.createTempDirectory("test-neo4j"); -// Set perms = PosixFilePermissions.fromString("rwxr-x---"); -// FileAttribute> attr = PosixFilePermissions.asFileAttribute(perms); -// Files.createDirectories(DB_PATH, attr); graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(tempDir.toString()); try (Transaction tx = graphDb.beginTx()) { firstNode = graphDb.createNode(); secondNode = graphDb.createNode(); + tx.success(); } - } catch (IOException ex) { + } catch (IOException ex) { Logger.getLogger(PersonSessionBean.class.getName()).log(Level.SEVERE, null, ex); } } @@ -127,21 +121,24 @@ public void createPerson() { public List getPersons() { List beans = new ArrayList(); - for (String key : firstNode.getPropertyKeys()) { - BackingBean bean = new BackingBean(); - Person p = Person.fromString((String)firstNode.getProperty(key)); - bean.setName(p.getName()); - bean.setAge(p.getAge()); - for (Relationship r : firstNode.getRelationships(RelTypes.SPOUSE, RelTypes.SISTER, RelTypes.BROTHER)) { - if (r.isType(RelTypes.SPOUSE)) { - bean.setRelationship("spouse"); - } else if (r.isType(RelTypes.SISTER)) { - bean.setRelationship("sister"); - } else if (r.isType(RelTypes.BROTHER)) { - bean.setRelationship("brother"); + try (Transaction tx = graphDb.beginTx()) { + for (String key : firstNode.getPropertyKeys()) { + BackingBean bean = new BackingBean(); + Person p = Person.fromString((String) firstNode.getProperty(key)); + bean.setName(p.getName()); + bean.setAge(p.getAge()); + for (Relationship r : firstNode.getRelationships(RelTypes.SPOUSE, RelTypes.SISTER, RelTypes.BROTHER)) { + if (r.isType(RelTypes.SPOUSE)) { + bean.setRelationship("spouse"); + } else if (r.isType(RelTypes.SISTER)) { + bean.setRelationship("sister"); + } else if (r.isType(RelTypes.BROTHER)) { + bean.setRelationship("brother"); + } } + beans.add(bean); } - beans.add(bean); + tx.success(); } return beans; } From 24b94b6bb1ff816ce6838928a3e8df896fe9875f Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 4 Oct 2013 23:12:40 -0700 Subject: [PATCH 087/995] Adding neo4j sample --- extra/nosql/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/extra/nosql/pom.xml b/extra/nosql/pom.xml index f00b553af..b18f17bf3 100644 --- a/extra/nosql/pom.xml +++ b/extra/nosql/pom.xml @@ -19,5 +19,6 @@ couchbase redis cassandra + neo4j
From 5131a1d9c14398ed44e0d7615fe94a00832a7402 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Fri, 4 Oct 2013 23:20:55 -0700 Subject: [PATCH 088/995] Adding a break to avoid redundant evaluation --- .../java/org/javaee7/extra/nosql/neo4j/PersonSessionBean.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/PersonSessionBean.java b/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/PersonSessionBean.java index f4e2ffba7..407917d58 100644 --- a/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/PersonSessionBean.java +++ b/extra/nosql/neo4j/src/main/java/org/javaee7/extra/nosql/neo4j/PersonSessionBean.java @@ -130,10 +130,13 @@ public List getPersons() { for (Relationship r : firstNode.getRelationships(RelTypes.SPOUSE, RelTypes.SISTER, RelTypes.BROTHER)) { if (r.isType(RelTypes.SPOUSE)) { bean.setRelationship("spouse"); + break; } else if (r.isType(RelTypes.SISTER)) { bean.setRelationship("sister"); + break; } else if (r.isType(RelTypes.BROTHER)) { bean.setRelationship("brother"); + break; } } beans.add(bean); From 21179a3dabb85695f95a7b17c3e923bf077f17b3 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Sun, 6 Oct 2013 21:50:44 -0700 Subject: [PATCH 089/995] Starting work on HBase sample --- extra/nosql/hbase/pom.xml | 28 +++ .../org/javaee7/extra/nosql/hbase/Person.java | 92 ++++++++++ .../extra/nosql/hbase/PersonSessionBean.java | 162 ++++++++++++++++++ .../hbase/src/main/webapp/WEB-INF/beans.xml | 49 ++++++ .../src/main/webapp/WEB-INF/template.xhtml | 26 +++ .../hbase/src/main/webapp/WEB-INF/web.xml | 24 +++ extra/nosql/hbase/src/main/webapp/index.xhtml | 33 ++++ .../main/webapp/resources/css/cssLayout.css | 61 +++++++ .../src/main/webapp/resources/css/default.css | 29 ++++ extra/nosql/hbase/src/main/webapp/show.xhtml | 29 ++++ 10 files changed, 533 insertions(+) create mode 100644 extra/nosql/hbase/pom.xml create mode 100644 extra/nosql/hbase/src/main/java/org/javaee7/extra/nosql/hbase/Person.java create mode 100644 extra/nosql/hbase/src/main/java/org/javaee7/extra/nosql/hbase/PersonSessionBean.java create mode 100644 extra/nosql/hbase/src/main/webapp/WEB-INF/beans.xml create mode 100644 extra/nosql/hbase/src/main/webapp/WEB-INF/template.xhtml create mode 100644 extra/nosql/hbase/src/main/webapp/WEB-INF/web.xml create mode 100644 extra/nosql/hbase/src/main/webapp/index.xhtml create mode 100644 extra/nosql/hbase/src/main/webapp/resources/css/cssLayout.css create mode 100644 extra/nosql/hbase/src/main/webapp/resources/css/default.css create mode 100644 extra/nosql/hbase/src/main/webapp/show.xhtml diff --git a/extra/nosql/hbase/pom.xml b/extra/nosql/hbase/pom.xml new file mode 100644 index 000000000..574b06db3 --- /dev/null +++ b/extra/nosql/hbase/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + + org.javaee7.extra.nosql + extra-nosql-samples + 1.0-SNAPSHOT + ../pom.xml + + + org.javaee7.extra.nosql + hbase + 1.0-SNAPSHOT + war + + + + org.apache.hadoop + hadoop-core + 0.20.2 + + + org.apache.hbase + hbase + 0.90.2 + + + diff --git a/extra/nosql/hbase/src/main/java/org/javaee7/extra/nosql/hbase/Person.java b/extra/nosql/hbase/src/main/java/org/javaee7/extra/nosql/hbase/Person.java new file mode 100644 index 000000000..0842f0198 --- /dev/null +++ b/extra/nosql/hbase/src/main/java/org/javaee7/extra/nosql/hbase/Person.java @@ -0,0 +1,92 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.nosql.hbase; + +import java.util.StringTokenizer; +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Named; +import javax.validation.constraints.Size; + +/** + * @author Arun Gupta + */ +@Named +@ApplicationScoped +public class Person { + + @Size(min = 1, max = 20) + private String name; + + private int age; + + public Person() { + } + + public Person(String name, int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + @Override + public String toString() { + return name + ", " + age; + } + + public static Person fromString(String string) { + StringTokenizer tokens = new StringTokenizer(string, ","); + return new Person(tokens.nextToken(), Integer.parseInt(tokens.nextToken().trim())); + } +} diff --git a/extra/nosql/hbase/src/main/java/org/javaee7/extra/nosql/hbase/PersonSessionBean.java b/extra/nosql/hbase/src/main/java/org/javaee7/extra/nosql/hbase/PersonSessionBean.java new file mode 100644 index 000000000..10643fd11 --- /dev/null +++ b/extra/nosql/hbase/src/main/java/org/javaee7/extra/nosql/hbase/PersonSessionBean.java @@ -0,0 +1,162 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.nosql.hbase; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.ejb.Stateless; +import javax.inject.Inject; +import javax.inject.Named; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.HColumnDescriptor; +import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.KeyValue; +import org.apache.hadoop.hbase.client.HBaseAdmin; +import org.apache.hadoop.hbase.client.HTableInterface; +import org.apache.hadoop.hbase.client.HTablePool; +import org.apache.hadoop.hbase.client.Put; +import org.apache.hadoop.hbase.client.Result; +import org.apache.hadoop.hbase.client.ResultScanner; +import org.apache.hadoop.hbase.client.Scan; +import org.apache.hadoop.hbase.util.Bytes; + +/** + * @author Arun Gupta + */ +@Named +@Stateless +public class PersonSessionBean { + + @Inject + Person person; + + Set set = new HashSet<>(); + + private static final String personsColumnFamily = "person"; + private static final String personsTable = "persons"; + HTablePool pool; + + @PostConstruct + private void initDB() { + try { + // By default, it's localhost, don't worry. + Configuration config = HBaseConfiguration.create(); + + // Without pooling, the connection to a table will be reinitialized. + // Creating a new connection to a table might take up to 5-10 seconds! + pool = new HTablePool(config, 10); + + HBaseAdmin admin = new HBaseAdmin(config); + HTableDescriptor blogstable = new HTableDescriptor(personsTable); + admin.createTable(blogstable); + + // Cannot edit a stucture on an active table. + admin.disableTable(personsTable); + + HColumnDescriptor userCol = new HColumnDescriptor("name"); + admin.addColumn(personsTable, userCol); + + HColumnDescriptor ageCol = new HColumnDescriptor("age"); + admin.addColumn(personsTable, ageCol); + + // For readin, it needs to be re-enabled. + admin.enableTable(personsTable); + } catch (IOException ex) { + Logger.getLogger(PersonSessionBean.class.getName()).log(Level.SEVERE, null, ex); + } + } + + @PreDestroy + private void stopDB() { + } + + public void createPerson() { + try { + HTableInterface table = pool.getTable(personsTable); + Put put = new Put(Bytes.toBytes(person.getName())); + put.add( + Bytes.toBytes(personsColumnFamily), + Bytes.toBytes(person.getName()), + Bytes.toBytes(person.getAge())); + table.put(put); + table.close(); + } catch (IOException ex) { + Logger.getLogger(PersonSessionBean.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public List getPersons() { + List persons = new ArrayList<>(); + + try { + HTableInterface table = pool.getTable(personsTable); + Scan scan = new Scan(); + scan.addFamily(Bytes.toBytes(personsColumnFamily)); + + ResultScanner resultScanner = table.getScanner(scan); + +// For each row + for (Result result : resultScanner) { + for (KeyValue kv : result.raw()) { + Person p = new Person(); +// p.setTitle(Bytes.toString(kv.getQualifier())); +// p.setBody(Bytes.toString(kv.getValue())); +// p.setId(Bytes.toString(result.getRow())); + persons.add(person); + } + } + + resultScanner.close(); + table.close(); + } catch (IOException ex) { + Logger.getLogger(PersonSessionBean.class.getName()).log(Level.SEVERE, null, ex); + } + + return persons; + } +} diff --git a/extra/nosql/hbase/src/main/webapp/WEB-INF/beans.xml b/extra/nosql/hbase/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 000000000..aa81c7c3c --- /dev/null +++ b/extra/nosql/hbase/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,49 @@ + + + + \ No newline at end of file diff --git a/extra/nosql/hbase/src/main/webapp/WEB-INF/template.xhtml b/extra/nosql/hbase/src/main/webapp/WEB-INF/template.xhtml new file mode 100644 index 000000000..c0d6c22b3 --- /dev/null +++ b/extra/nosql/hbase/src/main/webapp/WEB-INF/template.xhtml @@ -0,0 +1,26 @@ + + + + + + + + + Redis using Java EE 7 + + + + +
+

Redis using Java EE 7

+
+ +
+ Content +
+ +
+ + diff --git a/extra/nosql/hbase/src/main/webapp/WEB-INF/web.xml b/extra/nosql/hbase/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..c5e7c7381 --- /dev/null +++ b/extra/nosql/hbase/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/extra/nosql/hbase/src/main/webapp/index.xhtml b/extra/nosql/hbase/src/main/webapp/index.xhtml new file mode 100644 index 000000000..e2f909985 --- /dev/null +++ b/extra/nosql/hbase/src/main/webapp/index.xhtml @@ -0,0 +1,33 @@ + + + + + + + + + + + Name:
+ Age:

+ +
+
+

+
    +
  • Download HBase stable and tar xzvf.
  • +
  • Start HBase: ./bin/start-hbase.sh
  • +
  • Look for messages like:
    + starting master, logging to /Users/arungup/tools/hbase/hbase-0.94.12/bin/../logs/hbase-arungup-master-arungup-mac.local.out +
  • +
+
+ +
+ + + diff --git a/extra/nosql/hbase/src/main/webapp/resources/css/cssLayout.css b/extra/nosql/hbase/src/main/webapp/resources/css/cssLayout.css new file mode 100644 index 000000000..8ee7cebe3 --- /dev/null +++ b/extra/nosql/hbase/src/main/webapp/resources/css/cssLayout.css @@ -0,0 +1,61 @@ + +#top { + position: relative; + background-color: #036fab; + color: white; + padding: 5px; + margin: 0px 0px 10px 0px; +} + +#bottom { + position: relative; + background-color: #c2dfef; + padding: 5px; + margin: 10px 0px 0px 0px; +} + +#left { + float: left; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +#right { + float: right; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +.center_content { + position: relative; + background-color: #dddddd; + padding: 5px; +} + +.left_content { + background-color: #dddddd; + padding: 5px; + margin-left: 170px; +} + +.right_content { + background-color: #dddddd; + padding: 5px; + margin: 0px 170px 0px 170px; +} + +#top a:link, #top a:visited { + color: white; + font-weight : bold; + text-decoration: none; +} + +#top a:link:hover, #top a:visited:hover { + color: black; + font-weight : bold; + text-decoration : underline; +} + + diff --git a/extra/nosql/hbase/src/main/webapp/resources/css/default.css b/extra/nosql/hbase/src/main/webapp/resources/css/default.css new file mode 100644 index 000000000..6cbc3d18e --- /dev/null +++ b/extra/nosql/hbase/src/main/webapp/resources/css/default.css @@ -0,0 +1,29 @@ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/extra/nosql/hbase/src/main/webapp/show.xhtml b/extra/nosql/hbase/src/main/webapp/show.xhtml new file mode 100644 index 000000000..342b4446b --- /dev/null +++ b/extra/nosql/hbase/src/main/webapp/show.xhtml @@ -0,0 +1,29 @@ + + + + + + + + + + + Name#{p.name} + Age#{p.age} + +

+ + + + +
+ +
+ + + From 743c01967074ad713a9b42d78bc4f304f5af471e Mon Sep 17 00:00:00 2001 From: Heiko Scherrer Date: Mon, 7 Oct 2013 09:15:39 +0200 Subject: [PATCH 090/995] Fixed javadocs and sources download --- .gitignore | 198 +++++++++++++++++++++-------------------------------- pom.xml | 11 ++- 2 files changed, 87 insertions(+), 122 deletions(-) diff --git a/.gitignore b/.gitignore index 4da7b0943..4f469494d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,121 +1,77 @@ -/jaxrs/resource-validation/target/ -/jaxrs/mapping-exceptions/target/ -/jaxrs/server-negotiation/target/ -/jaxrs/async-client/target/ -/batch/flow/target/ -/batch/batchlet-simple/target/ -/batch/chunk-checkpoint/target/ -/batch/chunk-exception/target/ -/batch/chunk-mapper/target/ -/batch/decision/target/ -/batch/listeners/target/ -/batch/multiple-steps/target/ -/batch/split/target/ -/batch/chunk-simple-nobeans/target/ -/json/object-builder/target/ -/json/object-reader/target/ -/json/streaming-generate/target/ -/json/streaming-parser/target/ -/websocket/binary/target/ -/websocket/whiteboard/target/ -/cdi/vetoed/target/ -/cdi/pkg-level/target/ -/cdi/decorators/target/ -/cdi/bean-discovery-all/target/ -/cdi/bean-discovery-none/target/ -/cdi/bean-discovery-annotated/target/ -/cdi/exclude-filter/target/ -/cdi/built-in/target/ -/cdi/interceptors/target/ -/cdi/nobeans-xml/target/ -/cdi/beansxml-noversion/target/ -/cdi/beanmanager/target/ -/concurrency/dynamicproxy/target/ -/concurrency/executor/target/ -/concurrency/schedule/target/ -/concurrency/threads/target/ -/websocket/chat/target/ -/websocket/encoder/target/ -/websocket/encoder-client/target/ -/websocket/encoder-programmatic/target/ -/websocket/endpoint/target/ -/websocket/endpoint-async/target/ -/jaxrs/endpoint/target/ -/jaxrs/client/target/ -/jsf/server-extension/target/ -/jaxrs/jaxrs-endpoint/target/ -/jaxrs/jaxrs-client/target/ -/jsf/http-get/target/ -/websocket/endpoint-javatypes/target/ -/websocket/endpoint-config/target/ -/websocket/endpoint-programmatic/target/ -/websocket/endpoint-programmatic-async/target/ -/websocket/endpoint-programmatic-config/target/ -/websocket/endpoint-programmatic-injection/target/ -/websocket/endpoint-security/target/ -/websocket/httpsession/target/ -/websocket/injection/target/ -/websocket/messagesize/target/ -/websocket/parameters/target/ -/websocket/websocket-vs-rest/target/ -/websocket/subprotocol/target/ -/websocket/websocket-client/target/ -/websocket/websocket-client-config/target/ -/websocket/websocket-client-programmatic/target/ -/websocket/websocket-client-programmatic-config/target/ -/websocket/websocket-client-programmatic-encoders/target/ -/websocket/javase-client/target/ -/ejb/stateful/target/ -/jpa/pu-typesafe/target/ -/jpa/criteria/target/ -/jta/transactional/target/ -/jta/transaction-scope/target/ -/jta/tx-exception/target/ -/ejb/stateless/target/ -/servlet/cookies/target/ -/jpa/schema-gen-scripts/target/ -/jta/user-transaction/target/ -/ejb/singleton/target/ -/ejb/lifecycle/singleton/target/ -/servlet/async-servlet/target/ -/jms/send-receive-simple/target/ -/jms/send-receive/target/ -/servlet/error-mapping/target/ -/servlet/event-listeners/target/ -/servlet/metadata-complete/target/ -/servlet/nonblocking/target/ -/servlet/resource-packaging/target/ -/servlet/servlet-filters/target/ -/servlet/web-fragment/target/ -/servlet/servlet-security/target/ -/jsf/flows-simple/target/ -/jsf/flows-mixed/target/ -/jaxrs/client-negotiation/target/ -/jpa/schema-gen-scripts-generate/target/ -/jaxrs/readerwriter-injection/target/ -/jsf/flows-programmatic/target/ -/jsf/flows-declarative/target/ -/javamail/definition/target/ -/jta/transactional-scope/target/ -/cdi/extension-impl/target/ -/cdi/extension/target/ -/batch/chunk-csv-database/target/ -/batch/chunk-optional-processor/target/ -/batch/chunk-partition/target/ -/jpa/listeners/target/ -/jpa/multiple-pu/target/ -/json/twitter-search/target/ -/jsf/radio-buttons/target/ -/jsf/viewscoped/target/ -/ejb/lifecycle/target/ -/jpa/schema-gen/target/ -/jpa/storedprocedure/target/ -/jsf/contracts/target/ -/jsf/contracts-library/target/ -/jsf/file-upload/target/ -/extra/quartz/target/ -/extra/twitter-search/target/ -/concurrency/managedexecutor/target/ -/concurrency/managedscheduledexecutor/target/ -/concurrency/manageablethread/target/ -/batch/chunk-simple/target/ \ No newline at end of file +# Directories # +/build/ +/bin/ +target/ +libs/ + +# OS Files # +.DS_Store + +*.class + +# Package Files # +*.jar +*.war +*.ear +*.db +rebel.xml + +###################### +# Windows +###################### + +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + +###################### +# OSX +###################### + +.DS_Store +.svn + +# Thumbnails +._* + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes + +###################### +# IDEA +###################### +*.iml + +###################### +# Eclipse +###################### + +*.pydevproject +.project +.metadata +bin/** +tmp/** +tmp/**/* +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath +/src/main/resources/rebel.xml +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath \ No newline at end of file diff --git a/pom.xml b/pom.xml index 72dd86b90..0bda70765 100644 --- a/pom.xml +++ b/pom.xml @@ -266,12 +266,21 @@ javadocs + javadocs + org.apache.maven.plugins maven-dependency-plugin - 2.8 + 2.4 sources From d85165f994535b37466b5521fc8c691ecc5523ab Mon Sep 17 00:00:00 2001 From: Heiko Scherrer Date: Mon, 7 Oct 2013 19:49:17 +0200 Subject: [PATCH 091/995] Added maven-enforcer-plugin to take care of Maven in version 3.x and Java 1.7, to avoid clashes on developer environment --- pom.xml | 58 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 0bda70765..44267415d 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,5 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.javaee7 @@ -9,6 +9,8 @@ Java EE 7 Samples + 1.7 + 3.0.0 glassfish4x /Users/arungup/tools/glassfish/4.0/final/glassfish4 wildfly8x @@ -17,8 +19,11 @@ weblogic12x /Users/arungup/tools/weblogic/12c/wlserver gfv3ee6 + + + 1.3.1 - + javax @@ -33,7 +38,7 @@ provided - + codehaus-snapshots @@ -70,8 +75,8 @@ maven-compiler-plugin 2.3.2 - 1.7 - 1.7 + ${java.min.version} + ${java.min.version} @@ -111,9 +116,36 @@ + + maven-enforcer-plugin + + + + At least Maven in version ${maven.min.version} is required. + ${maven.min.version} + + + At least a JDK in version ${java.min.version} is required. + ${java.min.version} + + + + + enforce + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + ${plugin.enforcer.version} + + + - + glassfish @@ -165,14 +197,14 @@ 8080 8181 - + org.glassfish.main.common simple-glassfish-api 4.0 - + org.glassfish.main.extras glassfish-embedded-all @@ -266,7 +298,11 @@ javadocs - javadocs + + + javadocs + + + + \ No newline at end of file diff --git a/extra/nosql/voldemort/src/main/webapp/WEB-INF/template.xhtml b/extra/nosql/voldemort/src/main/webapp/WEB-INF/template.xhtml new file mode 100644 index 000000000..31d2e3aeb --- /dev/null +++ b/extra/nosql/voldemort/src/main/webapp/WEB-INF/template.xhtml @@ -0,0 +1,26 @@ + + + + + + + + + Voldemort using Java EE 7 + + + + +
+

Voldemort using Java EE 7

+
+ +
+ Content +
+ +
+ + diff --git a/extra/nosql/voldemort/src/main/webapp/WEB-INF/web.xml b/extra/nosql/voldemort/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..c5e7c7381 --- /dev/null +++ b/extra/nosql/voldemort/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/extra/nosql/voldemort/src/main/webapp/index.xhtml b/extra/nosql/voldemort/src/main/webapp/index.xhtml new file mode 100644 index 000000000..457c3dba9 --- /dev/null +++ b/extra/nosql/voldemort/src/main/webapp/index.xhtml @@ -0,0 +1,29 @@ + + + + + + + + + + + Name:
+ Age:

+ +
+
+ +
+ +
+ + + diff --git a/extra/nosql/voldemort/src/main/webapp/resources/css/cssLayout.css b/extra/nosql/voldemort/src/main/webapp/resources/css/cssLayout.css new file mode 100644 index 000000000..8ee7cebe3 --- /dev/null +++ b/extra/nosql/voldemort/src/main/webapp/resources/css/cssLayout.css @@ -0,0 +1,61 @@ + +#top { + position: relative; + background-color: #036fab; + color: white; + padding: 5px; + margin: 0px 0px 10px 0px; +} + +#bottom { + position: relative; + background-color: #c2dfef; + padding: 5px; + margin: 10px 0px 0px 0px; +} + +#left { + float: left; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +#right { + float: right; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +.center_content { + position: relative; + background-color: #dddddd; + padding: 5px; +} + +.left_content { + background-color: #dddddd; + padding: 5px; + margin-left: 170px; +} + +.right_content { + background-color: #dddddd; + padding: 5px; + margin: 0px 170px 0px 170px; +} + +#top a:link, #top a:visited { + color: white; + font-weight : bold; + text-decoration: none; +} + +#top a:link:hover, #top a:visited:hover { + color: black; + font-weight : bold; + text-decoration : underline; +} + + diff --git a/extra/nosql/voldemort/src/main/webapp/resources/css/default.css b/extra/nosql/voldemort/src/main/webapp/resources/css/default.css new file mode 100644 index 000000000..6cbc3d18e --- /dev/null +++ b/extra/nosql/voldemort/src/main/webapp/resources/css/default.css @@ -0,0 +1,29 @@ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/extra/nosql/voldemort/src/main/webapp/show.xhtml b/extra/nosql/voldemort/src/main/webapp/show.xhtml new file mode 100644 index 000000000..8f1d60f31 --- /dev/null +++ b/extra/nosql/voldemort/src/main/webapp/show.xhtml @@ -0,0 +1,27 @@ + + + + + + + + + + + Name#{p.name} + Age#{p.age} + +

+ + + + +
+ +
+ + + From 3a36540c684f577daa89c3e32d798dcf0cb0f267 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Mon, 7 Oct 2013 17:32:55 -0700 Subject: [PATCH 095/995] Starting work on Alternatives sample --- cdi/alternatives/pom.xml | 15 +++ .../org/javaee7/cdi/alternatives/Fancy.java | 58 ++++++++ .../cdi/alternatives/FancyGreeting.java | 56 ++++++++ .../javaee7/cdi/alternatives/Greeting.java | 47 +++++++ .../cdi/alternatives/SimpleGreeting.java | 55 ++++++++ .../javaee7/cdi/alternatives/TestServlet.java | 127 ++++++++++++++++++ .../src/main/webapp/WEB-INF/beans.xml | 52 +++++++ cdi/alternatives/src/main/webapp/index.jsp | 55 ++++++++ 8 files changed, 465 insertions(+) create mode 100644 cdi/alternatives/pom.xml create mode 100644 cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/Fancy.java create mode 100644 cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/FancyGreeting.java create mode 100644 cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/Greeting.java create mode 100644 cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/SimpleGreeting.java create mode 100644 cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/TestServlet.java create mode 100644 cdi/alternatives/src/main/webapp/WEB-INF/beans.xml create mode 100644 cdi/alternatives/src/main/webapp/index.jsp diff --git a/cdi/alternatives/pom.xml b/cdi/alternatives/pom.xml new file mode 100644 index 000000000..6f1fcf381 --- /dev/null +++ b/cdi/alternatives/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + + org.javaee7.cdi + cdi-samples + 1.0-SNAPSHOT + ../pom.xml + + + org.javaee7.cdi + alternatives + 1.0-SNAPSHOT + war + diff --git a/cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/Fancy.java b/cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/Fancy.java new file mode 100644 index 000000000..a30c0f6d3 --- /dev/null +++ b/cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/Fancy.java @@ -0,0 +1,58 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.cdi.alternatives; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +import javax.inject.Qualifier; + +/** + * @author Arun Gupta + */ +@Qualifier +@Retention(RUNTIME) +@Target({METHOD, FIELD, PARAMETER, TYPE}) +public @interface Fancy { +} diff --git a/cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/FancyGreeting.java b/cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/FancyGreeting.java new file mode 100644 index 000000000..c08874349 --- /dev/null +++ b/cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/FancyGreeting.java @@ -0,0 +1,56 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.cdi.alternatives; + +import javax.enterprise.inject.Alternative; + +/** + * @author Arun Gupta + */ +@Fancy +@Alternative +public class FancyGreeting implements Greeting { + + @Override + public String greet(String name) { + return "Nice to meet you, hello" + name; + } + +} diff --git a/cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/Greeting.java b/cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/Greeting.java new file mode 100644 index 000000000..7c65d641f --- /dev/null +++ b/cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/Greeting.java @@ -0,0 +1,47 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.cdi.alternatives; + +/** + * @author Arun Gupta + */ +public interface Greeting { + public String greet(String name); +} diff --git a/cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/SimpleGreeting.java b/cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/SimpleGreeting.java new file mode 100644 index 000000000..9ea9b18ea --- /dev/null +++ b/cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/SimpleGreeting.java @@ -0,0 +1,55 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.cdi.alternatives; + +import javax.enterprise.inject.Alternative; + +/** + * @author Arun Gupta + */ +@Alternative +public class SimpleGreeting implements Greeting { + + @Override + public String greet(String name) { + return "Hello " + name; + } + +} diff --git a/cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/TestServlet.java b/cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/TestServlet.java new file mode 100644 index 000000000..821fb7fec --- /dev/null +++ b/cdi/alternatives/src/main/java/org/javaee7/cdi/alternatives/TestServlet.java @@ -0,0 +1,127 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.cdi.alternatives; + +import java.io.IOException; +import java.io.PrintWriter; +import javax.inject.Inject; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @author Arun Gupta + */ +@WebServlet(urlPatterns = {"/TestServlet"}) +public class TestServlet extends HttpServlet { + + @Inject Greeting greeting; + + /** + * Processes requests for both HTTP + * GET and + * POST methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + try (PrintWriter out = response.getWriter()) { + out.println(""); + out.println(""); + out.println(""); + out.println("CDI Interceptors"); + out.println(""); + out.println(""); + out.println("

CDI Interceptors

"); + out.println(greeting.greet("Duke")); + out.println("

Look for output in \"server.log\"."); + out.println(""); + out.println(""); + } + } + + // + /** + * Handles the HTTP + * GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP + * POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// +} diff --git a/cdi/alternatives/src/main/webapp/WEB-INF/beans.xml b/cdi/alternatives/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 000000000..ea66c22d0 --- /dev/null +++ b/cdi/alternatives/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,52 @@ + + + + + org.javaee7.cdi.alternatives.FancyGreeting + + diff --git a/cdi/alternatives/src/main/webapp/index.jsp b/cdi/alternatives/src/main/webapp/index.jsp new file mode 100644 index 000000000..fc02ee19d --- /dev/null +++ b/cdi/alternatives/src/main/webapp/index.jsp @@ -0,0 +1,55 @@ + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + + CDI : Alternatives + + +

CDI : Alternatives

+ Invoke the client. + + From 8be988cfce0bc882b0caaea6bc4b22b9c9025937 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Tue, 8 Oct 2013 14:41:19 -0700 Subject: [PATCH 096/995] Adding alternatives module --- cdi/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/cdi/pom.xml b/cdi/pom.xml index bf10b1f41..6d9a4bd77 100644 --- a/cdi/pom.xml +++ b/cdi/pom.xml @@ -29,5 +29,6 @@ beanmanager extension scopes + alternatives
From b327f697479562fa3572071b0ead1df7e5fefe8a Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Tue, 8 Oct 2013 16:57:25 -0700 Subject: [PATCH 097/995] Adding riak module --- extra/nosql/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/extra/nosql/pom.xml b/extra/nosql/pom.xml index cc3b0bd64..4c3088fa7 100644 --- a/extra/nosql/pom.xml +++ b/extra/nosql/pom.xml @@ -22,5 +22,6 @@ neo4j hbase voldemort + riak
From aa2b1a46d499fee4635f89c845329a367aed7b53 Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Tue, 8 Oct 2013 16:57:34 -0700 Subject: [PATCH 098/995] Adding Riak module --- extra/nosql/riak/pom.xml | 30 +++++ .../org/javaee7/extra/nosql/riak/Person.java | 95 +++++++++++++++ .../extra/nosql/riak/PersonSessionBean.java | 109 ++++++++++++++++++ .../riak/src/main/webapp/WEB-INF/beans.xml | 49 ++++++++ .../src/main/webapp/WEB-INF/template.xhtml | 26 +++++ .../riak/src/main/webapp/WEB-INF/web.xml | 24 ++++ extra/nosql/riak/src/main/webapp/index.xhtml | 49 ++++++++ .../main/webapp/resources/css/cssLayout.css | 61 ++++++++++ .../src/main/webapp/resources/css/default.css | 29 +++++ extra/nosql/riak/src/main/webapp/show.xhtml | 27 +++++ 10 files changed, 499 insertions(+) create mode 100644 extra/nosql/riak/pom.xml create mode 100644 extra/nosql/riak/src/main/java/org/javaee7/extra/nosql/riak/Person.java create mode 100644 extra/nosql/riak/src/main/java/org/javaee7/extra/nosql/riak/PersonSessionBean.java create mode 100644 extra/nosql/riak/src/main/webapp/WEB-INF/beans.xml create mode 100644 extra/nosql/riak/src/main/webapp/WEB-INF/template.xhtml create mode 100644 extra/nosql/riak/src/main/webapp/WEB-INF/web.xml create mode 100644 extra/nosql/riak/src/main/webapp/index.xhtml create mode 100644 extra/nosql/riak/src/main/webapp/resources/css/cssLayout.css create mode 100644 extra/nosql/riak/src/main/webapp/resources/css/default.css create mode 100644 extra/nosql/riak/src/main/webapp/show.xhtml diff --git a/extra/nosql/riak/pom.xml b/extra/nosql/riak/pom.xml new file mode 100644 index 000000000..73eb681e1 --- /dev/null +++ b/extra/nosql/riak/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + org.javaee7.extra.nosql + extra-nosql-samples + 1.0-SNAPSHOT + ../pom.xml + + + org.javaee7.extra.nosql + riak + 1.0-SNAPSHOT + war + + + + voldemort-repo + http://repo.springsource.org/plugins-release/ + + + + + + com.basho.riak + riak-client + 1.4.1 + + + diff --git a/extra/nosql/riak/src/main/java/org/javaee7/extra/nosql/riak/Person.java b/extra/nosql/riak/src/main/java/org/javaee7/extra/nosql/riak/Person.java new file mode 100644 index 000000000..154f2a246 --- /dev/null +++ b/extra/nosql/riak/src/main/java/org/javaee7/extra/nosql/riak/Person.java @@ -0,0 +1,95 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.nosql.riak; + +import java.io.Serializable; +import java.util.StringTokenizer; +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Named; +import javax.validation.constraints.Size; + +/** + * @author Arun Gupta + */ +@Named +@ApplicationScoped +public class Person implements Serializable { + + @Size(min = 1, max = 20) + private String name; + + private int age; + + public Person() { + } + + public Person(String name, int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + @Override + public String toString() { + return name + ", " + age; + } + + public static Person fromString(String string) { + StringTokenizer tokens = new StringTokenizer(string, ","); + + return new Person(tokens.nextToken(), Integer.parseInt(tokens.nextToken().trim())); + } + +} diff --git a/extra/nosql/riak/src/main/java/org/javaee7/extra/nosql/riak/PersonSessionBean.java b/extra/nosql/riak/src/main/java/org/javaee7/extra/nosql/riak/PersonSessionBean.java new file mode 100644 index 000000000..85d04d6ad --- /dev/null +++ b/extra/nosql/riak/src/main/java/org/javaee7/extra/nosql/riak/PersonSessionBean.java @@ -0,0 +1,109 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.nosql.riak; + +import com.basho.riak.client.IRiakClient; +import com.basho.riak.client.RiakException; +import com.basho.riak.client.RiakFactory; +import com.basho.riak.client.RiakRetryFailedException; +import com.basho.riak.client.bucket.Bucket; +import com.basho.riak.client.cap.UnresolvedConflictException; +import com.basho.riak.client.convert.ConversionException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +/** + * @author Arun Gupta + */ +@Named +@Singleton +public class PersonSessionBean { + + @Inject + Person person; + + Set set = new HashSet<>(); + Bucket myBucket; + + @PostConstruct + private void initDB() { + try { + IRiakClient client = RiakFactory.pbcClient("localhost", 8087); + myBucket = client.fetchBucket("test").execute(); + } catch (RiakException ex) { + Logger.getLogger(PersonSessionBean.class.getName()).log(Level.SEVERE, null, ex); + } + } + + @PreDestroy + private void stopDB() { + } + + public void createPerson() { + try { + myBucket.store(person.getName(), new Person(person.getName(), person.getAge())).execute(); + set.add(person.getName()); + } catch (RiakRetryFailedException | UnresolvedConflictException | ConversionException ex) { + Logger.getLogger(PersonSessionBean.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public List getPersons() { + List persons = new ArrayList(); + for (String key : set) { + try { + Person p = myBucket.fetch(key, Person.class).execute(); + persons.add(p); + } catch (UnresolvedConflictException | RiakRetryFailedException | ConversionException ex) { + Logger.getLogger(PersonSessionBean.class.getName()).log(Level.SEVERE, null, ex); + } + } + return persons; + } +} diff --git a/extra/nosql/riak/src/main/webapp/WEB-INF/beans.xml b/extra/nosql/riak/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 000000000..aa81c7c3c --- /dev/null +++ b/extra/nosql/riak/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,49 @@ + + + + \ No newline at end of file diff --git a/extra/nosql/riak/src/main/webapp/WEB-INF/template.xhtml b/extra/nosql/riak/src/main/webapp/WEB-INF/template.xhtml new file mode 100644 index 000000000..730271b63 --- /dev/null +++ b/extra/nosql/riak/src/main/webapp/WEB-INF/template.xhtml @@ -0,0 +1,26 @@ + + + + + + + + + Riak using Java EE 7 + + + + +
+

Riak using Java EE 7

+
+ +
+ Content +
+ +
+ + diff --git a/extra/nosql/riak/src/main/webapp/WEB-INF/web.xml b/extra/nosql/riak/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..c5e7c7381 --- /dev/null +++ b/extra/nosql/riak/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/extra/nosql/riak/src/main/webapp/index.xhtml b/extra/nosql/riak/src/main/webapp/index.xhtml new file mode 100644 index 000000000..b05d3200a --- /dev/null +++ b/extra/nosql/riak/src/main/webapp/index.xhtml @@ -0,0 +1,49 @@ + + + + + + + + + + + Name:
+ Age:

+ +
+
+ + +
    Build from source (more details) +
  • Install Erlang (more details)
  • +
      +
    • curl -O http://erlang.org/download/otp_src_R15B01.tar.gz
    • +
    • tar zxvf otp_src_R15B01.tar.gz
    • +
    • cd otp_src_R15B01
    • +
    • export CFLAGS=-O0
    • +
    • ./configure --disable-hipe --enable-smp-support --enable-threads --enable-kernel-poll --enable-darwin-64bit
    • +
    • unset CFLAGS
    • +
    • make
    • +
    • make install
    • +
    +
  • wget http://s3.amazonaws.com/downloads.basho.com/riak/1.4/1.4.2/riak-1.4.2.tar.gz
  • +
  • tar zxvf riak-1.4.2.tar.gz
  • +
  • cd riak-1.4.2
  • +
  • make rel
  • +
  • cd rel/riak
  • +
  • ./bin/riak start
  • +
  • ./bin/riak ping (to verify)
  • +
+
+ +
+ + + diff --git a/extra/nosql/riak/src/main/webapp/resources/css/cssLayout.css b/extra/nosql/riak/src/main/webapp/resources/css/cssLayout.css new file mode 100644 index 000000000..8ee7cebe3 --- /dev/null +++ b/extra/nosql/riak/src/main/webapp/resources/css/cssLayout.css @@ -0,0 +1,61 @@ + +#top { + position: relative; + background-color: #036fab; + color: white; + padding: 5px; + margin: 0px 0px 10px 0px; +} + +#bottom { + position: relative; + background-color: #c2dfef; + padding: 5px; + margin: 10px 0px 0px 0px; +} + +#left { + float: left; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +#right { + float: right; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +.center_content { + position: relative; + background-color: #dddddd; + padding: 5px; +} + +.left_content { + background-color: #dddddd; + padding: 5px; + margin-left: 170px; +} + +.right_content { + background-color: #dddddd; + padding: 5px; + margin: 0px 170px 0px 170px; +} + +#top a:link, #top a:visited { + color: white; + font-weight : bold; + text-decoration: none; +} + +#top a:link:hover, #top a:visited:hover { + color: black; + font-weight : bold; + text-decoration : underline; +} + + diff --git a/extra/nosql/riak/src/main/webapp/resources/css/default.css b/extra/nosql/riak/src/main/webapp/resources/css/default.css new file mode 100644 index 000000000..6cbc3d18e --- /dev/null +++ b/extra/nosql/riak/src/main/webapp/resources/css/default.css @@ -0,0 +1,29 @@ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/extra/nosql/riak/src/main/webapp/show.xhtml b/extra/nosql/riak/src/main/webapp/show.xhtml new file mode 100644 index 000000000..8f1d60f31 --- /dev/null +++ b/extra/nosql/riak/src/main/webapp/show.xhtml @@ -0,0 +1,27 @@ + + + + + + + + + + + Name#{p.name} + Age#{p.age} + +

+ + + + +
+ +
+ + + From 2d3edb86f95c0154885ac673e01e25f9c15c93ef Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 10 Oct 2013 14:04:06 -0700 Subject: [PATCH 099/995] Adding new sample for Oracle NoSQL --- extra/nosql/oracle/pom.xml | 23 +++++ .../javaee7/extra/nosql/oracle/Person.java | 95 +++++++++++++++++++ .../extra/nosql/oracle/PersonSessionBean.java | 94 ++++++++++++++++++ .../oracle/src/main/webapp/WEB-INF/beans.xml | 49 ++++++++++ .../src/main/webapp/WEB-INF/template.xhtml | 26 +++++ .../oracle/src/main/webapp/WEB-INF/web.xml | 24 +++++ .../nosql/oracle/src/main/webapp/index.xhtml | 33 +++++++ .../main/webapp/resources/css/cssLayout.css | 61 ++++++++++++ .../src/main/webapp/resources/css/default.css | 29 ++++++ extra/nosql/oracle/src/main/webapp/show.xhtml | 27 ++++++ 10 files changed, 461 insertions(+) create mode 100644 extra/nosql/oracle/pom.xml create mode 100644 extra/nosql/oracle/src/main/java/org/javaee7/extra/nosql/oracle/Person.java create mode 100644 extra/nosql/oracle/src/main/java/org/javaee7/extra/nosql/oracle/PersonSessionBean.java create mode 100644 extra/nosql/oracle/src/main/webapp/WEB-INF/beans.xml create mode 100644 extra/nosql/oracle/src/main/webapp/WEB-INF/template.xhtml create mode 100644 extra/nosql/oracle/src/main/webapp/WEB-INF/web.xml create mode 100644 extra/nosql/oracle/src/main/webapp/index.xhtml create mode 100644 extra/nosql/oracle/src/main/webapp/resources/css/cssLayout.css create mode 100644 extra/nosql/oracle/src/main/webapp/resources/css/default.css create mode 100644 extra/nosql/oracle/src/main/webapp/show.xhtml diff --git a/extra/nosql/oracle/pom.xml b/extra/nosql/oracle/pom.xml new file mode 100644 index 000000000..125b0685b --- /dev/null +++ b/extra/nosql/oracle/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + org.javaee7.extra.nosql + extra-nosql-samples + 1.0-SNAPSHOT + ../pom.xml + + + org.javaee7.extra.nosql + oracle + 1.0-SNAPSHOT + war + + + + com.oracle.nosql + oracle-nosql + 2.1.19 + + + diff --git a/extra/nosql/oracle/src/main/java/org/javaee7/extra/nosql/oracle/Person.java b/extra/nosql/oracle/src/main/java/org/javaee7/extra/nosql/oracle/Person.java new file mode 100644 index 000000000..bec1295d5 --- /dev/null +++ b/extra/nosql/oracle/src/main/java/org/javaee7/extra/nosql/oracle/Person.java @@ -0,0 +1,95 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.nosql.oracle; + +import java.io.Serializable; +import java.util.StringTokenizer; +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Named; +import javax.validation.constraints.Size; + +/** + * @author Arun Gupta + */ +@Named +@ApplicationScoped +public class Person implements Serializable { + + @Size(min = 1, max = 20) + private String name; + + private int age; + + public Person() { + } + + public Person(String name, int age) { + this.name = name; + this.age = age; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + @Override + public String toString() { + return name + ", " + age; + } + + public static Person fromString(String string) { + StringTokenizer tokens = new StringTokenizer(string, ","); + + return new Person(tokens.nextToken(), Integer.parseInt(tokens.nextToken().trim())); + } + +} diff --git a/extra/nosql/oracle/src/main/java/org/javaee7/extra/nosql/oracle/PersonSessionBean.java b/extra/nosql/oracle/src/main/java/org/javaee7/extra/nosql/oracle/PersonSessionBean.java new file mode 100644 index 000000000..bc1a17a53 --- /dev/null +++ b/extra/nosql/oracle/src/main/java/org/javaee7/extra/nosql/oracle/PersonSessionBean.java @@ -0,0 +1,94 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package org.javaee7.extra.nosql.oracle; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; +import oracle.kv.KVStore; +import oracle.kv.KVStoreConfig; +import oracle.kv.KVStoreFactory; +import oracle.kv.Key; +import oracle.kv.Value; + +/** + * @author Arun Gupta + */ +@Named +@Singleton +public class PersonSessionBean { + + @Inject + Person person; + + Set set = new HashSet<>(); + + private KVStore store; + + @PostConstruct + private void initDB() { + // bootstrap + store = KVStoreFactory.getStore(new KVStoreConfig("kvstore", "localhost:5000")); + } + + @PreDestroy + private void stopDB() { + } + + public void createPerson() { + store.put(Key.createKey(person.getName()), Value.createValue(new Person(person.getName(), person.getAge()).toString().getBytes())); + set.add(person.getName()); + } + + public List getPersons() { + List persons = new ArrayList(); + for (String key : set) { + persons.add(Person.fromString(new String(store.get(Key.createKey(key)).getValue().getValue()))); + } + return persons; + } +} diff --git a/extra/nosql/oracle/src/main/webapp/WEB-INF/beans.xml b/extra/nosql/oracle/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 000000000..aa81c7c3c --- /dev/null +++ b/extra/nosql/oracle/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,49 @@ + + + + \ No newline at end of file diff --git a/extra/nosql/oracle/src/main/webapp/WEB-INF/template.xhtml b/extra/nosql/oracle/src/main/webapp/WEB-INF/template.xhtml new file mode 100644 index 000000000..3418cda01 --- /dev/null +++ b/extra/nosql/oracle/src/main/webapp/WEB-INF/template.xhtml @@ -0,0 +1,26 @@ + + + + + + + + + Oracle NoSQL using Java EE 7 + + + + +
+

Oracle NoSQL using Java EE 7

+
+ +
+ Content +
+ +
+ + diff --git a/extra/nosql/oracle/src/main/webapp/WEB-INF/web.xml b/extra/nosql/oracle/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..c5e7c7381 --- /dev/null +++ b/extra/nosql/oracle/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/extra/nosql/oracle/src/main/webapp/index.xhtml b/extra/nosql/oracle/src/main/webapp/index.xhtml new file mode 100644 index 000000000..eae2f204d --- /dev/null +++ b/extra/nosql/oracle/src/main/webapp/index.xhtml @@ -0,0 +1,33 @@ + + + + + + + + + + + Name:
+ Age:

+ +
+
+
    +
  • Download Oracle NoSQL Community Edition and unzip.
  • +
  • Install the NoSQL Client jar: mvn install:install-file -Dfile=/Users/arungup/tools/oracle/nosql/kv-2.1.19/lib/kvclient.jar -DgroupId=com.oracle.nosql -DartifactId=oracle-nosql -Dversion=2.1.19 -Dpackaging=jar
  • +
  • Start the server as: java -jar lib/kvstore.jar kvlite to see the output as:
    +Created new kvlite store with args:
    +-root ./kvroot -store kvstore -host arungup-mac.local -port 5000 -admin 5001 +
  • +
+
+ +
+ + + diff --git a/extra/nosql/oracle/src/main/webapp/resources/css/cssLayout.css b/extra/nosql/oracle/src/main/webapp/resources/css/cssLayout.css new file mode 100644 index 000000000..8ee7cebe3 --- /dev/null +++ b/extra/nosql/oracle/src/main/webapp/resources/css/cssLayout.css @@ -0,0 +1,61 @@ + +#top { + position: relative; + background-color: #036fab; + color: white; + padding: 5px; + margin: 0px 0px 10px 0px; +} + +#bottom { + position: relative; + background-color: #c2dfef; + padding: 5px; + margin: 10px 0px 0px 0px; +} + +#left { + float: left; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +#right { + float: right; + background-color: #ece3a5; + padding: 5px; + width: 150px; +} + +.center_content { + position: relative; + background-color: #dddddd; + padding: 5px; +} + +.left_content { + background-color: #dddddd; + padding: 5px; + margin-left: 170px; +} + +.right_content { + background-color: #dddddd; + padding: 5px; + margin: 0px 170px 0px 170px; +} + +#top a:link, #top a:visited { + color: white; + font-weight : bold; + text-decoration: none; +} + +#top a:link:hover, #top a:visited:hover { + color: black; + font-weight : bold; + text-decoration : underline; +} + + diff --git a/extra/nosql/oracle/src/main/webapp/resources/css/default.css b/extra/nosql/oracle/src/main/webapp/resources/css/default.css new file mode 100644 index 000000000..6cbc3d18e --- /dev/null +++ b/extra/nosql/oracle/src/main/webapp/resources/css/default.css @@ -0,0 +1,29 @@ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + color: #000000; + margin: 10px; +} + +h1 { + font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; + border-bottom: 1px solid #AFAFAF; + font-size: 16px; + font-weight: bold; + margin: 0px; + padding: 0px; + color: #D20005; +} + +a:link, a:visited { + color: #045491; + font-weight : bold; + text-decoration: none; +} + +a:link:hover, a:visited:hover { + color: #045491; + font-weight : bold; + text-decoration : underline; +} diff --git a/extra/nosql/oracle/src/main/webapp/show.xhtml b/extra/nosql/oracle/src/main/webapp/show.xhtml new file mode 100644 index 000000000..8f1d60f31 --- /dev/null +++ b/extra/nosql/oracle/src/main/webapp/show.xhtml @@ -0,0 +1,27 @@ + + + + + + + + + + + Name#{p.name} + Age#{p.age} + +

+ + + + +
+ +
+ + + From 3214cca7f2c614e74dbe39c214fa63a730d8305b Mon Sep 17 00:00:00 2001 From: Arun Gupta Date: Thu, 10 Oct 2013 15:41:05 -0700 Subject: [PATCH 100/995] Adding a line break --- extra/nosql/oracle/src/main/webapp/index.xhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/nosql/oracle/src/main/webapp/index.xhtml b/extra/nosql/oracle/src/main/webapp/index.xhtml index eae2f204d..5e1c6d271 100644 --- a/extra/nosql/oracle/src/main/webapp/index.xhtml +++ b/extra/nosql/oracle/src/main/webapp/index.xhtml @@ -20,7 +20,7 @@