[jboss-dev-forums] [Design of POJO Server] - Re: ReferenceMetaDataResolverDeployer is wrong
adrian@jboss.org
do-not-reply at jboss.com
Tue Dec 4 09:27:48 EST 2007
"adrian at jboss.org" wrote : Also, I'm seeing a lot of this hackery in the new metadata.
| What's wrong with using OO?
|
|
| | private static String getJndiName(JBossEnterpriseBeanMetaData beanMD, boolean isLocal)
| | {
| | String jndiName = null;
| | if (isLocal)
| | {
| | // Validate that there is a local home associated with this bean
| | jndiName = beanMD.determineLocalJndiName();
| | if (jndiName == null)
| | {
| | log.warn("LocalHome jndi name requested for: '" + beanMD.getEjbName() + "' but there is no LocalHome class");
| | }
| | }
| | else
| | {
| | - if( beanMD.isEntity() )
| | - {
| | - JBossEntityBeanMetaData md = (JBossEntityBeanMetaData) beanMD;
| | - jndiName = md.getJndiName();
| | - }
| | - else if( beanMD.isSession())
| | - {
| | - JBossSessionBeanMetaData md = (JBossSessionBeanMetaData) beanMD;
| | - jndiName = md.getHomeJndiName();
| | - if(jndiName == null)
| | - jndiName = md.getJndiName();
| | - }
| | + jndiName = md.determineRemoteJndiName();
| | }
| | return jndiName;
| | }
| |
|
| And move the if statements into the types?
In fact, there already is a determineJndiName() for the remote jndi name.
It should be using that, otherwise it doesn't do the jndi-name=ejb-name
when the jndi name is not explicitly specified.
It still needs fixing to be OO, see the comment in the code.
| [ejort at warjort server]$ svn diff
| Index: src/main/org/jboss/deployment/ReferenceMetaDataResolverDeployer.java
| ===================================================================
| --- src/main/org/jboss/deployment/ReferenceMetaDataResolverDeployer.java (revision 67880)
| +++ src/main/org/jboss/deployment/ReferenceMetaDataResolverDeployer.java (working copy)
| @@ -408,17 +408,19 @@
| }
| else
| {
| + // FIXME the session.getHomeJndiName should be moved to the JBossSessionMetaData.determineJndiName()
| + // and these if statements replaced with md.determineJndiName()
| if( beanMD.isEntity() )
| {
| JBossEntityBeanMetaData md = (JBossEntityBeanMetaData) beanMD;
| - jndiName = md.getJndiName();
| + jndiName = md.determineJndiName();
| }
| else if( beanMD.isSession())
| {
| JBossSessionBeanMetaData md = (JBossSessionBeanMetaData) beanMD;
| jndiName = md.getHomeJndiName();
| if(jndiName == null)
| - jndiName = md.getJndiName();
| + jndiName = md.determineJndiName();
| }
| }
| return jndiName;
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4110210#4110210
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4110210
More information about the jboss-dev-forums
mailing list