[ 
https://issues.apache.org/jira/browse/SLING-4154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14207809#comment-14207809
 ] 

Marius Petria commented on SLING-4154:
--------------------------------------

Question from [~tripod]: why don't you rely on OSGi alone? it seems like you 
recreate the
service/component registration.


Answer:
Agents have several subcomponents. We want the agent to be the unit of 
configuration, i.e. the agent configuration must be able to personalize all its 
subcomponents. So the problem was: how do we build an agent and its 
subcomponents from a map of properties that contains also the configs for the 
subcomponents. The solution to that was to have a factory that can parse the 
map of properties and assemble everything. You can see in [1] how such a deep 
configuration looks like for an agent.

[1] 
https://github.com/apache/sling/blob/37d51791611f20aa7c4e927fd3eaefc499ff8215/contrib/extensions/distribution/sample/src/main/resources/SLING-CONTENT/libs/sling/distribution/jcrsettings/agents/jpublish.json

> Discuss distribution components creation and configuration 
> -----------------------------------------------------------
>
>                 Key: SLING-4154
>                 URL: https://issues.apache.org/jira/browse/SLING-4154
>             Project: Sling
>          Issue Type: Task
>          Components: Distribution
>            Reporter: Marius Petria
>
> Distribution has one main component (agent) and several secondary components 
> (triggers, exporters and importers).
> These can be created as java objects using a DistributionComponentFactory. 
> The core framework provides a DefaultDistributionComponentFactory that will 
> create the components implemented in the core but a client can define its own 
> components and factory and the default component factory will use those to 
> create a component it does not know of.
> The core framework also provides two ways of registering such a java object 
> as an OSGI service:
> 1. using osgi configs, the osgi properties are parsed and passed to the 
> factory, a component is created and registered 
> (GenericDistributionComponentFactory)
> 2. resource configs, the properties of a resource are parsed and passed to 
> the factory, a component is created and registered 
> (ResourceBasedDistributionComponentFactory)
> Components registered as OSGI services are available as resources via 
> OsgiServicePropertiesResourceProvider.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to