geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: Constructing reference patterns
Date Tue, 08 Feb 2005 01:50:23 GMT
I talked about this with Alan and Dain a bit and they have some  
additional points that I hopefully won't misrepresent too badly.

First of all everyone likes the first choice better, indicate the stuff  
to leave out and use wildcards for.

Dain suggested including the type in the reference object, set in the  
GBeanInfo.  I think this will work most of the time but I think there  
may be cases that involve multiple patterns that cannot be handled with  
a single type, so I think we need to keep an option to specify the  
type.  Perhaps this is only needed when you specify the literal name  
anyway.

Alan pointed out that the keys fall into two categories: implicit  
(derivable from the context) and explicit (not derivable from the  
context).  For jsr-77 naming, implicit keys are domain, server,  
application, module, and type, whereas the only explicit key is name.

For implicit keys, if the key is not mentioned in the reference  
pattern, it should be included with the value from the context.
If it is mentioned with a value, it should be included with that value.
if it is mentioned with no value or * or some such marker, it should be  
omitted and the pattern includes *

For explicit keys, all explicit keys must be mentioned in the pattern
If the key is mentioned with a value, it should be included with that  
value
if the key is mentioned with * or some such it will be ommitted and the  
pattern include *.

if we allowed you to leave out an explicit key, it would have to mean  
the same as wildcarding it, and that could produce unexpectedly large  
numbers of matches.

So, lets try some new-style examples.

Remember the type is set in the GBeanInfo, so we don't need to specify  
it.

<reference name="ManagedConnectionFactories">
   <name>*</name>
</reference>
gets all MCF deployed in the current application

<reference name="ManagedConnectionFactories">
   <application>null</application>
   <module>*</module>   //or <module/>
   <name>*</name>
</reference>
gets all MCF deployed in a standalone, non-ear module.

<reference name="StatelessSessionBeans">
   <module>*</module>
   <name>bar</name>
</reference>
gets all stateless session beans in the current ear named "bar".  This  
would typically be used to resolve an ejb link. (see GERONIMO-552)

<reference name="ManagedConnectionFactories">
   <gbeanName>geronimo.server:name=foo,*</gbeanName>
</reference>
supplies the complete gbean name explicitly.

There's a question about whether the parts should be specified with  
elements or attributes.  I think elements will be clearer and provide  
more possibilities for validation, but I'm open to suggestions.   
There's also potential for confusion between the reference name and the  
name key of the reference pattern.


Also, I'd like opinions on the choice of
<module>*</module>
or
<module/>
or something else to show that a key is left out of the query and the  
query becomes a wildcard.

thanks
david jencks






On Feb 6, 2005, at 12:13 PM, David Jencks wrote:

> Currently specifying gbean reference patterns in plans is nearly  
> impossible without referring to geronimo.log, finding the actual name  
> of the intended target, and copying it back into the plan, and then  
> testing to see if you got it right and your referencing gbean actually  
> starts or if there is some other pattern gotcha waiting nearby to jump  
> out and force your gbean back into waiting forever.
>
> (As a side note, just to distract you from the main subject of this  
> note, it would be handy to have a service that attempts to start all  
> non-started gbeans and tells you why they wont start.  Perhaps this  
> could be exposed as a command line tool or from the debug-tool.)
>
> I think this could be helped considerably by a better syntax for  
> specifying the pattern, not requiring you to write a whole object name  
> yourself.
>
> In general, there are:
> 1) keys you want to specify the value of (typically j2eeType or name)
> 2) keys you want to inherit from your current context (typically  
> J2EEServer, sometimes J2EEApplication and/or various module types)
> 3) keys you want to leave out and wildcard.
>
> There's a bit of an issue with references to e.g. application gbeans  
> that don't have so many keys as regular component/gbean names.  Since  
> there are very few if any of these currently, and the names are  
> simpler, I think it would be acceptable to require that these patterns  
> be completely and explicitly specified.
>
> Here's a proposal for each of the categories above
>
> 1) specify the value explicitly in an element
> 2) do not mention the key
> 3) mention the key with an "omit" attribute or with an element content  
> of "*"
>
> Here are some examples:
>
> <reference name="Foo">
>   <application>null</application>
>   <module>*</module>
>   <type>JCAManagedConnectionFactory</type>
>   <name>*</name>
> </reference>
> gets all MCF deployed in a standalone module.
>
> <reference name="Foo">
>   <module>*</module>
>   <type>StatelessSessionBean</type>
>   <name>bar</name>
> </reference>
> gets all stateless session beans in the current ear named "bar".  This  
> would typically be used to resolve an ejb link. (see GERONIMO-552)
>
> Alternatively these rules:
>
> 1) specify the value explicitly in an element
> 2) specify inherit, perhaps by an empty element
> 3) omit the key
>
> the same examples:
>
> <reference name="Foo">
>   <domain/>
>   <server/>
>   <application>null</application>
>   <type>JCAManagedConnectionFactory</type>
> </reference>
> gets all MCF deployed in a standalone module.
>
> <reference name="Foo">
>   <domain/>
>   <server/>
>   <application/>
>   <type>StatelessSessionBean</type>
>   <name>bar</name>
> </reference>
> gets all stateless session beans in the current ear named "bar".  This  
> would typically be used to resolve an ejb link. (see GERONIMO-552)
>
> For explicitly specifying an entire object name we should introduce an  
> enclosing element to avoid mixed content:
>
> <reference  
> name="Foo"><gbeanName>geronimo.server: 
> J2EEServer=geronimo,J2EEApplication=null,WebModule=org/foo/ 
> bar,j2eeType=Servlet,*</gbeanName></reference>
>
> Comments?
>
> thanks
> david jencks
>
>
>
>


Mime
View raw message