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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Robert Munteanu (Jira)
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.


Reply | Threaded
Open this post in threaded view
|

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

Robert Munteanu (Jira)

     [ 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.


Reply | Threaded
Open this post in threaded view
|

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

paksegu


Ransford Segu-Baffoe

[hidden email]

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

--- On Thu, 9/11/08, Bertrand Delacretaz (JIRA) <[hidden email]> wrote:

From: Bertrand Delacretaz (JIRA) <[hidden email]>
Subject: [jira] Resolved: (SLING-654) RunMode service
To: [hidden email]
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.