deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r986065 - in /websites/staging/deltaspike/trunk/content: ./ documentation/configuration.html documentation/data.html documentation/scheduler.html
Date Tue, 19 Apr 2016 09:03:10 GMT
Author: buildbot
Date: Tue Apr 19 09:03:09 2016
New Revision: 986065

Log:
Staging update by buildbot for deltaspike

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

Propchange: websites/staging/deltaspike/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Tue Apr 19 09:03:09 2016
@@ -1 +1 @@
-1739869
+1739872

Modified: websites/staging/deltaspike/trunk/content/documentation/configuration.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/documentation/configuration.html (original)
+++ websites/staging/deltaspike/trunk/content/documentation/configuration.html Tue Apr 19
09:03:09 2016
@@ -486,6 +486,27 @@ to change dynamically if someone likes t
 </div>
 </div>
 <div class="sect2">
+<h3 id="_variable_replacement_in_configured_values">Variable Replacement in Configured
Values</h3>
+<div class="paragraph">
+<p>Since version 1.6.1, DeltaSpike also supports using 'variables' inside configured
values.
+You can e.g. define a single configuration key for your server and use it in other configuration
values</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre>document.server.url=http://localhost:8081
+myapp.document.lists=${document.server.url}/docapp/list
+myapp.document.admin=${document.server.url}/docadmin/app</pre>
+</div>
+</div>
+<div class="paragraph">
+<p>A variable name starts with <code>${</code> and ends with <code>}</code>.</p>
+</div>
+<div class="paragraph">
+<p>Variable support is enabled by default.
+If you like to use the <code>ConfigResolver</code> without variable support you
need to use the methods with the <code>evaluateVariables</code> parameter set
to <code>false</code>.</p>
+</div>
+</div>
+<div class="sect2">
 <h3 id="_typedresolver_api">TypedResolver API</h3>
 <div class="paragraph">
 <p>Very often the configured values represent more than just strings&#8201;&#8212;&#8201;number
types and booleans are commonly used as
@@ -952,6 +973,7 @@ log.</p>
 <li><a href="#_handling_of_default_values">Handling of Default Values</a></li>
 </ul>
 </li>
+<li><a href="#_variable_replacement_in_configured_values">Variable Replacement
in Configured Values</a></li>
 <li><a href="#_typedresolver_api">TypedResolver API</a>
 <ul class="sectlevel3">
 <li><a href="#_supported_types">Supported types</a></li>

Modified: websites/staging/deltaspike/trunk/content/documentation/data.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/documentation/data.html (original)
+++ websites/staging/deltaspike/trunk/content/documentation/data.html Tue Apr 19 09:03:09
2016
@@ -605,6 +605,86 @@ be implemented in the repository.</p>
 </div>
 </div>
 <div class="sect2">
+<h3 id="_support_of_transactionscoped_entitymanagers">Support of @TransactionScoped
EntityManagers</h3>
+<div class="paragraph">
+<p>For using <code>@TransactionScoped</code> beans like a <code>@TransactionScoped</code>-<code>EntityManager</code>,
+you need to annotate the Data-repository with @Transactional explicitly or one of the beans
in the call-hierarchy.
+That&#8217;s needed, because the context bound to <code>@TransactionScoped</code>
needs to be active,
+before the <code>@TransactionScoped</code>-<code>EntityManager</code>
gets resolved (internally).</p>
+</div>
+<div class="paragraph">
+<p>The following examples illustrate the described usages:</p>
+</div>
+<div class="listingblock">
+<div class="title">@TransactionScoped EntityManager combined with a simple repository</div>
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span>
<span class="type">class</span> <span class="class">EntityManagerProducer</span>
+{
+    <span class="annotation">@Produces</span>
+    <span class="annotation">@TransactionScoped</span>
+    <span class="directive">public</span> EntityManager create() { ... }
+
+    <span class="directive">public</span> <span class="type">void</span>
close(<span class="annotation">@Disposes</span> EntityManager em)  { ... }
+}
+
+<span class="annotation">@ApplicationScoped</span>
+<span class="directive">public</span> <span class="type">class</span>
<span class="class">MyService</span>
+{
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> MyRepository myRepository;
+
+    <span class="directive">public</span> <span class="type">void</span>
create()
+    {
+        <span class="comment">//...</span>
+        <span class="local-variable">this</span>.myRepository.save(...); <span
class="comment">//executed in a transaction</span>
+        <span class="comment">//...</span>
+    }
+}
+
+<span class="annotation">@Transactional</span>
+<span class="annotation">@Repository</span>
+<span class="directive">public</span> <span class="type">interface</span>
<span class="class">MyRepository</span> <span class="directive">extends</span>
EntityRepository&lt;MyEntity, <span class="predefined-type">String</span>&gt;
+{
+  <span class="comment">//...</span>
+}</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="title">@TransactionScoped EntityManager combined with a simple repository
called by a transactional bean</div>
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span>
<span class="type">class</span> <span class="class">EntityManagerProducer</span>
+{
+    <span class="annotation">@Produces</span>
+    <span class="annotation">@TransactionScoped</span>
+    <span class="directive">public</span> EntityManager create() { ... }
+
+    <span class="directive">public</span> <span class="type">void</span>
close(<span class="annotation">@Disposes</span> EntityManager em)  { ... }
+}
+
+<span class="annotation">@Transactional</span>
+<span class="annotation">@ApplicationScoped</span>
+<span class="directive">public</span> <span class="type">class</span>
<span class="class">MyService</span>
+{
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> MyRepository myRepository;
+
+    <span class="directive">public</span> <span class="type">void</span>
create() <span class="comment">//executed in a transaction</span>
+    {
+        <span class="comment">//...</span>
+        <span class="local-variable">this</span>.myRepository.save(...);
+        <span class="comment">//...</span>
+    }
+}
+
+<span class="annotation">@Repository</span>
+<span class="directive">public</span> <span class="type">interface</span>
<span class="class">MyRepository</span> <span class="directive">extends</span>
EntityRepository&lt;MyEntity, <span class="predefined-type">String</span>&gt;
+{
+  <span class="comment">//...</span>
+}</code></pre>
+</div>
+</div>
+</div>
+<div class="sect2">
 <h3 id="_using_multiple_entitymanagers">Using Multiple EntityManagers</h3>
 <div class="paragraph">
 <p>While most applications will run just fine with a single
@@ -2148,6 +2228,7 @@ provider when persisting / updating the
 </ul>
 </li>
 <li><a href="#_deactivating_repositories">Deactivating Repositories</a></li>
+<li><a href="#_support_of_transactionscoped_entitymanagers">Support of @TransactionScoped
EntityManagers</a></li>
 <li><a href="#_using_multiple_entitymanagers">Using Multiple EntityManagers</a></li>
 <li><a href="#_other_entitymanager_methods">Other EntityManager Methods</a></li>
 </ul>

Modified: websites/staging/deltaspike/trunk/content/documentation/scheduler.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/documentation/scheduler.html (original)
+++ websites/staging/deltaspike/trunk/content/documentation/scheduler.html Tue Apr 19 09:03:09
2016
@@ -545,6 +545,36 @@ start a job once (without registering it
 </div>
 </div>
 <div class="sect1">
+<h2 id="_manual_scheduling">Manual scheduling</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>If the SPI provided by <code>org.apache.deltaspike.scheduler.spi.Scheduler</code>
doesn&#8217;t provide a method you are looking for,
+you can use <code>#unwrap</code> to access the underlying scheduler.
+Per default DeltaSpike uses an implementation of <code>org.quartz.Scheduler</code>.
+Therefore, it&#8217;s possible to inject <code>org.apache.deltaspike.scheduler.spi.Scheduler</code>
and use it like 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">ManualJobScheduler</span>
+{
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> Scheduler&lt;Job&gt; scheduler;
+
+    <span class="annotation">@Override</span>
+    <span class="directive">public</span> <span class="type">void</span>
scheduleJob(JobDetail jobDetail, Trigger trigger) <span class="directive">throws</span>
SchedulerException
+    {
+        <span class="local-variable">this</span>.scheduler.unwrap(org.quartz.Scheduler.class).scheduleJob(jobDetail,
trigger);
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>With that it&#8217;s e.g. possible to schedule quartz-jobs based on the same
quartz-job(-class), but with different triggers,&#8230;&#8203;
+Also manually scheduled jobs benefit from DeltaSpike features like the support of <code>@Inject</code>
in the job-instances.</p>
+</div>
+</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">
@@ -625,6 +655,7 @@ For more information, see <a href="https
 <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="#_configurable_cron_expressions">Configurable CRON expressions</a></li>
 <li><a href="#_manual_scheduler_control">Manual Scheduler Control</a></li>
+<li><a href="#_manual_scheduling">Manual scheduling</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>



Mime
View raw message