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 2004/02/02 01:44:09 UTC

cvs commit: avalon/merlin/logging/logkit/test/conf logging.xml

mcconnell    2004/02/01 16:44:09

  Modified:    merlin/kernel/cli merlin.properties
               merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli
                        Main.java Resources.properties
               merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl
                        DefaultCriteria.java DefaultFactory.java
               merlin/logging/logkit/plugins/datagram/src/java/org/apache/avalon/logging/logkit/factory/datagram
                        Resources.properties
               merlin/logging/logkit/test/conf logging.xml
  Log:
  Add a commandline switch to enable code security (using -secure) and update the criteria def and factory to disable code security as default behaviour.
  
  Revision  Changes    Path
  1.2       +1 -1      avalon/merlin/kernel/cli/merlin.properties
  
  Index: merlin.properties
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/kernel/cli/merlin.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- merlin.properties	8 Dec 2003 15:37:12 -0000	1.1
  +++ merlin.properties	2 Feb 2004 00:44:09 -0000	1.2
  @@ -1,5 +1,5 @@
   
  -merlin.info = false
  +merlin.info = true
   merlin.debug = false
   merlin.deployment = conf/test.block,conf/test-2.block,conf/hello.block
   merlin.override = conf/override.xml
  
  
  
  1.16      +15 -1     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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Main.java	25 Jan 2004 13:18:48 -0000	1.15
  +++ Main.java	2 Feb 2004 00:44:09 -0000	1.16
  @@ -107,6 +107,10 @@
              "info",
              REZ.getString( "cli-info-description" ) );
   
  +        Option secure = new Option(
  +           "secure",
  +           REZ.getString( "cli-secure-description" ) );
  +
           Option locale = OptionBuilder
              .hasArg()
              .withArgName( "code" )
  @@ -174,6 +178,7 @@
           options.addOption( info );
           options.addOption( debug );
           options.addOption( audit );
  +        options.addOption( secure );
           options.addOption( install );
           options.addOption( home );
           options.addOption( context );
  @@ -310,6 +315,7 @@
           setDebugPolicy( criteria, line );
           setAuditPolicy( criteria, line );
           setServerPolicy( criteria, line );
  +        setSecurityPolicy( criteria, line );
           setAnchorDirectory( criteria, line );
           setContextDirectory( criteria, line );
           setRepositoryDirectory( criteria, line );
  @@ -410,6 +416,14 @@
           if( line.hasOption( "execute" ) )
           {
               criteria.put( "merlin.server", new Boolean( false ) );
  +        }
  +    }
  +
  +    private void setSecurityPolicy( Map criteria, CommandLine line )
  +    {
  +        if( line.hasOption( "secure" ) )
  +        {
  +            criteria.put( "merlin.code.security.enabled", new Boolean( true ) );
           }
       }
   
  
  
  
  1.5       +2 -0      avalon/merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/kernel/cli/src/java/org/apache/avalon/merlin/cli/Resources.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Resources.properties	16 Jan 2004 16:39:02 -0000	1.4
  +++ Resources.properties	2 Feb 2004 00:44:09 -0000	1.5
  @@ -23,6 +23,8 @@
   
   cli-audit-description=Generate a model audit report.
   
  +cli-secure-description=Executes with code security enabled.
  +
   cli-implementation-description=An artifact specification that overrides the default implementation.
   
   cli-home-description=A relative or absolute path to a working home directory. If not supplied, the system will default to the current directory.
  
  
  
  1.18      +97 -16    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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DefaultCriteria.java	24 Jan 2004 23:25:31 -0000	1.17
  +++ DefaultCriteria.java	2 Feb 2004 00:44:09 -0000	1.18
  @@ -160,7 +160,7 @@
               new PackedParameter( 
                 MERLIN_DEPLOYMENT, ",", new String[0] ),
               new Parameter( 
  -              MERLIN_KERNEL, URL.class, null ),
  +              MERLIN_KERNEL, String.class, null ),
               new Parameter( 
                 MERLIN_LOGGING_CONFIG, 
                 File.class, null ),
  @@ -194,7 +194,7 @@
                 Long.class, new Long( 1000 ) ),
               new Parameter( 
                 MERLIN_CODE_SECURITY_ENABLED, 
  -              Boolean.class, new Boolean( true ) )
  +              Boolean.class, new Boolean( false ) )
            };
       }
   
  @@ -459,18 +459,47 @@
       */
       public URL getKernelURL()
       {
  -        URL url = (URL) get( MERLIN_KERNEL );
  -        if( null != url ) return url;
  -        File conf = getConfigDirectory();
  -        if( null == conf ) return null;
  -        File kernel = new File( conf, "kernel.xml" );
  -        if( kernel.exists() )
  +        String uri = (String) get( MERLIN_KERNEL );
  +        if( null == uri )
           {
  -            return toURL( kernel );
  +            File conf = getConfigDirectory();
  +            if( null == conf ) return null;
  +            File kernel = new File( conf, "kernel.xml" );
  +            if( kernel.exists() )
  +            {
  +                return toURL( kernel );
  +            }
  +            else
  +            {
  +                return null;
  +            }
  +        }
  +        else if( uri.indexOf( ":" ) < 0 )
  +        {
  +            File target = new File( uri );
  +            if( target.exists() )
  +            {
  +                return toURL( target );
  +            }
  +            else
  +            {
  +                File base = getWorkingDirectory();
  +                target = new File( base, uri );
  +                if( target.exists() )
  +                {
  +                    return toURL( target );
  +                }
  +                else
  +                {
  +                    final String error = 
  +                      "Kernel file not found [" + target + "].";
  +                    throw new KernelRuntimeException( error );
  +                }
  +            }
           }
           else
           {
  -            return null;
  +            return toURL( uri );
           }
       }
   
  @@ -633,13 +662,13 @@
      /**
       * Return the code security enabled status.
       *
  -    * @return TRUE if code security is enabled
  +    * @return TRUE if code security is enabled - default is false
       */
       public boolean isCodeSecurityEnabled()
       {
           Boolean value = (Boolean) get( MERLIN_CODE_SECURITY_ENABLED );
           if( null != value ) return value.booleanValue();
  -        return true;
  +        return false;
       }
   
       //--------------------------------------------------------------
  @@ -747,15 +776,15 @@
           }
       }
   
  -    private URL resolveURL( File base, String value ) throws Exception
  +    private URL resolveURL( File base, String value )
       {
           if( value.startsWith( "block:" ) )
           {
  -            return new URL( null, value, new BlockHandler() );
  +            return blockSpecToURL( value );
           }
           else if( value.startsWith( "artifact:" ) )
           {
  -            return new URL( null, value, new ArtifactHandler() );
  +            return artifactSpecToURL( value );
           }
   
           try
  @@ -799,6 +828,58 @@
                 "Unable to transform the file [" 
                     + file.toString()
                     + "] to a URL.";
  +            throw new KernelRuntimeException( error, e );
  +        }
  +    }
  +
  +    private URL blockSpecToURL( String spec )
  +    {
  +        if( null == spec ) throw new NullPointerException( "spec" );
  +        try
  +        {
  +            return new URL( null, spec, new BlockHandler() );
  +        }
  +        catch( Throwable e )
  +        {
  +            final String error = 
  +              "Unable to transform the block specification [" 
  +                + spec
  +                + "] to a URL.";
  +            throw new KernelRuntimeException( error, e );
  +        }
  +    }
  +
  +    private URL artifactSpecToURL( String spec )
  +    {
  +        if( null == spec ) throw new NullPointerException( "spec" );
  +        try
  +        {
  +            return new URL( null, spec, new ArtifactHandler() );
  +        }
  +        catch( Throwable e )
  +        {
  +            final String error = 
  +              "Unable to transform the artifact specification [" 
  +                + spec
  +                + "] to a URL.";
  +            throw new KernelRuntimeException( error, e );
  +        }
  +    }
  +
  +    private URL toURL( String spec )
  +    {
  +        if( null == spec ) throw new NullPointerException( "spec" );
  +
  +        try
  +        {
  +            return new URL( spec );
  +        }
  +        catch( Throwable e )
  +        {
  +            final String error = 
  +              "Unable to construct url from spec [" 
  +                + spec
  +                + "].";
               throw new KernelRuntimeException( error, e );
           }
       }
  
  
  
  1.22      +9 -2      avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultFactory.java
  
  Index: DefaultFactory.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultFactory.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- DefaultFactory.java	28 Jan 2004 14:41:59 -0000	1.21
  +++ DefaultFactory.java	2 Feb 2004 00:44:09 -0000	1.22
  @@ -98,8 +98,7 @@
       private static Resources REZ =
           ResourceManager.getPackageResources( DefaultFactory.class );
   
  -    private static final String LINE = 
  -      "\n-----------------------------------------------------------";
  +    private static final String LINE = InitialContext.LINE;
   
       private static final XMLComponentProfileCreator CREATOR = 
         new XMLComponentProfileCreator();
  @@ -922,6 +921,14 @@
           buffer.append( 
             "\n  ${merlin.autostart} == " 
             + criteria.isAutostartEnabled() );
  +
  +        buffer.append( 
  +          "\n  ${merlin.code.security.enabled} == " 
  +          + criteria.isCodeSecurityEnabled() );
  +
  +        buffer.append( 
  +          "\n  ${merlin.deployment.timeout} == " 
  +          + criteria.getDeploymentTimeout() );
   
           buffer.append( 
             "\n  ${merlin.repository} == " 
  
  
  
  1.2       +6 -5      avalon/merlin/logging/logkit/plugins/datagram/src/java/org/apache/avalon/logging/logkit/factory/datagram/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/logging/logkit/plugins/datagram/src/java/org/apache/avalon/logging/logkit/factory/datagram/Resources.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Resources.properties	29 Jan 2004 06:11:34 -0000	1.1
  +++ Resources.properties	2 Feb 2004 00:44:09 -0000	1.2
  @@ -1,5 +1,6 @@
  -datagram.error.missing-address=Missing 'address' attribute is supplied datagram target configuration.
  -datagram.error.unknown-host=Datagram target references an unknown host.
  -datagram.error.missing-host=Datagram target does not contain required 'hostname' attribute.
  -datagram.error.internal=Internal error while attempting to construct datagram target.
  -datagram.error.missing-port=Datagram target does not contain required 'port' attribute.
  +socket.error.missing-address=Missing 'address' attribute is supplied socket target configuration.
  +socket.error.unknown-host=Socket target references an unknown host.
  +socket.error.missing-host=Socket target does not contain required 'hostname' attribute.
  +socket.error.missing-port=Socket target does not contain required 'port' attribute.
  +socket.error.internal=Internal error while attempting to construct socket target.
  +
  
  
  
  1.7       +12 -2     avalon/merlin/logging/logkit/test/conf/logging.xml
  
  Index: logging.xml
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/logging/logkit/test/conf/logging.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- logging.xml	29 Jan 2004 06:33:54 -0000	1.6
  +++ logging.xml	2 Feb 2004 00:44:09 -0000	1.7
  @@ -1,6 +1,6 @@
   <?xml version="1.0" encoding="ISO-8859-1"?>
   
  -<logging debug="false">
  +<logging debug="true">
   
     <!--
     Declaration of a set of logging targets.
  @@ -48,6 +48,16 @@
         <address hostname="localhost" port="0"/>
       </target>
   
  +    <target id="smtp"
  +        artifact="avalon-logging/avalon-logkit-smtp?version=1.0-SNAPSHOT">
  +      <to>mcconnell@osm.net</to>
  +      <from>mcconnell@osm.net</from>
  +      <subject>logging target test</subject>
  +      <maximum-size>1</maximum-size>
  +      <session>
  +      </session>
  +    </target>
  +    
     </targets>
   
     <!--
  @@ -61,7 +71,7 @@
         <categories name="logger" priority="warn">
           <category name="test" priority="fatal_error"/>
         </categories>
  -      <category name="roger-ramjet" priority="debug" target="simple"/>
  +      <category name="roger-ramjet" priority="debug" target="smtp"/>
       </categories>
     </categories>
   
  
  
  

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