[Design of POJO Server] - Re: ReferenceMetaDataResolverDeployer is wrong
by adrian@jboss.org
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.resolveRemoteJndiName();
| }
| return jndiName;
| }
|
And move the if statements into the types?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4110188#4110188
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4110188
18 years
[Design of POJO Server] - ReferenceMetaDataResolverDeployer is wrong
by adrian@jboss.org
The ReferenceMetaDataResolverDeployer (RMDRD) is wrong
in that it updates the mapped-name/jndi-name with the resolved jndi-name.
This breaks the reversability of the model and will also confuse things
with the profile service.
Example:
I have ejb1 with jndi-name="ejb1jndiName"
I have ejb2 with ejb-link="ejb1"
The RMDRD will do EJBReference.setMappedName("ejb1JndiName");
| if(link != null)
| target = findEjbLink(unit, link);
| if(target == null)
| unresolvedRefs.add(ref.getEjbRefName()+"/ejb-ref/"+link);
| else
| ref.setMappedName(target);
|
When the ManagedObjects are retrieved for this deployment,
the EJBReferfence now has a mapped-name and so it will be saved
and never re-resolved on a deploy from the profile service.
If I then use the managed console (profile service) to change the
jndi-name of ejb1 ejb1JndiName -> ejb1ChangedName
the EJBReference is now invalid, but it won't be re-resolved because
the mapped-name is not null.
Instead what should be happening is that on the ResourceInjectionMetaData
there should be:
| private String resolvedJndiName;
|
| public String getResolvedJndiName()
| {
| return resolvedJndiName;
| }
|
| @XmlTransient // not included in xml model
| public void setResolvedJndiName(String jndiName)
| {
| this.resolvedJndiName = resolvedJndiName;
| }
|
The RMDRD should setting the resolvedJndiName and the
containers should be using getResolvedJndiName(), rather than getMapped/JndiName().
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4110170#4110170
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4110170
18 years