private void applyToMethod(FacesContext facesContext, Method method, EJB ejb, Object instance) { if (method.getName().startsWith("set")) { Object value = null; if (ejb.lookup() != null && !"".equals(ejb.lookup().trim())) { value = lookup(facesContext, ejb.lookup()); } else if (ejb.name() != null && !"".equals(ejb.name().trim())) { value = lookup(facesContext, JAVA_COMP_ENV + ejb.name()); } invokeMethod(facesContext, method, instance, value); } } }
private void applyToMethod(FacesContext facesContext, Method method, EJB ejb, Object instance) { if (method.getName().startsWith("set")) { Object value = null; if (ejb.lookup() != null && !"".equals(ejb.lookup().trim())) { value = lookup(facesContext, ejb.lookup()); } else if (ejb.name() != null && !"".equals(ejb.name().trim())) { value = lookup(facesContext, JAVA_COMP_ENV + ejb.name()); } invokeMethod(facesContext, method, instance, value); } } }
private void applyToMethod(FacesContext facesContext, Method method, EJB ejb, Object instance) { if (method.getName().startsWith("set")) { Object value = null; if (ejb.lookup() != null && !"".equals(ejb.lookup().trim())) { value = lookup(facesContext, ejb.lookup()); } else if (ejb.name() != null && !"".equals(ejb.name().trim())) { value = lookup(facesContext, JAVA_COMP_ENV + ejb.name()); } invokeMethod(facesContext, method, instance, value); } } }
private void applyToField(FacesContext facesContext, Field field, EJB ejb, Object instance) { Object value; if (ejb.lookup() != null && !"".equals(ejb.lookup().trim())) { value = lookup(facesContext, ejb.lookup()); } else if (ejb.name() != null && !"".equals(ejb.name().trim())) { value = lookup(facesContext, JAVA_COMP_ENV + ejb.name()); } else { value = lookup(facesContext, JAVA_MODULE + field.getType().getSimpleName()); } setField(facesContext, field, instance, value); }
private void applyToField(FacesContext facesContext, Field field, EJB ejb, Object instance) { Object value; if (ejb.lookup() != null && !"".equals(ejb.lookup().trim())) { value = lookup(facesContext, ejb.lookup()); } else if (ejb.name() != null && !"".equals(ejb.name().trim())) { value = lookup(facesContext, JAVA_COMP_ENV + ejb.name()); } else { value = lookup(facesContext, JAVA_MODULE + field.getType().getSimpleName()); } setField(facesContext, field, instance, value); }
private void applyToField(FacesContext facesContext, Field field, EJB ejb, Object instance) { Object value; if (ejb.lookup() != null && !"".equals(ejb.lookup().trim())) { value = lookup(facesContext, ejb.lookup()); } else if (ejb.name() != null && !"".equals(ejb.name().trim())) { value = lookup(facesContext, JAVA_COMP_ENV + ejb.name()); } else { value = lookup(facesContext, JAVA_MODULE + field.getType().getSimpleName()); } setField(facesContext, field, instance, value); }
@Override public ResourceReference<Object> createResource() { return new SimpleResourceReference<Object>(doLookup(ejb.lookup(), null)); } };
throw WeldLogger.ROOT_LOGGER.injectionPointNotAJavabean((Method) injectionPoint.getMember()); if (!ejb.lookup().equals("")) { if (ejb.lookup().startsWith("ejb:")) { return new ResourceReferenceFactory<Object>() { @Override return handleServiceLookup(ejb.lookup(), injectionPoint); } else { final ViewDescription viewDescription = getViewDescription(ejb, injectionPoint);
@Test public void testResolveJNDINameLookupSpecified() { cut.enrich(new EJBEnrichedLookupClass()); String expected = EJBEnrichedLookupClass.class.getDeclaredFields()[0].getAnnotation(EJB.class).lookup(); /* * When 'lookup' is set, the only JNDI name to check is the exact value specified in the annotation. */ assertThat(resolvedJndiName, is(notNullValue())); assertThat(resolvedJndiName.length, is(1)); assertThat(resolvedJndiName[0], is(expected)); }
@Test public void testResolveJNDINameLookupSpecified() { cut.enrich(new EJBEnrichedLookupClass()); String expected = EJBEnrichedLookupClass.class.getDeclaredFields()[0].getAnnotation(EJB.class).lookup(); /* * When 'lookup' is set, the only JNDI name to check is the exact value specified in the annotation. */ assertThat(resolvedJndiName, is(notNullValue())); assertThat(resolvedJndiName.length, is(1)); assertThat(resolvedJndiName[0], is(expected)); }
String lookupName = annotation.lookup(); if (!lookupName.isEmpty()) { ejbLocalRef.setLookupName(lookupName); String lookupName = annotation.lookup(); if (!lookupName.isEmpty()) { ejbRef.setLookupName(lookupName); String lookupName = annotation.lookup(); if (!lookupName.isEmpty()) { ejbRef.setLookupName(lookupName);
String mappedName = ejb.mappedName(); String beanName = ejb.beanName(); String lookupName = ejb.lookup();
throw WeldMessages.MESSAGES.injectionPointNotAJavabean((Method) injectionPoint.getMember()); if (!ejb.lookup().equals("")) { final ContextNames.BindInfo ejbBindInfo = ContextNames.bindInfoFor(moduleDescription.getApplicationName(), moduleDescription.getModuleName(), moduleDescription.getModuleName(), ejb.lookup()); ServiceController<?> controller = serviceRegistry.getRequiredService(ejbBindInfo.getBinderServiceName()); ManagedReferenceFactory factory = (ManagedReferenceFactory) controller.getValue();
private String getLookupName( Class annotatedClass, AnnotatedField annotatedField, List<InjectionCapable> injectionResources ) { String lookupName = null; if ( annotatedField.isAnnotationPresent( Resource.class ) ) { Resource resource = annotatedField.getAnnotation( Resource.class ); lookupName = getJndiName( resource.lookup(), resource.mappedName(), resource.name() ); } else if ( annotatedField.isAnnotationPresent( EJB.class ) ) { EJB ejb = annotatedField.getAnnotation( EJB.class ); lookupName = getJndiName(ejb.lookup(), ejb.mappedName(), ejb.name()); } else if ( annotatedField.isAnnotationPresent( WebServiceRef.class ) ) { WebServiceRef webServiceRef = annotatedField.getAnnotation( WebServiceRef.class ); lookupName = getJndiName(webServiceRef.lookup(), webServiceRef.mappedName(), webServiceRef.name()); } else if ( annotatedField.isAnnotationPresent( PersistenceUnit.class ) ) { PersistenceUnit persistenceUnit = annotatedField.getAnnotation( PersistenceUnit.class ); lookupName = getJndiName( persistenceUnit.unitName(), null, persistenceUnit.name() ); } else if ( annotatedField.isAnnotationPresent( PersistenceContext.class ) ) { PersistenceContext persistenceContext = annotatedField.getAnnotation( PersistenceContext.class ); lookupName = getJndiName( persistenceContext.unitName(), null, persistenceContext.name() ); } if ( lookupName == null || lookupName.trim().length() == 0 ) { lookupName = getComponentEnvName( annotatedClass, annotatedField.getJavaMember().getName(), injectionResources ); } return lookupName; }