avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: avalon/fortress/tools/src/java/org/apache/avalon/fortress/tools Component.java
Date Wed, 18 Jun 2003 13:16:50 GMT
bloritsch    2003/06/18 06:16:48

  Modified:    fortress/container/src/api/org/apache/avalon/fortress
                        MetaInfoEntry.java
               fortress/container/src/impl/org/apache/avalon/fortress/util
                        Service.java
               fortress/container/src/test/org/apache/avalon/fortress/test
                        MetaInfoEntryTestCase.java
               fortress/tools/src/java/org/apache/avalon/fortress/tools
                        Component.java
  Log:
  Revert Method move, it will help things compile.
  
  Revision  Changes    Path
  1.7       +40 -2     avalon/fortress/container/src/api/org/apache/avalon/fortress/MetaInfoEntry.java
  
  Index: MetaInfoEntry.java
  ===================================================================
  RCS file: /home/cvs/avalon/fortress/container/src/api/org/apache/avalon/fortress/MetaInfoEntry.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MetaInfoEntry.java	17 Jun 2003 20:50:26 -0000	1.6
  +++ MetaInfoEntry.java	18 Jun 2003 13:16:46 -0000	1.7
  @@ -111,7 +111,7 @@
           if ( null == deps ) throw new NullPointerException( "\"deps\" cannot be null."
);
   
           m_klass = componentClass;
  -        m_configName = properties.getProperty( "x-avalon.name", Service.createShortName(
componentClass.getName() ) );
  +        m_configName = properties.getProperty( "x-avalon.name", createShortName( componentClass.getName()
) );
           m_handler = Thread.currentThread().getContextClassLoader().loadClass( getHandler(
properties ) );
           m_roles = new HashSet();
           m_dependencies = deps;
  @@ -248,6 +248,44 @@
           }
   
           return handler;
  +    }
  +
  +    /**
  +     * Convert a Component implmentation classname into a shorthand
  +     * name.  It assumes all classnames for a particular component is
  +     * unique.
  +     *
  +     * @param className  The classname of a component
  +     * @return String the short name
  +     */
  +    public static final String createShortName( final String className )
  +    {
  +        final StringBuffer shortName = new StringBuffer();
  +
  +        final char[] name = className.substring(
  +            className.lastIndexOf( '.' ) + 1 ).toCharArray();
  +        char last = '\0';
  +
  +        for (int i = 0; i < name.length; i++)
  +        {
  +            if (Character.isUpperCase(name[i]))
  +            {
  +                if ( Character.isLowerCase( last ) )
  +                {
  +                    shortName.append('-');
  +                }
  +
  +                shortName.append(Character.toLowerCase(name[i]));
  +            }
  +            else
  +            {
  +                shortName.append(name[i]);
  +            }
  +
  +            last = name[i];
  +        }
  +
  +        return shortName.toString().toLowerCase();
       }
   
   }
  
  
  
  1.8       +0 -37     avalon/fortress/container/src/impl/org/apache/avalon/fortress/util/Service.java
  
  Index: Service.java
  ===================================================================
  RCS file: /home/cvs/avalon/fortress/container/src/impl/org/apache/avalon/fortress/util/Service.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Service.java	17 Jun 2003 20:50:26 -0000	1.7
  +++ Service.java	18 Jun 2003 13:16:48 -0000	1.8
  @@ -169,41 +169,4 @@
           return providerSet.iterator();
       }
   
  -    /**
  -     * Convert a Component implmentation classname into a shorthand
  -     * name.  It assumes all classnames for a particular component is
  -     * unique.
  -     *
  -     * @param className  The classname of a component
  -     * @return String the short name
  -     */
  -    public static final String createShortName( final String className )
  -    {
  -        final StringBuffer shortName = new StringBuffer();
  -
  -        final char[] name = className.substring(
  -            className.lastIndexOf( '.' ) + 1 ).toCharArray();
  -        char last = '\0';
  -
  -        for (int i = 0; i < name.length; i++)
  -        {
  -            if (Character.isUpperCase(name[i]))
  -            {
  -                if ( Character.isLowerCase( last ) )
  -                {
  -                    shortName.append('-');
  -                }
  -
  -                shortName.append(Character.toLowerCase(name[i]));
  -            }
  -            else
  -            {
  -                shortName.append(name[i]);
  -            }
  -
  -            last = name[i];
  -        }
  -
  -        return shortName.toString().toLowerCase();
  -    }
   }
  
  
  
  1.9       +4 -4      avalon/fortress/container/src/test/org/apache/avalon/fortress/test/MetaInfoEntryTestCase.java
  
  Index: MetaInfoEntryTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon/fortress/container/src/test/org/apache/avalon/fortress/test/MetaInfoEntryTestCase.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MetaInfoEntryTestCase.java	17 Jun 2003 20:50:26 -0000	1.8
  +++ MetaInfoEntryTestCase.java	18 Jun 2003 13:16:48 -0000	1.9
  @@ -237,22 +237,22 @@
           String start = "Regular";
           String end   = "regular";
   
  -        assertEquals( end, Service.createShortName(start));
  +        assertEquals( end, MetaInfoEntry.createShortName(start));
   
           start = "TwoWords";
           end = "two-words";
   
  -        assertEquals( end, Service.createShortName(start));
  +        assertEquals( end, MetaInfoEntry.createShortName(start));
   
           start = "MANYcaps";
           end = "manycaps";
   
  -        assertEquals( end, Service.createShortName( start ) );
  +        assertEquals( end, MetaInfoEntry.createShortName( start ) );
   
           start = "MANYcapsAndWords";
           end = "manycaps-and-words";
   
  -        assertEquals( end, Service.createShortName( start ) );
  +        assertEquals( end, MetaInfoEntry.createShortName( start ) );
       }
   
       private void checkMetaInfoEntry( MetaInfoEntry entry, Class handler, String name, boolean
oneRole )
  
  
  
  1.16      +2 -2      avalon/fortress/tools/src/java/org/apache/avalon/fortress/tools/Component.java
  
  Index: Component.java
  ===================================================================
  RCS file: /home/cvs/avalon/fortress/tools/src/java/org/apache/avalon/fortress/tools/Component.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Component.java	17 Jun 2003 20:56:38 -0000	1.15
  +++ Component.java	18 Jun 2003 13:16:48 -0000	1.16
  @@ -205,7 +205,7 @@
           DocletTag avalonConfigName = m_javaClass.getTagByName( TAG_INFO );
           if ( null == avalonConfigName ) avalonConfigName = m_javaClass.getTagByName( TAG_NAME
);
   
  -        String name = org.apache.avalon.fortress.util.Service.createShortName(m_javaClass.getName());
  +        String name = MetaInfoEntry.createShortName(m_javaClass.getName());
   
           if ( avalonConfigName != null )
           {
  
  
  

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


Mime
View raw message