[Yanel-dev] policy viewer refactoring (inside "policymanager" resource-type)

Michael Wechner michael.wechner at wyona.com
Tue Mar 23 07:21:53 CET 2010


One more item (apart from the API spec) which comes to my mind is 
testing. Do we have tests for the current policy manager resource? If 
not, then let's write some tests before we continue with the refactoring ...

Thanks

Michi

Guillaume Déflache wrote:
> Michael Wechner schrieb:
>> Guillaume Déflache wrote:
>>> Hi!
>>>
>>> For a project I need to implement some specific behaviour for the 
>>> policy viewer.
>>> So as to also reuse existing Yanel code for other unchanged things 
>>> I'd need to be able to reuse parts of the existing Yanel 
>>> implementation.
>>>
>>>
>>> ATM alas the policy viewer is implemented by calling the sole static 
>>> method PolicyViewer#getXHTMLView(PolicyManager pm, GroupManager gm, 
>>> String path, String contentItemId, [other view options' parameters]) 
>>> which does not allow any kind of overriding.
>>>
>>>
>>> I'd like to introduce the following method in 
>>> org.wyona.yanel.impl.resources.policymanager.PolicyManagerResource:
>>>
>>>     protected PolicyViewer getPolicyViewer(PolicyManager pm, 
>>> GroupManager gm, [other view options' parameters]);
>>>
>>> with the visible API of PolicyViewer being:
>>>
>>>     InputStream getXHTMLInputStream(String path, String 
>>> contentItemId) throws Exception
>>>
>>> Then I would be able to just change the used resource-type in 
>>> $MY_SPECIFIC_REALM_DIR/src/webapp/global-resource-configs/policy-manager_yanel-rc.xml 
>>> to one using my own PolicyViewer-based Java class!
>>>
>>> WDYT?
>>
>> What exactly would you like to do?
>
> The 1st thing I would like to do is to able to use the existing 
> PolicyManagerResource as it is now, except I'd like to replace the 
> PolicyViewer by another project-specific class, possibly reusing some 
> parts of Yanel's original PolicyViewer implementation at a later stage.
>
>
>> The reason I am asking is because I think "overriding/inheritance" is 
>> not always a good thing and maybe it's better to introduce
>> appropriate interfaces.
>
> I do suggest introducing an API when I write "the visible API of 
> PolicyViewer", even if in this 1st step it would not be a Java 
> interface per se.
> But indeed we should introduce a PolicyViewerV1 Java interface at some 
> point, except for now I am not 100% sure if what I suggest is 
> sufficient even for my own needs and if I would not need a 
> finer-grained one later on. So I'd rather use a class than an 
> interface at this point to avoid setting it in stone too early.
>
>
> Hope this clears things a bit.
>
> Cheers,
>    Guillaume



More information about the Yanel-development mailing list