You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by David Blevins <da...@visi.com> on 2009/08/05 03:59:36 UTC
Fwd: JNDI Names: lower case interfaceType.annotationName?
So, the replacement we are doing now can be done without the swizzle
StringTemplate code. Small snippet as so:
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
private static final Pattern PATTERN = Pattern.compile("(\\{)(\\w+)
(})");
static String format(String input, Map<String, String> map) {
Matcher matcher = PATTERN.matcher(input);
StringBuffer buf = new StringBuffer();
while (matcher.find()) {
String key = matcher.group(2);
String value = map.get(key);
matcher.appendReplacement(buf, value);
}
matcher.appendTail(buf);
return buf.toString();
}
Then we just check the key for the ".lc", ".uc", and ".cc" suffixes,
shave them off, and munge the map value appropriately. Maybe even
support "Lc" and so on as a backwards compatible way to get rid of
having to eagerly create some of the existing keys "FooLc" keys we
have.
We could probably even add this to a class called StringTemplate and
use it as a drop in replacement.
-David
Begin forwarded message:
> Resent-From: <db...@visi.com>
> From: David Blevins <da...@visi.com>
> Date: August 4, 2009 4:03:32 PM PDT
> To: users@openejb.apache.org
> Subject: Re: JNDI Names: lower case interfaceType.annotationName?
> Reply-To: users@openejb.apache.org
>
> I'll give you some tips on the dev@ list -- should be easy to do
> with the swizzle-stream apis.
>
> -David
>
> On Aug 4, 2009, at 3:25 PM, Jonathan Gallimore wrote:
>
>> I was thinking that as I was adding the new setting to the
>> documentation. I
>> think that's a neat idea - I'll see if I can code that up.
>>
>> Jon
>>
>> On Tue, Aug 4, 2009 at 11:18 PM, David Blevins <david.blevins@visi.com
>> >wrote:
>>
>>> Maybe we should take all the entries we have and automatically
>>> make both
>>> ".lc" and ".uc" versions of them? (possibly even ".cc" for camel
>>> case). Or
>>> maybe smarten up our formatting so that they are only created on
>>> demand.
>>>
>>>
>>>
>>>
>>> On Aug 4, 2009, at 2:26 PM, Jonathan Gallimore wrote:
>>>
>>> Hi Mark,
>>>>
>>>> I've just committed this for you.
>>>>
>>>> Cheers
>>>>
>>>> Jon
>>>>
>>>> On Tue, Aug 4, 2009 at 2:16 PM, Jonathan Gallimore <
>>>> jonathan.gallimore@gmail.com> wrote:
>>>>
>>>> Hi Mark,
>>>>>
>>>>> This seems like a good addition to me, I'm more than happy to
>>>>> get this in
>>>>> (should be able to do it this evening).
>>>>>
>>>>> Cheers
>>>>>
>>>>> Jon
>>>>>
>>>>>
>>>>> On Mon, Aug 3, 2009 at 4:35 PM, Mark Taylor <mt...@gmail.com>
>>>>> wrote:
>>>>>
>>>>> First, thanks for a great project and I have a feature request.
>>>>>>
>>>>>> It seems like the default JBoss JNDI name is: {beanName}/
>>>>>> {lowercase
>>>>>> annotation type} (ie local or remote). Hence I have an
>>>>>> application
>>>>>> full of @EJB mapped-names such as: "MyStatelessBean/local".
>>>>>> From the
>>>>>> document
>>>>>>
>>>>>> http://openejb.apache.org/3.0/jndi-names.html.
>>>>>>
>>>>>> It appears we can only use interfaceType.annotationName to get
>>>>>> Local
>>>>>> or Remote (ie uppercase). Would it be possible to add:
>>>>>> interfaceType.annotationNameLowerCase to the JNDI Name formatting
>>>>>> options?
>>>>>>
>>>>>> It could go in org.apache.openejb.assembler.classic.JndiBuilder:
>>>>>>
>>>>>> public String getName(Class interfce, Interface type) {
>>>>>> StringTemplate template =
>>>>>> templates.get(interfce.getName());
>>>>>> if (template == null) template =
>>>>>> templates.get(type.getAnnotationName());
>>>>>> if (template == null) template = templates.get("");
>>>>>>
>>>>>> Map<String,String> contextData = new
>>>>>> HashMap<String,String>();
>>>>>> contextData.put("moduleId", deploymentInfo.getModuleID());
>>>>>> contextData.put("ejbType",
>>>>>> deploymentInfo.getComponentType().name());
>>>>>> contextData.put("ejbClass",
>>>>>> deploymentInfo.getBeanClass().getName());
>>>>>> contextData.put("ejbClass.simpleName",
>>>>>> deploymentInfo.getBeanClass().getSimpleName());
>>>>>> contextData.put("ejbClass.packageName",
>>>>>> packageName(deploymentInfo.getBeanClass()));
>>>>>> contextData.put("ejbName", deploymentInfo.getEjbName());
>>>>>> contextData.put("deploymentId",
>>>>>> deploymentInfo.getDeploymentID().toString());
>>>>>> contextData.put("interfaceType",
>>>>>> type.getAnnotationName());
>>>>>> contextData.put("interfaceType.annotationName",
>>>>>> type.getAnnotationName());
>>>>>> //***********************************************
>>>>>> //
>>>>>> contextData.put("interfaceType.annotationNameLC",
>>>>>> type.getAnnotationName().toLower());
>>>>>> //
>>>>>> //***********************************************
>>>>>> contextData.put("interfaceType.xmlName",
>>>>>> type.getXmlName());
>>>>>> contextData.put("interfaceType.xmlNameCc",
>>>>>> type.getXmlNameCc());
>>>>>> contextData.put("interfaceType.openejbLegacyName",
>>>>>> type.getOpenejbLegacy());
>>>>>> contextData.put("interfaceClass", interfce.getName());
>>>>>> contextData.put("interfaceClass.simpleName",
>>>>>> interfce.getSimpleName());
>>>>>> contextData.put("interfaceClass.packageName",
>>>>>> packageName(interfce));
>>>>>> return template.apply(contextData);
>>>>>> }
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>
>
>
Re: JNDI Names: lower case interfaceType.annotationName?
Posted by Jonathan Gallimore <jo...@gmail.com>.
Its in. I didn't change to StringBuilder in the end as
Matcher.appendReplacement() doesn't support it.
Cheers
Jon
On Tue, Sep 1, 2009 at 11:39 PM, David Blevins <da...@visi.com>wrote:
> Go ahead and commit it.
>
>
> On Sep 1, 2009, at 3:14 PM, Jonathan Gallimore wrote:
>
> Thanks again David. I've made those changes and attached them to the
>> issue.
>> All tests pass and it seems to work ok.
>>
>> I've just remembered that I forgot to swap to use StringBuilder - I'll do
>> that before committing. Let me know if there's any other comments!
>>
>> Cheers
>>
>> Jon
>>
>> On Mon, Aug 31, 2009 at 11:56 PM, David Blevins <david.blevins@visi.com
>> >wrote:
>>
>>
>>> On Aug 31, 2009, at 2:44 PM, Jonathan Gallimore wrote:
>>>
>>> This seems to work well, although I did break the JndiNameTest. I've
>>> fixed
>>>
>>>> this by using the StringTemplate that is used normally, and grabbing the
>>>> format string from there. This seems a bit nasty but all the
>>>> openejb-core
>>>> tests pass now (and I'll run the rest tonight).
>>>>
>>>>
>>>
>>> That does seem a bit nasty. What if we created a complete replacement
>>> StringTemplate class, something like this (refactored version of the code
>>> from your patch):
>>>
>>> public class StringTemplate {
>>>
>>> private static final Pattern PATTERN =
>>> Pattern.compile("(\\{)((\\.|\\w)+)(})");
>>>
>>> private Matcher matcher;
>>>
>>> public StringTemplate(String template) {
>>> matcher = PATTERN.matcher(template);
>>> }
>>>
>>> public String format(Map<String, String> map) {
>>> StringBuffer buf = new StringBuffer();
>>>
>>> while (matcher.find()) {
>>> String key = matcher.group(2);
>>> String value = map.get(key);
>>>
>>> if (key.toLowerCase().endsWith(".lc")) {
>>> value = map.get(key.substring(0, key.length() -
>>> 3)).toLowerCase();
>>> } else if (key.toLowerCase().endsWith(".uc")) {
>>> value = map.get(key.substring(0, key.length() -
>>> 3)).toUpperCase();
>>> } else if (key.toLowerCase().endsWith(".cc")) {
>>> value = Strings.camelCase(map.get(key.substring(0,
>>> key.length() - 3)));
>>> }
>>>
>>> matcher.appendReplacement(buf, value);
>>> }
>>>
>>> matcher.appendTail(buf);
>>> return buf.toString();
>>> }
>>>
>>> }
>>>
>>>
>>> We could throw that in the util package then just do a find/replace on
>>> org.codehaus.swizzle.stream.StringTemplate ->
>>> org.apache.openejb.util.StringTemplate
>>>
>>> Thoughts?
>>>
>>> On a side note we should use StringBuilder instead of StringBuffer.
>>>
>>> -David
>>>
>>>
>>>
>
Re: JNDI Names: lower case interfaceType.annotationName?
Posted by David Blevins <da...@visi.com>.
Go ahead and commit it.
On Sep 1, 2009, at 3:14 PM, Jonathan Gallimore wrote:
> Thanks again David. I've made those changes and attached them to the
> issue.
> All tests pass and it seems to work ok.
>
> I've just remembered that I forgot to swap to use StringBuilder -
> I'll do
> that before committing. Let me know if there's any other comments!
>
> Cheers
>
> Jon
>
> On Mon, Aug 31, 2009 at 11:56 PM, David Blevins <david.blevins@visi.com
> >wrote:
>
>>
>> On Aug 31, 2009, at 2:44 PM, Jonathan Gallimore wrote:
>>
>> This seems to work well, although I did break the JndiNameTest.
>> I've fixed
>>> this by using the StringTemplate that is used normally, and
>>> grabbing the
>>> format string from there. This seems a bit nasty but all the
>>> openejb-core
>>> tests pass now (and I'll run the rest tonight).
>>>
>>
>>
>> That does seem a bit nasty. What if we created a complete
>> replacement
>> StringTemplate class, something like this (refactored version of
>> the code
>> from your patch):
>>
>> public class StringTemplate {
>>
>> private static final Pattern PATTERN =
>> Pattern.compile("(\\{)((\\.|\\w)+)(})");
>>
>> private Matcher matcher;
>>
>> public StringTemplate(String template) {
>> matcher = PATTERN.matcher(template);
>> }
>>
>> public String format(Map<String, String> map) {
>> StringBuffer buf = new StringBuffer();
>>
>> while (matcher.find()) {
>> String key = matcher.group(2);
>> String value = map.get(key);
>>
>> if (key.toLowerCase().endsWith(".lc")) {
>> value = map.get(key.substring(0, key.length() -
>> 3)).toLowerCase();
>> } else if (key.toLowerCase().endsWith(".uc")) {
>> value = map.get(key.substring(0, key.length() -
>> 3)).toUpperCase();
>> } else if (key.toLowerCase().endsWith(".cc")) {
>> value = Strings.camelCase(map.get(key.substring(0,
>> key.length() - 3)));
>> }
>>
>> matcher.appendReplacement(buf, value);
>> }
>>
>> matcher.appendTail(buf);
>> return buf.toString();
>> }
>>
>> }
>>
>>
>> We could throw that in the util package then just do a find/replace
>> on
>> org.codehaus.swizzle.stream.StringTemplate ->
>> org.apache.openejb.util.StringTemplate
>>
>> Thoughts?
>>
>> On a side note we should use StringBuilder instead of StringBuffer.
>>
>> -David
>>
>>
Re: JNDI Names: lower case interfaceType.annotationName?
Posted by Jonathan Gallimore <jo...@gmail.com>.
Thanks again David. I've made those changes and attached them to the issue.
All tests pass and it seems to work ok.
I've just remembered that I forgot to swap to use StringBuilder - I'll do
that before committing. Let me know if there's any other comments!
Cheers
Jon
On Mon, Aug 31, 2009 at 11:56 PM, David Blevins <da...@visi.com>wrote:
>
> On Aug 31, 2009, at 2:44 PM, Jonathan Gallimore wrote:
>
> This seems to work well, although I did break the JndiNameTest. I've fixed
>> this by using the StringTemplate that is used normally, and grabbing the
>> format string from there. This seems a bit nasty but all the openejb-core
>> tests pass now (and I'll run the rest tonight).
>>
>
>
> That does seem a bit nasty. What if we created a complete replacement
> StringTemplate class, something like this (refactored version of the code
> from your patch):
>
> public class StringTemplate {
>
> private static final Pattern PATTERN =
> Pattern.compile("(\\{)((\\.|\\w)+)(})");
>
> private Matcher matcher;
>
> public StringTemplate(String template) {
> matcher = PATTERN.matcher(template);
> }
>
> public String format(Map<String, String> map) {
> StringBuffer buf = new StringBuffer();
>
> while (matcher.find()) {
> String key = matcher.group(2);
> String value = map.get(key);
>
> if (key.toLowerCase().endsWith(".lc")) {
> value = map.get(key.substring(0, key.length() -
> 3)).toLowerCase();
> } else if (key.toLowerCase().endsWith(".uc")) {
> value = map.get(key.substring(0, key.length() -
> 3)).toUpperCase();
> } else if (key.toLowerCase().endsWith(".cc")) {
> value = Strings.camelCase(map.get(key.substring(0,
> key.length() - 3)));
> }
>
> matcher.appendReplacement(buf, value);
> }
>
> matcher.appendTail(buf);
> return buf.toString();
> }
>
> }
>
>
> We could throw that in the util package then just do a find/replace on
> org.codehaus.swizzle.stream.StringTemplate ->
> org.apache.openejb.util.StringTemplate
>
> Thoughts?
>
> On a side note we should use StringBuilder instead of StringBuffer.
>
> -David
>
>
Re: JNDI Names: lower case interfaceType.annotationName?
Posted by David Blevins <da...@visi.com>.
On Aug 31, 2009, at 2:44 PM, Jonathan Gallimore wrote:
> This seems to work well, although I did break the JndiNameTest. I've
> fixed
> this by using the StringTemplate that is used normally, and grabbing
> the
> format string from there. This seems a bit nasty but all the openejb-
> core
> tests pass now (and I'll run the rest tonight).
That does seem a bit nasty. What if we created a complete replacement
StringTemplate class, something like this (refactored version of the
code from your patch):
public class StringTemplate {
private static final Pattern PATTERN = Pattern.compile("(\\{)((\
\.|\\w)+)(})");
private Matcher matcher;
public StringTemplate(String template) {
matcher = PATTERN.matcher(template);
}
public String format(Map<String, String> map) {
StringBuffer buf = new StringBuffer();
while (matcher.find()) {
String key = matcher.group(2);
String value = map.get(key);
if (key.toLowerCase().endsWith(".lc")) {
value = map.get(key.substring(0, key.length() -
3)).toLowerCase();
} else if (key.toLowerCase().endsWith(".uc")) {
value = map.get(key.substring(0, key.length() -
3)).toUpperCase();
} else if (key.toLowerCase().endsWith(".cc")) {
value = Strings.camelCase(map.get(key.substring(0,
key.length() - 3)));
}
matcher.appendReplacement(buf, value);
}
matcher.appendTail(buf);
return buf.toString();
}
}
We could throw that in the util package then just do a find/replace on
org.codehaus.swizzle.stream.StringTemplate ->
org.apache.openejb.util.StringTemplate
Thoughts?
On a side note we should use StringBuilder instead of StringBuffer.
-David
Re: JNDI Names: lower case interfaceType.annotationName?
Posted by Jonathan Gallimore <jo...@gmail.com>.
Thanks for the pointers David. I've just coded this up, and attached a patch
to OPENEJB-1056 (https://issues.apache.org/jira/browse/OPENEJB-1056).
This seems to work well, although I did break the JndiNameTest. I've fixed
this by using the StringTemplate that is used normally, and grabbing the
format string from there. This seems a bit nasty but all the openejb-core
tests pass now (and I'll run the rest tonight).
I'll this committed if there's no objections.
Jon
On Wed, Aug 5, 2009 at 3:15 AM, David Blevins <da...@visi.com>wrote:
> Whoops, just noticed the regex I posted doesn't accept a '.'
>
>
> On Aug 4, 2009, at 6:59 PM, David Blevins wrote:
>
> So, the replacement we are doing now can be done without the swizzle
>> StringTemplate code. Small snippet as so:
>>
>> import java.util.Map;
>> import java.util.regex.Matcher;
>> import java.util.regex.Pattern;
>>
>> private static final Pattern PATTERN = Pattern.compile("(\\{)(\\w+)(})");
>>
>> static String format(String input, Map<String, String> map) {
>> Matcher matcher = PATTERN.matcher(input);
>> StringBuffer buf = new StringBuffer();
>> while (matcher.find()) {
>> String key = matcher.group(2);
>> String value = map.get(key);
>> matcher.appendReplacement(buf, value);
>> }
>> matcher.appendTail(buf);
>> return buf.toString();
>> }
>>
>> Then we just check the key for the ".lc", ".uc", and ".cc" suffixes, shave
>> them off, and munge the map value appropriately. Maybe even support "Lc"
>> and so on as a backwards compatible way to get rid of having to eagerly
>> create some of the existing keys "FooLc" keys we have.
>>
>> We could probably even add this to a class called StringTemplate and use
>> it as a drop in replacement.
>>
>>
>> -David
>>
>> Begin forwarded message:
>>
>> Resent-From: <db...@visi.com>
>>> From: David Blevins <da...@visi.com>
>>> Date: August 4, 2009 4:03:32 PM PDT
>>> To: users@openejb.apache.org
>>> Subject: Re: JNDI Names: lower case interfaceType.annotationName?
>>> Reply-To: users@openejb.apache.org
>>>
>>> I'll give you some tips on the dev@ list -- should be easy to do with
>>> the swizzle-stream apis.
>>>
>>> -David
>>>
>>> On Aug 4, 2009, at 3:25 PM, Jonathan Gallimore wrote:
>>>
>>> I was thinking that as I was adding the new setting to the
>>>> documentation. I
>>>> think that's a neat idea - I'll see if I can code that up.
>>>>
>>>> Jon
>>>>
>>>> On Tue, Aug 4, 2009 at 11:18 PM, David Blevins <david.blevins@visi.com
>>>> >wrote:
>>>>
>>>> Maybe we should take all the entries we have and automatically make
>>>>> both
>>>>> ".lc" and ".uc" versions of them? (possibly even ".cc" for camel
>>>>> case). Or
>>>>> maybe smarten up our formatting so that they are only created on
>>>>> demand.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Aug 4, 2009, at 2:26 PM, Jonathan Gallimore wrote:
>>>>>
>>>>> Hi Mark,
>>>>>
>>>>>>
>>>>>> I've just committed this for you.
>>>>>>
>>>>>> Cheers
>>>>>>
>>>>>> Jon
>>>>>>
>>>>>> On Tue, Aug 4, 2009 at 2:16 PM, Jonathan Gallimore <
>>>>>> jonathan.gallimore@gmail.com> wrote:
>>>>>>
>>>>>> Hi Mark,
>>>>>>
>>>>>>>
>>>>>>> This seems like a good addition to me, I'm more than happy to get
>>>>>>> this in
>>>>>>> (should be able to do it this evening).
>>>>>>>
>>>>>>> Cheers
>>>>>>>
>>>>>>> Jon
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Aug 3, 2009 at 4:35 PM, Mark Taylor <mt...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>> First, thanks for a great project and I have a feature request.
>>>>>>>
>>>>>>>>
>>>>>>>> It seems like the default JBoss JNDI name is: {beanName}/{lowercase
>>>>>>>> annotation type} (ie local or remote). Hence I have an application
>>>>>>>> full of @EJB mapped-names such as: "MyStatelessBean/local". From
>>>>>>>> the
>>>>>>>> document
>>>>>>>>
>>>>>>>> http://openejb.apache.org/3.0/jndi-names.html.
>>>>>>>>
>>>>>>>> It appears we can only use interfaceType.annotationName to get Local
>>>>>>>> or Remote (ie uppercase). Would it be possible to add:
>>>>>>>> interfaceType.annotationNameLowerCase to the JNDI Name formatting
>>>>>>>> options?
>>>>>>>>
>>>>>>>> It could go in org.apache.openejb.assembler.classic.JndiBuilder:
>>>>>>>>
>>>>>>>> public String getName(Class interfce, Interface type) {
>>>>>>>> StringTemplate template = templates.get(interfce.getName());
>>>>>>>> if (template == null) template =
>>>>>>>> templates.get(type.getAnnotationName());
>>>>>>>> if (template == null) template = templates.get("");
>>>>>>>>
>>>>>>>> Map<String,String> contextData = new HashMap<String,String>();
>>>>>>>> contextData.put("moduleId", deploymentInfo.getModuleID());
>>>>>>>> contextData.put("ejbType",
>>>>>>>> deploymentInfo.getComponentType().name());
>>>>>>>> contextData.put("ejbClass",
>>>>>>>> deploymentInfo.getBeanClass().getName());
>>>>>>>> contextData.put("ejbClass.simpleName",
>>>>>>>> deploymentInfo.getBeanClass().getSimpleName());
>>>>>>>> contextData.put("ejbClass.packageName",
>>>>>>>> packageName(deploymentInfo.getBeanClass()));
>>>>>>>> contextData.put("ejbName", deploymentInfo.getEjbName());
>>>>>>>> contextData.put("deploymentId",
>>>>>>>> deploymentInfo.getDeploymentID().toString());
>>>>>>>> contextData.put("interfaceType", type.getAnnotationName());
>>>>>>>> contextData.put("interfaceType.annotationName",
>>>>>>>> type.getAnnotationName());
>>>>>>>> //***********************************************
>>>>>>>> //
>>>>>>>> contextData.put("interfaceType.annotationNameLC",
>>>>>>>> type.getAnnotationName().toLower());
>>>>>>>> //
>>>>>>>> //***********************************************
>>>>>>>> contextData.put("interfaceType.xmlName", type.getXmlName());
>>>>>>>> contextData.put("interfaceType.xmlNameCc",
>>>>>>>> type.getXmlNameCc());
>>>>>>>> contextData.put("interfaceType.openejbLegacyName",
>>>>>>>> type.getOpenejbLegacy());
>>>>>>>> contextData.put("interfaceClass", interfce.getName());
>>>>>>>> contextData.put("interfaceClass.simpleName",
>>>>>>>> interfce.getSimpleName());
>>>>>>>> contextData.put("interfaceClass.packageName",
>>>>>>>> packageName(interfce));
>>>>>>>> return template.apply(contextData);
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>
>>>
>>
>>
>
Re: JNDI Names: lower case interfaceType.annotationName?
Posted by David Blevins <da...@visi.com>.
Whoops, just noticed the regex I posted doesn't accept a '.'
On Aug 4, 2009, at 6:59 PM, David Blevins wrote:
> So, the replacement we are doing now can be done without the swizzle
> StringTemplate code. Small snippet as so:
>
> import java.util.Map;
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
>
> private static final Pattern PATTERN = Pattern.compile("(\\{)(\\w+)
> (})");
>
> static String format(String input, Map<String, String> map) {
> Matcher matcher = PATTERN.matcher(input);
> StringBuffer buf = new StringBuffer();
> while (matcher.find()) {
> String key = matcher.group(2);
> String value = map.get(key);
> matcher.appendReplacement(buf, value);
> }
> matcher.appendTail(buf);
> return buf.toString();
> }
>
> Then we just check the key for the ".lc", ".uc", and ".cc" suffixes,
> shave them off, and munge the map value appropriately. Maybe even
> support "Lc" and so on as a backwards compatible way to get rid of
> having to eagerly create some of the existing keys "FooLc" keys we
> have.
>
> We could probably even add this to a class called StringTemplate and
> use it as a drop in replacement.
>
>
> -David
>
> Begin forwarded message:
>
>> Resent-From: <db...@visi.com>
>> From: David Blevins <da...@visi.com>
>> Date: August 4, 2009 4:03:32 PM PDT
>> To: users@openejb.apache.org
>> Subject: Re: JNDI Names: lower case interfaceType.annotationName?
>> Reply-To: users@openejb.apache.org
>>
>> I'll give you some tips on the dev@ list -- should be easy to do
>> with the swizzle-stream apis.
>>
>> -David
>>
>> On Aug 4, 2009, at 3:25 PM, Jonathan Gallimore wrote:
>>
>>> I was thinking that as I was adding the new setting to the
>>> documentation. I
>>> think that's a neat idea - I'll see if I can code that up.
>>>
>>> Jon
>>>
>>> On Tue, Aug 4, 2009 at 11:18 PM, David Blevins <david.blevins@visi.com
>>> >wrote:
>>>
>>>> Maybe we should take all the entries we have and automatically
>>>> make both
>>>> ".lc" and ".uc" versions of them? (possibly even ".cc" for camel
>>>> case). Or
>>>> maybe smarten up our formatting so that they are only created on
>>>> demand.
>>>>
>>>>
>>>>
>>>>
>>>> On Aug 4, 2009, at 2:26 PM, Jonathan Gallimore wrote:
>>>>
>>>> Hi Mark,
>>>>>
>>>>> I've just committed this for you.
>>>>>
>>>>> Cheers
>>>>>
>>>>> Jon
>>>>>
>>>>> On Tue, Aug 4, 2009 at 2:16 PM, Jonathan Gallimore <
>>>>> jonathan.gallimore@gmail.com> wrote:
>>>>>
>>>>> Hi Mark,
>>>>>>
>>>>>> This seems like a good addition to me, I'm more than happy to
>>>>>> get this in
>>>>>> (should be able to do it this evening).
>>>>>>
>>>>>> Cheers
>>>>>>
>>>>>> Jon
>>>>>>
>>>>>>
>>>>>> On Mon, Aug 3, 2009 at 4:35 PM, Mark Taylor <mt...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>> First, thanks for a great project and I have a feature request.
>>>>>>>
>>>>>>> It seems like the default JBoss JNDI name is: {beanName}/
>>>>>>> {lowercase
>>>>>>> annotation type} (ie local or remote). Hence I have an
>>>>>>> application
>>>>>>> full of @EJB mapped-names such as: "MyStatelessBean/local".
>>>>>>> From the
>>>>>>> document
>>>>>>>
>>>>>>> http://openejb.apache.org/3.0/jndi-names.html.
>>>>>>>
>>>>>>> It appears we can only use interfaceType.annotationName to get
>>>>>>> Local
>>>>>>> or Remote (ie uppercase). Would it be possible to add:
>>>>>>> interfaceType.annotationNameLowerCase to the JNDI Name
>>>>>>> formatting
>>>>>>> options?
>>>>>>>
>>>>>>> It could go in
>>>>>>> org.apache.openejb.assembler.classic.JndiBuilder:
>>>>>>>
>>>>>>> public String getName(Class interfce, Interface type) {
>>>>>>> StringTemplate template =
>>>>>>> templates.get(interfce.getName());
>>>>>>> if (template == null) template =
>>>>>>> templates.get(type.getAnnotationName());
>>>>>>> if (template == null) template = templates.get("");
>>>>>>>
>>>>>>> Map<String,String> contextData = new
>>>>>>> HashMap<String,String>();
>>>>>>> contextData.put("moduleId", deploymentInfo.getModuleID());
>>>>>>> contextData.put("ejbType",
>>>>>>> deploymentInfo.getComponentType().name());
>>>>>>> contextData.put("ejbClass",
>>>>>>> deploymentInfo.getBeanClass().getName());
>>>>>>> contextData.put("ejbClass.simpleName",
>>>>>>> deploymentInfo.getBeanClass().getSimpleName());
>>>>>>> contextData.put("ejbClass.packageName",
>>>>>>> packageName(deploymentInfo.getBeanClass()));
>>>>>>> contextData.put("ejbName", deploymentInfo.getEjbName());
>>>>>>> contextData.put("deploymentId",
>>>>>>> deploymentInfo.getDeploymentID().toString());
>>>>>>> contextData.put("interfaceType",
>>>>>>> type.getAnnotationName());
>>>>>>> contextData.put("interfaceType.annotationName",
>>>>>>> type.getAnnotationName());
>>>>>>> //***********************************************
>>>>>>> //
>>>>>>> contextData.put("interfaceType.annotationNameLC",
>>>>>>> type.getAnnotationName().toLower());
>>>>>>> //
>>>>>>> //***********************************************
>>>>>>> contextData.put("interfaceType.xmlName",
>>>>>>> type.getXmlName());
>>>>>>> contextData.put("interfaceType.xmlNameCc",
>>>>>>> type.getXmlNameCc());
>>>>>>> contextData.put("interfaceType.openejbLegacyName",
>>>>>>> type.getOpenejbLegacy());
>>>>>>> contextData.put("interfaceClass", interfce.getName());
>>>>>>> contextData.put("interfaceClass.simpleName",
>>>>>>> interfce.getSimpleName());
>>>>>>> contextData.put("interfaceClass.packageName",
>>>>>>> packageName(interfce));
>>>>>>> return template.apply(contextData);
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>
>>
>>
>
>