You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2003/09/09 16:59:30 UTC

cvs commit: avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl CLIKernelLoader.java DefaultKernelContext.java

mcconnell    2003/09/09 07:59:30

  Modified:    merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl
                        CLIKernelLoader.java DefaultKernelContext.java
  Log:
  Remove "/home" except on default home path establishment.
  
  Revision  Changes    Path
  1.17      +21 -64    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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- CLIKernelLoader.java	9 Sep 2003 13:42:10 -0000	1.16
  +++ CLIKernelLoader.java	9 Sep 2003 14:59:30 -0000	1.17
  @@ -223,7 +223,7 @@
           Kernel kernel = null;
           try
           {
  -            kernel = createKernel( context );
  +            kernel = createKernel( null, context );
           }
           catch( KernelException e )
           {
  @@ -262,11 +262,6 @@
           return true;
       }
   
  -    private Kernel createKernel( KernelContext context ) throws KernelException
  -    {
  -        return createKernel( null, context );
  -    }
  -
       private Kernel createKernel( MBeanServer server, KernelContext context ) 
         throws KernelException
       {
  @@ -328,17 +323,6 @@
               {
                   String blockarg = arguments[i];
                   blocks[i] = resolveURL( blockarg );
  -                //try
  -                //{
  -                //    URL url = getFile( HOME, blockarg ).toURL();
  -                //    blocks[i] = url;
  -                //}
  -                //catch( MalformedURLException mue )
  -                //{
  -                //    final String error = 
  -                //      "Unable to establish url to target: " + blockarg;
  -                //    throw new KernelException( error, mue );
  -                //}
               }
           }
   
  @@ -392,7 +376,8 @@
           try
           {
               return new DefaultKernelContext( 
  -              repository, system, library, home, kernel, blocks, config, server, info, debug );
  +              repository, system, library, home, kernel, 
  +              blocks, config, server, info, debug );
           }
           catch( KernelException e )
           {
  @@ -509,7 +494,7 @@
       }
   
      /**
  -    * Return the configuration overrides file.
  +    * Return the configuration overrides url.
       * @param block the directory containing the block defintion
       * @param command the command line
       * @return the target override configuration (possibly null)
  @@ -518,66 +503,38 @@
       {
           final String key = "config";
           if( !command.hasOption( key ) ) return null;
  -        String filename = command.getOptionValue( key );
  -        File file = getFile( HOME, filename );
  -        if( file.exists() )
  -        {
  -             return file.toURL();
  -        }
  -        else
  -        {
  -             throw new FileNotFoundException( file.toString() );
  -        }
  +        String path = command.getOptionValue( key );
  +        return resolveURL( path );
       }
   
  +   /**
  +    * Return the kernel url.
  +    * @param block the directory containing the block defintion
  +    * @param command the command line
  +    * @return the target override configuration (possibly null)
  +    */
       private URL getKernelPath( CommandLine command ) throws Exception
       {
  -        String filename = null;
           final String key = "kernel";
  -        if( command.hasOption( key ) )
  -        {
  -            filename = command.getOptionValue( key );
  -            File file = getFile( HOME, filename );
  -            if( file.exists() )
  -            {
  -                return file.toURL();
  -            }
  -            else
  -            {
  -                final String error =
  -                  "Supplied kernel configuration file does not exist: "
  -                  + file;
  -                throw new IOException( error );
  -            }
  -        }
  -        else
  -        {
  -            return null;
  -        }
  +        if( !command.hasOption( key ) ) return null;
  +        String path = command.getOptionValue( key );
  +        return resolveURL( path );
       }
   
      /**
       * Return the directory to be used as the working home directory.  If no command line
  -    * argument is supplied, the home directory defaults to the directory derived from
  -    * the user.work System property.
  +    * argument is supplied, the home directory defaults null.
       *
       * @param command the command line arguments
  -    * @return the home directory
  +    * @return the home directory or null if undefined
       * @exception IOException if an error occurs in directory resolution
       */
       private File getHomePath( CommandLine command ) throws IOException
       {
  -        String path = null;
           final String key = "home";
  -        if( command.hasOption( key ) )
  -        {
  -            path = command.getOptionValue( key );
  -            return getFile( HOME, path );
  -        }
  -        else
  -        {
  -            return HOME;
  -        }
  +        if( !command.hasOption( key ) ) return null;
  +        final String path = command.getOptionValue( key );
  +        return getFile( HOME, path );
       }
   
       private File getLibraryPath( CommandLine command, File system ) throws IOException
  @@ -757,7 +714,7 @@
       {
           final String local = 
               System.getProperty( "merlin.home", 
  -              System.getProperty( "user.home" ) + "/merlin" );
  +              System.getProperty( "user.home" ) + "/.merlin" );
           return new File( local );
       }
   }
  
  
  
  1.25      +5 -10     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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- DefaultKernelContext.java	9 Sep 2003 02:15:27 -0000	1.24
  +++ DefaultKernelContext.java	9 Sep 2003 14:59:30 -0000	1.25
  @@ -149,11 +149,6 @@
       private final File m_home;
   
       /**
  -     * The working directory
  -     */
  -    private final File m_working;
  -
  -    /**
        * The temp path
        */
       private final File m_temp;
  @@ -243,10 +238,10 @@
           }
           else
           {
  -            m_home = new File( System.getProperty( "user.work" ));
  +            final File base = new File( System.getProperty( "user.dir" ) );
  +            m_home = new File( base, "home" );
           }
   
  -        m_working = new File( home, "home" );
           m_temp = new File( System.getProperty( "java.io.tmpdir" ) );
   
           Configuration kernelConfig = null;
  @@ -309,7 +304,7 @@
   
           Configuration conf = kernelConfig.getChild( "logging" );
           LoggingDescriptor logging = createLoggingDescriptor( conf );
  -        m_logging = bootstrapLoggingManager( home, logging, debug );
  +        m_logging = bootstrapLoggingManager( m_home, logging, debug );
           m_kernelLogger = m_logging.getLoggerForCategory( logging.getName() );
           enableLogging( getKernelLogger().getChildLogger( CATEGORY_NAME ) );
           getLogger().debug( "logging system established" );
  @@ -548,7 +543,7 @@
       */
       public File getHomePath()
       {
  -        return m_working;
  +        return m_home;
       }
   
      /**
  
  
  

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