@Remote public interface BeanRemote { String method(); }
private List<Class> remoteAndLocalIfaces(final Class<?> resourceClass) { final List<Class> allLocalOrRemoteIfaces = new LinkedList<>(); if (resourceClass.isAnnotationPresent(Remote.class)) { allLocalOrRemoteIfaces.addAll(Arrays.asList(resourceClass.getAnnotation(Remote.class).value())); } if (resourceClass.isAnnotationPresent(Local.class)) { allLocalOrRemoteIfaces.addAll(Arrays.asList(resourceClass.getAnnotation(Local.class).value())); } for (Class<?> i : resourceClass.getInterfaces()) { if (i.isAnnotationPresent(Remote.class) || i.isAnnotationPresent(Local.class)) { allLocalOrRemoteIfaces.add(i); } } return allLocalOrRemoteIfaces; }
@Remote public interface RuntimeDataServiceEJBRemote extends RuntimeDataService, DeploymentEventListener { /** * This method is not supported in EJB remote api as <code>TaskSummaryQueryBuilder<code> is not remote capable object */ @Override TaskSummaryQueryBuilder taskSummaryQuery(String userId); }
private Collection<Class<?>> getRemoteBusinessInterfaces(final DeploymentUnit deploymentUnit, final Class<?> sessionBeanClass) throws DeploymentUnitProcessingException { final Remote remoteViewAnnotation = sessionBeanClass.getAnnotation(Remote.class); if (remoteViewAnnotation == null) { Collection<Class<?>> interfaces = getBusinessInterfacesFromInterfaceAnnotations(sessionBeanClass, Remote.class); if (!interfaces.isEmpty()) { return interfaces; } return Collections.emptySet(); } Class<?>[] remoteViews = remoteViewAnnotation.value(); if (remoteViews == null || remoteViews.length == 0) { Set<Class<?>> interfaces = getPotentialBusinessInterfaces(sessionBeanClass); // For version < 3.2, the EJB spec didn't allow more than one implementing interfaces to be considered as remote when the bean class had the @Remote annotation without any explicit value. // EJB 3.2 allows it (core spec, section 4.9.7) if (interfaces.size() != 1 && !isEjbVersionGreaterThanOrEqualTo32(deploymentUnit)) { throw EjbLogger.ROOT_LOGGER.beanWithRemoteAnnotationImplementsMoreThanOneInterface(sessionBeanClass); } return interfaces; } return Arrays.asList(remoteViews); }
@Remote public interface ProcessServiceEJBRemote extends ProcessService { }
@Override public boolean matches(MethodDescription targetMethod) { final AnnotationList declaredAnnotationsOfType = targetMethod.getDeclaringType().asErasure().getDeclaredAnnotations(); if (declaredAnnotationsOfType.isAnnotationPresent(Remote.class)) { final Class[] remoteInterfaces = declaredAnnotationsOfType.ofType(Remote.class).loadSilent().value(); if (!new TypeList.ForLoadedTypes(remoteInterfaces).filter(isDeclaredInInterfaceHierarchy(targetMethod)).isEmpty()) { return true; } } return false; } }
@Remote public interface ProcessInstanceMigrationServiceEJBRemote extends ProcessInstanceMigrationService { }
@Override public boolean matches(MethodDescription.InDefinedShape targetMethod) { final AnnotationList declaredAnnotationsOfType = targetMethod.getDeclaringType().getDeclaredAnnotations(); if (declaredAnnotationsOfType.isAnnotationPresent(Remote.class)) { final Class[] remoteInterfaces = declaredAnnotationsOfType.ofType(Remote.class).loadSilent().value(); if (!new TypeList.ForLoadedTypes(remoteInterfaces).filter(isDeclaredInInterfaceHierarchy(targetMethod)).isEmpty()) { return true; } } return false; } }
@Remote public interface UserTaskServiceEJBRemote extends UserTaskService { }
@Remote public interface QueryServiceEJBRemote extends QueryService { }
@Remote public interface DefinitionServiceEJBRemote extends DefinitionService, DeploymentEventListener { }
@Remote public interface DeploymentServiceEJBRemote {
@Remote(RemoteInterface.class) public class RemoteInterfaceImpl implements RemoteInterface { @Override public void foo() { } @Override public String toString() { return super.toString(); } }
@Remote private interface RemoteInterfaceWithRemoteAnnotation extends RemoteInterface { void bar(); }
/** * Local stateless session bean implementing a remote interface. * Part of CDI extension lookup issue reproducer. * * @author Jakub Podlesak (jakub.podlesak at oracle.com) */ @Stateless @LocalBean @Remote(MyRemoteInterface.class) public class LocalBeanWithRemoteInterface { /** * Simple getter to be invoked from a CDI backed JAX-RS resource. * * @return Josh string literal. */ public String getName() { return "Josh"; } }
/** * A SLSB with a remote business interface * * @author Daniel Meyer * */ @Stateless @Remote(BusinessInterface.class) public class RemoteSLSBean implements BusinessInterface { public boolean doBusiness() { return true; } }
@Stateless @Remote(InvocationCounterService.class) @Local(InvocationCounterServiceLocal.class) public class InvocationCounterServiceBean implements InvocationCounterService, InvocationCounterServiceLocal { @Inject private InvocationCounter invocationCounter; public int getNumOfInvocations() { return invocationCounter.incrementAndGet(); } }
/** * A SingletonBean with a remote business interface * * @author Daniel Meyer * */ @Singleton @Remote(BusinessInterface.class) public class RemoteSingletonBean implements BusinessInterface { public boolean doBusiness() { return true; } }
/** * A SFSB with a remote business interface * * @author Daniel Meyer * */ @Stateful @Remote(BusinessInterface.class) public class RemoteSFSBean implements BusinessInterface { public boolean doBusiness() { return true; } }
@Remote public interface TimerSync { boolean waitFor(String name); void countDown(String name); }