public String getEjbName() { return this.beanContext.getEjbName(); }
public String getEjbName() { return this.beanContext.getEjbName(); }
@Override protected String getFakeUrl() { return beanContext.getEjbName().replace('/', '-') + "_ejb" + beanContext.hashCode(); }
@Override protected String getFakeUrl() { return beanContext.getEjbName().replace('/', '-') + "_ejb" + beanContext.hashCode(); }
public void setAppContext(final AppContext appModule, final Collection<BeanContext> ejbs) { compContexts.clear(); ear = false; for (final BeanContext beanContext : appModule.getBeanContexts()) { if (!ear) { ear = beanContext.getEjbName().contains("ear-scoped-cdi-beans_"); } if (beanContext.getBeanClass().equals(BeanContext.Comp.class) && (ejbs == null || ear || ejbs.contains(beanContext))) { compContexts.add(beanContext); } } this.appCtx = appModule; }
@ManagedAttribute @Description("Container managed beans.") public String[] getManagedBeans() { final BeanContext[] beans = container.getBeanContexts(); final String[] beanNames = new String[beans.length]; int i = 0; for (final BeanContext bc : beans) { beanNames[i++] = new StringBuilder("bean-class: ").append(bc.getBeanClass().getName()).append(", ") .append("ejb-name: ").append(bc.getEjbName()).append(", ") .append("deployment-id: ").append(bc.getDeploymentID()).append(", ") .toString(); } return beanNames; }
@ManagedAttribute @Description("Container managed beans.") public String[] getManagedBeans() { final BeanContext[] beans = container.getBeanContexts(); final String[] beanNames = new String[beans.length]; int i = 0; for (final BeanContext bc : beans) { beanNames[i++] = new StringBuilder("bean-class: ").append(bc.getBeanClass().getName()).append(", ") .append("ejb-name: ").append(bc.getEjbName()).append(", ") .append("deployment-id: ").append(bc.getDeploymentID()).append(", ") .toString(); } return beanNames; }
private static void validateObserverMethods(final CdiEjbBean<?> bean, final Map<ObserverMethod<?>, AnnotatedMethod<?>> methods) { final BeanContext beanContext = bean.getBeanContext(); if (beanContext.isLocalbean()) { return; } for (final Map.Entry<ObserverMethod<?>, AnnotatedMethod<?>> m : methods.entrySet()) { final Method method = m.getValue().getJavaMember(); if (!Modifier.isStatic(method.getModifiers()) && doResolveViewMethod(bean, method) == null) { throw new WebBeansConfigurationException("@Observes " + method + " neither in the ejb view of ejb " + bean.getBeanContext().getEjbName() + " nor static"); } } }
private static void validateObserverMethods(final CdiEjbBean<?> bean, final Map<ObserverMethod<?>, AnnotatedMethod<?>> methods) { final BeanContext beanContext = bean.getBeanContext(); if (beanContext.isLocalbean()) { return; } for (final Map.Entry<ObserverMethod<?>, AnnotatedMethod<?>> m : methods.entrySet()) { final Method method = m.getValue().getJavaMember(); if (!Modifier.isStatic(method.getModifiers()) && doResolveViewMethod(bean, method) == null) { throw new WebBeansConfigurationException("@Observes " + method + " neither in the ejb view of ejb " + bean.getBeanContext().getEjbName() + " nor static"); } } }
public List<TreeEntry> getDeployments(BeanContext[] beanContexts) { List<TreeEntry> deployments = new ArrayList<TreeEntry>(); TreeEntry deploymentsEntry = null; for (BeanContext deployment : beanContexts) { deploymentsEntry = new TreeEntry(); deploymentsEntry.setName(deployment.getEjbName()); deploymentsEntry.setValues(new String[]{ deployment.getContainer().getContainerID().toString(), deployment.getDeploymentID().toString()}); deploymentsEntry.setChildren(new ArrayList<TreeEntry>()); deployments.add(deploymentsEntry); } return deployments; }
private String computeGlobalName(final BeanContext cdi, final Class<?> intrface) { final ModuleContext module = cdi.getModuleContext(); final AppContext application = module.getAppContext(); final String appName = application.isStandaloneModule() ? "" : application.getId() + "/"; final String moduleName = moduleName(cdi); String beanName = cdi.getEjbName(); if (intrface != null) { beanName = beanName + "!" + intrface.getName(); } return "global/" + appName + moduleName + beanName; }
private void resumePersistentSchedulers(final AppContext appContext) { final Scheduler globalScheduler = SystemInstance.get().getComponent(Scheduler.class); final Collection<Scheduler> schedulers = new ArrayList<Scheduler>(); for (final BeanContext ejb : appContext.getBeanContexts()) { final Scheduler scheduler = ejb.get(Scheduler.class); if (scheduler == null || scheduler == globalScheduler || schedulers.contains(scheduler)) { continue; } schedulers.add(scheduler); try { scheduler.resumeAll(); } catch (final Exception e) { logger.warning("Failed to resume scheduler for " + ejb.getEjbName(), e); } } }
private String computeGlobalName(final BeanContext cdi, final Class<?> intrface) { final ModuleContext module = cdi.getModuleContext(); final AppContext application = module.getAppContext(); final String appName = application.isStandaloneModule() ? "" : application.getId() + "/"; final String moduleName = cdi.getModuleName() + "/"; String beanName = cdi.getEjbName(); if (intrface != null) { beanName = beanName + "!" + intrface.getName(); } return "global/" + appName + moduleName + beanName; }
private void deployEJB(final String web, final String context, final BeanContext beanContext, final Collection<Object> additionalProviders, final Collection<ServiceInfo> serviceInfos) { final String nopath = getAddress(context, beanContext.getBeanClass()); final RsHttpListener listener = createHttpListener(); final RsRegistry.AddressInfo address = rsRegistry.createRsHttpListener(web, listener, beanContext.getClassLoader(), nopath.substring(NOPATH_PREFIX.length() - 1), virtualHost, auth, realm); services.add(new DeployedService(address.complete, context, beanContext.getBeanClass().getName())); listener.deployEJB(context, getFullContext(address.base, context), beanContext, additionalProviders, new ServiceConfiguration(beanContext.getProperties(), serviceInfos)); LOGGER.info("REST Service: " + address.complete + " -> EJB " + beanContext.getEjbName()); }
private static void validateProduceMethods(final CdiEjbBean<?> bean, final Set<ProducerMethodBean<?>> methods) { final BeanContext beanContext = bean.getBeanContext(); if (beanContext.isLocalbean()) { return; } for (final ProducerMethodBean<?> m : methods) { final Method method = m.getCreatorMethod(); if (doResolveViewMethod(bean, method) == null) { throw new WebBeansConfigurationException("@Produces " + method + " not in the ejb view of ejb " + beanContext.getEjbName()); } } }
private static void validateProduceMethods(final CdiEjbBean<?> bean, final Set<ProducerMethodBean<?>> methods) { final BeanContext beanContext = bean.getBeanContext(); if (beanContext.isLocalbean()) { return; } for (final ProducerMethodBean<?> m : methods) { final Method method = m.getCreatorMethod(); if (doResolveViewMethod(bean, method) == null) { throw new WebBeansConfigurationException("@Produces " + method + " not in the ejb view of ejb " + beanContext.getEjbName()); } } }
public static Lines listEJBs(final String cr) throws Exception { final ContainerSystem cs = SystemInstance.get().getComponent(ContainerSystem.class); final Lines lines = new Lines(cr); lines.add(new Line("Name", "Class", "Interface Type", "Bean Type")); for (final BeanContext bc : cs.deployments()) { if (bc.isHidden()) { continue; } lines.add(new Line(bc.getEjbName(), bc.getBeanClass().getName(), getType(bc), componentType(bc.getComponentType()))); } return lines; }
protected ObjectName registerMBean() { final ObjectName name = new ObjectNameBuilder("openejb.management") .set("j2eeType", "JAX-WS") .set("J2EEServer", "openejb") .set("J2EEApplication", null) .set("EndpointType", "EJB") .set("name", beanContext.getEjbName()) .build(); mbean = new WsServiceMBean(beanContext, port); LocalMBeanServer.registerDynamicWrapperSilently(mbean, name); return name; }
public static Lines listEJBs(final String cr) throws Exception { final ContainerSystem cs = SystemInstance.get().getComponent(ContainerSystem.class); final Lines lines = new Lines(cr); lines.add(new Line("Name", "Class", "Interface Type", "Bean Type")); for (final BeanContext bc : cs.deployments()) { if (bc.isHidden()) { continue; } lines.add(new Line(bc.getEjbName(), bc.getBeanClass().getName(), getType(bc), componentType(bc.getComponentType()))); } return lines; }
protected ObjectName registerMBean() { final ObjectName name = new ObjectNameBuilder("openejb.management") .set("j2eeType", "JAX-WS") .set("J2EEServer", "openejb") .set("J2EEApplication", null) .set("EndpointType", "EJB") .set("name", beanContext.getEjbName()) .build(); mbean = new WsServiceMBean(beanContext, port); LocalMBeanServer.registerDynamicWrapperSilently(mbean, name); return name; }