deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r979862 - in /websites/staging/deltaspike/trunk/content: ./ staging/documentation/build.html staging/documentation/configure.html staging/documentation/data.html staging/documentation/scheduler.html staging/documentation/snapshots.html
Date Mon, 08 Feb 2016 18:40:12 GMT
Author: buildbot
Date: Mon Feb  8 18:40:12 2016
New Revision: 979862

Log:
Staging update by buildbot for deltaspike

Modified:
    websites/staging/deltaspike/trunk/content/   (props changed)
    websites/staging/deltaspike/trunk/content/staging/documentation/build.html
    websites/staging/deltaspike/trunk/content/staging/documentation/configure.html
    websites/staging/deltaspike/trunk/content/staging/documentation/data.html
    websites/staging/deltaspike/trunk/content/staging/documentation/scheduler.html
    websites/staging/deltaspike/trunk/content/staging/documentation/snapshots.html

Propchange: websites/staging/deltaspike/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Mon Feb  8 18:40:12 2016
@@ -1 +1 @@
-1719073
+1729222

Modified: websites/staging/deltaspike/trunk/content/staging/documentation/build.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/staging/documentation/build.html (original)
+++ websites/staging/deltaspike/trunk/content/staging/documentation/build.html Mon Feb  8
18:40:12 2016
@@ -277,7 +277,7 @@ table.CodeRay td.code>pre{padding:0}
 <p>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.</p>
 </div>
 <div class="paragraph">
-<p>In all cases, to obtain the DeltaSpike source, <a href="https://deltaspike.apache.org/download.html">download</a>
<code>deltaspike-project-1.5.2-source-release.zip</code> and extract the contents.</p>
+<p>In all cases, to obtain the DeltaSpike source, <a href="https://deltaspike.apache.org/download.html">download</a>
<code>deltaspike-project-1.5.3-source-release.zip</code> and extract the contents.</p>
 </div>
 <div class="admonitionblock note">
 <table>
@@ -301,7 +301,7 @@ You can also obtain the DeltaSpike sourc
 </div>
 <div class="listingblock">
 <div class="content">
-<pre class="CodeRay highlight"><code data-lang="shell">$ cd /path/to/deltaspike-project-1.5.2/
+<pre class="CodeRay highlight"><code data-lang="shell">$ cd /path/to/deltaspike-project-1.5.3/
 $ mvn clean install</code></pre>
 </div>
 </div>

Modified: websites/staging/deltaspike/trunk/content/staging/documentation/configure.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/staging/documentation/configure.html (original)
+++ websites/staging/deltaspike/trunk/content/staging/documentation/configure.html Mon Feb
 8 18:40:12 2016
@@ -309,7 +309,7 @@ You can also opt to use the lastest Delt
 <div class="listingblock">
 <div class="content">
 <pre class="CodeRay highlight"><code data-lang="xml"><span class="tag">&lt;properties&gt;</span>
-    <span class="tag">&lt;deltaspike.version&gt;</span>1.5.2<span
class="tag">&lt;/deltaspike.version&gt;</span>
+    <span class="tag">&lt;deltaspike.version&gt;</span>1.5.3<span
class="tag">&lt;/deltaspike.version&gt;</span>
 <span class="tag">&lt;/properties&gt;</span></code></pre>
 </div>
 </div>

Modified: websites/staging/deltaspike/trunk/content/staging/documentation/data.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/staging/documentation/data.html (original)
+++ websites/staging/deltaspike/trunk/content/staging/documentation/data.html Mon Feb  8 18:40:12
2016
@@ -579,7 +579,7 @@ be implemented in the repository.</p>
 <p>The <code>EntityRepository</code> interface implements the <a href="core.html#_deactivatable">Deactivatable</a>
interface allowing it to be used in the ClassDeactivator.</p>
 </div>
 <div class="paragraph">
-<p>If your repository don&#8217;t implement <code>EntityRepository</code>
and you want to deactivate it, you will need to implement the <a href="core.html#_deactivatable">Deactivatable</a>
 interface yourself.</p>
+<p>If your repository does not implement <code>EntityRepository</code>
and you want to deactivate it, you will need to implement the <a href="core.html#_deactivatable">Deactivatable</a>
 interface yourself.</p>
 </div>
 <div class="listingblock">
 <div class="content">
@@ -648,6 +648,32 @@ a JPA 2.0 <code>EntityManager</code>:</p
 {
     ...
 }</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Alternatively, you can extend the <code>FullEntityRepository</code>
interface which is a short-hand for extending
+all of <code>EntityRepository</code>, <code>EntityManagerDelegate</code>
and <code>CriteriaSupport</code>.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@Repository</span>
+<span class="directive">public</span> <span class="type">interface</span>
<span class="class">PersonRepository</span> <span class="directive">extends</span>
FullEntityRepository&lt;Person, <span class="predefined-type">Long</span>&gt;
+{
+    ...
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>For abstract classes, there is a convenience base class <code>AbstractFullEntityRepository</code>
which also
+implements <code>EntityManagerDelegate</code> and <code>CriteriaSupport</code>
and thus exposes most <code>EntityManager</code> methods:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@Repository</span>
+<span class="directive">public</span> <span class="directive">abstract</span>
PersonRepository <span class="directive">extends</span> AbstractFullEntityRepository&lt;Person,
<span class="predefined-type">Long</span>&gt;
+{
+    ...
+}</code></pre>
 </div>
 </div>
 </div>

Modified: websites/staging/deltaspike/trunk/content/staging/documentation/scheduler.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/staging/documentation/scheduler.html (original)
+++ websites/staging/deltaspike/trunk/content/staging/documentation/scheduler.html Mon Feb
 8 18:40:12 2016
@@ -349,7 +349,7 @@ table.CodeRay td.code>pre{padding:0}
 </div>
 </div>
 <div class="sect1">
-<h2 id="__scheduled">@Scheduled</h2>
+<h2 id="__scheduled_with_org_quartz_job_or_java_lang_runnable">@Scheduled with org.quartz.Job
or java.lang.Runnable</h2>
 <div class="sectionbody">
 <div class="paragraph">
 <p>Just annotate your Quartz-Jobs with <code>@Scheduled</code> and they
will get
@@ -357,6 +357,7 @@ picked up and passed to the scheduler au
 bootstrapping process).</p>
 </div>
 <div class="listingblock">
+<div class="title">Scheduled task based on org.quartz.Job</div>
 <div class="content">
 <pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@Scheduled</span>(cronExpression
= <span class="string"><span class="delimiter">&quot;</span><span
class="content">0 0/10 * * * ?</span><span class="delimiter">&quot;</span></span>)
 <span class="directive">public</span> <span class="type">class</span>
<span class="class">CdiAwareQuartzJob</span> <span class="directive">implements</span>
org.quartz.Job
@@ -373,7 +374,33 @@ bootstrapping process).</p>
 </div>
 </div>
 <div class="paragraph">
-<p>In such Quartz-jobs CDI based dependency-injection is enabled.
+<p>As an alternative it&#8217;s possible to annotate an implementation of <code>java.lang.Runnable</code>
(since DeltaSpike v1.5.3):</p>
+</div>
+<div class="listingblock">
+<div class="title">Scheduled task based on java.lang.Runnable</div>
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@Scheduled</span>(cronExpression
= <span class="string"><span class="delimiter">&quot;</span><span
class="content">0 0/10 * * * ?</span><span class="delimiter">&quot;</span></span>)
+<span class="directive">public</span> <span class="type">class</span>
<span class="class">CdiAwareRunnableJob</span> <span class="directive">implements</span>
java.lang.Runnable
+{
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> MyService service;
+
+    <span class="annotation">@Override</span>
+    <span class="directive">public</span> <span class="type">void</span>
run()
+    {
+        <span class="comment">//...</span>
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Behind the scenes DeltaSpike registers an adapter for Quartz which just delegates
to the <code>run</code>-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 <code>org.quartz.Job</code> or <code>java.lang.Runnable</code>
for all your scheduled-tasks, bot not both!</p>
+</div>
+<div class="paragraph">
+<p>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 <cod
 <p>With 'false' for <code>@Scheduled#onStartup</code>, it is even possible
to
 schedule/install jobs dynamically.</p>
 </div>
+<div class="paragraph">
+<p>The following example shows how to use it, if you are using <code>org.quartz.Job</code>
(and not <code>java.lang.Runnable</code>).</p>
+</div>
 <div class="listingblock">
 <div class="title">Example</div>
 <div class="content">
@@ -472,11 +502,41 @@ start a job once (without registering it
 </div>
 </div>
 <div class="sect1">
+<h2 id="_execute_java_lang_runnable_with_managedexecutorservice">Execute java.lang.Runnable
with ManagedExecutorService</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>If you would like to use e.g. the <code>ManagedExecutorService</code>
(with EE7+) to run the jobs,
+you can provide a custom adapter by adding e.g.
+<code>deltaspike.scheduler.runnable-adapter-class=mypackage.DelegatingJobRunnableAdapter</code>
to <code>META-INF/apache-deltaspike.properties</code>.
+Such an adapter just needs to implement <code>org.quartz.Job</code> and in case
of EE7+ inject e.g. <code>ManagedExecutorService</code> as shown in the following
example:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span>
<span class="type">class</span> <span class="class">DelegatingJobRunnableAdapter</span>
<span class="directive">implements</span> java.lang.Runnable
+{
+    <span class="annotation">@Resource</span>
+    <span class="directive">private</span> ManagedExecutorService managedExecutorService;
+
+    <span class="annotation">@Override</span>
+    <span class="directive">public</span> <span class="type">void</span>
run()
+    {
+        <span class="predefined-type">Class</span>&lt;? <span class="directive">extends</span>
<span class="predefined-type">Runnable</span>&gt; jobClass =
+            ClassUtils.tryToLoadClassForName(context.getJobDetail().getKey().getName(), <span
class="predefined-type">Runnable</span>.class);
+
+        <span class="predefined-type">Runnable</span> runnableBean = BeanProvider.getContextualReference(jobClass);
+        managedExecutorService.execute(runnableBean);
+    }
+}</code></pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
 <h2 id="_custom_scheduler">Custom Scheduler</h2>
 <div class="sectionbody">
 <div class="paragraph">
 <p>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 <a href="https://deltaspike.apache.org/javadoc/1.5.2/org/apache/deltaspike/scheduler/spi/Scheduler.html">Scheduler
javadoc</a>.</p>
+For more information, see <a href="https://deltaspike.apache.org/javadoc/1.5.3/org/apache/deltaspike/scheduler/spi/Scheduler.html">Scheduler
javadoc</a>.</p>
 </div>
 </div>
 </div>
@@ -519,8 +579,9 @@ For more information, see <a href="https
 <li><a href="#_3_declare_container_control_dependency">3. Declare Container Control
dependency</a></li>
 </ul>
 </li>
-<li><a href="#__scheduled">@Scheduled</a></li>
+<li><a href="#__scheduled_with_org_quartz_job_or_java_lang_runnable">@Scheduled
with org.quartz.Job or java.lang.Runnable</a></li>
 <li><a href="#_manual_scheduler_control">Manual Scheduler Control</a></li>
+<li><a href="#_execute_java_lang_runnable_with_managedexecutorservice">Execute
java.lang.Runnable with ManagedExecutorService</a></li>
 <li><a href="#_custom_scheduler">Custom Scheduler</a></li>
 </ul>
                     </div>

Modified: websites/staging/deltaspike/trunk/content/staging/documentation/snapshots.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/staging/documentation/snapshots.html (original)
+++ websites/staging/deltaspike/trunk/content/staging/documentation/snapshots.html Mon Feb
 8 18:40:12 2016
@@ -343,7 +343,7 @@ Snapshots provide previews of DeltaSpike
 <div class="listingblock">
 <div class="content">
 <pre class="CodeRay highlight"><code data-lang="xml"><span class="tag">&lt;properties&gt;</span>
-    <span class="tag">&lt;deltaspike.version&gt;</span>1.5.3-SNAPSHOT<span
class="tag">&lt;/deltaspike.version&gt;</span>
+    <span class="tag">&lt;deltaspike.version&gt;</span>1.5.4-SNAPSHOT<span
class="tag">&lt;/deltaspike.version&gt;</span>
 <span class="tag">&lt;/properties&gt;</span></code></pre>
 </div>
 </div>



Mime
View raw message