You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by Randy Watler <wa...@wispertel.net> on 2009/02/18 15:30:53 UTC

Adding Required Spring Categories Metadata for Filtering

Gang,

I have been pondering how to add a switch type flag to be used to select 
cross component technology implementations within the Spring 
configurations for J2. I am pondering categories like 'ojb' and 'jpa'. 
To be honest, I really am not convinced that filter/categories is the 
greatest solution, but I am trying to work with it.

The filtering logic seems to be strictly an 'OR' operation. In other 
words, if any category defined in the meta data matches the current 
category set, the bean is included. Selecting cross concerns like 'ojb' 
or 'jpa' might be easier to specify as an 'AND' operation. Basically, I 
want to say something like: "use this bean only if a specific category 
is defined" in addition to the existing categories logic.

I am doubling down on the complexity for sure, but I am wondering if 
this approach would have any objectors? Perhaps it is already 
implemented? Just checking first before I go down the path. All feedback 
welcome.

Randy

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: Adding Required Spring Categories Metadata for Filtering

Posted by Ate Douma <at...@douma.nu>.
Randy Watler wrote:
> David/Ate,
> 
> Am going to implement David's suggestion and and recognize a CSV list as 
> a special case, (i.e. 'X,Y,Z' -> 'X or Y or Z'), to maintain a limited 
> backwards compatibility support. Let me know if we can simply drop the 
> CSV case and I will in the name of simplicity.

+1 to both David's suggestion and *no* backwards compatibility for the current CSV list usage.
We currently have one internal project build against the trunk but we can easily update that ourselves, and a few other client projects 
working against a branch so they are not (immediately) harmed by that either.

Good timing by the way: I was just planning to write documentation about the new Spring configuration solution ;)
I better wait a little longer until this enhancement is implemented too!

Real pitty the Springsource guys themselves never thought of or planned adding some kind of jstl or other expression language support to 
their assembly ...

Ate


> 
> Randy
> 
> David Sean Taylor wrote:
>>
>> On Feb 18, 2009, at 8:14 AM, Randy Watler wrote:
>>
>>> Ate,
>>>
>>> Thanks for the reply. I am still pondering this, so I am not sure I 
>>> am going this route. If I do, I will follow your suggestions below.
>>>
>>> Would you have any objections to using a separate meta tag key for 
>>> required, (and possibly inverse), categories? I understand the use of 
>>> a '-' and '+' in CSV lists is a pattern in Spring, but unless we 
>>> start writing full predicate expressions, the syntax is going to be 
>>> obtuse for the layman. Do you think something like this is more clear 
>>> or more confusing?
>>>
>>> <meta key="j2:requires" value="ojb"/>
>>> <meta key="j2:cat" value="dbPageMangler"/>
>>> <meta key="j2:alias" value"..."/>
>>>
>>> In fact, perhaps this is even better:
>>>
>>> <meta key="j2:requires" value="ojb"/>
>>> <meta key="j2:supports" value="dbPageMangler"/>
>>> <meta key="j2:alias" value"..."/>
>>>
>>> That way I could also support this syntax in parallel:
>>>
>>> <meta key="j2:cat" value="dbPageMangler,+ojb"/>
>>> <meta key="j2:alias" value"..."/>
>>>
>>> Thoughts?
>>>
>>
>> Expressions would be the easiest to understand. Distilling to its 
>> essence, some examples:
>>
>> (dbpm OR jpa)
>>
>> dbpm OR ojb AND serializer
>>
>>
>> <meta key="j2:cat" value="(an expression like above)"/>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
>> For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: Adding Required Spring Categories Metadata for Filtering

Posted by Randy Watler <wa...@wispertel.net>.
David/Ate,

Am going to implement David's suggestion and and recognize a CSV list as 
a special case, (i.e. 'X,Y,Z' -> 'X or Y or Z'), to maintain a limited 
backwards compatibility support. Let me know if we can simply drop the 
CSV case and I will in the name of simplicity.

Randy

David Sean Taylor wrote:
>
> On Feb 18, 2009, at 8:14 AM, Randy Watler wrote:
>
>> Ate,
>>
>> Thanks for the reply. I am still pondering this, so I am not sure I 
>> am going this route. If I do, I will follow your suggestions below.
>>
>> Would you have any objections to using a separate meta tag key for 
>> required, (and possibly inverse), categories? I understand the use of 
>> a '-' and '+' in CSV lists is a pattern in Spring, but unless we 
>> start writing full predicate expressions, the syntax is going to be 
>> obtuse for the layman. Do you think something like this is more clear 
>> or more confusing?
>>
>> <meta key="j2:requires" value="ojb"/>
>> <meta key="j2:cat" value="dbPageMangler"/>
>> <meta key="j2:alias" value"..."/>
>>
>> In fact, perhaps this is even better:
>>
>> <meta key="j2:requires" value="ojb"/>
>> <meta key="j2:supports" value="dbPageMangler"/>
>> <meta key="j2:alias" value"..."/>
>>
>> That way I could also support this syntax in parallel:
>>
>> <meta key="j2:cat" value="dbPageMangler,+ojb"/>
>> <meta key="j2:alias" value"..."/>
>>
>> Thoughts?
>>
>
> Expressions would be the easiest to understand. Distilling to its 
> essence, some examples:
>
> (dbpm OR jpa)
>
> dbpm OR ojb AND serializer
>
>
> <meta key="j2:cat" value="(an expression like above)"/>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: Adding Required Spring Categories Metadata for Filtering

Posted by David Sean Taylor <da...@bluesunrise.com>.
On Feb 18, 2009, at 8:14 AM, Randy Watler wrote:

> Ate,
>
> Thanks for the reply. I am still pondering this, so I am not sure I  
> am going this route. If I do, I will follow your suggestions below.
>
> Would you have any objections to using a separate meta tag key for  
> required, (and possibly inverse), categories? I understand the use  
> of a '-' and '+' in CSV lists is a pattern in Spring, but unless we  
> start writing full predicate expressions, the syntax is going to be  
> obtuse for the layman. Do you think something like this is more  
> clear or more confusing?
>
> <meta key="j2:requires" value="ojb"/>
> <meta key="j2:cat" value="dbPageMangler"/>
> <meta key="j2:alias" value"..."/>
>
> In fact, perhaps this is even better:
>
> <meta key="j2:requires" value="ojb"/>
> <meta key="j2:supports" value="dbPageMangler"/>
> <meta key="j2:alias" value"..."/>
>
> That way I could also support this syntax in parallel:
>
> <meta key="j2:cat" value="dbPageMangler,+ojb"/>
> <meta key="j2:alias" value"..."/>
>
> Thoughts?
>

Expressions would be the easiest to understand. Distilling to its  
essence, some examples:

(dbpm OR jpa)

dbpm OR ojb AND serializer


<meta key="j2:cat" value="(an expression like above)"/>




---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: Adding Required Spring Categories Metadata for Filtering

Posted by Randy Watler <wa...@wispertel.net>.
Ate,

Thanks for the reply. I am still pondering this, so I am not sure I am 
going this route. If I do, I will follow your suggestions below.

Would you have any objections to using a separate meta tag key for 
required, (and possibly inverse), categories? I understand the use of a 
'-' and '+' in CSV lists is a pattern in Spring, but unless we start 
writing full predicate expressions, the syntax is going to be obtuse for 
the layman. Do you think something like this is more clear or more 
confusing?

<meta key="j2:requires" value="ojb"/>
<meta key="j2:cat" value="dbPageMangler"/>
<meta key="j2:alias" value"..."/>

In fact, perhaps this is even better:

<meta key="j2:requires" value="ojb"/>
<meta key="j2:supports" value="dbPageMangler"/>
<meta key="j2:alias" value"..."/>

That way I could also support this syntax in parallel:

<meta key="j2:cat" value="dbPageMangler,+ojb"/>
<meta key="j2:alias" value"..."/>

Thoughts?

Randy

Ate Douma wrote:
> Hi Randy,
>
> See inline comments below.
>
> Randy Watler wrote:
>> Gang,
>>
>> I have been pondering how to add a switch type flag to be used to 
>> select cross component technology implementations within the Spring 
>> configurations for J2. I am pondering categories like 'ojb' and 
>> 'jpa'. To be honest, I really am not convinced that filter/categories 
>> is the greatest solution, but I am trying to work with it.
>>
>> The filtering logic seems to be strictly an 'OR' operation. In other 
>> words, if any category defined in the meta data matches the current 
>> category set, the bean is included. Selecting cross concerns like 
>> 'ojb' or 'jpa' might be easier to specify as an 'AND' operation. 
>> Basically, I want to say something like: "use this bean only if a 
>> specific category is defined" in addition to the existing categories 
>> logic.
>>
>> I am doubling down on the complexity for sure, but I am wondering if 
>> this approach would have any objectors? Perhaps it is already 
>> implemented? Just checking first before I go down the path. All 
>> feedback welcome.
> You're assessment is correct: *currently* filtering only works using 
> 'OR' operations.
> Adding 'AND' (and likely '!') operations definitely would be very 
> helpful but so far we haven't had time (nor real need) to add that.
> Doing so probably shouldn't be too difficult to do.
> The current 'OR' handling is handled in the 
> JetspeedBeanDefinitionFilter.match() method, and it simply parses the 
> list of categories specified for a bean and see if any of those match 
> the configured categories.
> Adding 'AND' and '!' logic probably can be add very easily by checking 
> if a specified category starts with a '+' (AND) or '-' (NOT) and then 
> deal with it accordingly.
>
> I surely see no objections to adding such functionality!
>
> Regards,
>
> Ate
>>
>> Randy
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
>> For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: Adding Required Spring Categories Metadata for Filtering

Posted by Ate Douma <at...@douma.nu>.
Hi Randy,

See inline comments below.

Randy Watler wrote:
> Gang,
> 
> I have been pondering how to add a switch type flag to be used to select 
> cross component technology implementations within the Spring 
> configurations for J2. I am pondering categories like 'ojb' and 'jpa'. 
> To be honest, I really am not convinced that filter/categories is the 
> greatest solution, but I am trying to work with it.
> 
> The filtering logic seems to be strictly an 'OR' operation. In other 
> words, if any category defined in the meta data matches the current 
> category set, the bean is included. Selecting cross concerns like 'ojb' 
> or 'jpa' might be easier to specify as an 'AND' operation. Basically, I 
> want to say something like: "use this bean only if a specific category 
> is defined" in addition to the existing categories logic.
> 
> I am doubling down on the complexity for sure, but I am wondering if 
> this approach would have any objectors? Perhaps it is already 
> implemented? Just checking first before I go down the path. All feedback 
> welcome.
You're assessment is correct: *currently* filtering only works using 'OR' operations.
Adding 'AND' (and likely '!') operations definitely would be very helpful but so far we haven't had time (nor real need) to add that.
Doing so probably shouldn't be too difficult to do.
The current 'OR' handling is handled in the JetspeedBeanDefinitionFilter.match() method, and it simply parses the list of categories 
specified for a bean and see if any of those match the configured categories.
Adding 'AND' and '!' logic probably can be add very easily by checking if a specified category starts with a '+' (AND) or '-' (NOT) and then 
deal with it accordingly.

I surely see no objections to adding such functionality!

Regards,

Ate
> 
> Randy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org