+1
On Wed, Dec 11, 2013 at 3:16 AM, Sajith Kariyawasam <[email protected]> wrote: > Hi all, > > While implementing service deployment functionality for super tenant, I > found bit hard to plug a new subscription tenancy behaviour for a > CartidgeSubscription. > > Please correct me if I'm wrong, I wanted to add a new tenancy behaviour > for a FrameworkCartirdgeSubscription, but subscriptionTenancyBehaviour is > initialized to the relevant concrete class inside CartidgeSubscription, > which I think is not good, because that will lose the extension capability > without modifying the base class, for eg, if I want to add a new > subscriptionTenancyBehaviour, I will have to modify CartidgeSubscription > class, which is not correct. It would have been better if > the constructor of CartidgeSubscription accepts a type of > subscriptionTenancyBehaviour, and do the assignment inside the > CartidgeSubscription class, so that when instantiating a > CartidgeSubscription, the relevant subscriptionTenancyBehaviour would also > need to pass in. > > But then another problem comes, that is, subscriptionTenancyBehaviour "has > a" CartidgeSubscription, therefore when instantiating a > subscriptionTenancyBehaviour, cartridgeSubscription has to be passed in > constructor, therefore there is no way > to create a subscriptionTenancyBehaviour outside of a > cartridgeSubscription. > > However it seems that we can move cartridgeSubscription to the method > signatures of SubscriptionTenancyBehaviour, and also by > invoking subscriptionTenancyBehaviour's relevant operations from > "CartridgeSubscription" abstract class ( which should be the correct design > approach IMO, rather than to invoke it from the concrete class ) this can > be sorted out. > > Otherwise, for every addition of subscription tenant behaviours (which is > possible in the future) CartidgeSubscription need to be changed, also some > more parameters need to be passed to identify which class to be > instantiated. > > WDYT ? > > > -- > *Sajith Kariyawasam* > *Senior Software Engineer; WSO2, Inc.* > *AMIE (SL)* > *Blog: http://sajithblogs.blogspot.com/ <http://sajithblogs.blogspot.com/>* > *Mobile: +94772269575 <%2B94772269575>* > -- Thanks and Regards, Isuru H. Software Engineer, WSO2 Inc. +94 716 358 048* <http://wso2.com/>*
