User: starksm 
  Date: 02/02/15 10:03:36

  Modified:    src/main/org/jboss/deployment DeploymentInfo.java
  Log:
  Added findEjbLink method that walks through the DeploymentInfo hiearchy looking
  for the ejb-name that corresponds to the given ejb-link value.
  
  Revision  Changes    Path
  1.8       +52 -32    jboss/src/main/org/jboss/deployment/DeploymentInfo.java
  
  Index: DeploymentInfo.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/DeploymentInfo.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DeploymentInfo.java       12 Feb 2002 05:41:09 -0000      1.7
  +++ DeploymentInfo.java       15 Feb 2002 18:03:36 -0000      1.8
  @@ -15,6 +15,7 @@
   import java.util.HashSet;
   import java.util.Collection;
   import java.util.HashMap;
  +import java.util.Iterator;
   import java.util.List;
   import java.util.Iterator;
   import java.util.Vector;
  @@ -22,25 +23,17 @@
   import java.util.jar.JarFile;
   import java.util.jar.Manifest;
   
  -import java.util.Iterator;
  -
  -
  -import org.jboss.system.UnifiedClassLoader;
  -import org.jboss.system.ServiceLibraries;
  -import org.jboss.logging.Logger;
  -
  -/*
  -import org.w3c.dom.Document;
  -import org.w3c.dom.Element;
  -import org.w3c.dom.NodeList;
  -import org.w3c.dom.Text;
  -*/
  -
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
  +import org.w3c.dom.Document;
   import javax.xml.parsers.DocumentBuilderFactory;
   import javax.xml.parsers.DocumentBuilder;
  -import org.w3c.dom.Document;
  +
  +import org.jboss.system.UnifiedClassLoader;
  +import org.jboss.system.ServiceLibraries;
  +import org.jboss.logging.Logger;
  +import org.jboss.metadata.ApplicationMetaData;
  +import org.jboss.metadata.BeanMetaData;
   
   /**
   * Service Deployment Info .
  @@ -54,7 +47,8 @@
   * @author <a href="mailto:[EMAIL PROTECTED]";>David Jencks</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel Schulze</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Christoph G. Jung</a>
  -* @version   $Revision: 1.7 $ <p>
  +* @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>
  +* @version   $Revision: 1.8 $ <p>
   *
   *      <b>20011211 marc fleury:</b>
   *      <ul>
  @@ -64,14 +58,9 @@
   *      <ul>
   *        <li>Unification of deployers and merge with Jung/Schulze's Deployment.java 
  
   *      </ul>
  -
  -*
   */
  -
  -
   public class DeploymentInfo 
  -{
  -   
  +{   
      // Variables ------------------------------------------------------------
      
      public static HashMap deployments = new HashMap();
  @@ -241,12 +230,9 @@
            ServiceLibraries.getLibraries().removeClassLoader((UnifiedClassLoader) 
ucl);
         
         subDeployments.clear();
  -      
         mbeans.clear();
  -   
      }
  -   
  -   
  +
      private boolean recursiveDelete(File f)
      {
         if (f.isDirectory())
  @@ -262,8 +248,46 @@
         }
         return f.delete();
      }
  -   
  -   
  +
  +   /** A method that walks through the DeploymentInfo hiearchy looking
  +    *for the ejb-name that corresponds to the given ejb-link value.
  +    *@param ejbLink, the ejb-link value from the ejb-jar.xml or web.xml
  +    *descriptor to find. Need to add support for the <path>/ejb.jar#ejb-name style.
  +    *@return The deployment JNDI name of the ejb to which the ejbLink
  +    *refers if it is found, null if no such ejb exists.
  +    */
  +   public String findEjbLink(String ejbLink)
  +   {
  +      // Walk up to the topmost DeploymentInfo
  +      DeploymentInfo top = parent;
  +      while( top != null && top.parent != null )
  +         top = top.parent;
  +      if( top == null )
  +         return null;
  +      // Search from the top for a matching ejb
  +      return findEjbLink(top, ejbLink);
  +   }
  +   private static String findEjbLink(DeploymentInfo parent, String ejbLink)
  +   {
  +      String ejbName = null;
  +      // Search the parent if it has ApplicationMetaData
  +      if( parent.metaData instanceof ApplicationMetaData )
  +      {
  +         ApplicationMetaData appMD = (ApplicationMetaData) parent.metaData;
  +         BeanMetaData beanMD = appMD.getBeanByEjbName(ejbLink);
  +         if( beanMD != null )
  +            return beanMD.getJndiName();
  +      }
  +      // Search each subcontext
  +      Iterator iter = parent.subDeployments.iterator();
  +      while( iter.hasNext() && ejbName == null )
  +      {
  +         DeploymentInfo child = (DeploymentInfo) iter.next();
  +         ejbName = findEjbLink(child, ejbLink);
  +      }
  +      return ejbName;
  +   }
  +
      public int hashCode() 
      {
         return url.hashCode();
  @@ -282,8 +306,4 @@
      {
         return "DeploymentInfo:url=" + url;
      }
  -      
   }
  -
  -
  -
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to