public JBossSessionBeanMetaData getMetaData() { // TODO: resolve this cast using generics on EJBContainer return (JBossSessionBeanMetaData) getXml(); }
public <B> B createBusinessObject(SessionContainer container, Serializable sessionId, Class<B> intf) { assert sessionId == null : "sessionId is must be null for Stateless"; assert intf != null : "intf is null"; try { /* * Get all business interfaces */ Set<String> businessInterfaceNames = new HashSet<String>(); JBossSessionBeanMetaData smd= (JBossSessionBeanMetaData) container.getXml(); CollectionHelper.addAllIfSet(businessInterfaceNames, smd.getBusinessRemotes()); CollectionHelper.addAllIfSet(businessInterfaceNames, smd.getBusinessLocals()); String interfaceName = intf.getName(); if (!businessInterfaceNames.contains(interfaceName)) throw new IllegalStateException("Cannot find BusinessObject for interface: " + interfaceName); String jndiName = container.getXml().determineResolvedJndiName(interfaceName); return intf.cast(container.getInitialContext().lookup(jndiName)); } catch (NamingException e) { throw new RuntimeException("failed to invoke getBusinessObject", e); } } }
JBossSessionBeanMetaData smd= (JBossSessionBeanMetaData) container.getXml(); CollectionHelper.addAllIfSet(businessInterfaceNames, smd.getBusinessRemotes()); CollectionHelper.addAllIfSet(businessInterfaceNames, smd.getBusinessLocals()); throw new IllegalStateException("Cannot find BusinessObject for interface: " + interfaceName); String jndiName = container.getXml().determineResolvedJndiName(interfaceName); return businessInterface.cast(container.getInitialContext().lookup(jndiName));
protected <B> B createNoInterfaceView(SessionContainer container, Serializable sessionId, Class<B> intf) { Class<?> beanClass = container.getBeanClass(); String name = container.getDeploymentQualifiedName(); KernelControllerContext endpointContext = (KernelControllerContext) kernel.getController().getContext(name, null); AsyncMethodsMetaData asyncMethods = null; JBossEnterpriseBeanMetaData sessionBeanMetaData = container.getXml(); if (sessionBeanMetaData instanceof JBossSessionBean31MetaData) { asyncMethods = ((JBossSessionBean31MetaData) sessionBeanMetaData).getAsyncMethods(); } // create an invocation handler InvocationHandler invocationHandler = new NoInterfaceViewInvocationHandler(endpointContext, sessionId, intf, asyncMethods == null ? new AsyncMethodsMetaData() : asyncMethods); // Now create the proxy Object noInterfaceView = new JavassistProxyFactory().createProxy(new Class<?>[] {beanClass}, invocationHandler); return intf.cast(noInterfaceView); }