+1
On Fri, Aug 22, 2014 at 2:02 AM, Nirmal Fernando <nirmal070...@gmail.com> wrote: > Hi Akila, > > You would need to implement the interface and add the fully qualified > class name of it, to the META-INF/services folder in a file named " > org.apache.stratos.manager.subscription.filter.SubscriptionFilter" (I am > planning to use the Java ServiceLoader - > http://docs.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html) > > > On Fri, Aug 22, 2014 at 10:38 AM, Akila Ravihansa Perera < > raviha...@wso2.com> wrote: > >> Hi Nirmal, >> >> This is a very useful feature to have. >> >> Can you please give some implementation details about how we can hook a >> custom filter processor to the filter chain? >> >> Thanks. >> On 21 Aug 2014 09:28, "Nirmal Fernando" <nirmal070...@gmail.com> wrote: >> >>> Hi All, >>> >>> Currently, there's no clean way to intercept a subscription request and >>> do some pre-processing. As of now, we do some pre-processing of a >>> subscription request in order to identify the need of a load balancer and >>> act accordingly. I currently have another use-case to intercept a >>> subscription request and act upon a parameter. >>> >>> Hence, to make the code clean over there, I propose we introduce a >>> Subscription Filter chain where you could intercept a subscription request >>> and do some pre-processing before creating the actual subscription. >>> >>> Following is the interface design, I've come up with. >>> >>> /** >>> >>> * Intercepts the flow of Cartridge Subscription. >>> >>> * Implementations of this class would get executed before making the >>> real subscription. >>> >>> */ >>> >>> public interface SubscriptionFilter { >>> >>> >>> /** >>> >>> * Do some pre-processing on a subscription request. >>> >>> * @param cartridgeInfo {@link CartridgeInfo} >>> >>> * @param subscriptionData {@link SubscriptionData} >>> >>> * @return {@link Properties}, if there are any. >>> >>> * @throws ADCException on a failure while processing. >>> >>> */ >>> >>> public Properties execute(CartridgeInfo cartridgeInfo, SubscriptionData >>> subscriptionData) throws ADCException ; >>> >>> } >>> >>> Let me know your thoughts. >>> >>> -- >>> Best Regards, >>> Nirmal >>> >>> Nirmal Fernando. >>> PPMC Member & Committer of Apache Stratos, >>> Senior Software Engineer, WSO2 Inc. >>> >>> Blog: http://nirmalfdo.blogspot.com/ >>> >> > > > -- > Best Regards, > Nirmal > > Nirmal Fernando. > PPMC Member & Committer of Apache Stratos, > Senior Software Engineer, WSO2 Inc. > > Blog: http://nirmalfdo.blogspot.com/ > -- Imesh Gunaratne Technical Lead, WSO2 Committer & PMC Member, Apache Stratos