private <B> B createNoInterfaceBusinessObject(SessionContainer container, Serializable sessionId, Class<B> businessInterface) throws NamingException { // we have determined it's the no-interface, let's hack JBossSessionBean31MetaData beanMetaData = (JBossSessionBean31MetaData) container.getMetaData(); // get no-interface view jndi name String noInterfaceJndiName = this.getJNDINameResolver(beanMetaData).resolveNoInterfaceJNDIName(beanMetaData); return businessInterface.cast(container.getInitialContext().lookup(noInterfaceJndiName)); }
protected SessionProxyFactory getProxyFactory(LocalBinding binding) { assert binding!=null : LocalBinding.class.getSimpleName() + " must be specified"; // Find the jndiName String jndiName = this.getMetaData().getLocalJndiName(); if(binding!=null) { jndiName = binding.jndiBinding(); } // Get the Registry name String proxyFactoryRegistryBindName = this.getJndiRegistrar().getProxyFactoryRegistryKey(jndiName, this.getMetaData(), true); // Return return this.getProxyFactory(proxyFactoryRegistryBindName); }
protected SessionProxyFactory getProxyFactory(RemoteBinding binding) { assert binding!=null : RemoteBinding.class.getSimpleName() + " must be specified"; // Get the Registry name String proxyFactoryRegistryBindName = this.getJndiRegistrar().getProxyFactoryRegistryKey(binding.jndiBinding(), this.getMetaData(), true); // Return return this.getProxyFactory(proxyFactoryRegistryBindName); }
return this.getInitialContext().lookup(this.getMetaData().getHomeJndiName());
JBossSessionBeanMetaData smd = container.getMetaData();
protected void lockedStop() throws Exception { try { Dispatcher.singleton.unregisterTarget(getObjectName().getCanonicalName()); } catch (Exception ignore) { log.debug("Dispatcher unregister target failed", ignore); } // Deregister with Remoting Dispatcher.singleton.unregisterTarget(this.getName()); // Unbind applicable JNDI Entries JndiSessionRegistrarBase jndiRegistrar = this.getJndiRegistrar(); if (jndiRegistrar != null) { jndiRegistrar.unbindEjb(this.getInitialContext(), this.getMetaData()); } super.lockedStop(); }
protected void lockedStart() throws Exception { super.lockedStart(); this.registerWithAopDispatcher(); // Obtain registrar JndiSessionRegistrarBase registrar = this.getJndiRegistrar(); // Bind all appropriate references/factories to Global JNDI for Client access, if a JNDI Registrar is present if (registrar != null) { String guid = Ejb3Registry.guid(this); registrar.bindEjb(this.getInitialContext(), this.getMetaData(), this.getClassloader(), this.getObjectName() .getCanonicalName(), guid, this.getAdvisor()); } else { log.debug("No " + JndiSessionRegistrarBase.class.getSimpleName() + " was found; bypassing binding of Proxies to " + this.getName() + " in Global JNDI."); } }
protected ViewType getViewType(SessionContainer container, Class<?> intf) { // try to see if we can pass the preconditions of LegacyStatefulBusinessObjectFactory? // a direct copy out of LegacyStatefulBusinessObjectFactory // less risky than rolling our own thing. Class<?>[] remoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container); if(arrayContains(remoteInterfaces, intf)) return ViewType.REMOTE; Class<?>[] localInterfaces = ProxyFactoryHelper.getLocalAndBusinessLocalInterfaces(container); if(arrayContains(localInterfaces, intf)) return ViewType.LOCAL; // copied out of EJB3NoInterfaceDeployer JBossSessionBeanMetaData beanMetaData = container.getMetaData(); if(!(beanMetaData instanceof JBossSessionBean31MetaData)) return ViewType.UNKNOWN; JBossSessionBean31MetaData sessionBean31MetaData = (JBossSessionBean31MetaData) beanMetaData; if(!sessionBean31MetaData.isNoInterfaceBean()) return ViewType.UNKNOWN; // it could still be an unknown view, make sure it's the no-interface view if(intf.equals(container.getBeanClass())) return ViewType.NO_INTERFACE; return ViewType.UNKNOWN; }
/** * A direct copy out of LegacyStatefulBusinessObjectFactory */ protected <B> B createLegacyBusinessObject(SessionContainer container, Serializable sessionId, Class<B> businessInterface, ViewType type) { boolean isRemote = type == ViewType.REMOTE; // Obtain SFSB JNDI Registrar String sfsbJndiRegistrarObjectStoreBindName = ((StatefulContainer) container).getJndiRegistrarBindName(); JndiStatefulSessionRegistrar sfsbJndiRegistrar = Ejb3RegistrarLocator.locateRegistrar().lookup( sfsbJndiRegistrarObjectStoreBindName, JndiStatefulSessionRegistrar.class); // Get the metadata JBossSessionBeanMetaData smd = container.getMetaData(); // Get the appropriate JNDI Name String jndiName = !isRemote ? smd.getLocalJndiName() : smd.getJndiName(); // Find the Proxy Factory Key for this SFSB String proxyFactoryKey = sfsbJndiRegistrar.getProxyFactoryRegistryKey(jndiName, smd, !isRemote); // Lookup the Proxy Factory in the Object Store StatefulSessionProxyFactory proxyFactory = Ejb3RegistrarLocator.locateRegistrar().lookup(proxyFactoryKey, StatefulSessionProxyFactory.class); // Create a new business proxy Object proxy = proxyFactory.createProxyBusiness(sessionId, businessInterface.getName()); // Return the Proxy return businessInterface.cast(proxy); }
BusinessRemotesMetaData businessRemotes = container.getMetaData().getBusinessRemotes(); if (businessRemotes != null && businessRemotes.size() > 0) String jndiName = container.getMetaData().getJndiName(); log.debug("default remote binding has jndiName of " + jndiName); String uri = ""; // use the default