Examples of SessionProxyFactory


Examples of org.jboss.ejb3.proxy.factory.session.SessionProxyFactory

   protected SessionProxyFactory createRemoteProxyFactory(final String name, final String containerName,
         final String containerGuid, final JBossSessionBeanMetaData smd, final ClassLoader cl, final String url,
         final Advisor advisor, final String interceptorStack)
   {
      // Create
      SessionProxyFactory factory = new StatelessSessionClusteredProxyFactory(name, containerName, containerGuid, smd,
            cl, url, advisor, getRegistry(), interceptorStack);

      // Register with Remoting
      log.debug("Registering with Remoting Dispatcher under name \"" + factory.getName() + "\": " + factory);
      Dispatcher.singleton.registerTarget(factory.getName(), factory);

      // Return
      return factory;
   }
View Full Code Here

Examples of org.jboss.ejb3.proxy.factory.session.SessionProxyFactory

      Object factory = Ejb3RegistrarLocator.locateRegistrar().lookup(proxyFactoryKey);
     
      // Cast
      assert factory instanceof SessionProxyFactory : "Specified factory " + factory.getClass().getName() + " is not of type "
      + SessionProxyFactory.class.getName() + " as required by " + StatefulContainer.class.getName() + ", but was instead " + factory;
      SessionProxyFactory sessionFactory = null;
      sessionFactory = SessionProxyFactory.class.cast(factory);

      // Create Proxy
      Object proxy = sessionFactory.createProxyEjb2x();
     
      // Return
      return proxy;
   }
View Full Code Here

Examples of org.jboss.ejb3.proxy.factory.session.SessionProxyFactory

      /*
       * In this implementation we just make a new Proxy Factory, for now
       */

      // Create
      SessionProxyFactory factory = new ServiceRemoteProxyFactory(this.getName(), this.getName(), Ejb3Registry
            .guid(this), (JBossServiceBeanMetaData) this.getMetaData(), this.getClassloader(), binding.clientBindUrl(),
            this.getAdvisor(), binding.interceptorStack());

      // Start the factory
      try
      {
         factory.start();
      }
      catch (Exception e)
      {
         throw new RuntimeException("Error in starting " + factory, e);
      }
View Full Code Here

Examples of org.jboss.ejb3.proxy.factory.session.SessionProxyFactory

      /*
       * In this implementation we just make a new Proxy Factory, for now
       */

      // Create
      SessionProxyFactory factory = new ServiceRemoteProxyFactory(this.getName(), this.getName(), Ejb3Registry
            .guid(this), (JBossServiceBeanMetaData) this.getMetaData(), this.getClassloader(), binding.clientBindUrl(),
            this.getAdvisor(), binding.interceptorStack());

      // Start the factory
      try
      {
         factory.start();
      }
      catch (Exception e)
      {
         throw new RuntimeException("Error in starting " + factory, e);
      }
View Full Code Here

Examples of org.jboss.ejb3.proxy.factory.session.SessionProxyFactory

      /*
       * In this implementation we just make a new Proxy Factory, for now
       */

      // Initialize
      SessionProxyFactory factory = null;

      // If Clustered
      if (this.isAnnotationPresent(Clustered.class))
      {
         // Get the Proxy Clustering Registry
         Ejb3Registrar registrar = Ejb3RegistrarLocator.locateRegistrar();
         String mcName = ClusteredObjectStoreBindings.CLUSTERED_OBJECTSTORE_BEAN_NAME_PROXY_CLUSTERING_REGISTRY;
         ProxyClusteringRegistry registry = (ProxyClusteringRegistry) registrar.lookup(mcName);
         assert registry != null : "Could not find " + ProxyClusteringRegistry.class.getSimpleName() + " in the "
               + Ejb3Registrar.class.getSimpleName() + " under name " + mcName;
         factory = new StatelessSessionClusteredProxyFactory(this.getName(), this.getName(), Ejb3Registry.guid(this),
               this.getMetaData(), this.getClassloader(), binding.clientBindUrl(), this.getAdvisor(), registry, null);
      }
      else
      {
         factory = new StatelessSessionRemoteProxyFactory(this.getName(), this.getName(), Ejb3Registry.guid(this), this
               .getMetaData(), this.getClassloader(), binding.clientBindUrl(), this.getAdvisor(), null);
      }

      // Start the factory
      try
      {
         factory.start();
      }
      catch (Exception e)
      {
         throw new RuntimeException("Error in starting " + factory, e);
      }
View Full Code Here

Examples of org.jboss.ejb3.proxy.factory.session.SessionProxyFactory

      /*
       * In this implementation we just make a new Proxy Factory, for now
       */

      // Create
      SessionProxyFactory factory = new ServiceRemoteProxyFactory(this.getName(), this.getName(), Ejb3Registry
            .guid(this), (JBossServiceBeanMetaData) this.getMetaData(), this.getClassloader(), binding.clientBindUrl(),
            this.getAdvisor(), binding.interceptorStack());

      // Start the factory
      try
      {
         factory.start();
      }
      catch (Exception e)
      {
         throw new RuntimeException("Error in starting " + factory, e);
      }
View Full Code Here

Examples of org.jboss.ejb3.proxy.factory.session.SessionProxyFactory

      /*
       * In this implementation we just make a new Proxy Factory, for now
       */

      // Initialize
      SessionProxyFactory factory = null;

      // If Clustered
      if (this.isAnnotationPresent(Clustered.class))
      {
         // Get the Proxy Clustering Registry
         Ejb3Registrar registrar = Ejb3RegistrarLocator.locateRegistrar();
         String mcName = ClusteredObjectStoreBindings.CLUSTERED_OBJECTSTORE_BEAN_NAME_PROXY_CLUSTERING_REGISTRY;
         ProxyClusteringRegistry registry = (ProxyClusteringRegistry) registrar.lookup(mcName);
         assert registry != null : "Could not find " + ProxyClusteringRegistry.class.getSimpleName() + " in the "
               + Ejb3Registrar.class.getSimpleName() + " under name " + mcName;
         factory = new StatelessSessionClusteredProxyFactory(this.getName(), this.getName(), Ejb3Registry.guid(this),
               this.getMetaData(), this.getClassloader(), binding.clientBindUrl(), this.getAdvisor(), registry);
      }
      else
      {
         factory = new StatelessSessionRemoteProxyFactory(this.getName(), this.getName(), Ejb3Registry.guid(this), this
               .getMetaData(), this.getClassloader(), binding.clientBindUrl(), this.getAdvisor());
      }

      // Start the factory
      try
      {
         factory.start();
      }
      catch (Exception e)
      {
         throw new RuntimeException("Error in starting " + factory, e);
      }
View Full Code Here

Examples of org.jboss.ejb3.proxy.factory.session.SessionProxyFactory

   }
  
   @Override
   public Object createProxyRemoteEjb21(RemoteBinding binding, String businessInterfaceType) throws Exception
   {
      SessionProxyFactory proxyFactory = this.getProxyFactory(binding);
      return proxyFactory.createProxyEjb2x();
   }
View Full Code Here

Examples of org.jboss.ejb3.proxy.factory.session.SessionProxyFactory

      // Determine if a business interface is defined here
      boolean hasBusiness = this.hasBusiness(name, referenceAddresses);

      // Cast
      SessionProxyFactory sFactory = null;
      try
      {
         sFactory = SessionProxyFactory.class.cast(factory);
      }
      catch (ClassCastException cce)
      {
         throw new RuntimeException(ProxyFactory.class.getSimpleName() + " used in "
               + SessionProxyObjectFactory.class.getSimpleName() + " must be of type "
               + SessionProxyFactory.class.getName() + " but was instead " + factory, cce);
      }

      // If home and business are bound together
      if (hasHome && hasBusiness)
      {
         proxy = sFactory.createProxyDefault();
         log.debug("Created Proxy for both EJB2.x Home and EJB3 Business Interfaces.");
      }
      // If bound to home only
      else if (hasHome)
      {
         proxy = sFactory.createProxyHome();
         log.debug("Created Proxy for EJB2.x Home Interface(s)");
      }
      // If bound to business only
      else if (hasBusiness)
      {
         // Initialize
         String type = null;

         // If local
         if (this.hasLocalBusiness(referenceAddresses))
         {
            type = ProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_PROXY_BUSINESS_INTERFACE_LOCAL;
         }
         // If remote
         else
         {
            type = ProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_PROXY_BUSINESS_INTERFACE_REMOTE;
         }

         // Get all business interfaces to be used
         List<String> businessInterfaces = referenceAddresses.get(type);

         // If only one is defined
         if (businessInterfaces.size() == 1)
         {
            // Obtain a proxy specific to this business interface
            String businessInterface = businessInterfaces.get(0);
            proxy = sFactory.createProxyBusiness(businessInterface);
            log.debug("Created Proxy of type " + proxy.getClass().getSimpleName() + " for EJB3 Business Interface: "
                  + businessInterface);
         }
         else
         {
            // Use a general-purpose proxy for all business interfaces
            proxy = sFactory.createProxyDefault();
            log.debug("Created Proxy of type " + proxy.getClass().getSimpleName() + " for EJB3 Business Interfaces: "
                  + businessInterfaces);
         }
      }
      // No valid type is bound here
View Full Code Here

Examples of org.jboss.ejb3.proxy.factory.session.SessionProxyFactory

            url = JndiSessionRegistrarBase.DEFAULT_CLIENT_BINDING;
            remoteBinding.setClientBindUrl(url);
         }
         // Create and register a remote proxy factory
         String remoteProxyFactoryKey = this.getProxyFactoryRegistryKey(smd, false);
         SessionProxyFactory factory = this.createRemoteProxyFactory(remoteProxyFactoryKey, containerName,
               containerGuid, smd, cl, url, advisor);
         this.registerProxyFactory(remoteProxyFactoryKey, factory, smd);

         // Initialize Reference Addresses to attach to default remote JNDI Reference
         List<RefAddr> refAddrsForDefaultRemote = new ArrayList<RefAddr>();

         // For each of the remote business interfaces, make a Reference Address
         if (businessRemotes != null)
         {
            for (String businessRemote : businessRemotes)
            {
               RefAddr refAddr = new StringRefAddr(
                     ProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_PROXY_BUSINESS_INTERFACE_REMOTE, businessRemote);
               refAddrsForDefaultRemote.add(refAddr);
            }
         }

         // Determine if remote home and business remotes are bound to same JNDI Address
         boolean bindRemoteAndHomeTogether = this.isHomeAndBusinessBoundTogether(smd, false);
         if (bindRemoteAndHomeTogether)
         {
            // Add a Reference Address for the Remote Home
            String home = smd.getHome();
            assert home != null : "Home and Business set to be bound together, yet no home is defined";
            RefAddr refAddr = new StringRefAddr(
                  ProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_PROXY_EJB2x_INTERFACE_HOME_REMOTE, home);
            refAddrsForDefaultRemote.add(refAddr);
         }
         // Bind Home (not bound together) if exists
         else if (smd.getHome() != null && !smd.getHome().equals(""))
         {
            String homeType = smd.getHome();
            RefAddr refAddrHomeInterface = new StringRefAddr(
                  ProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_PROXY_EJB2x_INTERFACE_HOME_REMOTE, homeType);
            RefAddr refAddrRemoting = this.createRemotingRefAddr(smd);
            Reference homeRef = new Reference(JndiSessionRegistrarBase.OBJECT_FACTORY_CLASSNAME_PREFIX + homeType, this
                  .getSessionProxyObjectFactoryType(), null);
            homeRef.add(refAddrHomeInterface);
            homeRef.add(refAddrRemoting);
            String homeAddress = smd.getHomeJndiName();
            assert homeAddress != null && !homeAddress.equals("") : "JNDI Address for Remote Home must be defined";
            log.debug("Remote Home View for EJB " + smd.getEjbName() + " to be bound into JNDI at \"" + homeAddress
                  + "\"");
            this.bind(context, homeRef, homeAddress, remoteProxyFactoryKey, containerName);
         }

         // Add a Reference Address for the Remoting URL
         refAddrsForDefaultRemote.add(this.createRemotingRefAddr(smd));

         /*
          * Bind ObjectFactory for default remote businesses (and home if bound together)
          */

         // Get Classname to set for Reference
         String defaultRemoteClassName = this.getHumanReadableListOfInterfacesInRefAddrs(refAddrsForDefaultRemote);

         // Create a Reference
         Reference defaultRemoteRef = new Reference(JndiSessionRegistrarBase.OBJECT_FACTORY_CLASSNAME_PREFIX
               + defaultRemoteClassName, this.getSessionProxyObjectFactoryType(), null);

         // Add all Reference Addresses for Default Remote Reference
         for (RefAddr refAddr : refAddrsForDefaultRemote)
         {
            log.debug("Adding " + RefAddr.class.getSimpleName() + " to Default Remote "
                  + Reference.class.getSimpleName() + ": Type \"" + refAddr.getType() + "\", Content \""
                  + refAddr.getContent() + "\"");
            defaultRemoteRef.add(refAddr);
         }

         // Bind the Default Remote Reference to JNDI
         String defaultRemoteAddress = smd.getJndiName();
         log.debug("Default Remote Business View for EJB " + smd.getEjbName() + " to be bound into JNDI at \""
               + defaultRemoteAddress + "\"");
         this.bind(context, defaultRemoteRef, defaultRemoteAddress, remoteProxyFactoryKey, containerName);

         // Bind ObjectFactory specific to each Remote Business Interface
         if (businessRemotes != null)
         {
            for (String businessRemote : businessRemotes)
            {
               RefAddr refAddrBusinessInterface = new StringRefAddr(
                     ProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_PROXY_BUSINESS_INTERFACE_REMOTE, businessRemote);
               RefAddr refAddrRemoting = this.createRemotingRefAddr(smd);
               Reference ref = new Reference(JndiSessionRegistrarBase.OBJECT_FACTORY_CLASSNAME_PREFIX + businessRemote,
                     this.getSessionProxyObjectFactoryType(), null);
               ref.add(refAddrBusinessInterface);
               ref.add(refAddrRemoting);
               String address = JbossSessionBeanJndiNameResolver.resolveJndiName(smd, businessRemote);
               log.debug("Remote Business View for " + businessRemote + " of EJB " + smd.getEjbName()
                     + " to be bound into JNDI at \"" + address + "\"");
               this.bind(context, ref, address, remoteProxyFactoryKey, containerName);
            }
         }
      }
      // If there's a local view
      if (hasLocalView)
      {
         // Create and register a local proxy factory
         String localProxyFactoryKey = this.getProxyFactoryRegistryKey(smd, true);
         SessionProxyFactory factory = this.createLocalProxyFactory(localProxyFactoryKey, containerName, containerGuid,
               smd, cl, advisor);
         this.registerProxyFactory(localProxyFactoryKey, factory, smd);

         // Initialize Reference Addresses to attach to default local JNDI Reference
         List<RefAddr> refAddrsForDefaultLocal = new ArrayList<RefAddr>();
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.