@Path("/EdgeDictionary") @GZIP @Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf", "application/x-protostuff", "text/html"}) @LocalBean @Stateless @PermitAll public class EdgeDictionaryBean { @Resource private EJBContext ctx; @Inject private AccumuloConnectionFactory connectionFactory; @Inject private DatawaveEdgeDictionary datawaveEdgeDictionary; @Inject @SpringBean(refreshable = true) private EdgeDictionaryConfiguration edgeDictionaryConfiguration;
/** * Conformance Rest Service * * @author Peter Van Houte */ // START SNIPPET: jax-rs-conformance @Path("") @Stateless @Produces({ MediaType.APPLICATION_JSON, Constants.CT_FHIR_JSON, Constants.CT_FHIR_XML }) public class JaxRsConformanceProvider extends AbstractJaxRsConformanceProvider { @EJB private JaxRsPatientRestProvider provider; public JaxRsConformanceProvider() { super("My Server Description", "My Server Name", "My Server Version"); } @Override protected ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> getProviders() { ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> map = new ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider>(); map.put(JaxRsConformanceProvider.class, this); map.put(JaxRsPatientRestProvider.class, provider); return map; } } // END SNIPPET: jax-rs-conformance
@Stateless @Named public class TemplateServiceBean { @EJB IndexServiceBean indexService; @PersistenceContext(unitName = "VDCNet-ejbPU") private EntityManager em;
@Stateless @TransactionManagement(TransactionManagementType.BEAN) public class GiraffeService { @Inject private Event<Giraffe> event; @Resource private UserTransaction userTransaction; public void feed() throws Exception { userTransaction.begin(); event.fire(new Giraffe()); ActionSequence.addAction("checkpoint"); userTransaction.commit(); } }
/** * 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(); } }
@Path("/Accumulo") @RolesAllowed({"InternalUser", "Administrator"}) @DeclareRoles({"InternalUser", "Administrator"}) @LocalBean @Stateless @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) @TransactionManagement(TransactionManagementType.BEAN) public class ListUsersBean { @EJB private AccumuloConnectionFactory connectionFactory;
/** * * @author skraffmiller */ @Stateless @Named public class ControlledVocabularyValueServiceBean implements java.io.Serializable { @PersistenceContext(unitName = "VDCNet-ejbPU") private EntityManager em; public List<ControlledVocabularyValue> findByDatasetFieldTypeId(Long dsftId) { String queryString = "select o from ControlledVocabularyValue as o where o.datasetFieldType.id = " + dsftId + " "; TypedQuery<ControlledVocabularyValue> query = em.createQuery(queryString, ControlledVocabularyValue.class); return query.getResultList(); } }
@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()) { } } } } }
/** * @author Arun Gupta */ @Path("employee") @Stateless public class EmployeeResource { @PersistenceContext EntityManager em; @GET @Produces("application/xml") public Employee[] get() { return em.createNamedQuery("Employee.findAll", Employee.class).getResultList().toArray(new Employee[0]); } }
/** * @author Arun Gupta */ @Stateless public class TestBean { @Resource(name = "DefaultManagedExecutorService") ManagedExecutorService executor; public boolean doSomething() throws InterruptedException { TestStatus.latch = new CountDownLatch(1); executor.submit(new Runnable() { @Override public void run() { TestStatus.latch.countDown(); } }); TestStatus.latch.await(2000, TimeUnit.MILLISECONDS); return true; } }
@Stateless public class MeasurementProblemManagerBean implements MeasurementProblemManagerLocal, MeasurementProblemManagerRemote { @SuppressWarnings("unused") private final Log log = LogFactory.getLog(MeasurementProblemManagerBean.class); @PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME) private EntityManager entityManager; @EJB private AuthorizationManagerLocal authorizationManager;
@Stateless public class ActorService { @PersistenceContext private EntityManager em; public Actor findById(int id) { Actor actor = em.find(Actor.class, id); actor.getRoles(); return actor; } }
@Stateless @Local(ExecutorService.class) @TransactionAttribute(TransactionAttributeType.SUPPORTS) public class ExecutorServiceBean implements ExecutorService { @Resource(mappedName="eis/JcaExecutorServiceConnectionFactory") protected JcaExecutorServiceConnectionFactory executorConnectionFactory;
@Stateless(name="ProcessApplicationService", mappedName="ProcessApplicationService") @Local(ProcessApplicationService.class) @TransactionAttribute(TransactionAttributeType.SUPPORTS) public class EjbProcessApplicationService implements ProcessApplicationService { @EJB protected EjbBpmPlatformBootstrap ejbBpmPlatform;
@Stateless @EJB(name = "java:global/test/IdentityServiceBean", beanInterface = IdentityService.class) public class IdentityServiceBean implements IdentityService { private static final Log LOG = LogFactory.getLog(IdentityServiceBean.class); public IdentityRequest getIdentityRequest() { LOG.debug("getIdentityRequest"); IdentityRequest identityRequest = new IdentityRequest(true, true, true, true, true); return identityRequest; } }
@Stateless public class EJBBean { public String getText() { return "Called from EJB"; } }