Refine search
/** * JAX-RS resource used to reload the first application. * This resource is only registered inside the second application. * * @author Jakub Podlesak (jakub.podlesak at oracle.com) */ @Stateless @Path("reload") public class ReloaderResource { @EJB EjbReloaderService ejbReloaderService; @GET public void reloadTheOtherApp() { ejbReloaderService.reload(); } }
public EjbRefElement(Member member, AnnotatedElement ae, @Nullable PropertyDescriptor pd) { super(member, pd); EJB resource = ae.getAnnotation(EJB.class); String resourceBeanName = resource.beanName(); String resourceName = resource.name(); this.isDefaultName = !StringUtils.hasLength(resourceName); if (this.isDefaultName) { resourceName = this.member.getName(); if (this.member instanceof Method && resourceName.startsWith("set") && resourceName.length() > 3) { resourceName = Introspector.decapitalize(resourceName.substring(3)); } } Class<?> resourceType = resource.beanInterface(); if (Object.class != resourceType) { checkResourceType(resourceType); } else { // No resource type specified... check field/method. resourceType = getResourceType(); } this.beanName = resourceBeanName; this.name = resourceName; this.lookupType = resourceType; this.mappedName = resource.mappedName(); }
@ViewScoped @Named("RolePermissionHelperPage") public class RolePermissionHelperPage implements java.io.Serializable { @Inject DataverseSession session; @EJB DataverseRoleServiceBean dataverseRoleService; @EJB RoleAssigneeServiceBean roleAssigneeService;
/** * This is a CDI bean delegating to a SLSB from the same deployment * * @author Daniel Meyer * */ @Named("SLSBClientDelegate") public class SLSBClientDelegate implements JavaDelegate { @EJB private JavaDelegate bean; public void execute(DelegateExecution execution) throws Exception { bean.execute(execution); } }
@Named @Stateless public class BeanValidationServiceBean { @EJB DatasetServiceBean datasetService; @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void validateDatasets() { for (Dataset dataset : datasetService.findAll()) { for (DatasetVersion version : dataset.getVersions()) { for (FileMetadata fileMetadata : version.getFileMetadatas()) { } } } } }
@Stateless @EJB(name = "java:global/beta/AuditServiceBean", beanInterface = AuditService.class) public class AuditServiceBean implements AuditService { @EJB private SessionContextManager sessionContextManager; @PersistenceContext private EntityManager entityManager;
@Stateless(name="ProcessApplicationService", mappedName="ProcessApplicationService") @Local(ProcessApplicationService.class) @TransactionAttribute(TransactionAttributeType.SUPPORTS) public class EjbProcessApplicationService implements ProcessApplicationService { @EJB protected EjbBpmPlatformBootstrap ejbBpmPlatform;
@EJB protected TestEntityDao dao; @PersistenceContext protected EntityManager em;
@EJB(beanName="testBean3", beanInterface=ITestBean.class) private void setTestBean4(ITestBean testBean4) { if (this.testBean4 != null) { throw new IllegalStateException("Already called"); } this.testBean4 = testBean4; }
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; }
private String getNameFromAnnotation(Annotation annotation) { String name = null; if (annotation instanceof Resource) { name = ((Resource) annotation).name(); } else if (annotation instanceof EJB) { name = ((EJB) annotation).name(); } else if (annotation instanceof PersistenceUnit) { name = ((PersistenceUnit) annotation).name(); } else if (annotation instanceof PersistenceContext) { name = ((PersistenceContext) annotation).name(); } return name; } }
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); } } }
/** * Constructs EjbReference. * * @param ejbAnnotation ejb annotation * @param type fall back type * @return ejb reference instance */ private EjbReference getEjbReference(final EJB ejbAnnotation, final Class<?> type) { String beanInterface = ejbAnnotation.beanInterface().getName(); if (java.lang.Object.class.getName().equals(beanInterface)) { beanInterface = type.getName(); } return new EjbReference(ejbAnnotation.beanName(), beanInterface, ejbAnnotation.mappedName()); }
private ConfigProgram generateContext(AnnotatedMethod<?> method, EJB ejb) throws ConfigException { String name = ejb.name(); Method javaMethod = method.getJavaMember(); String location = getLocation(javaMethod); Class<?> bindType = javaMethod.getParameterTypes()[0]; // ejb/2005 if (! Object.class.equals(ejb.beanInterface())) { bindType = ejb.beanInterface(); } ValueGenerator gen = bindGenerator(location, ejb, bindType); if (name != null && ! "".equals(name)) { bindJndi(name, gen, name); } bindJndi(javaMethod, gen); return new MethodGeneratorProgram(javaMethod, gen); }