boolean isConflict(EjbReferenceDescriptor other) { return (getName().equals(other.getName())) && (!( DOLUtils.equals(getType(), other.getType()) && DOLUtils.equals(getEjbHomeInterface(), other.getEjbHomeInterface()) && DOLUtils.equals(getEjbInterface(), other.getEjbInterface()) && DOLUtils.equals(getLinkName(), other.getLinkName()) ) || isConflictResourceGroup(other)); } }
private String getRemoteEjbJndiName(EjbReferenceDescriptor refDesc) { String intf = refDesc.isEJB30ClientView() ? refDesc.getEjbInterface() : refDesc.getHomeClassName(); return getRemoteEjbJndiName(refDesc.isEJB30ClientView(), intf, refDesc.getJndiName()); }
/** * return the jndi name of the bean to which I refer. */ public String getJndiName() { String jndiName = this.getValue(); if( isLocal() ) { // mapped-name has no meaning for the local ejb view. ejb-link // should be used to resolve any ambiguities about the target // local ejb. return jndiName; } else { return (jndiName != null && ! jndiName.equals("")) ? jndiName : getMappedName(); } }
@Override public String getInjectResourceType() { return isEJB30ClientView() ? getEjbInterface() : getEjbHomeInterface(); }
public void setInjectResourceType(String resourceType) { if (isEJB30ClientView()) { setEjbInterface(resourceType); } else { setEjbHomeInterface(resourceType); } }
public boolean isEjbReferenceCacheable(EjbReferenceDescriptor ejbRefDesc) { // Ejb-ref is only eligible for caching if it refers to the legacy // Home view and it is resolved to an ejb within the same application. return ( (!ejbRefDesc.isEJB30ClientView()) && (ejbRefDesc.getEjbDescriptor() != null) ); // caching not enabled. //return false; }
/** returns a formatted string representing me. */ public void print(StringBuffer toStringBuffer) { String localVsRemote = isLocal() ? "Local" : "Remote"; toStringBuffer.append(localVsRemote + " ejb-ref "); toStringBuffer.append("name="+getName()); if( isEJB30ClientView() ) { toStringBuffer.append("," + localVsRemote + " 3.x interface ="+getEjbInterface()); } else { toStringBuffer.append("," + localVsRemote + " 2.x home ="+getEjbHomeInterface()); toStringBuffer.append("," + localVsRemote + " 2.x component interface="+getEjbInterface()); } if( ejbDescriptor != null ) { toStringBuffer.append(" resolved to intra-app EJB "+ejbDescriptor.getName() + " in module " + ejbDescriptor.getEjbBundleDescriptor().getModuleName()); } toStringBuffer.append(",ejb-link="+getLinkName()); toStringBuffer.append(",lookup="+getLookupName()); toStringBuffer.append(",mappedName="+getMappedName()); toStringBuffer.append(",jndi-name=" + getValue()); toStringBuffer.append(",refType="+getType()); }
for (EjbReferenceDescriptor ejbRef : ejbRefs) { if (target != null) ejbRef.addInjectionTarget(target); if (!ok(ejbRef.getName())) // a new one ejbRef.setName(logicalName); if (!ok(ejbRef.getDescription()) && ok(ejbAn.description())) ejbRef.setDescription(ejbAn.description()); if (!ejbRef.hasLookupName() && ok(ejbAn.lookup())) ejbRef.setLookupName(ejbAn.lookup()); if (!ok(ejbRef.getMappedName()) && ok(ejbAn.mappedName())) ejbRef.setMappedName(ejbAn.mappedName()); if (!ok(ejbRef.getLinkName()) && ok(ejbAn.beanName())) ejbRef.setLinkName(ejbAn.beanName());
if( ejbRefDesc.isLocal() ) { if( ejbRefDesc.hasLookupName()) { jndiObj = context.lookup(ejbRefDesc.getLookupName()); resolved = true; } else if( !ejbRefDesc.hasJndiName() && ejbRefDesc.hasLookupName() ) { jndiObj = context.lookup(ejbRefDesc.getLookupName()); resolved = true; } else if( ejbRefDesc.hasJndiName() && ejbRefDesc.getJndiName().startsWith("java:app/") && !ejbRefDesc.getJndiName().startsWith("java:app/env/")) { String remoteJndiName = ejbRefDesc.getJndiName(); String refInterface = ejbRefDesc.isEJB30ClientView() ? ejbRefDesc.getEjbInterface() : ejbRefDesc.getHomeClassName(); origClassLoader.loadClass(refInterface); ejbRefDesc.getReferringBundleDescriptor().getClassLoader(); Utility.setContextClassLoader(referringBundleClassLoader); setCL = true;
String name = getLogicalJNDIName(ejbRef.getName(), env); if(ejbRef.getEjbDescriptor() != null) { appResources.storeInNamespace(name, env); return; if (ejbRef.isLocal()) { if (ejbRef.hasLookupName()) { jndiName = ejbRef.getLookupName(); validationRequired = true; if (!ejbRef.hasJndiName() && ejbRef.hasLookupName()) { jndiName = ejbRef.getLookupName(); validationRequired = true; else if (ejbRef.hasJndiName() && ejbRef.getJndiName().startsWith("java:app/") && !ejbRef.getJndiName().startsWith("java:app/env/")) { String remoteJndiName = ejbRef.getJndiName(); appResources.store(new AppResource(name, jndiName, ejbRef.getType(), env, validationRequired));
public static Object resolveEjbRefObject(EjbReferenceDescriptor refDesc, Object jndiObj) throws NamingException { Object returnObject = jndiObj; if( refDesc.isLocal() ) { EjbDescriptor target = refDesc.getEjbDescriptor(); BaseContainer container = EjbContainerUtilImpl.getInstance().getContainer(target.getUniqueId()); if( refDesc.isEJB30ClientView() ) { GenericEJBLocalHome genericLocalHome = container.getEJBLocalBusinessHome(refDesc.getEjbInterface()); returnObject = genericLocalHome.create(refDesc.getEjbInterface()); } else { returnObject = container.getEJBLocalHome(); } } else { // For the Remote case, the only time we have to do // something extra with the given jndiObj is if the lookup // is for a Remote 3.0 object and it was made through a // corba interoperable name. In that case, // the jndiObj refers to the internal Remote 3.0 Home so we // still need to create a remote 30 client wrapper object. if ( refDesc.isEJB30ClientView() && !(jndiObj instanceof RemoteBusinessWrapperBase) ) { returnObject = EJBUtils.lookupRemote30BusinessObject (jndiObj, refDesc.getEjbInterface()); } } return returnObject; }
Class beanInterface) { if (ejbRef.getHomeClassName() != null) return; ejbRef.setHomeClassName(beanInterface.getName()); for (Method m : methods) { if (m.getName().equals("create")) { ejbRef.setEjbInterface(m.getReturnType().getName()); break; ejbRef.setLocal(EJBLocalHome.class.isAssignableFrom(beanInterface)); ejbRef.setType(targetBeanType);
public String getName() { return decoree.getName(); }
/** * Set the type information for the EJB starting with the EJB business * interface, but only if it hasn't already been set. */ private void setEjbIntfType(EjbReferenceDescriptor ejbRef, Class beanInterface) { if (ejbRef.getEjbInterface() != null) return; // only set it if not already set by DD ejbRef.setEjbInterface(beanInterface.getName()); if (beanInterface.getAnnotation(Local.class) != null) { ejbRef.setLocal(true); } else { // If beanInterface has @Remote annotation, setLocal(false); // If beanInterface has neither @Local nor @Remote, // assume remote for now. We can't know for sure until the // post-validation stage. Even though local business will // probably be more common than remote business, defaulting // to remote business simplifies the post-application // validation logic considerably. See // EjbBundleValidator.accept(EjbReferenceDescriptor) // for more details. ejbRef.setLocal(false); } ejbRef.setType(EjbSessionDescriptor.TYPE); }
/** * Gets the home classname of the referee EJB. * @return the class name of the EJB home. */ public String getEjbHomeInterface() { return getHomeClassName(); }
/** * Return the jndi name of the bean to which I refer. */ public String getValue() { if (ejbDescriptor == null) { return super.getValue(); } else { if (isLocal()) { return super.getValue(); } else { return ejbDescriptor.getJndiName(); } } }
public String getLink() { return decoree.getLinkName(); }
public String getLocal() { return decoree.getEjbInterface(); }
@Override public boolean hasJndiName() { String name = getJndiName(); return ( (name != null) && !name.equals("") ); }
private static boolean isEJB30Ref(EjbReferenceDescriptor refDesc) { return refDesc.isEJB30ClientView(); }