You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ni...@apache.org on 2004/01/19 22:46:10 UTC

cvs commit: avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl DefaultClassLoaderModel.java DefaultContainmentModel.java DefaultDeploymentModel.java DefaultSystemContext.java

niclas      2004/01/19 13:46:10

  Modified:    merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl
                        DefaultClassLoaderModel.java
                        DefaultContainmentModel.java
                        DefaultDeploymentModel.java
                        DefaultSystemContext.java
  Log:
  Additional changes in the composition to support code level security.
  
  Revision  Changes    Path
  1.7       +12 -1     avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultClassLoaderModel.java
  
  Index: DefaultClassLoaderModel.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultClassLoaderModel.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultClassLoaderModel.java	19 Jan 2004 13:35:10 -0000	1.6
  +++ DefaultClassLoaderModel.java	19 Jan 2004 21:46:10 -0000	1.7
  @@ -59,6 +59,7 @@
   import java.net.URL;
   import java.net.URLClassLoader;
   import java.security.Permission;
  +import java.security.cert.Certificate;
   
   import org.apache.avalon.composition.data.ContainmentProfile;
   import org.apache.avalon.composition.data.ClassLoaderDirective;
  @@ -375,6 +376,16 @@
           return m_classLoader;
       }
   
  +   /** 
  +    * Returns the Certificates associated with the classes that
  +    * can be loaded by the classloader.
  +    **/ 
  +    public Certificate[] getCertificates()
  +    {
  +        // TODO: We currently don't support Certificates.
  +        return null;
  +    }
  +    
      /** 
       * Return the security Permissions defined for this ClassLoaderModel.
       * 
  
  
  
  1.21      +21 -12    avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java
  
  Index: DefaultContainmentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- DefaultContainmentModel.java	16 Jan 2004 16:39:02 -0000	1.20
  +++ DefaultContainmentModel.java	19 Jan 2004 21:46:10 -0000	1.21
  @@ -252,6 +252,25 @@
           return m_context.getClassLoaderModel();
       }
   
  +   /**
  +    * Returns true if Secure Execution mode has been enabled in the kernel.
  +    * 
  +    * Secure Execution mode enables the deployer to restrict the exection
  +    * environment, and this flag allows for developers to quickly switch
  +    * between the secure and non-secure execution modes.
  +    * 
  +    * @return true if Secure Execution mode has been enabled in the kernel.
  +    **/ 
  +    public boolean isSecureExecutionEnabled()
  +    {
  +        SystemContext sc = m_context.getSystemContext();
  +        Parameters params = sc.getSystemParameters();
  +        return params.getParameterAsBoolean( 
  +          SECURE_EXECUTION_KEY, 
  +          false 
  +        );
  +    }
  +   
      /** 
       * Returns the maximum allowable time for deployment.
       *
  @@ -261,16 +280,6 @@
       public long getDeploymentTimeout()
       {
           return 0;
  -        //long n = super.getDeploymentTimeout();
  -        //if( isAssembled() )
  -        //{
  -        //    DeploymentModel[] startup = getStartupGraph();
  -        //    for( int i=0; i<startup.length; i++ )
  -        //   {
  -        //        n = ( n + startup[i].getDeploymentTimeout() );
  -        //    }
  -        //}
  -        //return n;
       }
   
      /**
  @@ -1766,4 +1775,4 @@
               throw new ModelException( error, e );
           }
       }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.12      +4 -4      avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentModel.java
  
  Index: DefaultDeploymentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentModel.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DefaultDeploymentModel.java	15 Jan 2004 12:23:04 -0000	1.11
  +++ DefaultDeploymentModel.java	19 Jan 2004 21:46:10 -0000	1.12
  @@ -228,8 +228,8 @@
           Parameters params = sc.getSystemParameters();
           return params.getParameterAsLong( 
             DEPLOYMENT_TIMEOUT_KEY, 
  -          params.getParameterAsLong( 
  -            "deployment-timeout", // legacy 
  -            1000 ) );
  +          1000
  +        );
       }
  +
   }
  
  
  
  1.9       +15 -3     avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultSystemContext.java
  
  Index: DefaultSystemContext.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultSystemContext.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultSystemContext.java	19 Jan 2004 17:37:31 -0000	1.8
  +++ DefaultSystemContext.java	19 Jan 2004 21:46:10 -0000	1.9
  @@ -91,6 +91,12 @@
       private static final Resources REZ =
               ResourceManager.getPackageResources( DefaultSystemContext.class );
   
  +    public static SystemContext createSystemContext( 
  +      File base, File root, int priority ) throws Exception
  +    {
  +        return createSystemContext( base, root, priority, false );
  +    }
  +    
      /**
       * Convinience function to create a new system context. This function
       * is intended for test purposes only.
  @@ -102,7 +108,7 @@
       * @return a system context
       */
       public static SystemContext createSystemContext( 
  -      File base, File root, int priority ) throws Exception
  +      File base, File root, int priority, boolean secure ) throws Exception
       {
           LoggingManager logging = createLoggingManager( base, priority );
           Logger logger = logging.getLoggerForCategory( "" );
  @@ -112,11 +118,17 @@
           //final File home = new File( working, "home" );
           //final File temp = new File( working, "temp" );
   
  +        Parameters parameters = null;
  +        if( secure )
  +        {
  +            parameters = new Parameters();
  +            parameters.setParameter( "urn:composition:security.enabled", "true" );
  +        }
           final File home = new File( base, "home" );
           final File temp = new File( base, "temp" );
   
           return new DefaultSystemContext( 
  -          logging, base, home, temp, repository, "system", false, null );
  +          logging, base, home, temp, repository, "system", false, parameters );
       }
   
       private static CacheManager createCacheManager( File root ) 
  
  
  

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