incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Sling Website > Run Modes (org.apache.sling.runmode)
Date Thu, 03 Dec 2009 08:56:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=SLINGxSITE&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/SLINGxSITE/Run+Modes+%28org.apache.sling.runmode%29">Run
Modes (org.apache.sling.runmode)</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~bdelacretaz">Bertrand
Delacretaz</a>
    </h4>
     isActive is true if any of the supplied run modes are active
          <div id="versionComment" class="noteMacro" style="display:none; padding: 5px;">
     isActive is true if any of the supplied run modes are active<br />
     </div>
          <br/>
     <div class="notificationGreySide">
         <h1><a name="RunModes%28org.apache.sling.runmode%29-Overview"></a>Overview</h1>

<p>Run modes are meant to define different sets of configuration parameters for various
Sling instances.</p>

<p>In a web publishing environment, for example, one could use run modes like <em>staging,
production, dev, dmz</em> or combinations of such values.</p>

<p>The <em><a href="http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/runmode"
rel="nofollow">org.apache.sling.runmode</a></em> bundle provides a simple way
of defining and querying a list of run modes.</p>

<h1><a name="RunModes%28org.apache.sling.runmode%29-Installation"></a>Installation</h1>

<p>The run mode service is not present in the default Sling launchpad builds, to activate
it install and start the <em>org.apache.sling.runmode</em> bundle.</p>

<h1><a name="RunModes%28org.apache.sling.runmode%29-Configuration"></a>Configuration</h1>

<p>Run modes can only be configured using a system property, or via the <em>sling.properties</em>
file.</p>

<p>Using <em>-Dsling.run.modes=foo,bar</em> on the JVM command-line, for
example, activates the <em>foo</em> and <em>bar</em> run modes. </p>

<p>This command-line parameter takes precedence over a similar definition (<em>sling.run.modes=dev,staging</em>)
that might be present in the <em>sling.properties</em> file found in the Sling
home directory.</p>

<h1><a name="RunModes%28org.apache.sling.runmode%29-Gettingthecurrentlistofrunmodes"></a>Getting
the current list of run modes</h1>

<p>The <a href="http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/runmode/src/main/java/org/apache/sling/runmode/RunMode.java"
rel="nofollow">RunMode service</a> provides the current list of run modes, examples:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>RunMode examples</b></div><div
class="codeContent panelContent">
<pre class="code-java">
RunMode r = ...get from BundleContext...
<span class="code-object">String</span> [] currentRunModes = r.getCurrentRunModes();

<span class="code-object">String</span> [] expectedRunModes = { <span class="code-quote">"foo"</span>,
<span class="code-quote">"wii"</span> };
<span class="code-keyword">if</span>(r.isActive(expectedRunModes)) {
  <span class="code-comment">// at least one of (foo,wii) run modes
</span>  <span class="code-comment">// is active
</span>}
</pre>
</div></div>

<h1><a name="RunModes%28org.apache.sling.runmode%29-Seealso"></a>See also</h1>

<p>The RunMode service is used by the <a href="/confluence/display/SLINGxSITE/JCR+Installer+%28jcr.jcrinstall+and+osgi.installer%29"
title="JCR Installer (jcr.jcrinstall and osgi.installer)">jcrinstall</a> services.</p>

<h1><a name="RunModes%28org.apache.sling.runmode%29-Automatedtests"></a>Automated
tests</h1>

<p>The <a href="http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/runmode/src/test/java/org/apache/sling/runmode/impl/RunModeImplTest.java"
rel="nofollow">RunModeImplTest class</a> provides more info about run modes parsing
and usage.</p>
     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/SLINGxSITE/Run+Modes+%28org.apache.sling.runmode%29">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=9011345&revisedVersion=2&originalVersion=1">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/SLINGxSITE/Run+Modes+%28org.apache.sling.runmode%29?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message