avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl DefaultCriteria.java
Date Fri, 12 Dec 2003 14:02:35 GMT
mcconnell    2003/12/12 06:02:35

  Modified:    merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl
                        DefaultAppliance.java
               merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli
                        Main.java
               merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl
                        DefaultCriteria.java
  Log:
  Update default criteria to better handle context parameter.
  
  Revision  Changes    Path
  1.14      +2 -2      avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DefaultAppliance.java
  
  Index: DefaultAppliance.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DefaultAppliance.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DefaultAppliance.java	8 Dec 2003 12:49:36 -0000	1.13
  +++ DefaultAppliance.java	12 Dec 2003 14:02:35 -0000	1.14
  @@ -572,7 +572,7 @@
           {
               final String error = 
                 "Illegal attempt to resolve an service from a non-deployed appliance ["
  -              + this + "]. A possible cause is a recursive dependency declaration.";
  +              + this + "].";
               getLogger().error( error );
               throw new IllegalStateException( error );
           }
  
  
  
  1.6       +5 -2      avalon/merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli/Main.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Main.java	10 Dec 2003 12:15:29 -0000	1.5
  +++ Main.java	12 Dec 2003 14:02:35 -0000	1.6
  @@ -261,6 +261,8 @@
                   Artifact impl = null; // default
                   String[] bootstrap = null; // default
                   
  +System.out.println( "SETTING INITIAL WORKING DIR: " + dir );
  +
                   InitialContext context = 
                      new DefaultInitialContext( 
                        dir, parent, impl, system, bootstrap );
  @@ -610,7 +612,8 @@
                   "merlin.home", 
                   Env.getEnvVariable( "MERLIN_HOME" ) );
               if( null != merlin ) return merlin;
  -            return System.getProperty( "user.home" ) + File.separator + ".merlin";
  +            return System.getProperty( "user.home" ) 
  +              + File.separator + ".merlin";
           }
           catch( Throwable e )
           {
  
  
  
  1.6       +23 -5     avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultCriteria.java
  
  Index: DefaultCriteria.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultCriteria.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultCriteria.java	11 Dec 2003 04:51:49 -0000	1.5
  +++ DefaultCriteria.java	12 Dec 2003 14:02:35 -0000	1.6
  @@ -524,8 +524,10 @@
       private File resolveWorkingFile( File file )
       {
           if( null == file ) return getWorkingDirectory();
  -        if( file.isAbsolute() ) return file;
  -        return new File( getWorkingDirectory(), file.toString() );
  +        if( file.isAbsolute() ) return getCanonicalForm( file );
  +        
  +        File relative = new File( getWorkingDirectory(), file.toString() );
  +        return getCanonicalForm( relative );
       }
   
       private void printProperties( Properties properties, String label )
  @@ -667,8 +669,24 @@
           String base = System.getProperty( "basedir" );
           if( null != base )
           {
  -            return new File( base );
  +            return getCanonicalForm( new File( base ) );
  +        }
  +        return getCanonicalForm( 
  +          new File( System.getProperty( "user.dir" ) ) );
  +    }
  +
  +    private static File getCanonicalForm( File file )
  +    {
  +        try
  +        {
  +            return file.getCanonicalFile();
  +        }
  +        catch( Throwable e )
  +        {
  +            final String error =
  +              "Unable to resolve cononical representation of: "
  +              + file; 
  +            throw new KernelRuntimeException( error, e );
           }
  -        return new File( System.getProperty( "user.dir" ) );
       }
   }
  
  
  

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


Mime
View raw message