This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 40e603a  Remove old references to juneau-svl.
40e603a is described below

commit 40e603a3d31c4278fda9e9e72fcdad09c7235fe3
Author: JamesBognar <[email protected]>
AuthorDate: Fri Oct 4 10:19:35 2019 -0400

    Remove old references to juneau-svl.
---
 .../27.SimpleVariableLanguage/01.SvlVariables.html | 206 +++++++++++++++++++++
 .../27.SimpleVariableLanguage/02.VarResolvers.html |  73 ++++++++
 .../03.DefaultVarResolver.html                     |  38 ++++
 .../27.SimpleVariableLanguage/04.OtherNotes.html   |  32 ++++
 4 files changed, 349 insertions(+)

diff --git 
a/juneau-doc/docs/Topics/02.juneau-marshall/27.SimpleVariableLanguage/01.SvlVariables.html
 
b/juneau-doc/docs/Topics/02.juneau-marshall/27.SimpleVariableLanguage/01.SvlVariables.html
new file mode 100644
index 0000000..f8ee1b7
--- /dev/null
+++ 
b/juneau-doc/docs/Topics/02.juneau-marshall/27.SimpleVariableLanguage/01.SvlVariables.html
@@ -0,0 +1,206 @@
+<!--
+/***************************************************************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *  
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 
or implied.  See the License for the
+ * specific language governing permissions and limitations under the License.
+ 
***************************************************************************************************************************/
+ -->
+
+SVL Variables
+
+<p>
+       Variables are defined through the {@link oaj.svl.Var} API.
+       The API comes with several predefined variables and is easily 
extensible.
+</p>
+<p>
+       The following is an example of a variable that performs URL-Encoding on 
strings.
+</p>
+<p class='bpcode w800'>
+       <jc>// First create our var.</jc>
+       <jk>public class</jk> UrlEncodeVar <jk>extends</jk> SimpleVar {
+               
+               <jc>// Must have a no-arg constructor!</jc>
+               <jk>public</jk> UrlEncodeVar() {
+                       <jk>super</jk>(<js>"UE"</js>);
+               }       
+               
+               <jc>// The method we must implement</jc>
+               <ja>@Override</ja>
+               <jk>public</jk> String resolve(VarResolverSession session, 
String key) {
+                       <jk>return</jk> URLEncoder.<jsm>encode</jsm>(key, 
<js>"UTF-8"</js>);
+               }
+       }
+       
+       <jc>// Next create a var resolver that extends the existing DEFAULT 
resolver
+       // that supports resolving system properties.</jc>
+       VarResolver r = VarResolver.<jsf>DEFAULT</jsf>
+               .builder()
+               .vars(UrlEncodeVar.<jk>class</jk>)
+               .build();
+       
+       <jc>// Retrieve a system property and URL-encode it if necessary.</jc>
+       String myProperty = r.resolve(<js>"$UE{$S{my.property}}"</js>);
+</p>
+<p>
+       The following shows the class hierarchy of the {@link oaj.svl.Var} 
class:
+</p>  
+<ul class='javatree'>
+       <li class='jac'>{@link oaj.svl.Var} - Superclass of all vars.
+       <ul>
+               <li class='jac'>{@link oaj.svl.SimpleVar} - Superclass of all 
vars that return strings.
+               <ul>
+                       <li class='jac'>{@link oaj.svl.DefaultingVar} - 
Variables that define a default value if the resolve method returns null.
+                       <ul>
+                               <li class='jac'>{@link oaj.svl.MapVar} - 
Variables that pull values from maps.
+                       </ul>
+                       <li class='jac'>{@link oaj.svl.MultipartVar} - 
Variables that consist of 2 or more comma-delimited arguments.
+               </ul>
+               <li class='jac'>{@link oaj.svl.StreamedVar} - Superclass of all 
vars that stream their value to writers.
+       </ul>
+</ul>
+<p>
+       The following is the list of default variables defined in all modules:
+</p>
+<table class='styled w800'>
+       <tr>
+               <th>Module</th><th>Class</th><th>Pattern</th>
+       </tr>
+       <tr class='dark'>
+               <td rowspan='15' 
style='text-align:center;font-weight:bold;padding:20px;' 
class='code'>juneau-svl</td>
+               <td>{@link oaj.svl.vars.EnvVariablesVar}</td>
+               <td class='code'>$E{key[,default]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oaj.svl.vars.SystemPropertiesVar}</td>
+               <td class='code'>$S{key[,default]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oaj.svl.vars.ArgsVar}</td>
+               <td class='code'>$A{key[,default]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oaj.svl.vars.ManifestFileVar}</td>
+               <td class='code'>$MF{key[,default]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oaj.svl.vars.IfVar}</td>
+               <td class='code'>$IF{arg,then[,else]}</td>
+       </tr>
+       <tr class='dark dd'>
+               <td>{@link oaj.svl.vars.SwitchVar}</td>
+               <td 
class='code'>$SW{arg,pattern1:then1[,pattern2:then2...]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oaj.svl.vars.CoalesceVar}</td>
+               <td class='code'>$CO{arg1[,arg2...]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oaj.svl.vars.PatternMatchVar}</td>
+               <td class='code'>$PM{arg,pattern}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oaj.svl.vars.PatternReplaceVar}</td>
+               <td class='code'>$PR{arg,pattern,replace}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oaj.svl.vars.PatternExtractVar}</td>
+               <td class='code'>$PE{arg,pattern,groupdIndex}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oaj.svl.vars.NotEmptyVar}</td>
+               <td class='code'>$NE{arg}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oaj.svl.vars.UpperCaseVar}</td>
+               <td class='code'>$UC{arg}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oaj.svl.vars.LowerCaseVar}</td>
+               <td class='code'>$LC{arg}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oaj.svl.vars.LenVar}</td>
+               <td class='code'>$LN{arg[,delimiter]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oaj.svl.vars.SubstringVar}</td>
+               <td class='code'>$ST{arg,start[,end]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oaj.html.HtmlWidgetVar}</td>
+               <td class='code'>$W{name}</td>
+       </tr>
+       <tr class='light dd'>
+               <td rowspan='1' 
style='text-align:center;font-weight:bold;padding:20px;' 
class='code'>juneau-config</td>
+               <td>{@link oaj.config.vars.ConfigVar}</td>
+               <td class='code'>$C{key[,default]}</td>
+       </tr>
+       <tr class='dark'>
+               <td rowspan='15' 
style='text-align:center;font-weight:bold;padding:20px;' 
class='code'>juneau-rest-server</td>
+               <td>{@link oajr.vars.FileVar}</td>
+               <td class='code'>$F{path[,default]}}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oajr.vars.ServletInitParamVar}</td>
+               <td class='code'>$I{name[,default]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oajr.vars.LocalizationVar}</td>
+               <td class='code'>$L{key[,args...]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oajr.vars.RequestAttributeVar}</td>
+               <td class='code'>$RA{key1[,key2...]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oajr.vars.RequestFormDataVar}</td>
+               <td class='code'>$RF{key1[,key2...]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oajr.vars.RequestHeaderVar}</td>
+               <td class='code'>$RH{key1[,key2...]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oajr.vars.RequestHeaderVar}</td>
+               <td class='code'>$RI{key}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oajr.vars.RequestPathVar}</td>
+               <td class='code'>$RP{key1[,key2...]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oajr.vars.RequestQueryVar}</td>
+               <td class='code'>$RQ{key1[,key2...]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oajr.vars.RequestVar}</td>
+               <td class='code'>$R{key1[,key2...]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oajr.vars.SerializedRequestAttrVar}</td>
+               <td class='code'>$SA{contentType,key[,default]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oajr.vars.SwaggerVar}</td>
+               <td class='code'>$SS{key1[,key2...]}</td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oajr.vars.UrlVar}</td>
+               <td class='code'>$U{uri}></td>
+       </tr>
+       <tr class='dark'>
+               <td>{@link oajr.vars.UrlEncodeVar}</td>
+               <td class='code'>$UE{uriPart}</td>
+       </tr>
+       <tr class='dark dd'>
+               <td>{@link oajr.vars.WidgetVar} <i>(deprecated)</i></td>
+               <td class='code'>$W{name}</td>
+       </tr>
+</table>
diff --git 
a/juneau-doc/docs/Topics/02.juneau-marshall/27.SimpleVariableLanguage/02.VarResolvers.html
 
b/juneau-doc/docs/Topics/02.juneau-marshall/27.SimpleVariableLanguage/02.VarResolvers.html
new file mode 100644
index 0000000..600d6dd
--- /dev/null
+++ 
b/juneau-doc/docs/Topics/02.juneau-marshall/27.SimpleVariableLanguage/02.VarResolvers.html
@@ -0,0 +1,73 @@
+<!--
+/***************************************************************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *  
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 
or implied.  See the License for the
+ * specific language governing permissions and limitations under the License.
+ 
***************************************************************************************************************************/
+ -->
+
+VarResolvers and VarResolverSessions
+
+<p>
+       The main class for performing variable resolution is {@link 
oaj.svl.VarResolver}.
+       Two methods are provided for resolving variables:
+</p>
+<ul class='javatree'>
+       <li class='jc'>{@link oaj.svl.VarResolver}
+       <ul>
+               <li class='jm'>{@link oaj.svl.VarResolver#resolve(String) 
resolve(String)} 
+                       - Resolves variables and returns the results as a 
simple string.
+               <li class='jm'>{@link 
oaj.svl.VarResolver#resolveTo(String,Writer) resolveTo(String,Writer)} 
+                       - Resolves variables and sends results to a writer.
+       </ul>
+</ul>
+<p>
+       Var resolvers can rely on the existence of other objects.
+       For example, {@link oaj.config.vars.ConfigVar} relies on the existence 
of a {@link oaj.config.Config}.
+       This is accomplished through the following:
+</p>
+<ul class='spaced-list'>
+       <li>Context-objects - Objects set on the resolver.
+       <li>Session-objects - Objects set on the resolver session.
+</ul>
+<p>
+       The following two classes are identical in behavior except for which 
objects they can access:
+</p>
+<ul class='javatree'>
+       <li class='jc'>{@link oaj.svl.VarResolver} - Has access to context 
objects only.
+       <li class='jc'>{@link oaj.svl.VarResolverSession} - Has access to 
context and session objects.
+</ul>
+<p>
+       Context and session objects are set through the following methods:
+</p>
+<ul class='javatree'>
+       <li class='jm'>{@link 
oaj.svl.VarResolverBuilder#contextObject(String,Object)} - Context objects.
+       <li class='jm'>{@link 
oaj.svl.VarResolverSession#sessionObject(String,Object)} - Session objects.
+       <li class='jm'>{@link oaj.svl.VarResolver#createSession(Map)} - Session 
objects.
+</ul>
+<p>
+       Both kinds of objects are accessible through the following method:
+</p>
+<ul class='javatree'>
+       <li class='jm'>{@link 
oaj.svl.VarResolverSession#getSessionObject(Class, String, boolean)}
+</ul>
+<p>
+       Var resolvers can be cloned and extended by using the {@link 
oaj.svl.VarResolver#builder()} method.
+       Cloning a resolver will copy it's {@link oaj.svl.Var} class names and 
context objects.
+</p>
+
+<h5 class='figure'>Example:</h5>
+<p class='bpcode w800'>
+       <jc>// Create a resolver that copies the default resolver and adds $C 
and $A vars.</jc>
+       VarResolver myVarResolver = VarResolver.<jsf>DEFAULT</jsf>
+               .builder()
+               .vars(ConfigVar.<jk>class</jk>, ArgsVar.<jk>class</jk>)
+               .build();
+</p>
diff --git 
a/juneau-doc/docs/Topics/02.juneau-marshall/27.SimpleVariableLanguage/03.DefaultVarResolver.html
 
b/juneau-doc/docs/Topics/02.juneau-marshall/27.SimpleVariableLanguage/03.DefaultVarResolver.html
new file mode 100644
index 0000000..a977fbc
--- /dev/null
+++ 
b/juneau-doc/docs/Topics/02.juneau-marshall/27.SimpleVariableLanguage/03.DefaultVarResolver.html
@@ -0,0 +1,38 @@
+<!--
+/***************************************************************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *  
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 
or implied.  See the License for the
+ * specific language governing permissions and limitations under the License.
+ 
***************************************************************************************************************************/
+ -->
+
+VarResolver.DEFAULT
+
+<p>
+       {@link oaj.svl.VarResolver#DEFAULT} is a reusable variable resolver 
with default support for the following variables:
+</p>
+<ul>
+       <li><c>$S{key[,default]}</c> - {@link oaj.svl.vars.SystemPropertiesVar}
+       <li><c>$E{key[,default]}</c> - {@link oaj.svl.vars.EnvVariablesVar}
+       <li><c>$A{key[,default]}</c> - {@link oaj.svl.vars.ArgsVar}
+       <li><c>$MF{key[,default]}</c> - {@link oaj.svl.vars.ManifestFileVar}
+       <li><c>$SW{stringArg,pattern:thenValue[,pattern:thenValue...]}</c> - 
{@link oaj.svl.vars.SwitchVar}
+       <li><c>$IF{arg,then[,else]}</c> - {@link oaj.svl.vars.IfVar}
+       <li><c>$CO{arg[,arg2...]}</c> - {@link oaj.svl.vars.CoalesceVar}
+       <li><c>$PM{arg,pattern}</c> - {@link oaj.svl.vars.PatternMatchVar}
+       <li><c>$PR{stringArg,pattern,replace}</c>- {@link 
oaj.svl.vars.PatternReplaceVar}
+       <li><c>$PE{arg,pattern,groupIndex}</c> - {@link 
oaj.svl.vars.PatternExtractVar}
+       <li><c>$UC{arg}</c> - {@link oaj.svl.vars.UpperCaseVar}
+       <li><c>$LC{arg}</c> - {@link oaj.svl.vars.LowerCaseVar}
+       <li><c>$NE{arg}</c> - {@link oaj.svl.vars.NotEmptyVar}
+       <li><c>$LN{arg[,delimiter]}</c> - {@link oaj.svl.vars.LenVar}
+       <li><c>$ST{arg,start[,end]}</c> - {@link oaj.svl.vars.SubstringVar}
+</ul>
+
diff --git 
a/juneau-doc/docs/Topics/02.juneau-marshall/27.SimpleVariableLanguage/04.OtherNotes.html
 
b/juneau-doc/docs/Topics/02.juneau-marshall/27.SimpleVariableLanguage/04.OtherNotes.html
new file mode 100644
index 0000000..469436c
--- /dev/null
+++ 
b/juneau-doc/docs/Topics/02.juneau-marshall/27.SimpleVariableLanguage/04.OtherNotes.html
@@ -0,0 +1,32 @@
+<!--
+/***************************************************************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *  
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 
or implied.  See the License for the
+ * specific language governing permissions and limitations under the License.
+ 
***************************************************************************************************************************/
+ -->
+
+Other Notes
+
+<ul class='spaced-list'>
+       <li>
+               The escape character <js>'\'</js> can be used when necessary to 
escape the following characters: 
+               <c>$ , { }</c>
+       <li>
+               <b>WARNING:</b>  It is possible to cause {@link 
java.lang.StackOverflowError StackOverflowErrors} if 
+               your nested variables result in a recursive loop (e.g. the 
environment variable 
+               <c>'MYPROPERTY'</c> has the value <c>'$E{MYPROPERTY}'</c>).
+               So don't do that!
+       <li>
+               As a general rule, this class tries to be as efficient as 
possible by not creating new strings when not 
+               needed.
+               <br>For example, calling the resolve method on a string that 
doesn't contain variables (e.g. 
+               <c>resolver.resolve(<js>"foobar"</js>)</c>) will simply be a 
no-op and return the same string.
+</ul>

Reply via email to