1 Reply Latest reply on Jun 16, 2008 2:54 PM by Scott Stark

    [jboss-metadata] Cannot get at DeploymentSummary set in Mapp

    Andrew Rubinger Master

      Issue is:

      http://jira.jboss.com/jira/browse/JBMETA-58

      The MappedReferenceMetadataResolverDeployer, in "mapEjbs", sets a DeploymentSummary in JBossMetaData, where the underlying implementation is the JBossMetaDataWrapper.

      However, when attempting to obtain the DeploymentSummary in JBossEnterpriseBeanMetadata.determineResolvedJndiName(), the summary returned is that from the wrapped object, not the wrapper itself. Far as I can tell, the intention is for the wrapper to provide a read-only view.

      So I cannot get at the CL required to create a DefaultJndiBindingPolicy:

      // Obtain the Deployment Summary
       DeploymentSummary dsummary = getJBossMetaData().getDeploymentSummary(); //This returns the wrapped metadata's summary, not the wrapper's one which was set in the deployer
      
       // Initialize the Default JNDI Binding Policy
       DefaultJndiBindingPolicy policy = null;
      
       // If Deployment Summary is defined
       if (dsummary != null)
       {
       try
       {
       /*
       * Create a JNDI Policy from the Deployment Summary
       */
      
       // Obtain the JNDI Policy Class Name
       String jndiPolicyClassName = this.getJndiBindingPolicy();
       if (jndiPolicyClassName != null && jndiPolicyClassName.trim().equals(""))
       {
       jndiPolicyClassName = null;
       }
      
       // Get the CL
       ClassLoader loader = dsummary.getLoader(); //Here's where I need the correct CL
      
       // Load the Class
       Class<? extends DefaultJndiBindingPolicy> jndiPolicyClass = null;
       if (jndiPolicyClassName != null)
       {
       Class<?> clazz = loader.loadClass(jndiPolicyClassName);
       assert DefaultJndiBindingPolicy.class.isAssignableFrom(clazz) : "Specified " + jndiPolicyClassName
       + " is not of expected type " + DefaultJndiBindingPolicy.class.getName();
       jndiPolicyClass = (Class<? extends DefaultJndiBindingPolicy>) clazz;
       }
      
       // Create Policy
       policy = createPolicy(loader, jndiPolicyClass);
       }
       catch (Exception e)
       {
       }
       }


      How can I resolve this without breaking the intention of the Wrapper to provide a read-only view?

      S,
      ALR