avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: avalon-excalibur/fortress/src/tools/org/apache/avalon/fortress/tools ComponentMetaInfoCollector.java
Date Thu, 10 Apr 2003 21:40:08 GMT
bloritsch    2003/04/10 14:40:08

  Modified:    fortress/src/tools/org/apache/avalon/fortress/tools
                        ComponentMetaInfoCollector.java
  Log:
  enable deep service resolution
  
  Revision  Changes    Path
  1.12      +27 -11    avalon-excalibur/fortress/src/tools/org/apache/avalon/fortress/tools/ComponentMetaInfoCollector.java
  
  Index: ComponentMetaInfoCollector.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/tools/org/apache/avalon/fortress/tools/ComponentMetaInfoCollector.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ComponentMetaInfoCollector.java	10 Apr 2003 21:14:07 -0000	1.11
  +++ ComponentMetaInfoCollector.java	10 Apr 2003 21:40:08 -0000	1.12
  @@ -293,21 +293,37 @@
               if ( className.indexOf('.') < 0)
               {
                   int classLen = className.length();
  -                Type[] types = javaClass.getImplements();
  -                for (int t = 0; t < types.length; t++)
  -                {
  -                    String type = types[t].getValue();
  -                    int typeLen = type.length();
  -                    
  -                    if (type.substring(typeLen - classLen).equals(className))
  -                    {
  -                        className = type;
  -                    }
  -                }
  +                className = resolveDeepClassName(javaClass, className, classLen);
               }
           }
           
           return className;
  +    }
  +    
  +    private String resolveDeepClassName(final JavaClass javaClass, final String className,
final int classLen)
  +    {
  +        // Stop at java.lang.Object
  +        if (javaClass.getFullyQualifiedName().equals("java.lang.Object")) return className;
  +        
  +        String serviceClass = null;
  +        Type[] types = javaClass.getImplements();
  +        for (int t = 0; t < types.length; t++)
  +        {
  +            String type = types[t].getValue();
  +            int typeLen = type.length();
  +                    
  +            if (type.substring(typeLen - classLen).equals(className))
  +            {
  +                serviceClass = type;
  +            }
  +        }
  +        
  +        if (serviceClass == null)
  +        {
  +            serviceClass = resolveDeepClassName(javaClass.getSuperJavaClass(), className,
classLen);
  +        }
  +        
  +        return serviceClass;
       }
       
       private Service getService(final String type) throws ClassNotFoundException
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message