You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bertrand Delacretaz (JIRA)" <ji...@apache.org> on 2008/09/11 14:25:44 UTC

[jira] Created: (SLING-654) RunMode service

RunMode service
---------------

                 Key: SLING-654
                 URL: https://issues.apache.org/jira/browse/SLING-654
             Project: Sling
          Issue Type: Improvement
          Components: Extensions
            Reporter: Bertrand Delacretaz
            Priority: Minor


It is often useful to enable/disable groups of components and services according to "run modes" like "development", "authoring", etc.

This was already discussed in http://markmail.org/message/76j6asutb2jtl27g , here's a more concrete spec based on an actual use case. This will be implemented in a new sling/extensions/runmode module.

-The RunMode service defines (from the environment, system properties, whatever) a set of "run modes" that are currently active, for example

 { "author", "dmz", "development" }

-OSGi components that are "run-mode aware" should use a multi-value configuration parameter to define in which run modes they are active.

-The RunMode service is used to selectively disable components, something like

   /** @scr.reference */
   RunMode runMode;

   private String [] myActiveRunModes;

   protected void activate(ComponentContext ctx) {
     if(!runMode.isActive(myActiveRunModes)) {
       ctx.disableComponent(myComponentName);
     }
   }






-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Resolved: (SLING-654) RunMode service

Posted by paksegu <pa...@yahoo.com>.

Ransford Segu-Baffoe

paksegu@yahoo.com

https://serenade.dev.java.net/
http://www.noqmx.com/

--- On Thu, 9/11/08, Bertrand Delacretaz (JIRA) <ji...@apache.org> wrote:

From: Bertrand Delacretaz (JIRA) <ji...@apache.org>
Subject: [jira] Resolved: (SLING-654) RunMode service
To: sling-dev@incubator.apache.org
Date: Thursday, September 11, 2008, 9:41 AM

     [
https://issues.apache.org/jira/browse/SLING-654?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Bertrand Delacretaz resolved SLING-654.
---------------------------------------

    Resolution: Fixed

Implemented in revision 694251

Using the test script below and starting Sling with
"-Dsling.run.modes=foo,bar", this request

  http://localhost:8888/content/foo/*.html

says "Active: false" whereas

  http://localhost:8888/content/foo/*.bar.html

says "Active: true".


ESP test script:
<%
var s = sling.getService(Packages.org.apache.sling.runmode.RunMode);

function dump(a) {
  for(var i in a) {
    %><%= a[i] %>,<%
  }
}
%>

<p>
run modes: <% dump(s.getCurrentRunModes()); %>
</p>

<p>
Selectors: <% dump(request.getRequestPathInfo().getSelectors()); %>
</p>

<p>
Active: <%= s.isActive(request.getRequestPathInfo().getSelectors()) %>
</p>



> RunMode service
> ---------------
>
>                 Key: SLING-654
>                 URL: https://issues.apache.org/jira/browse/SLING-654
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Bertrand Delacretaz
>            Priority: Minor
>
> It is often useful to enable/disable groups of components and services
according to "run modes" like "development",
"authoring", etc.
> This was already discussed in http://markmail.org/message/76j6asutb2jtl27g
, here's a more concrete spec based on an actual use case. This will be
implemented in a new sling/extensions/runmode module.
> -The RunMode service defines (from the environment, system properties,
whatever) a set of "run modes" that are currently active, for example
>  { "author", "dmz", "development" }
> -OSGi components that are "run-mode aware" should use a
multi-value configuration parameter to define in which run modes they are
active.
> -The RunMode service is used to selectively disable components, something
like
>    /** @scr.reference */
>    RunMode runMode;
>    private String [] myActiveRunModes;
>    protected void activate(ComponentContext ctx) {
>      if(!runMode.isActive(myActiveRunModes)) {
>        ctx.disableComponent(myComponentName);
>      }
>    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.




      

[jira] Resolved: (SLING-654) RunMode service

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-654?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bertrand Delacretaz resolved SLING-654.
---------------------------------------

    Resolution: Fixed

Implemented in revision 694251

Using the test script below and starting Sling with "-Dsling.run.modes=foo,bar", this request

  http://localhost:8888/content/foo/*.html

says "Active: false" whereas

  http://localhost:8888/content/foo/*.bar.html

says "Active: true".


ESP test script:
<%
var s = sling.getService(Packages.org.apache.sling.runmode.RunMode);

function dump(a) {
  for(var i in a) {
    %><%= a[i] %>,<%
  }
}
%>

<p>
run modes: <% dump(s.getCurrentRunModes()); %>
</p>

<p>
Selectors: <% dump(request.getRequestPathInfo().getSelectors()); %>
</p>

<p>
Active: <%= s.isActive(request.getRequestPathInfo().getSelectors()) %>
</p>



> RunMode service
> ---------------
>
>                 Key: SLING-654
>                 URL: https://issues.apache.org/jira/browse/SLING-654
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Bertrand Delacretaz
>            Priority: Minor
>
> It is often useful to enable/disable groups of components and services according to "run modes" like "development", "authoring", etc.
> This was already discussed in http://markmail.org/message/76j6asutb2jtl27g , here's a more concrete spec based on an actual use case. This will be implemented in a new sling/extensions/runmode module.
> -The RunMode service defines (from the environment, system properties, whatever) a set of "run modes" that are currently active, for example
>  { "author", "dmz", "development" }
> -OSGi components that are "run-mode aware" should use a multi-value configuration parameter to define in which run modes they are active.
> -The RunMode service is used to selectively disable components, something like
>    /** @scr.reference */
>    RunMode runMode;
>    private String [] myActiveRunModes;
>    protected void activate(ComponentContext ctx) {
>      if(!runMode.isActive(myActiveRunModes)) {
>        ctx.disableComponent(myComponentName);
>      }
>    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.