deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1739869 - in /deltaspike/site/trunk/content/staging/documentation: configuration.html core.html data.html scheduler.html
Date Tue, 19 Apr 2016 08:51:18 GMT
Author: gpetracek
Date: Tue Apr 19 08:51:18 2016
New Revision: 1739869

URL: http://svn.apache.org/viewvc?rev=1739869&view=rev
Log:
Site checkin for project Apache DeltaSpike Documentation

Modified:
    deltaspike/site/trunk/content/staging/documentation/configuration.html
    deltaspike/site/trunk/content/staging/documentation/core.html
    deltaspike/site/trunk/content/staging/documentation/data.html
    deltaspike/site/trunk/content/staging/documentation/scheduler.html

Modified: deltaspike/site/trunk/content/staging/documentation/configuration.html
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/staging/documentation/configuration.html?rev=1739869&r1=1739868&r2=1739869&view=diff
==============================================================================
--- deltaspike/site/trunk/content/staging/documentation/configuration.html (original)
+++ deltaspike/site/trunk/content/staging/documentation/configuration.html Tue Apr 19 08:51:18
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: deltaspike/site/trunk/content/staging/documentation/core.html
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/staging/documentation/core.html?rev=1739869&r1=1739868&r2=1739869&view=diff
==============================================================================
--- deltaspike/site/trunk/content/staging/documentation/core.html (original)
+++ deltaspike/site/trunk/content/staging/documentation/core.html Tue Apr 19 08:51:18 2016
@@ -1756,6 +1756,27 @@ The following example shows how it would
 </div>
 </div>
 <div class="sect1">
+<h2 id="_asynchronous_operations">Asynchronous Operations</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>DeltaSpike provides support for executing code in an asynchronous manner.  The behavior
is implemented as three different interceptors for your beans.</p>
+</div>
+<div class="ulist">
+<ul>
+<li>
+<p><code>@Futreable</code> - Designed for bean methods that return <code>Future&#8217;s</code>
of some form.  The method call will automatically be submitted to an <code>ExecutorService</code></p>
+</li>
+<li>
+<p><code>@Locked</code> - Ability to prevent concurrent access to a method
based on its usage of reads/writes.</p>
+</li>
+<li>
+<p><code>@Throttled</code> - Ability to limit how frequently a method can
be invoked.</p>
+</li>
+</ul>
+</div>
+</div>
+</div>
+<div class="sect1">
 <h2 id="_utilities">Utilities</h2>
 <div class="sectionbody">
 <div class="paragraph">
@@ -2012,6 +2033,7 @@ objects, the last object in the array wi
 <li><a href="#_deactivate_deactivatable_classes_via_config">Deactivate Deactivatable-Classes
via Config</a></li>
 </ul>
 </li>
+<li><a href="#_asynchronous_operations">Asynchronous Operations</a></li>
 <li><a href="#_utilities">Utilities</a>
 <ul class="sectlevel2">
 <li><a href="#_annotationutils">AnnotationUtils</a></li>

Modified: deltaspike/site/trunk/content/staging/documentation/data.html
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/staging/documentation/data.html?rev=1739869&r1=1739868&r2=1739869&view=diff
==============================================================================
--- deltaspike/site/trunk/content/staging/documentation/data.html (original)
+++ deltaspike/site/trunk/content/staging/documentation/data.html Tue Apr 19 08:51:18 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
@@ -1118,8 +1198,8 @@ the query:</p>
 <div class="listingblock">
 <div class="content">
 <pre class="CodeRay highlight"><code data-lang="java"><span class="predefined-type">List</span>&lt;Person&gt;
result = personRepository.findAllByAge(<span class="integer">18</span>, <span
class="integer">65</span>)
-    .orderAsc(Person_.lastName)
-    .orderDesc(Person_.age)
+    .orderAsc(<span class="string"><span class="delimiter">&quot;</span><span
class="content">p.lastName</span><span class="delimiter">&quot;</span></span>,
<span class="predefined-constant">false</span>)
+    .orderDesc(<span class="string"><span class="delimiter">&quot;</span><span
class="content">p.age</span><span class="delimiter">&quot;</span></span>,
<span class="predefined-constant">false</span>)
     .lockMode(LockModeType.WRITE)
     .hint(<span class="string"><span class="delimiter">&quot;</span><span
class="content">org.hibernate.timeout</span><span class="delimiter">&quot;</span></span>,
<span class="predefined-type">Integer</span>.valueOf(<span class="integer">10</span>))
     .getResultList();</code></pre>
@@ -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: deltaspike/site/trunk/content/staging/documentation/scheduler.html
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/staging/documentation/scheduler.html?rev=1739869&r1=1739868&r2=1739869&view=diff
==============================================================================
--- deltaspike/site/trunk/content/staging/documentation/scheduler.html (original)
+++ deltaspike/site/trunk/content/staging/documentation/scheduler.html Tue Apr 19 08:51:18
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