Re: [Dev] [APIM] [1.9.1] Tenant specific handler

2015-12-25 Thread Malith Munasinghe
Hi Sanjeewa,

Thank you for your help. I managed to get it done using apiContext to check
whether it contains the tenant domain.

Regards,
Malith
On Dec 23, 2015 10:55, "Sanjeewa Malalgoda"  wrote:

> If need you can write logic to check user name and fetch tenant domain
> from that.
> Then you may add if check to check tenant name before adding your handler.
> There are samples available and you may try that.
> But we normally do not recommend to do this kind of modifications unless
> its special tenant(some thing like organization tenant).
>
> Thanks,
> sanjeewa.
>
> On Wed, Dec 23, 2015 at 10:37 AM, Malith Munasinghe 
> wrote:
>
>> Removing [support-dev]
>>
>> On Wed, Dec 23, 2015 at 10:32 AM, Malith Munasinghe 
>> wrote:
>>
>>> Hi All,
>>>
>>> I am writing a custom handler. This handler needs to be added only to a
>>> specific tenant only. When I add it to the velocity_template.xml it gets
>>> applied to all the tenants.
>>>
>>> Is there a way to achieve this through velocity_template.xml itself ?
>>>
>>> Regards,
>>> Malith
>>>
>>> --
>>> Malith Munasinghe | Software Engineer
>>> M: +94 (71) 9401122
>>> E: mali...@wso2.com
>>> W: http://wso2.com
>>>
>>
>>
>>
>> --
>> Malith Munasinghe | Software Engineer
>> M: +94 (71) 9401122
>> E: mali...@wso2.com
>> W: http://wso2.com
>>
>
>
>
> --
>
> *Sanjeewa Malalgoda*
> WSO2 Inc.
> Mobile : +94713068779
>
> blog
> :http://sanjeewamalalgoda.blogspot.com/
> 
>
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [Hiera] Deeper hash merge instead of Native hash merge?

2015-12-25 Thread Akila Ravihansa Perera
Hi Raj,

It is true that native hash merging has its own limitations which would
lead to data duplication in some cases. But we need to analyze the
trade-off between data duplication against readability and trace-ability
aspects. IMHO, it's okay to have few data duplication if it makes things
more simple and less error prone.

My concern is that what if this accidentally leads to unexpected data
merging? I understand that native merging will merge the top level keys as
well, but that is less susceptible for human errors compared to N-level
deep merge.

Also have a look at Puppet official docs about deep merging [1]. Looks like
it is mainly intended for complex data structures and converting them to
Puppet resources.

We can ask the users to create their own Hiera data structures with deeper
merging if they are comfortable with it. But given the additional
complexity involved in configuring and installing deep_merge library [2],
shall we ship native merge data structures by default?

[1]
https://docs.puppetlabs.com/hiera/3.0/lookup_types.html#deep-merging-in-hiera
[2]
https://docs.puppetlabs.com/hiera/3.0/lookup_types.html#deep-merging-in-hiera

Thanks.

On Fri, Dec 25, 2015 at 10:45 AM, Rajkumar Rajaratnam 
wrote:

> Hi Devs,
>
> We are using *Native* hash merge right now. *It merges only the top-level
> keys and values in each source hash. If the same key exists in both a lower
> priority source and a higher priority source, the higher priority value
> will be used. *But it doesn't allow us to override a nested hash.
>
> Lets take an example,
>
> *hiera.yaml*
>
> ---
> :hierarchy:
> - "wso2/%{::product_name}/%{::product_version}/default"
> - wso2/common
> :backends:
> - yaml
> :yaml:
> :datadir: "hieradata/%{::environment}"
>
> *wso2/common.yaml*
>
> ---
> # Deployment synchronization configuration
> wso2::dep_sync :
> enabled : false
> auto_checkout : true
> auto_commit : false
> repository_type : svn
> svn :
>   url : http://svnrepo.example.com/repos/
>user : username
>password : password
>append_tenant_id: true
>
> *wso2/wso2esb/4.9.0/default.yaml*
>
> ---
> wso2::dep_sync :
> enabled : true
> svn :
>   url : http://rajkumar.com/repos/
>
>
> *Native* hash merge would return the following;
>
> {
>"enabled"   =>true,
>"auto_checkout"   =>true,
>"auto_commit"   =>false,
>"repository_type"   =>"svn",
>"svn"   =>   {
>   "url"  =>"http://rajkumar.com/repos/";
>}
> }
>
> *Deeper* hash merge would return the following;
>
> {
>"enabled"   =>true,
>"auto_checkout"   =>true,
>"auto_commit"   =>false,
>"repository_type"   =>"svn",
>"svn"   =>   {
>   "url"  =>"http://rajkumar.com/repos/";,
>   "user"  =>"username",
>   "password"  =>"password",
>   "append_tenant_id"  =>true
>}
> }
>
>
> If we use *Native* hash merging, we need to copy the complete nested hash
> ("svn" in above example) and override it. If we use *Deeper* hash
> merging, we can copy only a part of a nested hash and override it. As you
> can see, *Deeper* hash merge reduces data duplication.
>
> Thoughts please.
>
> Thanks,
> Raj.
>
> --
> Rajkumar Rajaratnam
> Committer & PMC Member, Apache Stratos
> Software Engineer, WSO2
>
> Mobile : +94777568639
> Blog : rajkumarr.com
>



-- 
Akila Ravihansa Perera
WSO2 Inc.;  http://wso2.com/

Blog: http://ravihansa3000.blogspot.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev