cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r841763 - in /websites/production/cxf/content: cache/docs.pageCache docs/jax-rs-advanced-features.html
Date Tue, 11 Dec 2012 18:48:10 GMT
Author: buildbot
Date: Tue Dec 11 18:48:09 2012
New Revision: 841763

Log:
Production update by buildbot for cxf

Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/jax-rs-advanced-features.html

Modified: websites/production/cxf/content/cache/docs.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/cxf/content/docs/jax-rs-advanced-features.html
==============================================================================
--- websites/production/cxf/content/docs/jax-rs-advanced-features.html (original)
+++ websites/production/cxf/content/docs/jax-rs-advanced-features.html Tue Dec 11 18:48:09
2012
@@ -231,12 +231,11 @@ An expression such as "name==CXF*" can b
 
 <p>Consider a typical query expression such as "a=avalue&amp;c=cvalue". This can
mean either "find all resources with 'a' and 'c' properties equal to 'avalue' and 'cvalue'"
or "find all resources with 'a' or 'c' properties equal to 'avalue' and 'cvalue'". It is application
specific on whether it is "and" or "or" as far as the combination of multiple query properties
is concerned.</p>
 
-<p>It is also difficult to capture conditional expressions with the custom language,
example, "find all resource with 'a' property less than 123".</p>
+<p>It is also to capture conditional expressions with the custom language, example,
"find all resource with 'a' property less than 123" when a number of properties is large or
the entities which can be searched are created dynamically.</p>
 
 <p>Use FIQL for capturing simple or medium complexity queries, typically in cases where
a set of properties that a user can specify is well-known. Example, a book store resource
will let users search books given a number of useful properties(those of Book and/or Library
a given book is available in, etc). </p>
 
-
-
+<p>Furthermore, consider using FIQL and SearchConditionVisitor for the purpose of generalizing
the search code, when the number of properties and entities is large, dynamic, etc.</p>
 
 
 <h2><a shape="rect" name="JAX-RSAdvancedFeatures-DependenciesandConfiguration"></a>Dependencies
and Configuration</h2>
@@ -932,6 +931,7 @@ get the converted query expression, with
 <span class="code-keyword">import</span> org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 <span class="code-keyword">import</span> org.apache.cxf.jaxrs.ext.search.QueryContextProvider;
 <span class="code-keyword">import</span> org.apache.cxf.jaxrs.ext.search.SearchBean;
+<span class="code-keyword">import</span> org.apache.cxf.jaxrs.ext.search.visitor.SBThrealLocalVisitorState;
 <span class="code-keyword">import</span> org.apache.cxf.jaxrs.ext.search.sql.SQLPrinterVisitor;
 
 <span class="code-keyword">import</span> books.BookStore;
@@ -941,7 +941,10 @@ get the converted query expression, with
 List&lt;<span class="code-object">Object</span>&gt; providers = <span
class="code-keyword">new</span> ArrayList&lt;<span class="code-object">Object</span>&gt;();
 providers.add(<span class="code-keyword">new</span> QueryContextProvider());
 sf.setProviders(providers);
-sf.getProperties(<span class="code-keyword">true</span>).put(<span class="code-quote">"search.visitor"</span>,
<span class="code-keyword">new</span> SQLPrinterVisitor&lt;SearchBean&gt;(<span
class="code-quote">"books"</span>));
+
+SQLPrinterVisitor&lt;SearchBean&gt; sqlVisitor = <span class="code-keyword">new</span>
SQLPrinterVisitor&lt;SearchBean&gt;(<span class="code-quote">"books"</span>);
+sqlVisitor.setVisitorState(<span class="code-keyword">new</span> SBThrealLocalVisitorState());
+sf.getProperties(<span class="code-keyword">true</span>).put(<span class="code-quote">"search.visitor"</span>,
sqlVisitor);
 
 
 sf.setResourceClasses(BookStore.class);
@@ -979,6 +982,11 @@ List&lt;Book&gt; books = client.getColle
 </pre>
 </div></div>
 
+<p>Note, given that SQLPrinterVisitor will be shared between multiple requests it has
to be made thread-safe by injecting a thread-local<br clear="none">
+org.apache.cxf.jaxrs.ext.search.visitor.SBThrealLocalVisitorState. This is not required when
the visitor is created in the code on the per-request basis.</p>
+
+<p>Custom visitors which are expected to be singletons and have the state accumulating
between multiple visit calls have to be thread safe. Utility org.apache.cxf.jaxrs.ext.search.visitor.ThrealLocalVisitorState
class can be used.</p>
+
 <h2><a shape="rect" name="JAX-RSAdvancedFeatures-SearchExpressionsinURIPathsegments"></a>Search
Expressions in URI Path segments</h2>
 
 <p>By default, a FIQL expression is expected to be available in either '_s' or '_search'
query.<br clear="none">



Mime
View raw message