mcconnell    2003/08/18 22:45:16

  Modified:    merlin/kernel/bootstrap/src/etc merlin.properties
               merlin/kernel/bootstrap/src/java Merlin.java
               merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl
                        CLIKernelLoader.java DefaultKernelContext.java
               merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel
                        KernelContext.java
               merlin/merlin-platform/tutorials/contextualization
                        README.TXT maven.xml
               merlin/merlin-plugin plugin.jelly project.xml
               merlin/merlin-plugin/src/java/org/apache/avalon/merlin/tools
                        MerlinBean.java
  Log:
  Improvements to the deployment and simulation handlers in the Maven plugin.
  
  Revision  Changes    Path
  1.5       +0 -29     avalon-sandbox/merlin/kernel/bootstrap/src/etc/merlin.properties
  
  Index: merlin.properties
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/kernel/bootstrap/src/etc/merlin.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- merlin.properties 19 Aug 2003 03:51:23 -0000      1.4
  +++ merlin.properties 19 Aug 2003 05:45:15 -0000      1.5
  @@ -5,35 +5,6 @@
   merlin.bootstrap.class=org.apache.avalon.merlin.kernel.impl.CLIKernelLoader
   
   #
  -# the bootstrap classpath
  -#
  -merlin.bootstrap.classpath.length=24
  -merlin.bootstrap.classpath.0=xerces:xerces;2.2.1
  -merlin.bootstrap.classpath.1=xml-apis:xml-apis;1.0.b2
  -merlin.bootstrap.classpath.2=avalon-framework:avalon-framework-api;SNAPSHOT
  -merlin.bootstrap.classpath.3=avalon-meta:avalon-meta-api;SNAPSHOT
  -merlin.bootstrap.classpath.4=avalon-meta:avalon-meta-spi;SNAPSHOT
  -merlin.bootstrap.classpath.5=avalon-extension:avalon-extension-spi;SNAPSHOT
  -merlin.bootstrap.classpath.6=avalon-composition:avalon-composition-spi;SNAPSHOT
  -merlin.bootstrap.classpath.7=avalon-activation:avalon-activation-spi;SNAPSHOT
  -merlin.bootstrap.classpath.8=avalon-framework:avalon-framework-impl;SNAPSHOT
  -merlin.bootstrap.classpath.9=avalon-meta:avalon-meta-impl;SNAPSHOT
  -merlin.bootstrap.classpath.10=avalon-extension:avalon-extension-impl;SNAPSHOT
  -merlin.bootstrap.classpath.11=avalon-composition:avalon-composition-impl;SNAPSHOT
  -merlin.bootstrap.classpath.12=avalon-activation:avalon-activation-impl;SNAPSHOT
  -merlin.bootstrap.classpath.13=excalibur-i18n:excalibur-i18n;1.0
  -merlin.bootstrap.classpath.14=avalon-repository:avalon-repository-spi;SNAPSHOT
  -merlin.bootstrap.classpath.15=avalon-repository:avalon-repository-impl;SNAPSHOT
  -merlin.bootstrap.classpath.16=commons-cli:commons-cli;1.0
  -merlin.bootstrap.classpath.17=merlin:merlin-kernel-spi;SNAPSHOT
  -merlin.bootstrap.classpath.18=merlin:merlin-kernel-impl;SNAPSHOT
  -merlin.bootstrap.classpath.19=logkit:logkit;1.2
  -merlin.bootstrap.classpath.20=excalibur-event:excalibur-event;1.0.3
  
-merlin.bootstrap.classpath.21=excalibur-configuration:excalibur-configuration;1.1-dev
  -merlin.bootstrap.classpath.22=excalibur-lifecycle:excalibur-lifecycle;1.0
  -merlin.bootstrap.classpath.23=avalon-activation:avalon-activation-api;SNAPSHOT
  -
  -#
   # the api classpath
   #
   merlin.api.classpath.length=3
  
  
  
  1.7       +0 -82     avalon-sandbox/merlin/kernel/bootstrap/src/java/Merlin.java
  
  Index: Merlin.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/kernel/bootstrap/src/java/Merlin.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Merlin.java       18 Aug 2003 19:42:04 -0000      1.6
  +++ Merlin.java       19 Aug 2003 05:45:15 -0000      1.7
  @@ -88,10 +88,6 @@
         "merlin.repository.remote";
       private static final String MERLIN_BOOTSTRAP_CLASSNAME_KEY = 
         "merlin.bootstrap.class";
  -    private static final String MERLIN_BOOTSTRAP_CLASSPATH_LENGTH_KEY = 
  -      "merlin.bootstrap.classpath.length";
  -    private static final String MERLIN_BOOTSTRAP_CLASSPATH_KEY = 
  -      "merlin.bootstrap.classpath";
       private static final String MERLIN_API_CLASSPATH_KEY = 
         "merlin.api.classpath";
       private static final String MERLIN_SPI_CLASSPATH_KEY = 
  @@ -165,21 +161,6 @@
           Properties properties = new Properties();
           properties.load( input );
   
  -        URL[] bootstrap = null;
  -        try
  -        {
  -            bootstrap = getURLs( repository, properties, 
MERLIN_BOOTSTRAP_CLASSPATH_KEY );
  -        }
  -        catch( Throwable e )
  -        {
  -            final String error =
  -              "\nInternal error while attempting to build bootstrap classloader.";
  -            String msg = 
  -              ExceptionHelper.packException( error, e, true );
  -            System.err.println( msg );
  -            return;
  -        }
  -
           URL[] api = null;
           try
           {
  @@ -233,10 +214,6 @@
           ClassLoader apiLoader = new URLClassLoader( api );
           ClassLoader spiLoader = new URLClassLoader( spi, apiLoader );
           ClassLoader loader = new URLClassLoader( impl, spiLoader );
  -
  -        //ClassLoader loader = new URLClassLoader( bootstrap );
  -        //Thread.currentThread().setContextClassLoader( loader );
  -
           Thread.currentThread().setContextClassLoader( loader );
   
           //
  @@ -341,63 +318,4 @@
   
           return (URL[]) list.toArray( new URL[0] );
       }
  -
  -
  -   /*
  -    private static URL[] getURLs( Repository repository, Properties properties )
  -    {
  -        ArrayList list = new ArrayList();
  -        final String value = properties.getProperty( 
MERLIN_BOOTSTRAP_CLASSPATH_LENGTH_KEY );
  -        if( value == null )
  -        {
  -            throw new NullPointerException( MERLIN_BOOTSTRAP_CLASSPATH_LENGTH_KEY );
  -        }
  -        int i = Integer.parseInt( value );
  -        for( int j=0; j<i; j++ )
  -        {
  -            final String key = MERLIN_BOOTSTRAP_CLASSPATH_KEY + "." + j;
  -            final String item = properties.getProperty( key );
  -            if( item == null )
  -            {
  -                final String error = 
  -                  "Inconsistent bootstrap classpath entry: " + key;
  -                throw new IllegalStateException( error );
  -            }
  -            try
  -            {
  -                int n = item.indexOf( ":" );
  -                final String group = item.substring( 0, n );
  -            
  -                String artifact = null;
  -                String version = null;
  -                int m = item.indexOf( ";" );
  -                if( m > -1 )
  -                {
  -                    artifact = item.substring( n+1, m );
  -                    version = item.substring( m+1, item.length() );
  -                }
  -                else
  -                {
  -                    artifact = item.substring( n+1, item.length() );
  -                }
  -            
  -                URL url = repository.getArtifact( group, artifact, version, "jar" );
  -                list.add( url );
  -            }
  -            catch( Throwable e )
  -            {
  -                final String error = 
  -                  "Internal bootstrap error.  Unable to load item: " + item;
  -                throw new BootstrapRuntimeException( error, e );
  -            }
  -        }
  -        //StringTokenizer tokenizer = new StringTokenizer( classpath, "," );
  -        //while( tokenizer.hasMoreElements() )
  -        //{
  -        //    final String item = (String)tokenizer.nextElement();
  -        //}
  -
  -        return (URL[]) list.toArray( new URL[0] );
  -    }
  -    */
   }
  
  
  
  1.7       +3 -12     
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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CLIKernelLoader.java      18 Aug 2003 15:11:33 -0000      1.6
  +++ CLIKernelLoader.java      19 Aug 2003 05:45:15 -0000      1.7
  @@ -235,7 +235,7 @@
           // the kernel configuration (used by the kernel loader)
           //
   
  -        URL kernel = kernel = getKernelPath( repository, line );
  +        URL kernel = kernel = getKernelPath( line );
   
           //
           // get the system path for extension resolution
  @@ -349,7 +349,7 @@
           }
       }
   
  -    private URL getKernelPath( Repository repository, CommandLine command ) throws 
Exception
  +    private URL getKernelPath( CommandLine command ) throws Exception
       {
           String filename = null;
           final String key = "kernel";
  @@ -371,16 +371,7 @@
           }
           else
           {
  -            try
  -            {
  -                return repository.getArtifact( "merlin", "kernel", "3.0", "xml" );
  -            }
  -            catch( Throwable e )
  -            {
  -                final String error =
  -                  "Could not locate the kernel descriptor.";
  -                throw new KernelException( error, e );
  -            } 
  +            return null;
           }
       }
   
  
  
  
  1.10      +25 -19    
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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultKernelContext.java 18 Aug 2003 17:02:37 -0000      1.9
  +++ DefaultKernelContext.java 19 Aug 2003 05:45:15 -0000      1.10
  @@ -263,9 +263,17 @@
           // bootstrap repository declared under the constructor
           //
   
  -        Configuration repositoryConfig = m_kernel.getChild( "repository" );
  -        m_repository = createRepository( system, repositoryConfig );
  -        getLogger().debug( "repository established" );
  +        if( system != null )
  +        {
  +            Configuration repositoryConfig = m_kernel.getChild( "repository" );
  +            m_repository = createRepository( system, repositoryConfig );
  +            getLogger().debug( "repository established" );
  +        }
  +        else
  +        {
  +            getLogger().debug( "using bootstrap repository" );
  +            m_repository = repository;
  +        }
   
           //
           // setup the pool manager
  @@ -432,15 +440,6 @@
       }
   
      /**
  -    * Return the system path
  -    * @return the path (possibly null)
  -    */
  -    public File getSystemPath()
  -    {
  -        return m_system;
  -    }
  -
  -   /**
       * Return the library path
       * @return the path (possibly null)
       */
  @@ -548,7 +547,7 @@
           StringBuffer buffer = new StringBuffer( "version: " );
           buffer.append( getVersionString() );
           buffer.append( "\nhome: " + getHomePath() );
  -        buffer.append( "\nsystem: " + getSystemPath() );
  +        buffer.append( "\nsystem: " + m_system );
           buffer.append( "\nlibrary: " + getLibraryPath() );
           buffer.append( "\nkernel: " + m_kernelURL );
           buffer.append( "\nblock: " + getInstallSequenceString() );
  @@ -754,13 +753,20 @@
       {
           try
           {
  -            return repository.getArtifact( "merlin", "kernel", "3.0", "xml" );
  +            return repository.getArtifact( "merlin", "kernel", "", "xml" );
           }
  -        catch( Throwable e )
  +        catch( Throwable re )
           {
  -            final String error = 
  -              "Could not load default kernel directive.";
  -            throw new KernelException( error, e );
  +            try
  +            {
  +                return repository.getArtifact( "merlin", "kernel", "3.0", "xml" );
  +            }
  +            catch( Throwable e )
  +            {
  +                final String error = 
  +                  "Could not load default kernel directive.";
  +                throw new KernelException( error, e );
  +            }
           }
       }
   }
  
  
  
  1.4       +1 -7      
avalon-sandbox/merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel/KernelContext.java
  
  Index: KernelContext.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel/KernelContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- KernelContext.java        18 Aug 2003 11:26:06 -0000      1.3
  +++ KernelContext.java        19 Aug 2003 05:45:15 -0000      1.4
  @@ -26,16 +26,10 @@
       ModelFactory getModelFactory();
   
      /**
  -    * Return the bootstrap repository.
  +    * Return the runtime repository.
       * @return the repository
       */
       Repository getRepository();
  -
  -   /**
  -    * Return the system path
  -    * @return the path (possibly null)
  -    */
  -    File getSystemPath();
   
      /**
       * Return the home path
  
  
  
  1.2       +8 -0      
avalon-sandbox/merlin/merlin-platform/tutorials/contextualization/README.TXT
  
  Index: README.TXT
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/merlin-platform/tutorials/contextualization/README.TXT,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- README.TXT        18 Aug 2003 19:38:37 -0000      1.1
  +++ README.TXT        19 Aug 2003 05:45:15 -0000      1.2
  @@ -7,4 +7,12 @@
   $ maven
   $ merlin -execute target\classes
   
  +[INFO   ] (tutorial.standard): contextualization using a custom strategy
  +
  +  strategy: tutorial.Contextualizable
  +  context: tutorial.StandardContextImp
  +  home: [your-directory]\home\tutorial\standard
  +  work: C:\TEMP\tutorial\standard
  +  name: standard
  +  partition: /tutorial/
   
  
  
  
  1.2       +4 -0      
avalon-sandbox/merlin/merlin-platform/tutorials/contextualization/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/merlin-platform/tutorials/contextualization/maven.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- maven.xml 18 Aug 2003 19:38:37 -0000      1.1
  +++ maven.xml 19 Aug 2003 05:45:15 -0000      1.2
  @@ -4,4 +4,8 @@
       <attainGoal name="avalon:meta"/>
     </preGoal>
   
  +  <postGoal name="test:test">
  +    <attainGoal name="merlin:simulate"/>
  +  </postGoal>
  +
   </project>
  
  
  
  1.20      +3 -42     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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- plugin.jelly      12 Aug 2003 10:51:09 -0000      1.19
  +++ plugin.jelly      19 Aug 2003 05:45:15 -0000      1.20
  @@ -85,7 +85,7 @@
         target="${maven.build.dir}/${maven.final.name}.jar" 
         config="${merlin.config}" 
         debug="${merlin.debug}" 
  -      wait="1000" 
  +      wait="${wait}" 
       />
   
     </goal>
  @@ -120,7 +120,7 @@
       If a kernel configuration has been declared the use it otherwise
       we default to the merlin installation kernel definition.
       -->
  -    <j:set var="merlin.kernel" value="${env.MERLIN_HOME}/config/kernel.xml"/>
  +    <j:set var="merlin.kernel" value="${maven.conf.dir}/config/kernel.xml"/>
       <j:set var="merlin.kernel.config" value="${merlin.kernel}"/>
       <util:file var="kernelFile" name="${merlin.kernel.config}"/>
       <j:if test="${kernelFile.exists()}">
  @@ -157,51 +157,12 @@
         kernel="${merlin.kernel}" 
         repository="${merlin.repository.local}/repository" 
         home="${basedir}" 
  -      path="${maven.conf.dir}/block.xml" 
  -      base="${basedir}/target/classes" 
  +      target="${basedir}/target/classes" 
         config="${merlin.config}" 
         debug="${merlin.debug}" 
         wait="${wait}" 
       />
   
     </goal>
  -
  -  <!--
  -  JMX handling (not working yet)
  -  -->
  -  <goal name="merlin:jmx" 
  -    description="JMX stuff.">
  -
  -    <taskdef name="jmx" classname="xdoclet.modules.jmx.JMXDocletTask">
  -      <classpath>
  -        <path refid="maven.dependency.classpath"/>
  -        <pathelement path="${plugin.getDependencyPath('xdoclet')}"/>
  -        <pathelement path="${plugin.getDependencyPath('xdoclet+xjavadoc')}"/>
  -        <pathelement path="${plugin.getDependencyPath('xdoclet+xdoclet-module')}"/>
  -        <pathelement path="${plugin.getDependencyPath('xdoclet+jmx-module')}"/>
  -        <pathelement path="${plugin.getDependencyPath('commons-collections')}"/>
  -        <pathelement path="${plugin.getDependencyPath('commons-logging')}"/>
  -        <pathelement path="${plugin.getDependencyPath('log4j')}"/>
  -      </classpath>
  -    </taskdef>
  -
  -    <echo> jmx stuff </echo>
  -
  -    <mkdir dir="${basedir}/temp"/>
  -    <jmx destdir="${basedir}/temp" 
  -       excludedtags="@version,@author"
  -       verbose="true"
  -       force="true">
  -      <fileset dir="${maven.src.dir}">
  -        <include name="**/*.*"/>
  -      </fileset>
  -      <fileset dir="${basedir}/temp">
  -        <include name="**/*.*"/>
  -      </fileset>
  -      <mbeaninterface/>
  -    </jmx>
  -
  -  </goal>
  -
   
   </project>
  
  
  
  1.15      +5 -0      avalon-sandbox/merlin/merlin-plugin/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-plugin/project.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- project.xml       11 Aug 2003 22:58:52 -0000      1.14
  +++ project.xml       19 Aug 2003 05:45:15 -0000      1.15
  @@ -30,6 +30,11 @@
   
       <dependency>
         <groupId>avalon-activation</groupId>
  +      <artifactId>avalon-activation-api</artifactId>
  +      <version>SNAPSHOT</version>
  +    </dependency>
  +    <dependency>
  +      <groupId>avalon-activation</groupId>
         <artifactId>avalon-activation-spi</artifactId>
         <version>SNAPSHOT</version>
       </dependency>
  
  
  
  1.11      +108 -154  
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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- MerlinBean.java   18 Aug 2003 15:11:33 -0000      1.10
  +++ MerlinBean.java   19 Aug 2003 05:45:15 -0000      1.11
  @@ -74,54 +74,47 @@
   
   public class MerlinBean
   {
  +    //-----------------------------------------------------
  +    // state
  +    //-----------------------------------------------------
   
      /**
  -    * The local repository.
  -    */
  -    private File m_local;
  -
  -   /**
  -    * The target jar file
  +    * The target jar file, simulated deployment directory or 
  +    * block file to be deployed.
       */
       private File m_target;
   
      /**
  -    * The local repository.
  +    * The local repository directory from which the resource
  +    * repository will be created.  Typically this will refer to 
  +    * Maven local repository.
       */
       private File m_repository;
   
      /**
  -    * ??
  -    */
  -    private File m_path;
  -
  -   /**
  -    * ??
  -    */
  -    private File m_base;
  -
  -   /**
  -    * the configuration targets
  +    * The configuration targets file to be used.
       */
       private File m_conf;
   
      /**
  -    * the kernel configuration
  +    * The kernel configuration file.
       */
       private File m_kernelPath;
   
      /**
  -    * the directory against which extension directories are resolved
  +    * The directory against which extension directories are resolved
  +    * if extension direcctories are declared in the classloader.
       */
       private File m_system;
   
      /**
  -    * the local working directory
  +    * The local working directory.  Typically corresponds to the 
  +    * Maven ${badedir} variable.
       */
       private File m_home;
   
      /**
  -    * ??
  +    * The debug flag.
       */
       private String m_debug;
   
  @@ -140,6 +133,10 @@
       */
       private Kernel m_kernel;
   
  +    //-----------------------------------------------------
  +    // bean pattern setters
  +    //-----------------------------------------------------
  +
      /**
       * Set the repository.
       * @param repository the repository directory
  @@ -149,6 +146,21 @@
           m_repository = repository;
       }
   
  +    //??
  +    public void setWait( int value ) 
  +    {
  +        m_wait = value;
  +    }
  +
  +    public void setConfig( File conf ) 
  +    {
  +        m_conf = conf;
  +    }
  +
  +    public void setKernel( File kernel ) 
  +    {
  +        m_kernelPath = kernel;
  +    }
   
      /**
       * Set the target jar file.
  @@ -160,137 +172,118 @@
       }
   
      /**
  -    * Get the target jar file as a URL
  -    * @return the target url
  +    * Set the working directory.
       */
  -    private URL getTarget() throws Exception
  +    public void setHome( File home ) 
       {
  -        return m_target.toURL();
  +        m_home = home;
       }
   
      /**
  -    * Get the configuration source as a URL
  -    * @return the config url
  +    * Set the debug flag.
       */
  -    private URL getConfigurationURL() throws Exception
  +    public void setDebug( String priority ) 
       {
  -        if( m_conf != null )
  -        {
  -            if( m_conf.exists() ) return m_conf.toURL();
  -        }
  -        return null;
  +        m_debug = priority;
       }
   
  -    //??
  -    public void setPath( File path ) 
  +   /**
  +    * Set the option jar file extensions directory anchor.
  +    */
  +    public void setSystem( File system ) 
       {
  -        m_path = path;
  +        m_system = system;
       }
   
  -    //??
  -    public void setWait( int value ) 
  +   /**
  +    * Set the deployment policy.
  +    */
  +    public void setDeploy( boolean value ) 
       {
  -        m_wait = value;
  +        m_deploy = value;
       }
   
  -    //??
  -    public int getWait() 
  -    {
  -        return m_wait;
  -    }
  +    //-----------------------------------------------------
  +    // implementation
  +    //-----------------------------------------------------
   
  -    //??
  -    private URL getPath()
  +   /**
  +    * Get the target jar file as a URL
  +    * @return the target url
  +    */
  +    private URL getTarget() throws Exception
       {
  -        try
  -        {
  -            return m_path.toURL();
  -        }
  -        catch( Throwable e )
  -        {
  -            throw new RuntimeException( e.toString() );
  -        }
  +        return m_target.toURL();
       }
   
  -    private File getBase()
  +   /**
  +    * Get the configuration source as a URL
  +    * @return the config url
  +    */
  +    private URL getConfigurationURL() throws Exception
       {
  -        if( m_base == null )
  -        {
  -            File file = new File( m_path.getParentFile().getParentFile(), 
"target/classes" );
  -            if( file.exists() )
  -            {
  -                return file;
  -            }
  -            else
  -            {
  -                final String error = 
  -                  "Cannot resolve the base direcrtory.";
  -                throw new IllegalStateException( error );
  -            }
  -        }
  -        else
  +        if( m_conf != null )
           {
  -            return m_base;
  +            if( m_conf.exists() ) return m_conf.toURL();
           }
  +        return null;
       }
   
  -    public void setConfig( File conf ) 
  -    {
  -        m_conf = conf;
  -    }
  -
  -    public void setBase( File base ) 
  -    {
  -        m_base = base;
  -    }
  -
  -    public void setKernel( File kernel ) 
  -    {
  -        m_kernelPath = kernel;
  -    }
  -
  -    public void setHome( File home ) 
  +   /**
  +    * The intival of time to wait before shutting down the kernel.  
  +    */
  +    public int getWait() 
       {
  -        m_home = home;
  +        return m_wait;
       }
   
  -    private File getHome()
  +   /**
  +    * Get the kernel source as a URL or null if not declared.
  +    * @return the kernel url
  +    */
  +    private URL getKernelURL() throws Exception
       {
  -        if( m_home == null )
  +        if( m_kernelPath != null )
           {
  -            m_home = new File( System.getProperty( "user.dir" ) );
  +            if( m_kernelPath.exists() ) return m_kernelPath.toURL();
           }
  -        return m_home;
  -    }
  -
  -    public void setDebug( String priority ) 
  -    {
  -        m_debug = priority;
  -    }
  -
  -    public void setSystem( File system ) 
  -    {
  -        m_system = system;
  +        return null;
       }
   
  -    public void setDeploy( boolean value ) 
  +   /**
  +    * Get the base directory.
  +    * @return the base directory
  +    */
  +    private File getHomeDirectory()
       {
  -        m_deploy = value;
  +        return m_home;
       }
   
  -    public boolean getDeploy( ) 
  +   /**
  +    * Return the deployment flag.
  +    * @return the flag
  +    */
  +    public boolean getDeployFlag( ) 
       {
           return m_deploy;
       }
   
  -    public File getSystem() 
  +   /**
  +    * Return the optional extensions anchor directory.
  +    * @return the flag
  +    */
  +    public File getAnchorDirectory() 
       {
           return m_system;
       }
   
  +   /**
  +    * Return the debug flag.
  +    * @return the flag
  +    */
       public boolean getDebugFlag()
       {
  -        return m_debug.equalsIgnoreCase( "debug" );
  +        return m_debug.equalsIgnoreCase( "true" );
       }
   
       public void doExecute() throws Exception
  @@ -301,14 +294,15 @@
               DefaultKernelContext context = 
                 new DefaultKernelContext( 
                   repository, 
  -                m_system, 
  -                m_home, 
  -                m_home, 
  -                m_kernelPath.toURL(), 
  +                null, 
  +                getAnchorDirectory(), 
  +                getHomeDirectory(), 
  +                getKernelURL(), 
                   new URL[]{ getTarget() },
                   getConfigurationURL(), 
  -                m_deploy, 
  -                getDebugFlag() );
  +                getDeployFlag(), 
  +                getDebugFlag() 
  +              );
   
               m_kernel = new DefaultKernel( context );
   
  @@ -322,45 +316,5 @@
               throw new KernelException( message, e );
           }
       }
  -
  -    /*
  -    private static URL[] getJarFiles( File base )
  -    {
  -        return getJarFiles( base, new URL[0] );
  -    }
  -
  -    private static URL[] getJarFiles( File base, URL[] urls )
  -    {
  -        List list = new ArrayList();
  -        for( int i=0; i<urls.length; i++ )
  -        {
  -            list.add( urls[i] );
  -        }
  -        populateJars( list, base );
  -        return (URL[]) list.toArray( new URL[0] );
  -    }
  -
  -    private static void populateJars( List list, File base )
  -    {
  -        try
  -        {
  -            File[] files = base.listFiles();
  -            for( int i=0; i<files.length; i++ )
  -            {
  -                File file = files[i];
  -                if( file.getName().endsWith( ".jar" ) )
  -                {
  -                    list.add( file.toURL() );
  -                }
  -            }
  -        }
  -        catch( Throwable e )
  -        {
  -            final String error =
  -              "Unexpected error while scanning files in shared directory: " + base;
  -            throw new KernelRuntimeException( error, e );
  -        }
  -    }
  -    */
   }
   
  
  
  

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

Reply via email to