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/03/07 00:19:31 UTC

cvs commit: avalon-sandbox/merlin-bootstrap/src/java Merlin.java

mcconnell    2003/03/06 15:19:31

  Modified:    merlin-bootstrap default.properties
               merlin-bootstrap/src/java Merlin.java
  Log:
  Improvements to command line handling enabling implict block argument.
  
  Revision  Changes    Path
  1.3       +2 -1      avalon-sandbox/merlin-bootstrap/default.properties
  
  Index: default.properties
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin-bootstrap/default.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- default.properties	12 Feb 2003 16:28:21 -0000	1.2
  +++ default.properties	6 Mar 2003 23:19:31 -0000	1.3
  @@ -5,6 +5,7 @@
   # Overridden by ../default.properties and all ant.properties
   # Not user-editable; use ant.properties files instead
   
  +family=merlin
   codename=merlin-bootstrap
   name=${codename}
   Name=Merlin CLI Bootstrap
  @@ -13,8 +14,8 @@
   package-version=1.0
   year=2003
   
  -remote.repository = http://www.osm.net/repository
   local.repository = ../lib
  +remote.repository = http://www.osm.net/repository
   
   # --------------------------------------------------
   #                REQUIRED LIBRARIES
  
  
  
  1.4       +26 -14    avalon-sandbox/merlin-bootstrap/src/java/Merlin.java
  
  Index: Merlin.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin-bootstrap/src/java/Merlin.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Merlin.java	17 Feb 2003 12:15:33 -0000	1.3
  +++ Merlin.java	6 Mar 2003 23:19:31 -0000	1.4
  @@ -164,7 +164,6 @@
           options.addOption( debug );
           options.addOption( system );
           options.addOption( home );
  -        options.addOption( block );
           options.addOption( config );
           options.addOption( kernel );
           options.addOption( locale );
  @@ -217,10 +216,21 @@
                   return;
               }
   
  -            if( !line.hasOption( "block" ) )
  +            File base = null;
  +            String[] arguments = line.getArgs();
  +            if( arguments.length == 0 )
               {
  -                doHelp();
  -                return;
  +                base = new File( HOME, "block.xml" );
  +                if( !base.exists() )
  +                {
  +                    doHelp();
  +                    return;
  +                }
  +            }
  +            else
  +            {
  +                String blockarg = arguments[0];
  +                base = getFile( HOME, blockarg );
               }
   
               boolean debug = line.hasOption( "debug" );
  @@ -232,18 +242,16 @@
               //
   
               //
  -            // the the system directory that we use internally to build the 
  +            // the the system directory that we use to build the 
               // classloaders
               File system = getSystemPath( line ); 
   
               //
               // the working home directory 
  -            File home = getHomePath( system, line );
  +            File home = getHomePath( line );
   
               //
               // the actual block base URL
  -            File base = getBlockPath( system, home, line );
  -
               URL block = null;
               if( base.toString().endsWith(".jar") )
               {
  @@ -282,6 +290,7 @@
               map.put( "urn:merlin:classloader.common", COMMON );
               map.put( "urn:merlin:classloader.system", CLASSLOADER);
               map.put( "urn:merlin:home", home );
  +            map.put( "urn:merlin:system", system );
               map.put( "urn:merlin:kernel.profile", kernel );
               map.put( "urn:merlin:block.url", block );
               if( debug )
  @@ -402,7 +411,10 @@
       private static void doHelp()
       {
           HelpFormatter formatter = new HelpFormatter();
  -        formatter.printHelp( "merlin", CL_OPTIONS );
  +        final String description = 
  +          "\nDescription: The merlin command executes the deployment of a component block.  The [block] argument may be either an block descriptor file or a jar file containing a block descriptor.  If not value if declared, Merlin will attempt to execute a file named 'block.xml' in the current directory."; 
  +
  +        formatter.printHelp( "merlin [block]", description, CL_OPTIONS, "", true );
       }
   
      /**
  @@ -600,15 +612,15 @@
       }
   
      /**
  -    * Return the directory to be used as the working home directory.  If not command line 
  -    * argument is supplied, the home directory defaults to ${merlin.system.dir}/home.
  +    * 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.
       *
  -    * @param system the fallback system directory
       * @param command the command line arguments
       * @return the home directory
       * @exception IOException if an error occurs in directory resolution
       */
  -    private static File getHomePath( File system, CommandLine command ) throws IOException
  +    private static File getHomePath( CommandLine command ) throws IOException
       {
           String path = null;
           File file = null;
  @@ -620,7 +632,7 @@
           }
           else
           {
  -            return system;
  +            return HOME;
           }
       }
   
  
  
  

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