Package org.jboss.metadata.ejb.jboss.jndipolicy.spi

Examples of org.jboss.metadata.ejb.jboss.jndipolicy.spi.DefaultJndiBindingPolicy


      if(policyClassName != null)
      {
         policyClass = (Class<? extends DefaultJndiBindingPolicy>)
            loader.loadClass(policyClassName);
      }
      DefaultJndiBindingPolicy policy = null;
      if(policyClass != null)
         policy = policyClass.newInstance();
      return policy;
   }
View Full Code Here


   }

   public static String getDefaultRemoteBusinessJndiName(EJBContainer container)
   {
      // Obtain JNDI Binding Policy
      DefaultJndiBindingPolicy policy = ProxyFactoryHelper.getJndiBindingPolicy(container);

      // Obtain Deployment Summary
      EjbDeploymentSummary summary = ProxyFactoryHelper.getDeploymentSummaryFromContainer(container);

      // Return the policy's default remote name for this summary
      return policy.getDefaultRemoteJndiName(summary);
   }
View Full Code Here

     
      // Obtain the Deployment Summary
      DeploymentSummary dsummary = getJBossMetaData().getDeploymentSummary();
     
      // Initialize the Default JNDI Binding Policy
      DefaultJndiBindingPolicy policy = null;
     
      try
      {
         // Initialize a CL
         ClassLoader loader = null;
        
         // Fall back on TCL if there's no DeploymentSummary
         if (loader == null)
         {
            loader = Thread.currentThread().getContextClassLoader();
         }

         // Create Policy, falling back on the default policy if specified
         policy = this.createPolicy(loader, defaultPolicy == null ? null : defaultPolicy.getClass());
      }
      catch (Exception e)
      {
         throw new RuntimeException("Error in creating " + DefaultJndiBindingPolicy.class.getSimpleName(),e);
      }
     
      // If there's still no policy
      if (policy == null)
      {
         // Use the metadata default binding policy
         policy = new BasicJndiBindingPolicy();
      }

      if(dsummary==null)
      {
         dsummary = new DeploymentSummary();
      }
     
      // Derive the summary info from this metadata and deployment summary
      EjbDeploymentSummary ejbSummary = new EjbDeploymentSummary(this, dsummary);
      KnownInterfaceType ifaceType = KnownInterfaces.classifyInterface(iface);
      // Need to compare iface against the metadata local-home/home & business locals/remotes
      if (this.isSession() && ifaceType == KnownInterfaceType.UNKNOWN)
      {
         JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) this;
         // Figure out the interface type from the metadata
         if (sbeanMD.getLocalHome() != null && sbeanMD.getLocalHome().equals(iface))
            ifaceType = KnownInterfaceType.LOCAL_HOME;
         else if (sbeanMD.getHome() != null && sbeanMD.getHome().equals(iface))
            ifaceType = KnownInterfaceType.REMOTE_HOME;
         else
         {
            // Check business locals
            BusinessLocalsMetaData locals = sbeanMD.getBusinessLocals();
            if (locals != null)
            {
               for (String local : locals)
               {
                  if (local.equals(iface))
                  {
                     ifaceType = KnownInterfaceType.BUSINESS_LOCAL;
                     break;
                  }
               }
            }
            if (ifaceType == KnownInterfaceType.UNKNOWN)
            {
               // Check business remotes
               BusinessRemotesMetaData remotes = sbeanMD.getBusinessRemotes();
               if (remotes != null)
               {
                  for (String remote : remotes)
                  {
                     if (remote.equals(iface))
                     {
                        ifaceType = KnownInterfaceType.BUSINESS_REMOTE;
                        break;
                     }
                  }
               }
            }
         }
      }
      else if (this.isEntity() && ifaceType == KnownInterfaceType.UNKNOWN)
      {
         JBossEntityBeanMetaData ebeanMD = (JBossEntityBeanMetaData) this;
         // Figure out the interface type from the metadata
         if (ebeanMD.getLocalHome() != null && ebeanMD.getLocalHome().equals(iface))
            ifaceType = KnownInterfaceType.LOCAL_HOME;
         else if (ebeanMD.getHome() != null && ebeanMD.getHome().equals(iface))
            ifaceType = KnownInterfaceType.REMOTE_HOME;
      }     
     
      // Have the policy generate the actual name
      String resolvedJndiName = policy.getJndiName(ejbSummary, iface, ifaceType);

      return resolvedJndiName;
   }
View Full Code Here

      if(policyClassName != null && loader != null)
      {
         policyClass = (Class<? extends DefaultJndiBindingPolicy>)
            loader.loadClass(policyClassName);
      }
      DefaultJndiBindingPolicy policy = null;
      if(policyClass != null)
         policy = policyClass.newInstance();
      return policy;
   }
View Full Code Here

         resolvedJndiName = this.determineResolvedLocalHomeJndiName();
      }
      if (ifaceType.equals(KnownInterfaceType.BUSINESS_REMOTE) || ifaceType.equals(KnownInterfaceType.BUSINESS_LOCAL))
      {
         // Obtain the JNDI Policy
         DefaultJndiBindingPolicy policy = this.getJndiPolicy();
         // Revert to defaults; have the policy generate the actual name
         resolvedJndiName = policy.getJndiName(getEjbDeploymentSummary(), iface, ifaceType);
         log.debug("Resolved JNDI Name for Interface " + iface + " of type " + ifaceType + " is " + resolvedJndiName);
      }

      // Ensure found
      assert resolvedJndiName != null : "The target JNDI Name has not been properly resolved";
View Full Code Here

         resolvedJndiName = this.determineResolvedLocalHomeJndiName();
      }
      if (ifaceType.equals(KnownInterfaceType.BUSINESS_REMOTE) || ifaceType.equals(KnownInterfaceType.BUSINESS_LOCAL))
      {
         // Obtain the JNDI Policy
         DefaultJndiBindingPolicy policy = this.getJndiPolicy();
         // Revert to defaults; have the policy generate the actual name
         resolvedJndiName = policy.getJndiName(getEjbDeploymentSummary(), iface, ifaceType);
         log.debug("Resolved JNDI Name for Interface " + iface + " of type " + ifaceType + " is " + resolvedJndiName);
      }

      // Ensure found
      assert resolvedJndiName != null : "The target JNDI Name has not been properly resolved";
View Full Code Here

     
      // Obtain the Deployment Summary
      DeploymentSummary dsummary = getJBossMetaData().getDeploymentSummary();
     
      // Initialize the Default JNDI Binding Policy
      DefaultJndiBindingPolicy policy = null;
     
      try
      {
         // Initialize a CL
         ClassLoader loader = null;
        
         // Fall back on TCL if there's no DeploymentSummary
         if (loader == null)
         {
            loader = Thread.currentThread().getContextClassLoader();
         }

         // Create Policy, falling back on the default policy if specified
         policy = this.createPolicy(loader, defaultPolicy == null ? null : defaultPolicy.getClass());
      }
      catch (Exception e)
      {
         throw new RuntimeException("Error in creating " + DefaultJndiBindingPolicy.class.getSimpleName(),e);
      }
     
      // If there's still no policy
      if (policy == null)
      {
         // Use the metadata default binding policy
         policy = new BasicJndiBindingPolicy();
      }

      if(dsummary==null)
      {
         dsummary = new DeploymentSummary();
      }
     
      // Derive the summary info from this metadata and deployment summary
      EjbDeploymentSummary ejbSummary = new EjbDeploymentSummary(this, dsummary);
      KnownInterfaceType ifaceType = KnownInterfaces.classifyInterface(iface);
      // Need to compare iface against the metadata local-home/home & business locals/remotes
      if (this.isSession() && ifaceType == KnownInterfaceType.UNKNOWN)
      {
         JBossSessionBeanMetaData sbeanMD = (JBossSessionBeanMetaData) this;
         // Figure out the interface type from the metadata
         if (sbeanMD.getLocalHome() != null && sbeanMD.getLocalHome().equals(iface))
            ifaceType = KnownInterfaceType.LOCAL_HOME;
         else if (sbeanMD.getHome() != null && sbeanMD.getHome().equals(iface))
            ifaceType = KnownInterfaceType.REMOTE_HOME;
         else
         {
            // Check business locals
            BusinessLocalsMetaData locals = sbeanMD.getBusinessLocals();
            if (locals != null)
            {
               for (String local : locals)
               {
                  if (local.equals(iface))
                  {
                     ifaceType = KnownInterfaceType.BUSINESS_LOCAL;
                     break;
                  }
               }
            }
            if (ifaceType == KnownInterfaceType.UNKNOWN)
            {
               // Check business remotes
               BusinessRemotesMetaData remotes = sbeanMD.getBusinessRemotes();
               if (remotes != null)
               {
                  for (String remote : remotes)
                  {
                     if (remote.equals(iface))
                     {
                        ifaceType = KnownInterfaceType.BUSINESS_REMOTE;
                        break;
                     }
                  }
               }
            }
         }
      }
      else if (this.isEntity() && ifaceType == KnownInterfaceType.UNKNOWN)
      {
         JBossEntityBeanMetaData ebeanMD = (JBossEntityBeanMetaData) this;
         // Figure out the interface type from the metadata
         if (ebeanMD.getLocalHome() != null && ebeanMD.getLocalHome().equals(iface))
            ifaceType = KnownInterfaceType.LOCAL_HOME;
         else if (ebeanMD.getHome() != null && ebeanMD.getHome().equals(iface))
            ifaceType = KnownInterfaceType.REMOTE_HOME;
      }     
     
      // Have the policy generate the actual name
      String resolvedJndiName = policy.getJndiName(ejbSummary, iface, ifaceType);

      return resolvedJndiName;
   }
View Full Code Here

      if(policyClassName != null && loader != null)
      {
         policyClass = (Class<? extends DefaultJndiBindingPolicy>)
            loader.loadClass(policyClassName);
      }
      DefaultJndiBindingPolicy policy = null;
      if(policyClass != null)
         policy = policyClass.newInstance();
      return policy;
   }
View Full Code Here

    */
   public void test() throws Throwable
   {

      // Create a BasicJndiBindingPolicy
      DefaultJndiBindingPolicy policy = new BasicJndiBindingPolicy();

      // Ensure Serializable
      assertTrue(BasicJndiBindingPolicy.class.getSimpleName() + " is not " + Serializable.class.getSimpleName(),
            policy instanceof Serializable);

View Full Code Here

      deploymentSummary.setDeploymentName("someModule");
      deploymentSummary.setDeploymentScopeBaseName("someEar");
      JBossMetaDataWrapper wrapper = new JBossMetaDataWrapper(primary, defaults);
      wrapper.setDeploymentSummary(deploymentSummary);
     
      DefaultJndiBindingPolicy policy = new MyDefaultJndiBindingPolicy();
      JBossSessionBeanMetaData beanMd = (JBossSessionBeanMetaData)wrapper.getEnterpriseBean("MyBean");
      String interfaceName = "testInterface";
      beanMd.setBusinessRemotes(new BusinessRemotesMetaData());
      beanMd.getBusinessRemotes().add(interfaceName);
      JBossSessionPolicyDecorator decorator = new JBossSessionPolicyDecorator(beanMd,policy);
View Full Code Here

TOP

Related Classes of org.jboss.metadata.ejb.jboss.jndipolicy.spi.DefaultJndiBindingPolicy

Copyright © 2018 www.massapicom. 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.