You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Timothee Maret (JIRA)" <ji...@apache.org> on 2011/08/18 14:20:27 UTC

[jira] [Created] (SLING-2185) Provide a way to configure IOManager/PropertyManager handlers at runtime.

Provide a way to configure IOManager/PropertyManager handlers at runtime.
-------------------------------------------------------------------------

                 Key: SLING-2185
                 URL: https://issues.apache.org/jira/browse/SLING-2185
             Project: Sling
          Issue Type: Improvement
          Components: JCR
    Affects Versions: JCR Webdav 2.1.0
            Reporter: Timothee Maret
            Priority: Minor


Currently, the handlers for the IOManager and PropertyManager instances are defined in the org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig class.
This is not flexible and make it difficult to add project specific handlers in the configuration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SLING-2185) Provide a way to configure IOManager/PropertyManager handlers at runtime.

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

Timothee Maret updated SLING-2185:
----------------------------------

    Attachment: io-handler-service.patch

> Provide a way to configure IOManager/PropertyManager handlers at runtime.
> -------------------------------------------------------------------------
>
>                 Key: SLING-2185
>                 URL: https://issues.apache.org/jira/browse/SLING-2185
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Webdav 2.1.0
>            Reporter: Timothee Maret
>            Priority: Minor
>         Attachments: io-handler-service-reactif.patch, io-handler-service.patch, io-handler-service.patch
>
>
> Currently, the handlers for the IOManager and PropertyManager instances are defined in the org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig class.
> This is not flexible and make it difficult to add project specific handlers in the configuration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2185) Provide a way to configure IOManager/PropertyManager handlers at runtime.

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13095242#comment-13095242 ] 

Felix Meschberger commented on SLING-2185:
------------------------------------------

Committed the test services in Rev. 1164023 without changes
Committed the integration tests in Rev. 1164025 without changes

> Provide a way to configure IOManager/PropertyManager handlers at runtime.
> -------------------------------------------------------------------------
>
>                 Key: SLING-2185
>                 URL: https://issues.apache.org/jira/browse/SLING-2185
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Webdav 2.1.0
>            Reporter: Timothee Maret
>            Assignee: Felix Meschberger
>            Priority: Minor
>         Attachments: io-handler-service-reactif.patch, io-handler-service.patch, io-handler-service.patch
>
>
> Currently, the handlers for the IOManager and PropertyManager instances are defined in the org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig class.
> This is not flexible and make it difficult to add project specific handlers in the configuration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2185) Provide a way to configure IOManager/PropertyManager handlers at runtime.

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

Bertrand Delacretaz commented on SLING-2185:
--------------------------------------------

Thanks for this Tim, looks good to me!

(note that if you re-upload your patch with the same filename, JIRA does the right thing and keeps both versions with dates)

Could you also provide tests for this feature? The simplest might be integration tests, you could for example add a few test services under [1] that are used by this extension, and add a few tests under [2] that verify that the test services are activated. The goal is only to verify that your extension does use the supplied services, so you can detect that in any suitable way: for example have your test service throw an exception that helps verify that it is present, or set something specific in the response that the tests can detect.

We can also discuss this on the sling dev list if you need more details.

[1] http://svn.apache.org/repos/asf/sling/trunk/launchpad/test-services/
[2] http://svn.apache.org/repos/asf/sling/trunk/launchpad/integration-tests/

> Provide a way to configure IOManager/PropertyManager handlers at runtime.
> -------------------------------------------------------------------------
>
>                 Key: SLING-2185
>                 URL: https://issues.apache.org/jira/browse/SLING-2185
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Webdav 2.1.0
>            Reporter: Timothee Maret
>            Priority: Minor
>         Attachments: io-handler-service-reactif.patch, io-handler-service.patch
>
>
> Currently, the handlers for the IOManager and PropertyManager instances are defined in the org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig class.
> This is not flexible and make it difficult to add project specific handlers in the configuration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2185) Provide a way to configure IOManager/PropertyManager handlers at runtime.

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13094400#comment-13094400 ] 

Felix Meschberger commented on SLING-2185:
------------------------------------------

Thanks for providing the patch. I will look into it and apply it if suitable.

> Provide a way to configure IOManager/PropertyManager handlers at runtime.
> -------------------------------------------------------------------------
>
>                 Key: SLING-2185
>                 URL: https://issues.apache.org/jira/browse/SLING-2185
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Webdav 2.1.0
>            Reporter: Timothee Maret
>            Assignee: Felix Meschberger
>            Priority: Minor
>         Attachments: io-handler-service-reactif.patch, io-handler-service.patch, io-handler-service.patch
>
>
> Currently, the handlers for the IOManager and PropertyManager instances are defined in the org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig class.
> This is not flexible and make it difficult to add project specific handlers in the configuration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2185) Provide a way to configure IOManager/PropertyManager handlers at runtime.

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13095238#comment-13095238 ] 

Felix Meschberger commented on SLING-2185:
------------------------------------------

Applied the jcr/webdav bundle patch slightly modified in Rev. 1164020.

My changes:
  - have a common generic handler class to manage the list of IOHandler and PropertyHandler services
  - use an internal TreeMap based on DS functionality to get the sorted handler list (instead of the ServiceTracker)
  - Don't register the IOManager and PropertyManager implementations as services but create them directly from within the WebDav servlet

> Provide a way to configure IOManager/PropertyManager handlers at runtime.
> -------------------------------------------------------------------------
>
>                 Key: SLING-2185
>                 URL: https://issues.apache.org/jira/browse/SLING-2185
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Webdav 2.1.0
>            Reporter: Timothee Maret
>            Assignee: Felix Meschberger
>            Priority: Minor
>         Attachments: io-handler-service-reactif.patch, io-handler-service.patch, io-handler-service.patch
>
>
> Currently, the handlers for the IOManager and PropertyManager instances are defined in the org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig class.
> This is not flexible and make it difficult to add project specific handlers in the configuration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SLING-2185) Provide a way to configure IOManager/PropertyManager handlers at runtime.

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

Timothee Maret updated SLING-2185:
----------------------------------

    Attachment: io-handler-service-reactif.patch

> Provide a way to configure IOManager/PropertyManager handlers at runtime.
> -------------------------------------------------------------------------
>
>                 Key: SLING-2185
>                 URL: https://issues.apache.org/jira/browse/SLING-2185
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Webdav 2.1.0
>            Reporter: Timothee Maret
>            Priority: Minor
>         Attachments: io-handler-service-reactif.patch, io-handler-service.patch
>
>
> Currently, the handlers for the IOManager and PropertyManager instances are defined in the org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig class.
> This is not flexible and make it difficult to add project specific handlers in the configuration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SLING-2185) Provide a way to configure IOManager/PropertyManager handlers at runtime.

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

Timothee Maret updated SLING-2185:
----------------------------------

    Attachment: io-handler-service.patch

> Provide a way to configure IOManager/PropertyManager handlers at runtime.
> -------------------------------------------------------------------------
>
>                 Key: SLING-2185
>                 URL: https://issues.apache.org/jira/browse/SLING-2185
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Webdav 2.1.0
>            Reporter: Timothee Maret
>            Priority: Minor
>         Attachments: io-handler-service.patch
>
>
> Currently, the handlers for the IOManager and PropertyManager instances are defined in the org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig class.
> This is not flexible and make it difficult to add project specific handlers in the configuration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2185) Provide a way to configure IOManager/PropertyManager handlers at runtime.

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

Bertrand Delacretaz commented on SLING-2185:
--------------------------------------------

Thanks for your patch!

To avoid using a timer, I suggest a different pattern to refresh the list of services dynamically, here's an example:


public FooBackend getFooBackend(String id) throws IllegalArgumentException {
        maybeReloadList();
        final FooBackend result = FooBackends.get(id);
        if(result == null) {
            throw new IllegalArgumentException("FooBackend having id=" + id + " not found");
        }
        return result;
    }
    
    private synchronized void maybeReloadList() {
        if(tracker.getTrackingCount() != trackingCount) {
            final Map<String, FooBackend> newMap = new HashMap<String, FooBackend>();
            final Object [] svc = tracker.getServices();
            if(svc != null) {
                for(Object o : svc) {
                    final FooBackend cb = (FooBackend)o;
                    newMap.put(cb.getId(), cb);
                }
            }
            
            FooBackends = newMap;
            trackingCount = tracker.getTrackingCount();
            log.info("Reloaded FooBackend services: {}", FooBackends.values());
        }
    }

This will even take service ordering into account, as ServiceTracker.getTrackingCount() changes any time a change to a relevant service happens.

Not also that you do not need to implement the Comparator<ServiceReference> yourself, as specified at http://www.osgi.org/javadoc/r4v42/org/osgi/framework/ServiceReference.html comparing ServiceReferences does take the service ranking into account.

> Provide a way to configure IOManager/PropertyManager handlers at runtime.
> -------------------------------------------------------------------------
>
>                 Key: SLING-2185
>                 URL: https://issues.apache.org/jira/browse/SLING-2185
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Webdav 2.1.0
>            Reporter: Timothee Maret
>            Priority: Minor
>         Attachments: io-handler-service.patch
>
>
> Currently, the handlers for the IOManager and PropertyManager instances are defined in the org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig class.
> This is not flexible and make it difficult to add project specific handlers in the configuration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2185) Provide a way to configure IOManager/PropertyManager handlers at runtime.

Posted by "Timothee Maret (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13087024#comment-13087024 ] 

Timothee Maret commented on SLING-2185:
---------------------------------------

Thanks for reviewing it! The second patch (io-handler-service-reactif.patch) takes your hints into account and update the service list on demand.


> Provide a way to configure IOManager/PropertyManager handlers at runtime.
> -------------------------------------------------------------------------
>
>                 Key: SLING-2185
>                 URL: https://issues.apache.org/jira/browse/SLING-2185
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Webdav 2.1.0
>            Reporter: Timothee Maret
>            Priority: Minor
>         Attachments: io-handler-service-reactif.patch, io-handler-service.patch
>
>
> Currently, the handlers for the IOManager and PropertyManager instances are defined in the org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig class.
> This is not flexible and make it difficult to add project specific handlers in the configuration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (SLING-2185) Provide a way to configure IOManager/PropertyManager handlers at runtime.

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

Felix Meschberger reassigned SLING-2185:
----------------------------------------

    Assignee: Felix Meschberger

> Provide a way to configure IOManager/PropertyManager handlers at runtime.
> -------------------------------------------------------------------------
>
>                 Key: SLING-2185
>                 URL: https://issues.apache.org/jira/browse/SLING-2185
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Webdav 2.1.0
>            Reporter: Timothee Maret
>            Assignee: Felix Meschberger
>            Priority: Minor
>         Attachments: io-handler-service-reactif.patch, io-handler-service.patch, io-handler-service.patch
>
>
> Currently, the handlers for the IOManager and PropertyManager instances are defined in the org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig class.
> This is not flexible and make it difficult to add project specific handlers in the configuration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (SLING-2185) Provide a way to configure IOManager/PropertyManager handlers at runtime.

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

Felix Meschberger resolved SLING-2185.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: JCR Webdav 2.1.2

Everyting seems to be building and tests passing. Thanks again for providing the patch.

> Provide a way to configure IOManager/PropertyManager handlers at runtime.
> -------------------------------------------------------------------------
>
>                 Key: SLING-2185
>                 URL: https://issues.apache.org/jira/browse/SLING-2185
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Webdav 2.1.0
>            Reporter: Timothee Maret
>            Assignee: Felix Meschberger
>            Priority: Minor
>             Fix For: JCR Webdav 2.1.2
>
>         Attachments: io-handler-service-reactif.patch, io-handler-service.patch, io-handler-service.patch
>
>
> Currently, the handlers for the IOManager and PropertyManager instances are defined in the org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig class.
> This is not flexible and make it difficult to add project specific handlers in the configuration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2185) Provide a way to configure IOManager/PropertyManager handlers at runtime.

Posted by "Timothee Maret (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13086981#comment-13086981 ] 

Timothee Maret commented on SLING-2185:
---------------------------------------

The io-handler-service.patch allow dynamic configuration.
It runs the IOManager, PropertyManager and handlers implementations as services.

> Provide a way to configure IOManager/PropertyManager handlers at runtime.
> -------------------------------------------------------------------------
>
>                 Key: SLING-2185
>                 URL: https://issues.apache.org/jira/browse/SLING-2185
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Webdav 2.1.0
>            Reporter: Timothee Maret
>            Priority: Minor
>         Attachments: io-handler-service.patch
>
>
> Currently, the handlers for the IOManager and PropertyManager instances are defined in the org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig class.
> This is not flexible and make it difficult to add project specific handlers in the configuration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2185) Provide a way to configure IOManager/PropertyManager handlers at runtime.

Posted by "Timothee Maret (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13090200#comment-13090200 ] 

Timothee Maret commented on SLING-2185:
---------------------------------------

Thanks for the hints. The last last patch contains an integration test that runs many dummy IOHandler services and test if they are executed according to the service ranking parameter.

> Provide a way to configure IOManager/PropertyManager handlers at runtime.
> -------------------------------------------------------------------------
>
>                 Key: SLING-2185
>                 URL: https://issues.apache.org/jira/browse/SLING-2185
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Webdav 2.1.0
>            Reporter: Timothee Maret
>            Priority: Minor
>         Attachments: io-handler-service-reactif.patch, io-handler-service.patch, io-handler-service.patch
>
>
> Currently, the handlers for the IOManager and PropertyManager instances are defined in the org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig class.
> This is not flexible and make it difficult to add project specific handlers in the configuration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira