public EjbMethodInvoker(final Bus bus, final BeanContext beanContext) { super(null); this.bus = bus; this.beanContext = beanContext; Object inst; try { inst = beanContext.getBeanClass().newInstance(); } catch (final Exception e) { inst = null; } this.instance = inst; }
private void addEjbToApplication(final Application application, final Map<String, EJBRestServiceInfo> restEjbs) { for (final Map.Entry<String, EJBRestServiceInfo> ejb : restEjbs.entrySet()) { application.getClasses().add(ejb.getValue().context.getBeanClass()); } }
private boolean skipEjbContext(final ThreadContext threadContext) { // we use it to deploy so if any lookup is done during the deployment // we don't want to get the DeployerEjb JNDI tree // since this method is pretty quick that's not an issue to do the test return threadContext == null || DeployerEjb.class.equals(threadContext.getBeanContext().getBeanClass()); }
public void setAppContext(final AppContext appModule) { for (final BeanContext beanContext : appModule.getBeanContexts()) { if (beanContext.getBeanClass().equals(BeanContext.Comp.class)) { compContexts.add(beanContext); } } }
@Override public List<Method> getRemoveMethods() { // Should we delegate to super and merge both? if (beanContext.isLocalbean()) { return findRemove(beanContext.getBeanClass(), beanContext.getBeanClass()); } return findRemove(beanContext.getBeanClass(), beanContext.getBusinessLocalInterface()); }
@Override public List<Method> getRemoveMethods() { // Should we delegate to super and merge both? if (beanContext.isLocalbean()) { return findRemove(beanContext.getBeanClass(), beanContext.getBeanClass()); } return findRemove(beanContext.getBeanClass(), beanContext.getBusinessLocalInterface()); }
@Deprecated @Override public void deployEJB(final String contextRoot, final String fullContext, final BeanContext beanContext, final Collection<Object> additionalProviders, final ServiceConfiguration configuration) { final Object proxy = ProxyEJB.subclassProxy(beanContext); deploy(contextRoot, beanContext.getBeanClass(), fullContext, new NoopResourceProvider(beanContext.getBeanClass(), proxy), proxy, null, new OpenEJBEJBInvoker(Collections.singleton(beanContext)), additionalProviders, configuration, beanContext.getWebBeansContext()); }
public BusinessLocalHome getBusinessLocalHome(final Class mainInterface) { final List<Class> localInterfaces = this.getBusinessLocalInterfaces(); final List<Class> interfaces = ProxyInterfaceResolver.getInterfaces(this.getBeanClass(), mainInterface, localInterfaces); return this.getBusinessLocalHome(interfaces, mainInterface); }
public BusinessRemoteHome getBusinessRemoteHome(final Class mainInterface) { final List<Class> remoteInterfaces = this.getBusinessRemoteInterfaces(); final List<Class> interfaces = ProxyInterfaceResolver.getInterfaces(this.getBeanClass(), mainInterface, remoteInterfaces); return this.getBusinessRemoteHome(interfaces, mainInterface); }
public BusinessRemoteHome getBusinessRemoteHome(final Class mainInterface) { final List<Class> remoteInterfaces = this.getBusinessRemoteInterfaces(); final List<Class> interfaces = ProxyInterfaceResolver.getInterfaces(this.getBeanClass(), mainInterface, remoteInterfaces); return this.getBusinessRemoteHome(interfaces, mainInterface); }
public void configureDeployments(final List<BeanContext> ejbDeployments) { beans = new WeakHashMap<Class<?>, BeanContext>(); for (final BeanContext deployment : ejbDeployments) { if (deployment.getComponentType().isSession()) { if (deployment.isLocalbean() && !deployment.isDynamicallyImplemented()) { beans.put(deployment.get(BeanContext.ProxyClass.class).getProxy(), deployment); } beans.put(deployment.getBeanClass(), deployment); } } }
public void configureDeployments(final List<BeanContext> ejbDeployments) { beans = new WeakHashMap<>(); for (final BeanContext deployment : ejbDeployments) { if (deployment.getComponentType().isCdiCompatible()) { if (deployment.isLocalbean() && !deployment.isDynamicallyImplemented()) { beans.put(deployment.get(BeanContext.ProxyClass.class).getProxy(), deployment); } beans.put(deployment.getBeanClass(), deployment); } } }
public BusinessLocalHome getBusinessLocalHome(final Class mainInterface) { final List<Class> localInterfaces = this.getBusinessLocalInterfaces(); final List<Class> interfaces = ProxyInterfaceResolver.getInterfaces(this.getBeanClass(), mainInterface, localInterfaces); return this.getBusinessLocalHome(interfaces, mainInterface); }
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()); }
@Override public void deploy(final BeanContext beanContext) throws OpenEJBException { final String id = (String) beanContext.getDeploymentID(); deploymentRegistry.put(id, beanContext); beanContext.setContainer(this); // add it before starting the timer (@PostCostruct) if (StatsInterceptor.isStatsActivated()) { final StatsInterceptor stats = new StatsInterceptor(beanContext.getBeanClass()); beanContext.addFirstSystemInterceptor(stats); } }
@Override public void deploy(final BeanContext beanContext) throws OpenEJBException { final String id = (String) beanContext.getDeploymentID(); deploymentRegistry.put(id, beanContext); beanContext.setContainer(this); // add it before starting the timer (@PostCostruct) if (StatsInterceptor.isStatsActivated()) { final StatsInterceptor stats = new StatsInterceptor(beanContext.getBeanClass()); beanContext.addFirstSystemInterceptor(stats); } }
public static Object subclassProxy(final BeanContext beanContext) { try { return LocalBeanProxyFactory.newProxyInstance(beanContext.getModuleContext().getClassLoader(), new Handler(beanContext), beanContext.getBeanClass(), IntraVmProxy.class, Serializable.class); } catch (final InternalError ie) { // try without intravmproxy which is maybe not loadable (in OSGi it can happen) return LocalBeanProxyFactory.newProxyInstance(beanContext.getModuleContext().getClassLoader(), new Handler(beanContext), beanContext.getBeanClass(), Serializable.class); } }
public static Object subclassProxy(final BeanContext beanContext) { try { return LocalBeanProxyFactory.newProxyInstance(beanContext.getModuleContext().getClassLoader(), new Handler(beanContext), beanContext.getBeanClass(), IntraVmProxy.class, Serializable.class); } catch (final InternalError ie) { // try without intravmproxy which is maybe not loadable (in OSGi it can happen) return LocalBeanProxyFactory.newProxyInstance(beanContext.getModuleContext().getClassLoader(), new Handler(beanContext), beanContext.getBeanClass(), Serializable.class); } }
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; }
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; }