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 Tue, 27 May 2003 15:38:32 GMT
bloritsch    2003/05/27 08:38:32

  Modified:    fortress/src/java/org/apache/avalon/fortress
                        MetaInfoEntry.java
               fortress/src/tools/org/apache/avalon/fortress/tools
                        ComponentMetaInfoCollector.java
  Log:
  remove last bit of hard coupling for MetaInfoEntry
  
  Revision  Changes    Path
  1.5       +15 -11    avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/MetaInfoEntry.java
  
  Index: MetaInfoEntry.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/MetaInfoEntry.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MetaInfoEntry.java	15 May 2003 18:56:27 -0000	1.4
  +++ MetaInfoEntry.java	27 May 2003 15:38:31 -0000	1.5
  @@ -49,11 +49,6 @@
   */
   package org.apache.avalon.fortress;
   
  -import org.apache.avalon.fortress.impl.handler.FactoryComponentHandler;
  -import org.apache.avalon.fortress.impl.handler.PerThreadComponentHandler;
  -import org.apache.avalon.fortress.impl.handler.PoolableComponentHandler;
  -import org.apache.avalon.fortress.impl.handler.ThreadSafeComponentHandler;
  -
   import java.util.*;
   
   /**
  @@ -67,6 +62,11 @@
    */
   public final class MetaInfoEntry
   {
  +    public static final String THREADSAFE_HANDLER = "org.apache.avalon.fortress.impl.handler.ThreadSafeComponentHandler";
  +    public static final String POOLABLE_HANDLER = "org.apache.avalon.fortress.impl.handler.PoolableComponentHandler";
  +    public static final String FACTORY_HANDLER = "org.apache.avalon.fortress.impl.handler.FactoryComponentHandler";
  +    public static final String PER_THREAD_HANDLER = "org.apache.avalon.fortress.impl.handler.PerThreadComponentHandler";
  +
       private final Class m_klass;
       private final String m_configName;
       private final Class m_handler;
  @@ -76,15 +76,19 @@
       /** Translate from lifestyle to component handler. */
       private static final Map m_lifecycleMap;
       private final List m_dependencies;
  +    private static final String TYPE_SINGLETON = "singleton";
  +    private static final String TYPE_THREAD = "thread";
  +    private static final String TYPE_POOLED = "pooled";
  +    private static final String TYPE_TRANSIENT = "transient";
   
       // Initialize the scope map
       static
       {
           Map lifecycleMap = new HashMap();
  -        lifecycleMap.put( "singleton", ThreadSafeComponentHandler.class.getName() );
  -        lifecycleMap.put( "thread", PerThreadComponentHandler.class.getName() );
  -        lifecycleMap.put( "pooled", PoolableComponentHandler.class.getName() );
  -        lifecycleMap.put( "transient", FactoryComponentHandler.class.getName() );
  +        lifecycleMap.put( TYPE_SINGLETON, THREADSAFE_HANDLER );
  +        lifecycleMap.put( TYPE_THREAD, PER_THREAD_HANDLER );
  +        lifecycleMap.put( TYPE_POOLED, POOLABLE_HANDLER );
  +        lifecycleMap.put( TYPE_TRANSIENT, FACTORY_HANDLER );
   
           m_lifecycleMap = Collections.unmodifiableMap( lifecycleMap );
       }
  @@ -238,7 +242,7 @@
   
           if ( null == handler )
           {
  -            handler = PerThreadComponentHandler.class.getName();
  +            handler = PER_THREAD_HANDLER;
           }
   
           return handler;
  
  
  
  1.23      +5 -9      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.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ComponentMetaInfoCollector.java	27 May 2003 15:01:42 -0000	1.22
  +++ ComponentMetaInfoCollector.java	27 May 2003 15:38:31 -0000	1.23
  @@ -92,10 +92,6 @@
        * The service list destination.
        */
       private File m_serviceFile;
  -    private static final String THREADSAFE_HANDLER = "org.apache.avalon.fortress.impl.handler.ThreadSafeComponentHandler";
  -    private static final String POOLABLE_HANDLER = "org.apache.avalon.fortress.impl.handler.PoolableComponentHandler";
  -    private static final String FACTORY_HANDLER = "org.apache.avalon.fortress.impl.handler.FactoryComponentHandler";
  -    private static final String PER_THREAD_HANDLER = "org.apache.avalon.fortress.impl.handler.PerThreadComponentHandler";
       private static final String SINGLE_THREADED = "org.apache.avalon.framework.thread.SingleThreaded";
       private static final String THREAD_SAFE = "org.apache.avalon.framework.thread.ThreadSafe";
       private static final String POOLABLE = "org.apache.avalon.excalibur.pool.Poolable";
  @@ -265,16 +261,16 @@
                       {
                           if ( interfaces[i].getClass().getName().equals( THREAD_SAFE ) )
                           {
  -                            handler = THREADSAFE_HANDLER;
  +                            handler = MetaInfoEntry.THREADSAFE_HANDLER;
                           }
                           else if ( interfaces[i].getClass().getName().equals( POOLABLE )
||
                               interfaces[i].getClass().getName().equals( RECYCLABLE ) )
                           {
  -                            handler = POOLABLE_HANDLER;
  +                            handler = MetaInfoEntry.POOLABLE_HANDLER;
                           }
                           else if ( interfaces[i].getClass().getName().equals( SINGLE_THREADED
) )
                           {
  -                            handler = FACTORY_HANDLER;
  +                            handler = MetaInfoEntry.FACTORY_HANDLER;
                           }
                       }
                   }
  @@ -285,7 +281,7 @@
                   }
                   else if ( handler != null )
                   {
  -                    handler = ( null == fortressHandler ) ? PER_THREAD_HANDLER : stripQuotes(fortressHandler.getNamedParameter(
ATTR_TYPE ));
  +                    handler = ( null == fortressHandler ) ? MetaInfoEntry.PER_THREAD_HANDLER
: stripQuotes(fortressHandler.getNamedParameter( ATTR_TYPE ));
                   }
   
                   if ( null != lifecycle ) comp.setAttribute( TAG_LIFESTYLE, lifecycle );
  
  
  

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


Mime
View raw message