Return-Path: X-Original-To: apmail-deltaspike-commits-archive@www.apache.org Delivered-To: apmail-deltaspike-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 85A9718B3F for ; Mon, 8 Feb 2016 18:39:34 +0000 (UTC) Received: (qmail 81427 invoked by uid 500); 8 Feb 2016 18:39:34 -0000 Delivered-To: apmail-deltaspike-commits-archive@deltaspike.apache.org Received: (qmail 81395 invoked by uid 500); 8 Feb 2016 18:39:34 -0000 Mailing-List: contact commits-help@deltaspike.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltaspike.apache.org Delivered-To: mailing list commits@deltaspike.apache.org Received: (qmail 81386 invoked by uid 99); 8 Feb 2016 18:39:34 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Feb 2016 18:39:34 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 02510180047 for ; Mon, 8 Feb 2016 18:39:34 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.371 X-Spam-Level: * X-Spam-Status: No, score=1.371 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.429] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id FbIFGGhWAXEk for ; Mon, 8 Feb 2016 18:39:31 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTP id 34E192139D for ; Mon, 8 Feb 2016 18:39:30 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 49BC3E00AF for ; Mon, 8 Feb 2016 18:39:29 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 3937C3A0667 for ; Mon, 8 Feb 2016 18:39:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1729222 - in /deltaspike/site/trunk/content/staging/documentation: build.html configure.html data.html scheduler.html snapshots.html Date: Mon, 08 Feb 2016 18:39:29 -0000 To: commits@deltaspike.apache.org From: gpetracek@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160208183929.3937C3A0667@svn01-us-west.apache.org> Author: gpetracek Date: Mon Feb 8 18:39:28 2016 New Revision: 1729222 URL: http://svn.apache.org/viewvc?rev=1729222&view=rev Log: Site checkin for project Apache DeltaSpike Documentation Modified: deltaspike/site/trunk/content/staging/documentation/build.html deltaspike/site/trunk/content/staging/documentation/configure.html deltaspike/site/trunk/content/staging/documentation/data.html deltaspike/site/trunk/content/staging/documentation/scheduler.html deltaspike/site/trunk/content/staging/documentation/snapshots.html Modified: deltaspike/site/trunk/content/staging/documentation/build.html URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/staging/documentation/build.html?rev=1729222&r1=1729221&r2=1729222&view=diff ============================================================================== --- deltaspike/site/trunk/content/staging/documentation/build.html (original) +++ deltaspike/site/trunk/content/staging/documentation/build.html Mon Feb 8 18:39:28 2016 @@ -277,7 +277,7 @@ table.CodeRay td.code>pre{padding:0}

The DeltaSpike source (modules and examples) is provided for inspection, contribution and testing purposes. The source must be built with Maven, which has been used to automate the compilation, testing and packaging processes. Arquillian tests are included with the source and a CDI implementation or container can be specified with which to carry out the tests.

-

In all cases, to obtain the DeltaSpike source, download deltaspike-project-1.5.2-source-release.zip and extract the contents.

+

In all cases, to obtain the DeltaSpike source, download deltaspike-project-1.5.3-source-release.zip and extract the contents.

@@ -301,7 +301,7 @@ You can also obtain the DeltaSpike sourc
-
$ cd /path/to/deltaspike-project-1.5.2/
+
$ cd /path/to/deltaspike-project-1.5.3/
 $ mvn clean install
Modified: deltaspike/site/trunk/content/staging/documentation/configure.html URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/staging/documentation/configure.html?rev=1729222&r1=1729221&r2=1729222&view=diff ============================================================================== --- deltaspike/site/trunk/content/staging/documentation/configure.html (original) +++ deltaspike/site/trunk/content/staging/documentation/configure.html Mon Feb 8 18:39:28 2016 @@ -309,7 +309,7 @@ You can also opt to use the lastest Delt
<properties>
-    <deltaspike.version>1.5.2</deltaspike.version>
+    <deltaspike.version>1.5.3</deltaspike.version>
 </properties>
Modified: deltaspike/site/trunk/content/staging/documentation/data.html URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/staging/documentation/data.html?rev=1729222&r1=1729221&r2=1729222&view=diff ============================================================================== --- deltaspike/site/trunk/content/staging/documentation/data.html (original) +++ deltaspike/site/trunk/content/staging/documentation/data.html Mon Feb 8 18:39:28 2016 @@ -579,7 +579,7 @@ be implemented in the repository.

The EntityRepository interface implements the Deactivatable interface allowing it to be used in the ClassDeactivator.

-

If your repository don’t implement EntityRepository and you want to deactivate it, you will need to implement the Deactivatable interface yourself.

+

If your repository does not implement EntityRepository and you want to deactivate it, you will need to implement the Deactivatable interface yourself.

@@ -648,6 +648,32 @@ a JPA 2.0 EntityManager:

+
+
+
+

Alternatively, you can extend the FullEntityRepository interface which is a short-hand for extending +all of EntityRepository, EntityManagerDelegate and CriteriaSupport.

+
+
+
+
@Repository
+public interface PersonRepository extends FullEntityRepository<Person, Long>
+{
+    ...
+}
+
+
+
+

For abstract classes, there is a convenience base class AbstractFullEntityRepository which also +implements EntityManagerDelegate and CriteriaSupport and thus exposes most EntityManager methods:

+
+
+
+
@Repository
+public abstract PersonRepository extends AbstractFullEntityRepository<Person, Long>
+{
+    ...
+}
Modified: deltaspike/site/trunk/content/staging/documentation/scheduler.html URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/staging/documentation/scheduler.html?rev=1729222&r1=1729221&r2=1729222&view=diff ============================================================================== --- deltaspike/site/trunk/content/staging/documentation/scheduler.html (original) +++ deltaspike/site/trunk/content/staging/documentation/scheduler.html Mon Feb 8 18:39:28 2016 @@ -349,7 +349,7 @@ table.CodeRay td.code>pre{padding:0}
-

@Scheduled

+

@Scheduled with org.quartz.Job or java.lang.Runnable

Just annotate your Quartz-Jobs with @Scheduled and they will get @@ -357,6 +357,7 @@ picked up and passed to the scheduler au bootstrapping process).

+
Scheduled task based on org.quartz.Job
@Scheduled(cronExpression = "0 0/10 * * * ?")
 public class CdiAwareQuartzJob implements org.quartz.Job
@@ -373,7 +374,33 @@ bootstrapping process).

-

In such Quartz-jobs CDI based dependency-injection is enabled. +

As an alternative it’s possible to annotate an implementation of java.lang.Runnable (since DeltaSpike v1.5.3):

+
+
+
Scheduled task based on java.lang.Runnable
+
+
@Scheduled(cronExpression = "0 0/10 * * * ?")
+public class CdiAwareRunnableJob implements java.lang.Runnable
+{
+    @Inject
+    private MyService service;
+
+    @Override
+    public void run()
+    {
+        //...
+    }
+}
+
+
+
+

Behind the scenes DeltaSpike registers an adapter for Quartz which just delegates to the run-method once the adapter gets called by Quartz. +Technically you end up with almost the same, just with a reduced API for implementing (all) your scheduled jobs. +Therefore the main difference is that your code is independent of Quartz-classes. +However, you need to select org.quartz.Job or java.lang.Runnable for all your scheduled-tasks, bot not both!

+
+
+

In such scheduled-tasks CDI based dependency-injection is enabled. Furthermore, the request- and session-scope get started (and stopped) per job-execution. Therefore, the container-control module (of DeltaSpike) is required. That can be controlled via @@ -384,6 +411,9 @@ container-control module as well as With 'false' for @Scheduled#onStartup, it is even possible to schedule/install jobs dynamically.

+
+

The following example shows how to use it, if you are using org.quartz.Job (and not java.lang.Runnable).

+
Example
@@ -472,11 +502,41 @@ start a job once (without registering it
+

Execute java.lang.Runnable with ManagedExecutorService

+
+
+

If you would like to use e.g. the ManagedExecutorService (with EE7+) to run the jobs, +you can provide a custom adapter by adding e.g. +deltaspike.scheduler.runnable-adapter-class=mypackage.DelegatingJobRunnableAdapter to META-INF/apache-deltaspike.properties. +Such an adapter just needs to implement org.quartz.Job and in case of EE7+ inject e.g. ManagedExecutorService as shown in the following example:

+
+
+
+
public class DelegatingJobRunnableAdapter implements java.lang.Runnable
+{
+    @Resource
+    private ManagedExecutorService managedExecutorService;
+
+    @Override
+    public void run()
+    {
+        Class<? extends Runnable> jobClass =
+            ClassUtils.tryToLoadClassForName(context.getJobDetail().getKey().getName(), Runnable.class);
+
+        Runnable runnableBean = BeanProvider.getContextualReference(jobClass);
+        managedExecutorService.execute(runnableBean);
+    }
+}
+
+
+
+
+

Custom Scheduler

It is possible to replace the default integration with Quartz. Any scheduler that supports cron-expressions for job-classes can be used. -For more information, see Scheduler javadoc.

+For more information, see Scheduler javadoc.

@@ -519,8 +579,9 @@ For more information, see 3. Declare Container Control dependency -
  • @Scheduled
  • +
  • @Scheduled with org.quartz.Job or java.lang.Runnable
  • Manual Scheduler Control
  • +
  • Execute java.lang.Runnable with ManagedExecutorService
  • Custom Scheduler
  • Modified: deltaspike/site/trunk/content/staging/documentation/snapshots.html URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/staging/documentation/snapshots.html?rev=1729222&r1=1729221&r2=1729222&view=diff ============================================================================== --- deltaspike/site/trunk/content/staging/documentation/snapshots.html (original) +++ deltaspike/site/trunk/content/staging/documentation/snapshots.html Mon Feb 8 18:39:28 2016 @@ -343,7 +343,7 @@ Snapshots provide previews of DeltaSpike
    <properties>
    -    <deltaspike.version>1.5.3-SNAPSHOT</deltaspike.version>
    +    <deltaspike.version>1.5.4-SNAPSHOT</deltaspike.version>
     </properties>