river-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtra...@apache.org
Subject svn commit: r1307115 - in /river/jtsk/skunk/surrogate: src/org/apache/river/container/ src/schemas/ test/org/apache/river/container/config/ testfiles/ testfiles/testroot/profile/default/
Date Thu, 29 Mar 2012 21:21:43 GMT
Author: gtrasuk
Date: Thu Mar 29 21:21:42 2012
New Revision: 1307115

URL: http://svn.apache.org/viewvc?rev=1307115&view=rev
Log:
Continued work on the classloading hierarchy in pursuit of appropriate dynamic security capabilities.
 Not quite there yet, but close.

Modified:
    river/jtsk/skunk/surrogate/src/org/apache/river/container/AnnotatedClassDeployer.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/Bootstrap.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/MessageNames.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/Messages.properties
    river/jtsk/skunk/surrogate/src/org/apache/river/container/ProfileConfigReader.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/Strings.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/SystemClassloaderInitializer.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/Utils.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/core-config.xml
    river/jtsk/skunk/surrogate/src/schemas/config.xsd
    river/jtsk/skunk/surrogate/test/org/apache/river/container/config/ConfigurationParserTest.java
    river/jtsk/skunk/surrogate/test/org/apache/river/container/config/config-test-doc.xml
    river/jtsk/skunk/surrogate/testfiles/logging.properties
    river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/config.xml

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/AnnotatedClassDeployer.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/AnnotatedClassDeployer.java?rev=1307115&r1=1307114&r2=1307115&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/AnnotatedClassDeployer.java
(original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/AnnotatedClassDeployer.java
Thu Mar 29 21:21:42 2012
@@ -308,8 +308,13 @@ public class AnnotatedClassDeployer impl
      */
     List<Member> buildMemberList(Class cls) throws SecurityException {
         List<Member> members = new ArrayList<Member>();
+        try {
         members.addAll(Arrays.asList(cls.getDeclaredMethods()));
         members.addAll(Arrays.asList(cls.getDeclaredFields()));
+        } catch(Error err) {
+            Utils.logClassLoaderHierarchy(log, cls);
+            throw err;
+        }
         return members;
     }
 

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/Bootstrap.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/Bootstrap.java?rev=1307115&r1=1307114&r2=1307115&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/Bootstrap.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/Bootstrap.java Thu Mar 29 21:21:42
2012
@@ -17,7 +17,6 @@
  */
 package org.apache.river.container;
 
-import java.beans.Statement;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.InputStream;
@@ -25,9 +24,7 @@ import java.lang.reflect.InvocationTarge
 import java.lang.reflect.Method;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
+import java.util.*;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.xml.XMLConstants;
@@ -38,29 +35,21 @@ import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
-import org.apache.river.container.config.Component;
-import org.apache.river.container.config.ContainerConfig;
-import org.apache.river.container.config.DiscoveryContextType;
-import org.apache.river.container.config.Property;
+import org.apache.river.container.config.*;
 import org.xml.sax.SAXException;
 
 /**
-Bootstrap loader for the container.
-Performs roughly the following:
-<ul>
-<li>Based on the configuration parameter fed in at the command line, determine
-the configuration directory and the config file.</li>
-<li>Read the configuration file</li>
-<li>Based on the classpath declared in the config file, create the container's
-classloader.</li>
-<li>Using that classloader, create the context.</li>
-<li>Load any command-line parameters into the context</li>
-<li>Create all the elements (beans, discovery sets, etc) that are
-called out in the config file and put them into the context.  This will cause
-those beans to setup and initialize themselves.</li>
-</li>
+ Bootstrap loader for the container. Performs roughly the following: <ul>
+ <li>Based on the configuration parameter fed in at the command line, determine
+ the configuration directory and the config file.</li> <li>Read the
+ configuration file</li> <li>Based on the classpath declared in the config file,
+ create the container's classloader.</li> <li>Using that classloader, create
the
+ context.</li> <li>Load any command-line parameters into the context</li>
+ <li>Create all the elements (beans, discovery sets, etc) that are called out in
+ the config file and put them into the context. This will cause those beans to
+ setup and initialize themselves.</li> </li>
 
- * @author trasukg
+ @author trasukg
  */
 public class Bootstrap {
 
@@ -100,32 +89,94 @@ public class Bootstrap {
         return urls;
     }
 
+    private static Map<String, ClassLoader> createClassLoaders(ContainerConfig config)
throws MalformedURLException {
+
+        Map<String, ClassLoader> classLoaders = new HashMap<String, ClassLoader>();
+        /*
+         Setup the classloaders according to the config file.
+         */
+        List<String> seen = new LinkedList<String>();
+        Map<String, Classpath> classpaths = new HashMap<String, Classpath>();
+        for (Classpath classpath : config.getClasspath()) {
+            if (classpaths.containsKey(classpath.getId())) {
+                throw new ConfigurationException(MessageNames.DUPLICATE_CLASSPATH, classpath.getId());
+            }
+            classpaths.put(classpath.getId(), classpath);
+        }
+
+        for (String id : classpaths.keySet()) {
+            resolveClassLoader(classLoaders, seen, classpaths, id);
+        }
+        return classLoaders;
+    }
+
+    private static ClassLoader resolveClassLoader(Map<String, ClassLoader> classLoaders,
+            List<String> seen,
+            Map<String, Classpath> classpaths,
+            String id) throws MalformedURLException {
+        if (classLoaders.containsKey(id ) ){
+            return classLoaders.get(id);
+        }
+        if (seen.contains(id)) {
+            throw new ConfigurationException(MessageNames.CIRCULAR_CLASSPATH, id);      
   
+        }
+        // Add the id to the list of classloaders we have attempted to build.
+        seen.add(id);
+        Classpath classpath=classpaths.get(id);
+        if (classpath==null) {
+            throw new ConfigurationException(MessageNames.CLASSPATH_UNDEFINED, id);
+        }
+        String parentClasspathId=classpath.getParent();
+        ClassLoader parentClassLoader=null;
+        if (parentClasspathId!=null && !Strings.EMPTY.equals(parentClasspathId) ){
+            parentClassLoader=resolveClassLoader(classLoaders, seen, classpaths, parentClasspathId);
+        } else {
+            /* Should be the 'extension' classloader. */
+            parentClassLoader=Bootstrap.class.getClassLoader().getParent();
+        }
+        URL[] classpathUrls;
+        classpathUrls = findClasspathURLS(classpath.getValue());
+        
+        SettableCodebaseClassLoader classLoader = new SettableCodebaseClassLoader(classpathUrls,
+                parentClassLoader);
+        classLoaders.put(id, classLoader);
+        log.log(Level.FINE, MessageNames.CONFIGURED_CLASSPATH, new Object[]{
+                    id,
+                    Utils.format(classpathUrls)});
+        seen.remove(id);
+        return classLoader;      
+    }
+
     static void initializeContainer(String args[]) throws SAXException, JAXBException, FileNotFoundException,
MalformedURLException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException,
IllegalArgumentException, InvocationTargetException, InstantiationException, ConfigurationException,
Exception {
         //Logger.getLogger("org.apache.river.container.AnnotatedClassDeployer").setLevel(Level.ALL);
         Logger.getLogger(CommandLineArgumentParser.class.getName()).setLevel(Level.ALL);
-        
+
         ContainerConfig coreConfig = readCoreConfig();
-        URL[] urls = findClasspathURLS(coreConfig);
-        log.log(Level.FINE, MessageNames.CONFIGURED_CLASSPATH, new Object[]{
-                    Utils.format(urls)});
-        /* Setup the classloader using the parent of the bootstrap's classloader,
-        which should be the extension loader.
-         */
-        SettableCodebaseClassLoader classLoader = new SettableCodebaseClassLoader(urls,
-                Bootstrap.class.getClassLoader().getParent());
-        /* Create the context object. */
-        Object context = Class.forName(Strings.CONTEXT_CLASS, true, classLoader).newInstance();
+        Map<String, ClassLoader> classLoaders = createClassLoaders(coreConfig);
+
+        ClassLoader containerClassLoader = classLoaders.get(Strings.CONTAINER_CLASS_LOADER);
+
+        /*
+         Create the context object.
+         */
+        Object context = Class.forName(Strings.CONTEXT_CLASS, true, containerClassLoader).newInstance();
         Method putByNameMethod = context.getClass().getMethod(
                 Strings.PUT, new Class[]{String.class, Object.class});
         Method initCompleteMethod = context.getClass().getMethod(Strings.INIT_COMPLETE, new
Class[0]);
-        Thread.currentThread().setContextClassLoader(classLoader);
-        /* Process the core configuration */
-        processConfiguration(coreConfig, classLoader, context);
-        /* We need to set the command line args after processing the core
+        Thread.currentThread().setContextClassLoader(containerClassLoader);
+        putByNameMethod.invoke(context, Strings.CLASS_LOADERS, (Object) classLoaders);
+        /*
+         Process the core configuration
+         */
+        processConfiguration(coreConfig, containerClassLoader, context);
+        /*
+         We need to set the command line args after processing the core
          configuration so that the items in the core-config get initialized.
          */
         putByNameMethod.invoke(context, Strings.COMMAND_LINE_ARGS, (Object) args);
-        /* The core configuration now loads the profile configuration... */
+        /*
+         The core configuration now loads the profile configuration...
+         */
         // processConfiguration(containerConfig, classLoader, putMethod, context, putByNameMethod);
         initCompleteMethod.invoke(context, new Object[0]);
     }
@@ -135,21 +186,27 @@ public class Bootstrap {
         Method putByNameMethod = context.getClass().getMethod(
                 Strings.PUT, new Class[]{String.class, Object.class});
 
-        /* Add the classpath urls found in the configuration into the
-         classloader.
+        /*
+         Add the classpath urls found in the configuration into the classloader.
          Note that we have to do this by reflection because the classloader
          we're handed may not be the same classloader that loaded this instance
-         of the Bootstrap class.  In particular, this occurs when we are loading
+         of the Bootstrap class. In particular, this occurs when we are loading
          the profile configuration by calling out ProfileConfigReader in
-         core-config.xml.  In that case, the container classloader is created
-         by the original Bootstrap class inside the original classloader, but
+         core-config.xml. In that case, the container classloader is created by
+         the original Bootstrap class inside the original classloader, but
          ProfileConfigReader and hence another Bootstrap class gets loaded by
          the container class loader.
          */
-        for(URL url: findClasspathURLS(config)) {
-            new Statement(classLoader, Strings.ADD_URL, new Object[] {url})
-            .execute();
-        }
+        /*
+         Not really sure about this.... would be required if we wanted the
+         profile configs to add jar files to the classpath. Not sure if that is
+         really "on", seeing as how we don't really want users attempting to
+         extend the container. Having said that, it's possible that certain
+         deployers might be in a different project, hence different jar files,
+         so we might want to let the profiles add to the classpath. Needs more
+         thought. for (URL url : findClasspathURLS(config)) { new
+         Statement(classLoader, Strings.ADD_URL, new Object[]{url}).execute(); }
+         */
         for (Object element : config.getElements()) {
             processElement(element, (ClassLoader) classLoader, putMethod, context, putByNameMethod);
         }
@@ -177,8 +234,8 @@ public class Bootstrap {
             Property p = (Property) element;
             putByNameMethod.invoke(context, p.getName(), p.getValue());
         } else if (element instanceof DiscoveryContextType) {
-            /* Just drop the element into the context under the
-            appropriate name.
+            /*
+             Just drop the element into the context under the appropriate name.
              */
             DiscoveryContextType dct = (DiscoveryContextType) element;
             if (dct.getName() == null) {
@@ -190,11 +247,10 @@ public class Bootstrap {
             throw new ConfigurationException(MessageNames.UNSUPPORTED_ELEMENT, element.getClass().getName());
         }
     }
-
-    static URL[] findClasspathURLS(ContainerConfig containerConfig) throws MalformedURLException
{
-        String classpathStr = containerConfig.getClasspath();
-        URL[] urls = findClasspathURLS(classpathStr);
-        return urls;
-    }
-
+    /*
+     static URL[] findClasspathURLS(ContainerConfig containerConfig) throws
+     MalformedURLException { String classpathStr =
+     containerConfig.getClasspath(); URL[] urls =
+     findClasspathURLS(classpathStr); return urls; }
+     */
 }

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/MessageNames.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/MessageNames.java?rev=1307115&r1=1307114&r2=1307115&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/MessageNames.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/MessageNames.java Thu Mar 29
21:21:42 2012
@@ -50,7 +50,9 @@ public class MessageNames {
             CALLING_MAIN="callingMain",
             CANT_CONVERT_EXCEPTION="cantConvertException",
             CANT_READ_START_PROPERTIES="cantReadStartProperties",
+            CIRCULAR_CLASSPATH="circularClasspath",
             CLASSLOADER_IS="classLoaderIs",
+            CLASSPATH_UNDEFINED="classpathUndefined",
             CLASS_SERVER_BAD_REQUEST="classServerBadRequest",
             CLASS_SERVER_ERROR_ACCEPTING_CONNECTIONS="classServerErrorAcceptingConnections",
             CLASS_SERVER_ESTABLISHED="classServerEstablished",
@@ -68,6 +70,7 @@ public class MessageNames {
             CONFIG_FILE="configFile",
             CONFIGURED_CLASSPATH = "configuredClasspath",
             CONTEXT_ITEM = "contextItem",
+            DUPLICATE_CLASSPATH="duplicateClasspath",
             EXCEPTION_THROWN="exceptionThrown",
             FAILED_DEPLOY_SERVICE="failedDeployService",
             FAILED_READ_PROPERTIES="failedReadProperties",
@@ -83,7 +86,9 @@ public class MessageNames {
             INJECT="inject",
             MISSING_PROPERTY_ENTRY="missingPropertyEntry",
             NO_DEPLOYMENT_DIRECTORY="noDeploymentDirectory",
+            PARENT_CLASS_LOADER_IS="parentClassLoaderIs",
             PROFILE_CONFIG_EXCEPTION="profileConfigurationException",
+            PROFILE_CONFIG_LOADING="profileConfigLoading",
             READ_PROPERTIES="readProperties",
             READ_PROPERTIES_FILE="readPropertiesFile",
             READING_OBJECT="readingObject",

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/Messages.properties
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/Messages.properties?rev=1307115&r1=1307114&r2=1307115&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/Messages.properties (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/Messages.properties Thu Mar
29 21:21:42 2012
@@ -29,7 +29,9 @@ basicWorkManagerInitialized=Basic Work M
 callingMain=Calling main method on class ''{0}'' with arguments {1}.
 cantConvertException=Can''t convert type ''{0}'' to ''{1}''.
 cantReadStartProperties=Can''t read starter configuration file ''{0}'' in ''{1}''.
+circularClasspath=Definition of classpath ''{0}'' contains a circular reference.
 classLoaderIs=ClassLoader for class {0} is {1}.
+classpathUndefined=No definition found for classpath id ''{0}''.
 classServerBadRequest=bad request \"{0}\" from {1}:{2}
 classServerErrorAcceptingConnections=Class Server was terminated due to IOException while
accepting connections.
 classServerEstablished=Class Server established on host {0} port {1}.
@@ -45,8 +47,9 @@ classServerTerminated=Class Server termi
 codeSourceIs=CodeSource for service in ''{0}'' is ''{1}''.
 completedServiceDeployment=Completed deployment of service in {0}.
 configFile=Configuration file is ''{0}''.
-configuredClasspath=The configured classpath is {0}.
+configuredClasspath=The configured classpath with id ''{0}'' is {1}.
 contextItem=Context key {0} refers to ''{1}''.
+duplicateClasspath=Duplicate class path entry for id ''{0}''.
 exceptionThrown=Exception thrown:
 failedDeployService=Deployment of service archive at ''{0}'' failed.
 failedReadProperties=Failed to read one or more properties files.
@@ -65,7 +68,9 @@ inject=Injecting {2} into member ''{1}''
 missingPropertyEntry="Properties file ''{0}'' is missing entry for ''{1}''.
 noDeploymentDirectory=No deployment directory called {0} found in {1}; \
 skipping deployment.
+parentClassLoaderIs=Parent class loader is {0}.
 profileConfigurationException=Failed to read the configuration for profile {0}.
+profileConfigLoading=Loading the profile configuration with classloader {0}.
 readProperties=...properties read were {0}.
 readPropertiesFile=Read properties file ''{0}''.
 readingObject=Reading instance of {1} named ''{0}'' for unresolved dependencies.

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/ProfileConfigReader.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/ProfileConfigReader.java?rev=1307115&r1=1307114&r2=1307115&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/ProfileConfigReader.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/ProfileConfigReader.java Thu
Mar 29 21:21:42 2012
@@ -57,6 +57,9 @@ public class ProfileConfigReader {
         return containerConfig;
     }
 
+    @Injected
+    private ClassLoader containerClassLoader;
+    
     @Init
     public void init() {
         try {
@@ -64,8 +67,10 @@ public class ProfileConfigReader {
             /* We use Object not ClassLoader because it might have been loaded
              by a different classloader.
              */
-            Object classLoader=this.getClass().getClassLoader();
-            Bootstrap.processConfiguration(profileConfig, classLoader, context);
+            
+            log.log(Level.FINE, MessageNames.PROFILE_CONFIG_LOADING, 
+                    new Object[] { containerClassLoader });
+            Bootstrap.processConfiguration(profileConfig, containerClassLoader, context);
         } catch (Exception ex) {
             throw new ConfigurationException(ex, MessageNames.PROFILE_CONFIG_EXCEPTION, profile);
         }

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/Strings.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/Strings.java?rev=1307115&r1=1307114&r2=1307115&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/Strings.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/Strings.java Thu Mar 29 21:21:42
2012
@@ -25,9 +25,11 @@ public class Strings {
 
     public static final String
             ADD_URL="addURL",
+            CLASS_LOADERS="classLoaders",
             COMMAND_LINE_ARGS = "commandLineArguments",
             CONFIG_XML = "config.xml",
             CORE_CONFIG_XML="core-config.xml",
+            CONTAINER_CLASS_LOADER="containerClassLoader",
             CONTAINER_JMX_DOMAIN="org.apache.river.container",
             CONTEXT_CLASS = "org.apache.river.container.Context",
             DASH = "-",

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/SystemClassloaderInitializer.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/SystemClassloaderInitializer.java?rev=1307115&r1=1307114&r2=1307115&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/SystemClassloaderInitializer.java
(original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/SystemClassloaderInitializer.java
Thu Mar 29 21:21:42 2012
@@ -19,6 +19,7 @@
 package org.apache.river.container;
 
 import java.net.URLClassLoader;
+import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -33,8 +34,12 @@ public class SystemClassloaderInitialize
     
     @Init
     public void init() {
-        ClassLoader cl=this.getClass().getClassLoader().getParent();
-        context.put(Strings.SYSTEM_CLASS_LOADER, cl);
+        Map<String, ClassLoader> classLoaders=
+                (Map<String, ClassLoader>) context.get(Strings.CLASS_LOADERS);
+        ClassLoader cl=classLoaders.get(Strings.SYSTEM_CLASS_LOADER);
+        for (String id: classLoaders.keySet()) {
+            context.put(id, classLoaders.get(id));
+        }
         String classpath=Strings.UNKNOWN;
         if(cl instanceof URLClassLoader) {
             URLClassLoader ucl=(URLClassLoader) cl;

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/Utils.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/Utils.java?rev=1307115&r1=1307114&r2=1307115&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/Utils.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/Utils.java Thu Mar 29 21:21:42
2012
@@ -22,6 +22,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import org.apache.commons.vfs.FileObject;
 import org.apache.commons.vfs.FileSystemException;
 import org.apache.commons.vfs.FileType;
@@ -91,4 +93,16 @@ public class Utils {
         }
         return ret;
     }
+    
+    public static void logClassLoaderHierarchy(Logger log,
+            Class cls) {
+        log.log(Level.FINE, MessageNames.CLASSLOADER_IS,
+                new Object[] { cls.getName(), cls.getClassLoader() });
+        ClassLoader parent=cls.getClassLoader().getParent();
+        while (parent!= null) {
+            log.log(Level.FINE, MessageNames.PARENT_CLASS_LOADER_IS,
+                    new Object[] { parent } );
+            parent=parent.getParent();
+        }
+    }
 }

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/core-config.xml
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/core-config.xml?rev=1307115&r1=1307114&r2=1307115&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/core-config.xml (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/core-config.xml Thu Mar 29 21:21:42
2012
@@ -38,7 +38,20 @@
 <cfg:container-config  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
    xmlns:cfg='http://river.apache.org/xml/ns/container/config/1.0'
    xsi:schemaLocation='http://river.apache.org/xml/ns/container/config/1.0 file:/home/trasukg/development/surrogate/src/schemas/config.xsd'>
-    <cfg:classpath>../../dist/RiverSurrogate.jar</cfg:classpath>
+    <!-- Dynamic policy provider needs to be available to both the container and
+    any "application" classloaders, so it needs to be in a classloader which is
+    a parent to both the container classloader and the application loaders.
+    In traditional Jini usage, jsk-policy.jar was put into the extensions directory,
+    hence was available in the "extensions" loader.  Here, we'd prefer not to 
+    require any changes to the JSDK installation directory.
+    -->
+    <cfg:classpath id="systemClassLoader">lib/jsk-policy.jar</cfg:classpath>
+    <cfg:classpath id="containerClassLoader" parent="systemClassLoader">
+        lib/RiverSurrogate.jar
+        lib/commons-logging-1.1.1.jar
+        lib/commons-vfs-1.0.jar
+    </cfg:classpath>
+
     <!--cfg:component class="org.apache.river.container.ShowContextToConsole"/-->
     <cfg:component class="org.apache.river.container.AnnotatedClassDeployer"/>
 

Modified: river/jtsk/skunk/surrogate/src/schemas/config.xsd
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/schemas/config.xsd?rev=1307115&r1=1307114&r2=1307115&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/schemas/config.xsd (original)
+++ river/jtsk/skunk/surrogate/src/schemas/config.xsd Thu Mar 29 21:21:42 2012
@@ -8,7 +8,7 @@
     <xsd:element name="container-config">
         <xsd:complexType>
             <xsd:sequence>
-                <xsd:element ref="tns:classpath"/>
+                <xsd:element ref="tns:classpath" maxOccurs="unbounded" minOccurs="0"/>
                 <xsd:choice maxOccurs="unbounded">
                     <xsd:annotation>
                         <xsd:appinfo>
@@ -35,7 +35,16 @@
         <xsd:attribute name="name" type="xsd:string" use="optional"/>
     </xsd:complexType>
     
-    <xsd:element name="classpath" type="xsd:string"/>
+    <xsd:element name="classpath">
+        <xsd:complexType>
+            <xsd:simpleContent>
+                <xsd:extension base="xsd:string">
+                    <xsd:attribute name="id" use="required" type="xsd:string"/>
+                    <xsd:attribute name="parent" use="optional" type="xsd:string"/>
+                </xsd:extension>
+            </xsd:simpleContent>
+        </xsd:complexType>
+    </xsd:element>
 
     <xsd:element name="codebase" type="xsd:string"/>
 

Modified: river/jtsk/skunk/surrogate/test/org/apache/river/container/config/ConfigurationParserTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/test/org/apache/river/container/config/ConfigurationParserTest.java?rev=1307115&r1=1307114&r2=1307115&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/test/org/apache/river/container/config/ConfigurationParserTest.java
(original)
+++ river/jtsk/skunk/surrogate/test/org/apache/river/container/config/ConfigurationParserTest.java
Thu Mar 29 21:21:42 2012
@@ -75,7 +75,9 @@ public class ConfigurationParserTest {
         InputStream is = getClass().getResourceAsStream("config-test-doc.xml");
         ContainerConfig containerConfig = (ContainerConfig) um.unmarshal(is);
 
-        assertEquals("lib/abc.jar", containerConfig.getClasspath());
+        assertEquals("lib/abc.jar", containerConfig.getClasspath().get(0).getValue());
+        assertEquals("lib/def.jar", containerConfig.getClasspath().get(1).getValue());
+        assertEquals("a", containerConfig.getClasspath().get(1).getParent());
         assertEquals(3, containerConfig.getElements().size());
     }
 

Modified: river/jtsk/skunk/surrogate/test/org/apache/river/container/config/config-test-doc.xml
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/test/org/apache/river/container/config/config-test-doc.xml?rev=1307115&r1=1307114&r2=1307115&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/test/org/apache/river/container/config/config-test-doc.xml
(original)
+++ river/jtsk/skunk/surrogate/test/org/apache/river/container/config/config-test-doc.xml
Thu Mar 29 21:21:42 2012
@@ -11,7 +11,8 @@
 <cfg:container-config  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
    xmlns:cfg='http://river.apache.org/xml/ns/container/config/1.0'
    xsi:schemaLocation='http://river.apache.org/xml/ns/container/config/1.0 file:/home/trasukg/development/surrogate/schemas/config.xsd'>
-    <cfg:classpath>lib/abc.jar</cfg:classpath>
+    <cfg:classpath id="a">lib/abc.jar</cfg:classpath>
+    <cfg:classpath id="b" parent="a">lib/def.jar</cfg:classpath>
 
     <cfg:discovery-context name="default">
         <cfg:locator></cfg:locator>

Modified: river/jtsk/skunk/surrogate/testfiles/logging.properties
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/testfiles/logging.properties?rev=1307115&r1=1307114&r2=1307115&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/testfiles/logging.properties (original)
+++ river/jtsk/skunk/surrogate/testfiles/logging.properties Thu Mar 29 21:21:42 2012
@@ -50,6 +50,6 @@ java.util.logging.ConsoleHandler.formatt
 ############################################################
 
 org.apache.river.container.level = FINER
-org.apache.river.container.AnnotatedClassDeployer.level=INFO
+org.apache.river.container.AnnotatedClassDeployer.level=FINER
 org.apache.river.container.ShowContextToConsole.level=INFO
 net.jini.config.level=FINE

Modified: river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/config.xml
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/config.xml?rev=1307115&r1=1307114&r2=1307115&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/config.xml (original)
+++ river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/config.xml Thu Mar 29 21:21:42
2012
@@ -11,18 +11,6 @@
 <cfg:container-config  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
    xmlns:cfg='http://river.apache.org/xml/ns/container/config/1.0'
    xsi:schemaLocation='http://river.apache.org/xml/ns/container/config/1.0 file:/home/trasukg/development/surrogate/src/schemas/config.xsd'>
-    <cfg:classpath>
-        lib/RiverSurrogate.jar
-        lib/commons-logging-1.1.1.jar
-        lib/commons-vfs.jar
-        <!-- Don't think we need these in the core container, just in the 
-        deployers.
-        lib/jsk-platform.jar
-        lib/jsk-dl.jar
-        lib/jsk-resources.jar
-        -->
-    </cfg:classpath>
-
     <cfg:property name="deploymentDirectory" value="deploy"/>
 
     <cfg:discovery-context name="default">



Mime
View raw message