Examples of SessionBeanJNDINameResolver


Examples of org.jboss.metadata.ejb.jboss.jndi.resolver.spi.SessionBeanJNDINameResolver

            // Create mappings based on the bean business interfaces
            if(bean instanceof JBossSessionBeanMetaData)
            {
               JBossSessionBeanMetaData sbean = (JBossSessionBeanMetaData) bean;
               String ejbName = sbean.getEjbName();
               SessionBeanJNDINameResolver sessionbeanJNDINameResolver = JNDIPolicyBasedJNDINameResolverFactory.getJNDINameResolver(sbean, this.defaultJNDIBindingPolicy);
               // home
               if(sbean.getHome() != null && sbean.getHome().length() > 0)
               {
                  String remoteHomeJNDIName = sessionbeanJNDINameResolver.resolveRemoteHomeJNDIName(sbean);
                  cdmd.addJndiName(remoteHomeJNDIName);
                  // Add ejb/vfsPath@iface
                  String home = sbean.getHome();
                  String ifacePath = prefix + "@" + home;
                  if(endpointAlternateMap.containsKey(ifacePath))
                     log.debug(ejbName+" duplicates home: "+home+", existing: "+endpointAlternateMap.get(ifacePath));
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, local-home: "+ifacePath+", ejbName: "+ejbName);
                  }
                  // Add ejb/iface
                  ifacePath = "ejb@" + home;
                  if(endpointMap.containsKey(ifacePath))
                  {
                     // TODO: may need to track the duplicates to create an error
                     log.debug(ejbName+" duplicates home: "+home+", existing: "+endpointMap.get(ifacePath));
                  }
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, home: "+ifacePath+", ejbName: "+ejbName);
                  }
               }
               // remote
               if(sbean.getRemote() != null && sbean.getRemote().length() > 0)
               {
                  // Add ejb/vfsPath@iface
                  String remote = sbean.getRemote();
                  String remoteJndiName = sessionbeanJNDINameResolver.resolveJNDIName(sbean, remote);
                  cdmd.addJndiName(remoteJndiName);
                  String ifacePath = prefix + "@" + remote;
                  if(endpointAlternateMap.containsKey(ifacePath))
                     log.debug(ejbName+" duplicates remote: "+remote+", existing: "+endpointAlternateMap.get(ifacePath));
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, remote: "+ifacePath+", ejbName: "+ejbName);
                  }
                  // Add ejb/iface
                  ifacePath = "ejb@" + remote;
                  if(endpointMap.containsKey(ifacePath))
                  {
                     // TODO: may need to track the duplicates to create an error
                     log.debug(ejbName+" duplicates remote: "+remote+", existing: "+endpointMap.get(ifacePath));
                  }
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, local: "+ifacePath+", ejbName: "+ejbName);
                  }
               }
               // local-home
               if(sbean.getLocalHome() != null && sbean.getLocalHome().length() > 0)
               {
                  String localHomeJNDIName = sessionbeanJNDINameResolver.resolveLocalHomeJNDIName(sbean);
                  cdmd.addJndiName(localHomeJNDIName);
                  // Add ejb/vfsPath@iface
                  String local = sbean.getLocalHome();
                  String ifacePath = prefix + "@" + local;
                  if(endpointAlternateMap.containsKey(ifacePath))
                     log.debug(ejbName+" duplicates local-home: "+local+", existing: "+endpointAlternateMap.get(ifacePath));
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, local-home: "+ifacePath+", ejbName: "+ejbName);
                  }
                  // Add ejb/iface
                  ifacePath = "ejb@" + local;
                  if(endpointMap.containsKey(ifacePath))
                  {
                     // TODO: may need to track the duplicates to create an error
                     log.debug(ejbName+" duplicates local-home: "+local+", existing: "+endpointMap.get(ifacePath));
                  }
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, local-home: "+ifacePath+", ejbName: "+ejbName);
                  }
               }
               // local
               if(sbean.getLocal() != null && sbean.getLocal().length() > 0)
               {
                  // Add ejb/vfsPath@iface
                  String local = sbean.getLocal();
                  String localJndiName = sessionbeanJNDINameResolver.resolveJNDIName(sbean, local);
                  cdmd.addJndiName(localJndiName);
                  String ifacePath = prefix + "@" + local;
                  if(endpointAlternateMap.containsKey(ifacePath))
                     log.debug(ejbName+" duplicates local: "+local+", existing: "+endpointAlternateMap.get(ifacePath));
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, local: "+ifacePath+", ejbName: "+ejbName);
                  }
                  // Add ejb/iface
                  ifacePath = "ejb@" + local;
                  if(endpointMap.containsKey(ifacePath))
                  {
                     // TODO: may need to track the duplicates to create an error
                     log.debug(ejbName+" duplicates local: "+local+", existing: "+endpointMap.get(ifacePath));
                  }
                  else
                  {
                     endpointAlternateMap.put(ifacePath, ejbCompID);
                     mappings.add(ifacePath);
                     if(trace)
                        log.trace("mapEjbs, local: "+ifacePath+", ejbName: "+ejbName);
                  }
               }

               BusinessLocalsMetaData locals = sbean.getBusinessLocals();
               if(locals != null && locals.size() > 0)
               {
                  String defaultLocalBusinessJNDIName = sessionbeanJNDINameResolver.resolveLocalBusinessDefaultJNDIName(sbean);
                  cdmd.addJndiName(defaultLocalBusinessJNDIName);
                  for(String local : locals)
                  {
                     // Add a targeted jndi name
                     String localBusinessJNDIName = sessionbeanJNDINameResolver.resolveJNDIName(sbean, local);
                     cdmd.addJndiName(localBusinessJNDIName);
                     // Add ejb/vfsPath@iface
                     String ifacePath = prefix + "@" + local;
                     if(endpointAlternateMap.containsKey(ifacePath))
                        log.debug(ejbName+" duplicates business local: "+local+", existing: "+endpointAlternateMap.get(ifacePath));
                     else
                     {
                        endpointAlternateMap.put(ifacePath, ejbCompID);
                        mappings.add(ifacePath);
                        if(trace)
                           log.trace("mapEjbs, business-local: "+ifacePath+", ejbName: "+ejbName);
                     }
                     // Add ejb/iface
                     ifacePath = "ejb@" + local;
                     if(endpointMap.containsKey(ifacePath))
                     {
                        // TODO: may need to track the duplicates to create an error
                        log.debug(ejbName+" duplicates business-local: "+local+", existing: "+endpointMap.get(ifacePath));
                     }
                     else
                     {
                        endpointAlternateMap.put(ifacePath, ejbCompID);
                        mappings.add(ifacePath);
                        if(trace)
                           log.trace("mapEjbs, business-local: "+ifacePath+", ejbName: "+ejbName);
                     }
                  }
               }
               BusinessRemotesMetaData remotes = sbean.getBusinessRemotes();
               if(remotes != null && remotes.size() > 0)
               {
                  String defaultRemoteBusinessJNDIName = sessionbeanJNDINameResolver.resolveRemoteBusinessDefaultJNDIName(sbean);
                  cdmd.addJndiName(defaultRemoteBusinessJNDIName);
                  for(String remote : remotes)
                  {
                     // Add a targeted jndi name
                     String remoteBusinessJNDIName = sessionbeanJNDINameResolver.resolveJNDIName(sbean, remote);
                     cdmd.addJndiName(remoteBusinessJNDIName);
                     // Add ejb/vfsPath/iface
                     String ifacePath = prefix + "@" + remote;
                     if(endpointAlternateMap.containsKey(ifacePath))
                        log.debug(ejbName+" duplicates business remote: "+remote+", existing: "+endpointAlternateMap.get(ifacePath));
View Full Code Here

Examples of org.jboss.metadata.ejb.jboss.jndi.resolver.spi.SessionBeanJNDINameResolver

               //LegacyEjb3JndiPolicy policy = new LegacyEjb3JndiPolicy();
               JBossEnterpriseBeanMetaData beanMD = target.getBeanMetaData();
               String containerJndiName = null;
               if (beanMD.isSession() || beanMD.isService())
               {
                  SessionBeanJNDINameResolver jndiNameResolver = JNDIPolicyBasedJNDINameResolverFactory.getJNDINameResolver((JBossSessionBeanMetaData) beanMD, this.defaultJNDIBindingPolicy);
                  containerJndiName = jndiNameResolver.resolveJNDIName((JBossSessionBeanMetaData) beanMD, ifaceName);
               }
               else if (beanMD.isEntity())
               {
                  EntityBeanJNDINameResolver jndiNameResolver = JNDIPolicyBasedJNDINameResolverFactory.getJNDINameResolver((JBossEntityBeanMetaData) beanMD, this.defaultJNDIBindingPolicy);
                  containerJndiName = jndiNameResolver.resolveJNDIName((JBossEntityBeanMetaData) beanMD, ifaceName);
               }
               if(containerJndiName != null)
                  ref.setResolvedJndiName(containerJndiName);
            }
            else
View Full Code Here

Examples of org.jboss.metadata.ejb.jboss.jndi.resolver.spi.SessionBeanJNDINameResolver

               String localJndiName = null;
               if (ejbJarMd.isEJB3x())
               {
                  if (md.isSession() || md.isService())
                  {
                     SessionBeanJNDINameResolver sessionBeanJNDINameResolver = JNDIPolicyBasedJNDINameResolverFactory.getJNDINameResolver((JBossSessionBeanMetaData) md, this.defaultJNDIBindingPolicy);
                     if (useDefaultProxy)
                     {
                        localJndiName = sessionBeanJNDINameResolver
                              .resolveLocalBusinessDefaultJNDIName((JBossSessionBeanMetaData) md);  
                     }
                     else
                     {
                        localJndiName = sessionBeanJNDINameResolver.resolveJNDIName((JBossSessionBeanMetaData) md, localInterface);
                     }
                    
                  }
                  else if (md.isEntity())
                  {
View Full Code Here

Examples of org.jboss.metadata.ejb.jboss.jndi.resolver.spi.SessionBeanJNDINameResolver

               String remoteJNDIName = null;
               if (ejbMarMd.isEJB3x())
               {
                  if (md.isSession() || md.isService())
                  {
                     SessionBeanJNDINameResolver sessionBeanJNDINameResolver = JNDIPolicyBasedJNDINameResolverFactory.getJNDINameResolver((JBossSessionBeanMetaData) md, this.defaultJNDIBindingPolicy);
                     if (useDefaultProxy)
                     {
                        remoteJNDIName = sessionBeanJNDINameResolver.resolveRemoteBusinessDefaultJNDIName((JBossSessionBeanMetaData) md);  
                     }
                     else
                     {
                        remoteJNDIName = sessionBeanJNDINameResolver.resolveJNDIName((JBossSessionBeanMetaData) md, remoteInterface);
                     }
                    
                  }
                  else if (md.isEntity())
                  {
View Full Code Here

Examples of org.jboss.metadata.ejb.jboss.jndi.resolver.spi.SessionBeanJNDINameResolver

         // let's only do this for SLSB, SFSB and @Service
         // Ignore Entity beans or MDB
         if (bean.isSession() || bean.isService())
         {
            JBossSessionBeanMetaData sessionBean = (JBossSessionBeanMetaData) bean;
            SessionBeanJNDINameResolver sessionBeanJNDINameResolver = JNDIPolicyBasedJNDINameResolverFactory.getJNDINameResolver(sessionBean, jndiBindingPolicy);
            // set jndi-name (default remote business jndi-name)
            String defaultBusinessRemoteJNDIName = sessionBeanJNDINameResolver.resolveRemoteBusinessDefaultJNDIName(sessionBean);
            if (defaultBusinessRemoteJNDIName != null)
            {
               sessionBean.setJndiName(defaultBusinessRemoteJNDIName);
            }
            // set local-jndi-name
            String defaultBusinessLocalJNDIName = sessionBeanJNDINameResolver.resolveLocalBusinessDefaultJNDIName(sessionBean);
            if (defaultBusinessLocalJNDIName != null)
            {
               sessionBean.setLocalJndiName(defaultBusinessLocalJNDIName);
            }
            // set local-home-jndi-name
            String localHomeJNDIName = sessionBeanJNDINameResolver.resolveLocalHomeJNDIName(sessionBean);
            if (localHomeJNDIName != null)
            {
               sessionBean.setLocalHomeJndiName(localHomeJNDIName);
            }
            // set remote-home-jndi-name
            String remoteHomeJNDIName = sessionBeanJNDINameResolver.resolveRemoteHomeJNDIName(sessionBean);
            if (remoteHomeJNDIName != null)
            {
               sessionBean.setHomeJndiName(remoteHomeJNDIName);
            }
         }
View Full Code Here

Examples of org.jboss.metadata.ejb.jboss.jndi.resolver.spi.SessionBeanJNDINameResolver

      }

      String defaultInvokerLocatorURL = ProxyRemotingUtils.getDefaultClientBinding();

      DefaultJndiBindingPolicy jndibindingPolicy = DefaultJNDIBindingPolicyFactory.getDefaultJNDIBindingPolicy();
      SessionBeanJNDINameResolver jndiNameResolver = JNDIPolicyBasedJNDINameResolverFactory.getJNDINameResolver(
            sessionBean, jndibindingPolicy);

      String containerRegistryKey = container.getObjectName().getCanonicalName();
      Context jndiCtx = null;
      try
      {
         jndiCtx = new InitialContext();
      }
      catch (NamingException ne)
      {
         throw new RuntimeException("Could not create jndi context for jndi binders", ne);
      }

      ProxyFactory proxyFactory = new ReflectProxyFactory();
      Interceptor[] clientInterceptors = this.getClientInterceptors(container);

      Set<Class<?>> allRemoteinterfaces = new HashSet<Class<?>>();
      for (String businessRemote : businessRemotes)
      {
         try
         {
            Class<?> businessRemoteIntf = unit.getClassLoader().loadClass(businessRemote);
            allRemoteinterfaces.add(businessRemoteIntf);

            InvocationHandler invocationHandler = new SingletonBeanRemoteInvocationHandler(containerRegistryKey,
                  defaultInvokerLocatorURL, clientInterceptors, businessRemote);

            // time to create a proxy
            Object proxy = proxyFactory.createProxy(new Class<?>[]
            {businessRemoteIntf}, invocationHandler);

            // bind to jndi

            String jndiName = jndiNameResolver.resolveJNDIName(sessionBean, businessRemote);

            JNDIBinderImpl jndiBinder = new JNDIBinderImpl(jndiCtx, jndiName, proxy);
            String binderMCBeanName = "<JNDIBinder><BusinessRemote:" + businessRemote + "><Bean:"
                  + sessionBean.getEjbName() + "><Unit:" + unit.getName() + ">";
            BeanMetaData jndiBinderBMD = createBeanMetaData(binderMCBeanName, jndiBinder, container);
            DeploymentUnit parentUnit = unit.getParent();
            parentUnit.addAttachment(BeanMetaData.class + ":" + binderMCBeanName, jndiBinderBMD);

         }
         catch (ClassNotFoundException cnfe)
         {
            throw new RuntimeException("Could not load business remote interface " + businessRemote, cnfe);
         }

      }

      // time to create a proxy
      List<RemoteBindingMetaData> remoteBindings = sessionBean.getRemoteBindings();
      if (remoteBindings == null || remoteBindings.isEmpty())
      {

         InvocationHandler invocationHandler = new SingletonBeanRemoteInvocationHandler(containerRegistryKey,
               defaultInvokerLocatorURL, clientInterceptors);
         String defaultRemoteJNDIName = jndiNameResolver.resolveRemoteBusinessDefaultJNDIName(sessionBean);
         Object proxy = proxyFactory.createProxy(allRemoteinterfaces.toArray(new Class<?>[allRemoteinterfaces.size()]),
               invocationHandler);
         JNDIBinderImpl jndiBinder = new JNDIBinderImpl(jndiCtx, defaultRemoteJNDIName, proxy);
         String binderMCBeanName = "<DefaultRemoteJNDIBinder><Bean:" + sessionBean.getEjbName() + "><Unit:"
               + unit.getName() + ">";
         BeanMetaData jndiBinderBMD = createBeanMetaData(binderMCBeanName, jndiBinder, container);
         DeploymentUnit parentUnit = unit.getParent();
         parentUnit.addAttachment(BeanMetaData.class + ":" + binderMCBeanName, jndiBinderBMD);

      }
      else
      {
         for (RemoteBindingMetaData remoteBinding : remoteBindings)
         {
            String jndiName = remoteBinding.getJndiName();
            // if not explicitly specified, then use the default jndi name
            if (jndiName == null)
            {
               jndiName = jndiNameResolver.resolveRemoteBusinessDefaultJNDIName(sessionBean);
            }
            String invokerLocatorURL = getClientBindURL(remoteBinding);
            InvocationHandler invocationHandler = new SingletonBeanRemoteInvocationHandler(containerRegistryKey,
                  invokerLocatorURL, clientInterceptors);
            Object proxy = proxyFactory.createProxy(allRemoteinterfaces
View Full Code Here

Examples of org.jboss.metadata.ejb.jboss.jndi.resolver.spi.SessionBeanJNDINameResolver

      {
         return;
      }

      DefaultJndiBindingPolicy jndibindingPolicy = DefaultJNDIBindingPolicyFactory.getDefaultJNDIBindingPolicy();
      SessionBeanJNDINameResolver jndiNameResolver = JNDIPolicyBasedJNDINameResolverFactory.getJNDINameResolver(
            sessionBean, jndibindingPolicy);

      // TODO: Rethink
      String containerRegistryKey = container.getObjectName().getCanonicalName();

      ProxyFactory proxyFactory = new ReflectProxyFactory();

      Context jndiCtx = null;
      try
      {
         jndiCtx = new InitialContext();
      }
      catch (NamingException ne)
      {
         throw new RuntimeException("Could not create jndi context for jndi binders", ne);
      }
      Set<Class<?>> allLocalinterfaces = new HashSet<Class<?>>();
      for (String businessLocal : businessLocals)
      {
         Class<?> businessLocalIntf = null;
         try
         {
            businessLocalIntf = unit.getClassLoader().loadClass(businessLocal);
         }
         catch (ClassNotFoundException cnfe)
         {
            throw new RuntimeException("Could not load business local interface " + businessLocal, cnfe);
         }
         allLocalinterfaces.add(businessLocalIntf);

         InvocationHandler invocationHandler = new SingletonBeanLocalInvocationHandler(containerRegistryKey,
               businessLocal);

         // time to create a proxy
         Object proxy = proxyFactory.createProxy(new Class<?>[]
         {businessLocalIntf}, invocationHandler);

         // bind to jndi

         String jndiName = jndiNameResolver.resolveJNDIName(sessionBean, businessLocal);

         JNDIBinderImpl jndiBinder = new JNDIBinderImpl(jndiCtx, jndiName, proxy);
         String binderMCBeanName = "<JNDIBinder><BusinessLocal:" + businessLocal + "><Bean:" + sessionBean.getEjbName()
               + "><Unit:" + unit.getName() + ">";
         BeanMetaData jndiBinderBMD = createBeanMetaData(binderMCBeanName, jndiBinder, container);
         DeploymentUnit parentUnit = unit.getParent();
         parentUnit.addAttachment(BeanMetaData.class + ":" + binderMCBeanName, jndiBinderBMD);

      }

      List<LocalBindingMetaData> localBindings = sessionBean.getLocalBindings();
      if (localBindings == null || localBindings.isEmpty())
      {
         InvocationHandler invocationHandler = new SingletonBeanLocalInvocationHandler(containerRegistryKey);
         String defaultBusinessLocalJNDIName = jndiNameResolver.resolveLocalBusinessDefaultJNDIName(sessionBean);
         Object proxy = proxyFactory.createProxy(allLocalinterfaces.toArray(new Class<?>[allLocalinterfaces.size()]),
               invocationHandler);
         JNDIBinderImpl jndiBinder = new JNDIBinderImpl(jndiCtx, defaultBusinessLocalJNDIName, proxy);
         String binderMCBeanName = "<DefaultLocalJNDIBinder><Bean:" + sessionBean.getEjbName() + "><Unit:"
               + unit.getName() + ">";
         BeanMetaData jndiBinderBMD = createBeanMetaData(binderMCBeanName, jndiBinder, container);
         DeploymentUnit parentUnit = unit.getParent();
         parentUnit.addAttachment(BeanMetaData.class + ":" + binderMCBeanName, jndiBinderBMD);
      }
      else
      {
         for (LocalBindingMetaData localBinding : localBindings)
         {
            String jndiName = localBinding.getJndiName();
            // if not explicitly specified, then use the default jndi name
            if (jndiName == null)
            {
               jndiName = jndiNameResolver.resolveLocalBusinessDefaultJNDIName(sessionBean);
            }
            InvocationHandler invocationHandler = new SingletonBeanLocalInvocationHandler(containerRegistryKey);
            Object proxy = proxyFactory.createProxy(
                  allLocalinterfaces.toArray(new Class<?>[allLocalinterfaces.size()]), invocationHandler);
            JNDIBinderImpl jndiBinder = new JNDIBinderImpl(jndiCtx, jndiName, proxy);
View Full Code Here

Examples of org.jboss.metadata.ejb.jboss.jndi.resolver.spi.SessionBeanJNDINameResolver

      Set<Binding> bindings = new HashSet<Binding>();
     
      String defaultInvokerLocatorURL = ProxyRemotingUtils.getDefaultClientBinding();

      DefaultJndiBindingPolicy jndibindingPolicy = DefaultJNDIBindingPolicyFactory.getDefaultJNDIBindingPolicy();
      SessionBeanJNDINameResolver jndiNameResolver = JNDIPolicyBasedJNDINameResolverFactory.getJNDINameResolver(
            sessionBean, jndibindingPolicy);

      String containerRegistryKey = container.getObjectName().getCanonicalName();
      String containerGUID = Ejb3Registry.guid(container);

      ProxyFactory proxyFactory = new ReflectProxyFactory();
      Interceptor[] clientInterceptors = this.getRemoteClientInterceptors(container);

      Set<Class<?>> allRemoteinterfaces = new HashSet<Class<?>>();
      for (String businessRemote : businessRemotes)
      {
         try
         {
            Class<?> businessRemoteIntf = unit.getClassLoader().loadClass(businessRemote);
            allRemoteinterfaces.add(businessRemoteIntf);

            InvocationHandler invocationHandler = new SingletonBeanRemoteInvocationHandler(containerRegistryKey, containerGUID,
                  defaultInvokerLocatorURL, clientInterceptors, businessRemote);

            // time to create a proxy
            Object proxy = proxyFactory.createProxy(new Class<?>[]
            {businessRemoteIntf}, invocationHandler);

            // bind to jndi

            String jndiName = jndiNameResolver.resolveJNDIName(sessionBean, businessRemote);

            Binding binding = new Binding(jndiName, proxy, "EJB3.x Remote Business Interface");
            bindings.add(binding);

         }
         catch (ClassNotFoundException cnfe)
         {
            throw new RuntimeException("Could not load business remote interface " + businessRemote, cnfe);
         }

      }

      // time to create a proxy
      List<RemoteBindingMetaData> remoteBindings = sessionBean.getRemoteBindings();
      if (remoteBindings == null || remoteBindings.isEmpty())
      {

         InvocationHandler invocationHandler = new SingletonBeanRemoteInvocationHandler(containerRegistryKey, containerGUID,
               defaultInvokerLocatorURL, clientInterceptors);
         String defaultRemoteJNDIName = jndiNameResolver.resolveRemoteBusinessDefaultJNDIName(sessionBean);
         Object proxy = proxyFactory.createProxy(allRemoteinterfaces.toArray(new Class<?>[allRemoteinterfaces.size()]),
               invocationHandler);
         Binding binding = new Binding(defaultRemoteJNDIName, proxy, "EJB3.x Default Remote Business Interface");
         bindings.add(binding);

      }
      else
      {
         for (RemoteBindingMetaData remoteBinding : remoteBindings)
         {
            String jndiName = remoteBinding.getJndiName();
            // if not explicitly specified, then use the default jndi name
            if (jndiName == null)
            {
               jndiName = jndiNameResolver.resolveRemoteBusinessDefaultJNDIName(sessionBean);
            }
            String invokerLocatorURL = getClientBindURL(remoteBinding);
            InvocationHandler invocationHandler = new SingletonBeanRemoteInvocationHandler(containerRegistryKey, containerGUID,
                  invokerLocatorURL, clientInterceptors);
            Object proxy = proxyFactory.createProxy(allRemoteinterfaces
View Full Code Here

Examples of org.jboss.metadata.ejb.jboss.jndi.resolver.spi.SessionBeanJNDINameResolver

      }
     
      Set<Binding> bindings = new HashSet<Binding>();
     
      DefaultJndiBindingPolicy jndibindingPolicy = DefaultJNDIBindingPolicyFactory.getDefaultJNDIBindingPolicy();
      SessionBeanJNDINameResolver jndiNameResolver = JNDIPolicyBasedJNDINameResolverFactory.getJNDINameResolver(
            sessionBean, jndibindingPolicy);

      // TODO: Rethink
      String containerRegistryKey = container.getObjectName().getCanonicalName();
      String containerGUID = Ejb3Registry.guid(container);

      ProxyFactory proxyFactory = new ReflectProxyFactory();

      Set<Class<?>> allLocalinterfaces = new HashSet<Class<?>>();
      // get the client side AOP interceptor(s) for local business interface of the singleton bean
      Interceptor[] clientInterceptors = this.getLocalClientInterceptors(container);

      for (String businessLocal : businessLocals)
      {
         Class<?> businessLocalIntf = null;
         try
         {
            businessLocalIntf = unit.getClassLoader().loadClass(businessLocal);
         }
         catch (ClassNotFoundException cnfe)
         {
            throw new RuntimeException("Could not load business local interface " + businessLocal, cnfe);
         }
         allLocalinterfaces.add(businessLocalIntf);

         InvocationHandler invocationHandler = new SingletonBeanLocalInvocationHandler(containerRegistryKey,
               containerGUID, businessLocal, clientInterceptors);

         // time to create a proxy
         Object proxy = proxyFactory.createProxy(new Class<?>[]
         {businessLocalIntf}, invocationHandler);

         // bind to jndi

         String jndiName = jndiNameResolver.resolveJNDIName(sessionBean, businessLocal);

         Binding binding = new Binding(jndiName, proxy, "EJB3.x Local Business Interface");
         bindings.add(binding);

      }

      List<LocalBindingMetaData> localBindings = sessionBean.getLocalBindings();
      if (localBindings == null || localBindings.isEmpty())
      {
         InvocationHandler invocationHandler = new SingletonBeanLocalInvocationHandler(containerRegistryKey, containerGUID, clientInterceptors);
         String defaultBusinessLocalJNDIName = jndiNameResolver.resolveLocalBusinessDefaultJNDIName(sessionBean);
         Object proxy = proxyFactory.createProxy(allLocalinterfaces.toArray(new Class<?>[allLocalinterfaces.size()]),
               invocationHandler);
         Binding binding = new Binding(defaultBusinessLocalJNDIName, proxy, "EJB3.x Default Local Business Interface");
         bindings.add(binding);
      }
      else
      {
         for (LocalBindingMetaData localBinding : localBindings)
         {
            String jndiName = localBinding.getJndiName();
            // if not explicitly specified, then use the default jndi name
            if (jndiName == null)
            {
               jndiName = jndiNameResolver.resolveLocalBusinessDefaultJNDIName(sessionBean);
            }
            InvocationHandler invocationHandler = new SingletonBeanLocalInvocationHandler(containerRegistryKey, containerGUID, clientInterceptors);
            Object proxy = proxyFactory.createProxy(
                  allLocalinterfaces.toArray(new Class<?>[allLocalinterfaces.size()]), invocationHandler);
            Binding binding = new Binding(jndiName, proxy, "EJB3.x Default Local Business Interface");
View Full Code Here

Examples of org.jboss.metadata.ejb.jboss.jndi.resolver.spi.SessionBeanJNDINameResolver

      }

      String defaultInvokerLocatorURL = ProxyRemotingUtils.getDefaultClientBinding();

      DefaultJndiBindingPolicy jndibindingPolicy = DefaultJNDIBindingPolicyFactory.getDefaultJNDIBindingPolicy();
      SessionBeanJNDINameResolver jndiNameResolver = JNDIPolicyBasedJNDINameResolverFactory.getJNDINameResolver(
            sessionBean, jndibindingPolicy);

      String containerRegistryKey = container.getObjectName().getCanonicalName();
      String containerGUID = Ejb3Registry.guid(container);
      Context jndiCtx = null;
      try
      {
         jndiCtx = new InitialContext();
      }
      catch (NamingException ne)
      {
         throw new RuntimeException("Could not create jndi context for jndi binders", ne);
      }

      ProxyFactory proxyFactory = new ReflectProxyFactory();
      Interceptor[] clientInterceptors = this.getRemoteClientInterceptors(container);

      Set<Class<?>> allRemoteinterfaces = new HashSet<Class<?>>();
      for (String businessRemote : businessRemotes)
      {
         try
         {
            Class<?> businessRemoteIntf = unit.getClassLoader().loadClass(businessRemote);
            allRemoteinterfaces.add(businessRemoteIntf);

            InvocationHandler invocationHandler = new SingletonBeanRemoteInvocationHandler(containerRegistryKey, containerGUID,
                  defaultInvokerLocatorURL, clientInterceptors, businessRemote);

            // time to create a proxy
            Object proxy = proxyFactory.createProxy(new Class<?>[]
            {businessRemoteIntf}, invocationHandler);

            // bind to jndi

            String jndiName = jndiNameResolver.resolveJNDIName(sessionBean, businessRemote);

            JNDIBinderImpl jndiBinder = new JNDIBinderImpl(jndiCtx, jndiName, proxy);
            String binderMCBeanName = JNDI_BINDER_MC_BEAN_PREFIX + jndiName;
            BeanMetaData jndiBinderBMD = createBeanMetaData(binderMCBeanName, jndiBinder, container);
            DeploymentUnit parentUnit = unit.getParent();
            parentUnit.addAttachment(BeanMetaData.class + ":" + binderMCBeanName, jndiBinderBMD);

         }
         catch (ClassNotFoundException cnfe)
         {
            throw new RuntimeException("Could not load business remote interface " + businessRemote, cnfe);
         }

      }

      // time to create a proxy
      List<RemoteBindingMetaData> remoteBindings = sessionBean.getRemoteBindings();
      if (remoteBindings == null || remoteBindings.isEmpty())
      {

         InvocationHandler invocationHandler = new SingletonBeanRemoteInvocationHandler(containerRegistryKey, containerGUID,
               defaultInvokerLocatorURL, clientInterceptors);
         String defaultRemoteJNDIName = jndiNameResolver.resolveRemoteBusinessDefaultJNDIName(sessionBean);
         Object proxy = proxyFactory.createProxy(allRemoteinterfaces.toArray(new Class<?>[allRemoteinterfaces.size()]),
               invocationHandler);
         JNDIBinderImpl jndiBinder = new JNDIBinderImpl(jndiCtx, defaultRemoteJNDIName, proxy);
         String binderMCBeanName = JNDI_BINDER_MC_BEAN_PREFIX + defaultRemoteJNDIName;
         BeanMetaData jndiBinderBMD = createBeanMetaData(binderMCBeanName, jndiBinder, container);
         DeploymentUnit parentUnit = unit.getParent();
         parentUnit.addAttachment(BeanMetaData.class + ":" + binderMCBeanName, jndiBinderBMD);

      }
      else
      {
         for (RemoteBindingMetaData remoteBinding : remoteBindings)
         {
            String jndiName = remoteBinding.getJndiName();
            // if not explicitly specified, then use the default jndi name
            if (jndiName == null)
            {
               jndiName = jndiNameResolver.resolveRemoteBusinessDefaultJNDIName(sessionBean);
            }
            String invokerLocatorURL = getClientBindURL(remoteBinding);
            InvocationHandler invocationHandler = new SingletonBeanRemoteInvocationHandler(containerRegistryKey, containerGUID,
                  invokerLocatorURL, clientInterceptors);
            Object proxy = proxyFactory.createProxy(allRemoteinterfaces
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.