mcconnell    2003/08/23 02:35:46

  Modified:    merlin/composition/src/java/org/apache/avalon/composition/logging/impl
                        DefaultLoggingManager.java
               merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl
                        CLIKernelLoader.java DefaultKernelContext.java
                        Resources.properties
               merlin/merlin-plugin plugin.jelly plugin.properties
               merlin/merlin-plugin/src/java/org/apache/avalon/merlin/tools
                        MerlinBean.java
  Log:
  Seperation of info generation from debug mode selection.
  
  Revision  Changes    Path
  1.8       +16 -11    
avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/logging/impl/DefaultLoggingManager.java
  
  Index: DefaultLoggingManager.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/logging/impl/DefaultLoggingManager.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultLoggingManager.java        23 Aug 2003 02:23:30 -0000      1.7
  +++ DefaultLoggingManager.java        23 Aug 2003 09:35:45 -0000      1.8
  @@ -160,16 +160,25 @@
           String defaultPriority = DEFAULT_PRIORITY ;
           getHierarchy().setDefaultLogTarget( DEFAULT_STREAM );
           m_targets.put( DEFAULT_TARGET, DEFAULT_STREAM );
  -        if( descriptor.getPriority() != null )
  +        if( !debug )
           {
  -            defaultPriority = descriptor.getPriority();
  -            getHierarchy().setDefaultPriority( 
  -              Priority.getPriorityForName( defaultPriority ) ); 
  +            if( descriptor.getPriority() != null )
  +            {
  +                defaultPriority = descriptor.getPriority();
  +                getHierarchy().setDefaultPriority( 
  +                  Priority.getPriorityForName( defaultPriority ) ); 
  +            }
  +            else
  +            {
  +                getHierarchy().setDefaultPriority( 
  +                  Priority.getPriorityForName( defaultPriority ) ); 
  +            }
           }
           else
           {
  +            defaultPriority = "DEBUG";
               getHierarchy().setDefaultPriority( 
  -              Priority.getPriorityForName( defaultPriority ) ); 
  +                  Priority.getPriorityForName( "DEBUG" ) ); 
           }
   
           //
  @@ -194,7 +203,7 @@
               if( target != null )
               {
                   getHierarchy().setDefaultLogTarget( target );
  -            } 
  +            }
               else
               {
                   throw new LoggerException(
  @@ -335,7 +344,7 @@
               throw new RuntimeException( "Bad category: " + name );
           }
   
  -        if( priority != null )
  +        if( !m_debug && priority != null )
           {
               final Priority priorityValue = Priority.getPriorityForName( priority );
               if( !priorityValue.getName().equals( priority ) )
  @@ -424,10 +433,6 @@
           if( getLogger() != null )
           {
               getLogger().debug( message );
  -        }
  -        else
  -        {
  -            System.out.println( message );
           }
       }
   }
  
  
  
  1.12      +12 -1     
avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/CLIKernelLoader.java
  
  Index: CLIKernelLoader.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/CLIKernelLoader.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- CLIKernelLoader.java      22 Aug 2003 18:00:07 -0000      1.11
  +++ CLIKernelLoader.java      23 Aug 2003 09:35:45 -0000      1.12
  @@ -229,6 +229,12 @@
           boolean debug = line.hasOption( "debug" );
    
           //
  +        // get the info flag
  +        //
  +
  +        boolean info = line.hasOption( "info" );
  + 
  +        //
           // the kernel configuration (used by the kernel loader)
           //
   
  @@ -266,7 +272,7 @@
           try
           {
               return new DefaultKernelContext( 
  -              repository, system, library, home, kernel, blocks, config, server, 
debug );
  +              repository, system, library, home, kernel, blocks, config, server, 
info, debug );
           }
           catch( KernelException e )
           {
  @@ -526,6 +532,10 @@
              "debug",
              REZ.getString( "cli-debug-description" ) );
   
  +        Option info = new Option(
  +           "info",
  +           REZ.getString( "cli-info-description" ) );
  +
           Option locale = OptionBuilder
              .hasArg()
              .withArgName( "code" )
  @@ -566,6 +576,7 @@
           options.addOption( locale );
           options.addOption( execute );
           options.addOption( version );
  +        options.addOption( info );
           options.addOption( debug );
           options.addOption( home );
           options.addOption( sys );
  
  
  
  1.18      +4 -5      
avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernelContext.java
  
  Index: DefaultKernelContext.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernelContext.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DefaultKernelContext.java 23 Aug 2003 02:23:30 -0000      1.17
  +++ DefaultKernelContext.java 23 Aug 2003 09:35:45 -0000      1.18
  @@ -220,7 +220,7 @@
       */
       public DefaultKernelContext( 
         Repository repository, File system, File library, File home, 
  -      URL kernel, URL[] blocks, URL config, boolean server, boolean debug )
  +      URL kernel, URL[] blocks, URL config, boolean server, boolean info, boolean 
debug )
         throws NullPointerException, KernelException
       {
           if( repository == null ) throw new NullPointerException( "repository" );
  @@ -301,8 +301,7 @@
   
           Configuration conf = m_kernel.getChild( "logging" );
           LoggingDescriptor logging = createLoggingDescriptor( conf );
  -        boolean trace = conf.getAttributeAsBoolean( "trace", false );
  -        m_logging = bootstrapLoggingManager( home, logging, trace );
  +        m_logging = bootstrapLoggingManager( home, logging, debug );
           m_kernelLogger = m_logging.getLoggerForCategory( logging.getName() );
           enableLogging( getKernelLogger().getChildLogger( CATEGORY_NAME ) );
           getLogger().debug( "logging system established" );
  @@ -311,7 +310,7 @@
           // if the debug flag is enabled then print the context object
           //
   
  -        if( getDebugFlag() )
  +        if( debug || info )
           {
               System.out.println( "\n" + toString() + "\n" );
           }
  
  
  
  1.5       +2 -0      
avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/Resources.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Resources.properties      18 Aug 2003 15:11:33 -0000      1.4
  +++ Resources.properties      23 Aug 2003 09:35:45 -0000      1.5
  @@ -11,6 +11,8 @@
   
   cli-version-description=Prints version information.
   
  +cli-info-description=Lists info about the deployment context.
  +
   cli-debug-description=Enables debug mode.
   
   cli-home-description=A relative or absolute path to a working home directory. If 
not suppled, the system will default to the current directory.
  
  
  
  1.23      +2 -0      avalon-sandbox/merlin/merlin-plugin/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-plugin/plugin.jelly,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- plugin.jelly      19 Aug 2003 07:34:30 -0000      1.22
  +++ plugin.jelly      23 Aug 2003 09:35:46 -0000      1.23
  @@ -92,6 +92,7 @@
         target="${maven.build.dir}/${maven.final.name}.jar" 
         config="${merlin.config}" 
         debug="${merlin.debug}" 
  +      info="${merlin.info}" 
         wait="${wait}" 
       />
   
  @@ -173,6 +174,7 @@
         target="${basedir}/target/classes" 
         config="${merlin.config}" 
         debug="${merlin.debug}" 
  +      info="${merlin.info}" 
         wait="${wait}" 
       />
   
  
  
  
  1.5       +5 -1      avalon-sandbox/merlin/merlin-plugin/plugin.properties
  
  Index: plugin.properties
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-plugin/plugin.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- plugin.properties 19 Aug 2003 07:34:30 -0000      1.4
  +++ plugin.properties 23 Aug 2003 09:35:46 -0000      1.5
  @@ -30,10 +30,14 @@
   #merlin.config
   
   #
  +# Merlin info flag.
  +#
  +merlin.info=false
  +
  +#
   # Merlin debug flag.
   #
   merlin.debug=false
  -
   
   
   
  
  
  
  1.14      +23 -0     
avalon-sandbox/merlin/merlin-plugin/src/java/org/apache/avalon/merlin/tools/MerlinBean.java
  
  Index: MerlinBean.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/merlin-plugin/src/java/org/apache/avalon/merlin/tools/MerlinBean.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- MerlinBean.java   20 Aug 2003 23:50:22 -0000      1.13
  +++ MerlinBean.java   23 Aug 2003 09:35:46 -0000      1.14
  @@ -124,6 +124,11 @@
       private boolean m_execute = true;
   
      /**
  +    * Info flag.
  +    */
  +    private boolean m_info = false;
  +
  +   /**
       * Shutdown pause.
       */
       private int m_wait = 0; // not used
  @@ -202,6 +207,14 @@
           m_execute = value;
       }
   
  +   /**
  +    * Set the deployment policy.
  +    */
  +    public void setInfo( boolean value ) 
  +    {
  +        m_info = value;
  +    }
  +
       //-----------------------------------------------------
       // implementation
       //-----------------------------------------------------
  @@ -280,6 +293,15 @@
       * Return the debug flag.
       * @return the flag
       */
  +    public boolean getInfoFlag()
  +    {
  +        return m_info;
  +    }
  +
  +   /**
  +    * Return the debug flag.
  +    * @return the flag
  +    */
       public boolean getDebugFlag()
       {
           return m_debug.equalsIgnoreCase( "true" );
  @@ -303,6 +325,7 @@
                   new URL[]{ getTarget() },
                   getConfigurationURL(), 
                   getExecuteFlag(), 
  +                getInfoFlag(),
                   getDebugFlag() 
                 );
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to