本文整理了Java中javax.ejb.EJB
类的一些代码示例,展示了EJB
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EJB
类的具体详情如下:
包路径:javax.ejb.EJB
类名称:EJB
暂无
代码示例来源:origin: jersey/jersey
/**
* 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();
}
}
代码示例来源:origin: spring-projects/spring-framework
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();
}
代码示例来源:origin: IQSS/dataverse
@Named
@Stateless
public class ShibGroupServiceBean {
@PersistenceContext(unitName = "VDCNet-ejbPU")
private EntityManager em;
@EJB
RoleAssigneeServiceBean roleAssigneeSvc;
@EJB
GroupServiceBean groupService;
@EJB
ActionLogServiceBean actionLogSvc;
代码示例来源:origin: IQSS/dataverse
@ViewScoped
@Named("RolePermissionHelperPage")
public class RolePermissionHelperPage implements java.io.Serializable {
@Inject DataverseSession session;
@EJB
DataverseRoleServiceBean dataverseRoleService;
@EJB
RoleAssigneeServiceBean roleAssigneeService;
代码示例来源:origin: IQSS/dataverse
@Named
@Dependent
public class FileRecordProcessor implements ItemProcessor {
@Inject
JobContext jobContext;
@EJB
DatasetServiceBean datasetServiceBean;
@EJB
DataFileServiceBean dataFileServiceBean;
代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl
@Stateless
public class Baz {
@EJB
Bar bar;
@Inject
Qux qux;
public Bar getBar() {
return bar;
}
public Qux getQux() {
return qux;
}
public int ping(int base) {
return bar.ping(++base);
}
}
代码示例来源:origin: ops4j/org.ops4j.pax.exam2
public class Setup {
@Inject
@Examples
private List<Movie> exampleMovies;
@EJB
private Movies moviesBean;
public List<Movie> setup() {
for (Movie movie : exampleMovies) {
moviesBean.addMovie(movie);
}
return exampleMovies;
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* 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);
}
}
代码示例来源:origin: jersey/jersey
/**
* JAX-RS resource backed with a stateful EJB bean.
*
* @author Jakub Podlesak (jakub.podlesak at oracle.com)
*/
@Stateful
@Path("stateful")
public class StatefulResource {
@EJB EjbCounterResource counter;
@GET
@Path("count")
public int getCount() {
return counter.getCount();
}
}
代码示例来源:origin: NationalSecurityAgency/datawave
@Path("/Accumulo")
@RolesAllowed({"InternalUser", "Administrator"})
@DeclareRoles({"InternalUser", "Administrator"})
@LocalBean
@Stateless
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
@TransactionManagement(TransactionManagementType.BEAN)
public class ListUsersBean {
@EJB
private AccumuloConnectionFactory connectionFactory;
代码示例来源:origin: IQSS/dataverse
@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()) {
}
}
}
}
}
代码示例来源:origin: be.fedict.eid-applet/eid-applet-beta-model
@Stateless
@EJB(name = "java:global/beta/AuditServiceBean", beanInterface = AuditService.class)
public class AuditServiceBean implements AuditService {
@EJB
private SessionContextManager sessionContextManager;
@PersistenceContext
private EntityManager entityManager;
代码示例来源:origin: camunda/camunda-bpm-platform
@Stateless(name="ProcessApplicationService", mappedName="ProcessApplicationService")
@Local(ProcessApplicationService.class)
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public class EjbProcessApplicationService implements ProcessApplicationService {
@EJB
protected EjbBpmPlatformBootstrap ejbBpmPlatform;
代码示例来源:origin: be.fedict.eid-applet/eid-applet-test-model
@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;
}
}
代码示例来源:origin: spring-projects/spring-framework
@EJB
protected TestEntityDao dao;
@PersistenceContext
protected EntityManager em;
代码示例来源:origin: spring-projects/spring-framework
@EJB(beanName="testBean3", beanInterface=ITestBean.class)
private void setTestBean4(ITestBean testBean4) {
if (this.testBean4 != null) {
throw new IllegalStateException("Already called");
}
this.testBean4 = testBean4;
}
代码示例来源:origin: org.glassfish.main.web/weld-integration
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;
}
代码示例来源:origin: org.ow2.jonas/jonas-webservices-jaxws-core
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;
}
}
代码示例来源:origin: org.jboss.ws/jbossws-jboss501
/**
* 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());
}
代码示例来源:origin: com.sun.faces/jsf-impl
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);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!