Hi Vidura,

Why are we define two different bean classes(HttpListenerConfiguration
,HttpsListenerConfiguration) for this purpose. Can't we use one bean class(
ListenerConfiguration) similar as in carbon-transport[1] and define all
variables in that class like[2].

1.
https://github.com/wso2/carbon-transports/blob/master/http/org.wso2.carbon.transport.http.netty/src/main/java/org/wso2/carbon/transport/http/netty/config/TransportsConfiguration.java#L62
2.
https://github.com/wso2/carbon-transports/blob/master/http/org.wso2.carbon.transport.http.netty/src/main/java/org/wso2/carbon/transport/http/netty/config/ListenerConfiguration.java

Thanks
Danesh

On Tue, Feb 21, 2017 at 6:33 PM, Vidura Nanayakkara <[email protected]>
wrote:

> Hi all,
>
> *Note:* This email is in reference to the "[Architecture] Carbon C5 - Se
> rver Configuration Model" previously sent to the Architecture mail thread.
>
> I am currently working on moving the
>
>    1. C5 server configuration model out of the carbon.core [1]
>    <https://github.com/wso2/carbon-kernel/issues/1285> and creating a
>    separate component which will support both OSGi and standalone mode.
>    2. Using the C5 server configuration model to configure the executor
>    pool in MSF4J
>
> However, there is an issue that needs to be addressed in relation to the
> C5 configuration model and is as stated below:
>
> Maven configuration plugin currently looks at the class template to
> process configurations. However, this has certain limitations considering
> the below example.
>
> Let's say for instance that I want to have the following configuration
> segment created.
>
> listenerConfigurations:
> -
>   id: "msf4j-http"
>   host: "127.0.0.1"
>   port: 8080
> -
>   id: "jaxrs-http"
>   host: "0.0.0.0"
>   port: 8094
>   scheme: https
>   keyStoreFile: "src/test/resources/cert.jks"
>   keyStorePass: secret
>   certPass: secret
>
>
> In order to create the above configuration, I may write any of the
> below-mentioned code segments.
>
> 1)
>
> @Element(description = "Listener configurations")
>     private List<Configuration> listenerConfigurations =
>             Arrays.asList(new HttpListenerConfiguration(), new 
> HttpsListenerConfiguration());
>
>
> Since the plugin only looks at the argument type I will not be able to
> have the above-mentioned configuration (Plugin will check for annotations
> inside the "Configuration" class and therefore only the elements in the
> "Configuration" class will be written to the configuration file)
>
>
> 2)
>
> @Element(description = "Listener configurations")
>     private List<Object> listenerConfigurations =
>             Arrays.asList(new HttpListenerConfiguration(), new 
> HttpsListenerConfiguration());
>
> Since the plugin only looks at the argument type I will not be able to
> have the above-mentioned configuration (Plugin will check for annotations
> inside the "Object" class). Furthermore since "Object" class doesn't have
> any annotation, I will not have any of the configuration elements at all.
>
> 3)
>
> @Element(description = "Listener configurations")
>     private List listenerConfigurations =
>             Arrays.asList(new HttpListenerConfiguration(), new 
> HttpsListenerConfiguration());
>
>
> This will throw an exception since the argument type is not stated within
> the angle brackets (should take as Object by default right?)
>
> *Suggestion*
>
>    - Consider the instance rather than the reference type when creating
>    the configuration file to solve the above problems.
>    - Iterate through inherited classes when creating the configuration
>    file. This way we can avoid duplicating the same code in multiple places
>    and help solve the problem stated in (1)
>
>
> WDYT?
>
> [1] carbon-kernel issue 1285
> <https://github.com/wso2/carbon-kernel/issues/1285>
>
> Best Regards,
>
> *Vidura Nanayakkara*
> Software Engineer
>
> Email : [email protected]
> Mobile : +94 (0) 717 919277 <+94%2071%20791%209277>
> Web : http://wso2.com
> Blog : https://medium.com/@viduran <http://wso2.com/>
> Twitter : http://twitter.com/viduranana
> LinkedIn : https://lk.linkedin.com/in/vidura-nanayakkara
> <http://wso2.com/>
>
> _______________________________________________
> Architecture mailing list
> [email protected]
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
>


-- 

*Danesh Kuruppu*
Senior Software Engineer | WSO2

Email: [email protected]
Mobile: +94 (77) 1690552
Web: WSO2 Inc <https://wso2.com/signature>
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to