You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by gt...@apache.org on 2011/09/14 04:22:43 UTC

svn commit: r1170414 - in /river/jtsk/skunk/surrogate: ./ src/org/apache/river/container/ src/org/apache/river/container/classloading/ src/org/apache/river/container/el/ src/org/apache/river/container/liaison/ test/org/apache/river/container/ test/org/...

Author: gtrasuk
Date: Wed Sep 14 02:22:42 2011
New Revision: 1170414

URL: http://svn.apache.org/viewvc?rev=1170414&view=rev
Log:
Continuing work on classloading for surrogate modules and overall configuration system for container.

Added:
    river/jtsk/skunk/surrogate/src/org/apache/river/container/el/
    river/jtsk/skunk/surrogate/src/org/apache/river/container/el/ArgsParser.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/el/ArgsParserImpl.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/liaison/VirtualFileSystemConfiguration.java
      - copied, changed from r1165577, river/jtsk/skunk/surrogate/src/org/apache/river/container/liaison/WorkingDirFileConfiguration.java
    river/jtsk/skunk/surrogate/test/org/apache/river/container/el/
    river/jtsk/skunk/surrogate/test/org/apache/river/container/el/ArgParserTest.java
Modified:
    river/jtsk/skunk/surrogate/build.xml
    river/jtsk/skunk/surrogate/src/org/apache/river/container/Bootstrap.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/FileSuffixSelector.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/FileUtilityImpl.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/PropertiesFileReader.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/ShowContextToConsole.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/StarterServiceDeployer.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/Strings.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/Utils.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathExpressionParser.jjt
    river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathFilterBuilder.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/Strings.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/core-config.xml
    river/jtsk/skunk/surrogate/src/org/apache/river/container/liaison/Strings.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/liaison/WorkingDirFileConfiguration.java
    river/jtsk/skunk/surrogate/test/org/apache/river/container/AnnotatedClassDeployerTest.java
    river/jtsk/skunk/surrogate/test/org/apache/river/container/CommonsVFSTest.java
    river/jtsk/skunk/surrogate/test/org/apache/river/container/PropertiesFileReaderTest.java
    river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/VFSClassLoaderTest.java
    river/jtsk/skunk/surrogate/testfiles/hosted-reggie.properties
    river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/config.xml
    river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/service-starter.properties

Modified: river/jtsk/skunk/surrogate/build.xml
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/build.xml?rev=1170414&r1=1170413&r2=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/build.xml (original)
+++ river/jtsk/skunk/surrogate/build.xml Wed Sep 14 02:22:42 2011
@@ -113,14 +113,16 @@
             value="${basedir}/build/test/reggie-module"/>
 
         <mkdir dir="${build.test.reggie-module.dir}"/>
+        <mkdir dir="${build.test.reggie-module.dir}/lib"/>
+        <mkdir dir="${build.test.reggie-module.dir}/lib-dl"/>
         <copy tofile="${build.test.reggie-module.dir}/start.properties"
             file="${basedir}/testfiles/hosted-reggie.properties"/>
-        <copy todir="${build.test.reggie-module.dir}"
+        <copy todir="${build.test.reggie-module.dir}/lib"
             file="dist/lib/reggie.jar"/>
-        <copy todir="${build.test.reggie-module.dir}"
+        <copy todir="${build.test.reggie-module.dir}/lib-dl"
             file="dist/lib/reggie-dl.jar"/>
         <jar basedir="${build.test.reggie-module.dir}"
-        jarfile="${basedir}/build/test/files/reggie-module.jar"/>
+        jarfile="${basedir}/build/test/files/reggie-module.ssar"/>
     </target>
 
     <!-- Pre-compiler target to run javacc against our parser sources. -->
@@ -173,6 +175,9 @@
                 <include name="jsk-*.jar"/>
                 <include name="commons-*.jar"/>
             </fileset>
+            <fileset dir="${basedir}/dist">
+                <include name="RiverSurrogate.jar"/>
+            </fileset>
         </copy>
     </target>
 </project>

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=1170414&r1=1170413&r2=1170414&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 Wed Sep 14 02:22:42 2011
@@ -106,7 +106,7 @@ public class Bootstrap {
         
         ContainerConfig coreConfig = readCoreConfig();
         URL[] urls = findClasspathURLS(coreConfig);
-        log.log(Level.INFO, MessageNames.CONFIGURED_CLASSPATH, new Object[]{
+        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.

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/FileUtilityImpl.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/FileUtilityImpl.java?rev=1170414&r1=1170413&r2=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/FileUtilityImpl.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/FileUtilityImpl.java Wed Sep 14 02:22:42 2011
@@ -57,7 +57,7 @@ public class FileUtilityImpl implements 
 
     @Override
     public FileObject getLibDirectory() throws IOException {
-        FileObject profileDir = fsm.resolveFile(Strings.LIB);
-        return profileDir;
+        FileObject libDir = fsm.resolveFile(new File(Strings.LIB), ".");
+        return libDir;
     }
 }

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=1170414&r1=1170413&r2=1170414&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 Wed Sep 14 02:22:42 2011
@@ -41,16 +41,22 @@ public class MessageNames {
     public static final String BUNDLE_NAME="org.apache.river.container.Messages";
 
     public static final String
+            ADDING_CLASSPATH_ENTRY="addingClasspathEntry",
             ANNOTATED_OBJECT_DEPLOYER_HAS_UNRESOLVED_DEPENDENCIES="annotatedObjectDeployerHasUnresolvedDependencies",
             BAD_CLASSPATH_EXPR="badClasspathExpression",
             BAD_MEMBER_FOR_INJECTED_ANNOTATION="badMemberForInjectedAnnotation",
             BAD_MEMBER_FOR_NAME_ANNOTATION="badMemberForNameAnnotation",
+            CALLING_MAIN="callingMain",
+            CANT_READ_START_PROPERTIES="cantReadStartProperties",
+            COMPLETED_SERVICE_DEPLOYMENT="completedServiceDeployment",
             CONFIG_FILE="configFile",
             CONFIGURED_CLASSPATH = "configuredClasspath",
             CONTEXT_ITEM = "contextItem",
             EXCEPTION_THROWN="exceptionThrown",
             FAILED_DEPLOY_SERVICE="failedDeployService",
             FAILED_READ_PROPERTIES="failedReadProperties",
+            FOUND_NO_SERVICE_ARCHIVES="foundNoServiceArchives",
+            FOUND_SERVICE_ARCHIVES="foundServiceArchives",
             ILLEGAL_ARGUMENT_EXCEPTION="illegalArgumentException",
             ILLEGAL_ACCESS_EXCEPTION="illegalAccessException",
             INITIALIZATION_EXCEPTION="initializationException",
@@ -67,6 +73,7 @@ public class MessageNames {
             READING_OBJECT_NON_ANNOTATED_MEMBER_FOUND="readingObject.nonAnnotatedMemberFound",
             SHOW_COMMAND_LINE_ARGUMENTS="showCommandLineArguments",
             STARTER_SERVICE_DEPLOYER_FAILED_INIT="starterServiceDeployerFailedInit",
+            STARTER_SERVICE_DEPLOYER_INITIALIZED="starterServiceDeployerInitialized",
             STARTER_SERVICE_DEPLOYER_STARTING="starterServiceDeployerStarting",
             UNRESOLVED_DEPENDENCY="unresolvedDependency",
             UNSUPPORTED_ELEMENT="unsupportedElement";

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=1170414&r1=1170413&r2=1170414&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 Wed Sep 14 02:22:42 2011
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+addingClasspathEntry=Adding classpath entry ''{0}''.
 annotatedObjectDeployerHasUnresolvedDependencies=Initialization failed because \
 one or more dependencies flagged with @Injected or @Name annotations \
 are unresolved.
@@ -24,12 +25,17 @@ badMemberForInjectedAnnotation=@Injected
  setter method only: Member {1} on class {0} doesn't qualify.
 badMemberForNameAnnotation=@Name annotation must be applied to a String field or\
  setter method only: Member {1} on class {0} doesn't qualify.
+callingMain=Calling main method on class ''{0}'' with arguments {1}.
+cantReadStartProperties=Can''t read starter configuration file ''{0}'' in ''{1}''.
+completedServiceDeployment=Completed deployment of service in {0}.
 configFile=Configuration file is ''{0}''.
 configuredClasspath=The configured classpath is {0}.
 contextItem=Context key {0} refers to ''{1}''.
 exceptionThrown=Exception thrown:
 failedDeployService=Deployment of service archive at ''{0}'' failed.
 failedReadProperties=Failed to read one or more properties files.
+foundNoServiceArchives=Found no service archives for deployment dir ''{0}''.
+foundServiceArchives=Found {0} service archives in deployment dir ''{1}''.
 illegalArgumentException=An operation threw an IllegalArgumentException.
 illegalAccessException=An operation threw an IllegalAccessException.
 invalidClasspathEntry=Invalid classpath entry: {0}
@@ -49,6 +55,8 @@ readingObject.annotatedMemberFound=Membe
 readingObject.nonAnnotatedMemberFound=Member ''{0}'' is not annotated @Injected.
 showCommandLineArguments=Command line arguments were: {0}.
 starterServiceDeployerFailedInit=Starter-Service deployer has failed to initialize.
+starterServiceDeployerInitialized=Starter-Service deployer named ''{0}'' completed \
+initialization.
 starterServiceDeployerStarting=Starter-Service deployer named ''{0}'' is being \
 initialized.
 unresolvedDependency=Object {0} has an unresolved dependent member ''{1}'' \

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=1170414&r1=1170413&r2=1170414&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 Wed Sep 14 02:22:42 2011
@@ -51,7 +51,7 @@ public class ProfileConfigReader {
         Unmarshaller um = Bootstrap.createConfigUnmarshaller();
         FileObject profileDir = fileUtility.getProfileDirectory();
         FileObject configFile = profileDir.resolveFile(Strings.CONFIG_XML);
-        log.log(Level.INFO, MessageNames.CONFIG_FILE, configFile.toString());
+        log.log(Level.FINE, MessageNames.CONFIG_FILE, configFile.toString());
         InputStream is = configFile.getContent().getInputStream();
         ContainerConfig containerConfig = (ContainerConfig) um.unmarshal(is);
         return containerConfig;

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/PropertiesFileReader.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/PropertiesFileReader.java?rev=1170414&r1=1170413&r2=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/PropertiesFileReader.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/PropertiesFileReader.java Wed Sep 14 02:22:42 2011
@@ -53,9 +53,16 @@ public class PropertiesFileReader {
     
     private void readPropertiesFile(FileObject fo) throws FileSystemException, IOException {
         String name=fo.getName().getBaseName();
+        Properties props = getProperties(fo);
+        context.put(name, props);
+    }
+
+    public Properties getProperties(FileObject fo) throws FileSystemException, IOException {
         InputStream is=fo.getContent().getInputStream();
         Properties props=new Properties();
         props.load(is);
-        context.put(name, props);
+        return props;
     }
+    
+
 }

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/ShowContextToConsole.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/ShowContextToConsole.java?rev=1170414&r1=1170413&r2=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/ShowContextToConsole.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/ShowContextToConsole.java Wed Sep 14 02:22:42 2011
@@ -34,7 +34,7 @@ public class ShowContextToConsole implem
     public void init() {
 
         for(String key: context.contents.keySet()) {
-            log.log(Level.INFO,MessageNames.CONTEXT_ITEM ,
+            log.log(Level.FINE,MessageNames.CONTEXT_ITEM ,
                     new Object[] {key, context.contents.get(key)});
         }
     }

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/StarterServiceDeployer.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/StarterServiceDeployer.java?rev=1170414&r1=1170413&r2=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/StarterServiceDeployer.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/StarterServiceDeployer.java Wed Sep 14 02:22:42 2011
@@ -17,64 +17,91 @@
  */
 
 /* TODO: - Complete deployment of items that are in the deployment
- directory.
+directory.
  */
 package org.apache.river.container;
 
+import java.io.File;
 import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.List;
 import java.util.Properties;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import org.apache.commons.vfs.FileObject;
 import org.apache.commons.vfs.FileSelector;
+import org.apache.commons.vfs.FileType;
 import org.apache.river.container.classloading.VirtualFileSystemClassLoader;
 import org.apache.river.container.codebase.CodebaseContext;
 import org.apache.river.container.codebase.CodebaseHandler;
+import org.apache.river.container.el.ArgsParser;
+import org.apache.river.container.liaison.VirtualFileSystemConfiguration;
 
 /**
  *
  * @author trasukg
  */
 public class StarterServiceDeployer {
-    private static final Logger log=
+
+    private int initCount=0;
+    private static final Logger log =
             Logger.getLogger(StarterServiceDeployer.class.getName(), MessageNames.BUNDLE_NAME);
-    @Injected private FileUtility fileUtility=null;
-    @Injected private ClassLoader systemClassLoader=null;
-    @Name private String myName=null;
-    @Injected private CodebaseHandler codebaseHandler=null;
     @Injected
-    private String deploymentDirectory=null;
-
+    private FileUtility fileUtility = null;
+    @Injected
+    private ClassLoader systemClassLoader = null;
+    @Name
+    private String myName = null;
+    @Injected
+    private CodebaseHandler codebaseHandler = null;
+    @Injected
+    private String deploymentDirectory = null;
     @Injected(Strings.STARTER_SERVICE_DEPLOYER_PROPERTIES)
-    Properties configProperties=null;
-    
-    private FileObject deploymentDirectoryFile=null;
+    Properties configProperties = null;
+    private FileObject deploymentDirectoryFile = null;
+    @Injected
+    private PropertiesFileReader propertiesFileReader = null;
+    @Injected
+    private ArgsParser argsParser = null;
 
-    @Init public void init() {
+    @Init
+    public void init() {
         try {
+            initCount++;
+            log.info("Init count is " + initCount);
             tryInitialize();
-        } catch (Exception ex) {
+        } catch (Throwable ex) {
+            log.log(Level.SEVERE, MessageNames.STARTER_SERVICE_DEPLOYER_FAILED_INIT,
+                    ex);
             throw new ConfigurationException(ex,
                     MessageNames.STARTER_SERVICE_DEPLOYER_FAILED_INIT);
         }
     }
 
     private void tryInitialize() throws IOException {
-        log.log(Level.INFO, MessageNames.STARTER_SERVICE_DEPLOYER_STARTING, myName);
+        log.log(Level.FINE, MessageNames.STARTER_SERVICE_DEPLOYER_STARTING, myName);
         /* Establish the deployment directory. */
-        deploymentDirectoryFile = fileUtility.getProfileDirectory()
-                .resolveFile(deploymentDirectory);
-        if (deploymentDirectoryFile==null) {
-            log.log(Level.INFO,MessageNames.NO_DEPLOYMENT_DIRECTORY,
-            new Object[] {deploymentDirectory,fileUtility.getProfileDirectory()});
+        deploymentDirectoryFile = fileUtility.getProfileDirectory().resolveFile(deploymentDirectory);
+        if (deploymentDirectoryFile == null
+                || deploymentDirectoryFile.getType() != FileType.FOLDER) {
+            log.log(Level.WARNING, MessageNames.NO_DEPLOYMENT_DIRECTORY,
+                    new Object[]{deploymentDirectory, fileUtility.getProfileDirectory()});
         }
         /* Read the maximal policy file if there is one. */
         /* Go through the deployment directory looking for services to deploy.
          */
-        FileObject[] serviceArchives=
-                deploymentDirectoryFile.findFiles(new FileSuffixSelector(Strings.SSAR));
-        if (serviceArchives!=null) {
+        List<FileObject> serviceArchives =
+                Utils.findChildrenWithSuffix(deploymentDirectoryFile,
+                Strings.SSAR);
+        if (serviceArchives != null) {
+            log.log(Level.FINE, MessageNames.FOUND_SERVICE_ARCHIVES,
+                    new Object[]{serviceArchives.size(), deploymentDirectory});
             deployServiceArchives(serviceArchives);
+        } else {
+            log.log(Level.WARNING, MessageNames.FOUND_NO_SERVICE_ARCHIVES,
+                    new Object[]{deploymentDirectory});
+
         }
 
         /* TODO: Establish the interval task to monitor the deployment directory
@@ -83,10 +110,11 @@ public class StarterServiceDeployer {
         /* TODO: Establish the interval task to monitor the deployment directory
         for deployment candidate changes.
          */
+        log.log(Level.INFO, MessageNames.STARTER_SERVICE_DEPLOYER_INITIALIZED, myName);
 
     }
 
-    private void deployServiceArchives(FileObject[] serviceArchives) {
+    private void deployServiceArchives(List<FileObject> serviceArchives) {
         /*
         Deploy those services.
          */
@@ -101,59 +129,110 @@ public class StarterServiceDeployer {
     }
 
     private void deployServiceArchive(FileObject serviceArchive) throws IOException {
-        FileObject serviceRoot=
-                serviceArchive.getFileSystem().getFileSystemManager()
-                .createVirtualFileSystem(serviceArchive);
-        deployService(serviceRoot);
+        FileObject serviceRoot =
+                serviceArchive.getFileSystem().getFileSystemManager().createFileSystem(Strings.JAR, serviceArchive);
+        deployService(serviceArchive, serviceRoot);
     }
-    
-    private void deployService(FileObject serviceRoot) throws IOException {
+
+    private String findServiceName(FileObject serviceArchive, FileObject serviceRoot) {
+        if (serviceArchive!=null) {
+            return serviceArchive.getName().getBaseName();
+        }
+        return serviceRoot.getName().getBaseName();
+    }
+    private void deployService(FileObject serviceArchive, FileObject serviceRoot) throws IOException {
+        String serviceName=findServiceName(serviceArchive, serviceRoot);
         /* Create the service classloader. */
-        VirtualFileSystemClassLoader cl=
+        VirtualFileSystemClassLoader cl =
                 new VirtualFileSystemClassLoader(null, systemClassLoader);
         /* Include platform jars from the container's lib directory. */
-        String platformJarSpec=configProperties.getProperty(Strings.PLATFORM_JARS);
+        String platformJarSpec = configProperties.getProperty(Strings.PLATFORM_JARS);
+        log.log(Level.FINE, MessageNames.ADDING_CLASSPATH_ENTRY, new Object[]{platformJarSpec});
         cl.addClassPathEntry(fileUtility.getLibDirectory(), platformJarSpec);
-        
+
         /* Add the jar files from the service's 'lib' directory. */
-        FileObject libDir=serviceRoot.resolveFile(Strings.LIB);
-        FileSelector jarSelector=new FileSuffixSelector(Strings.DOT_JAR);
-        FileObject[] jarFiles=libDir.findFiles(jarSelector);
+        FileObject libDir = serviceRoot.resolveFile(Strings.LIB);
+        List<FileObject> jarFiles = Utils.findChildrenWithSuffix(libDir,
+                Strings.DOT_JAR);
         for (FileObject jarFile : jarFiles) {
             cl.addClassPathEntry(libDir, jarFile.getName().getBaseName());
         }
         /* Create a codebase context. */
-        CodebaseContext codebaseContext=codebaseHandler.createContext();
-        
+        CodebaseContext codebaseContext = codebaseHandler.createContext();
+
         /* Register the platform codebase jars with the codebase service. */
-        String platformCodebaseSpec=configProperties.getProperty(Strings.PLATFORM_CODEBASE);
-        String[] codebaseJars=Utils.splitOnWhitespace(platformCodebaseSpec);
-        for(String codebaseJar: codebaseJars) {
-            FileObject fo=fileUtility.getLibDirectory().resolveFile(codebaseJar);
+        String platformCodebaseSpec = configProperties.getProperty(Strings.PLATFORM_CODEBASE);
+        String[] codebaseJars = Utils.splitOnWhitespace(platformCodebaseSpec);
+        for (String codebaseJar : codebaseJars) {
+            FileObject fo = fileUtility.getLibDirectory().resolveFile(codebaseJar);
             codebaseContext.addFile(fo);
         }
-        
+
         /* Register the service's codebase jars with the codebase service. */
-        FileObject libDlDir=serviceRoot.resolveFile(Strings.LIB_DL);
-        FileSelector dljarSelector=new FileSuffixSelector(Strings.DOT_JAR);
-        FileObject[] dljarFiles=libDlDir.findFiles(dljarSelector);
+        FileObject libDlDir = serviceRoot.resolveFile(Strings.LIB_DL);
+        List<FileObject> dljarFiles = Utils.findChildrenWithSuffix(libDlDir,
+                Strings.DOT_JAR);
         for (FileObject jarFile : dljarFiles) {
             codebaseContext.addFile(jarFile);
         }
-        
+
         /* Setup the classloader's codebase annotation. */
         cl.setCodebase(codebaseContext.getCodebaseAnnotation());
         /* Grant the appropriate permissions to the service's classloader and
-         protection domain. */
+        protection domain. */
         // TODO: Figure out how the protection domains, codesources, etc need to work.
-        
+
         /* Setup the liaison configuration. */
-        /* TODO: Consider the impact of using commons-vfs rather than unpacking the 
-        service archive.  Is it ok to include comons-vfs and commons-logging on the 
-        service's classpath?  Is it reasonable to disallow services from writing into 
-        their directory?  Should we create a working directory and then setup the liaison
-        config to hold it?
-        
+        try {
+            File workingDir = null;
+            if (serviceArchive != null) {
+                workingDir = new File(serviceArchive.getURL().toURI());
+            } else {
+                workingDir = new File(serviceRoot.getURL().toURI());
+
+            }
+            invokeStatic(cl, VirtualFileSystemConfiguration.class.getName(),
+                    Strings.SET_WORKING_DIRECTORY,
+                    workingDir);
+        } catch (Exception ex) {
+            log.log(Level.WARNING, MessageNames.EXCEPTION_THROWN, ex);
+            throw new ConfigurationException(ex,
+                    MessageNames.STARTER_SERVICE_DEPLOYER_FAILED_INIT);
+        }
+        /* Read the start.properties file. */
+        FileObject startProperties = serviceRoot.resolveFile(Strings.START_PROPERTIES);
+        if (startProperties == null || !startProperties.getType().equals(FileType.FILE)
+                || !startProperties.isReadable()) {
+            throw new LocalizedRuntimeException(MessageNames.BUNDLE_NAME,
+                    MessageNames.CANT_READ_START_PROPERTIES,
+                    new Object[]{Strings.START_PROPERTIES,
+                        serviceRoot.getName().getBaseName()});
+        }
+        Properties startProps = propertiesFileReader.getProperties(startProperties);
+        String argLine = startProps.getProperty(Strings.START_PARAMETERS);
+        String[] args = null;
+        if (argLine == null) {
+            args = new String[0];
+        } else {
+            args = argsParser.toArgs(argLine);
+        }
+        String startClassName = startProps.getProperty(Strings.START_CLASS);
         /* Launch the service. */
+        log.log(Level.FINE, MessageNames.CALLING_MAIN, new Object[] {
+            startClassName, Utils.format(args)
+        });
+        // TODO: Call the main class/method.
+        log.log(Level.INFO, MessageNames.COMPLETED_SERVICE_DEPLOYMENT, serviceName);
+    }
+
+    private Object invokeStatic(ClassLoader cl, String className, String methodName,
+            Object... parms) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+        Class clazz = Class.forName(className, true, cl);
+        Class[] parameterTypes = new Class[parms.length];
+        for (int i = 0; i < parms.length; i++) {
+            parameterTypes[i] = parms[i].getClass();
+        }
+        Method method = clazz.getMethod(methodName, parameterTypes);
+        return method.invoke(null, parms);
     }
 }

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=1170414&r1=1170413&r2=1170414&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 Wed Sep 14 02:22:42 2011
@@ -41,6 +41,7 @@ public class Strings {
             EMPTY = "",
             FILE_UTILITY="fileUtility",
             INIT_COMPLETE="initComplete",
+            JAR="jar",
             LIB="lib",
             LIB_DL="lib-dl",
             NAME="name",
@@ -52,7 +53,11 @@ public class Strings {
             SPACE=" ",
             SSAR="ssar",
             SET = "set",
+            SET_WORKING_DIRECTORY="setWorkingDirectory",
             SLASH="/",
+            START_CLASS="startClass",
+            START_PARAMETERS="startParameters",
+            START_PROPERTIES="start.properties",
             STARTER_SERVICE_DEPLOYER_PROPERTIES="service-starter.properties",
             SYSTEM_CLASS_LOADER="systemClassLoader",
             TYPE="type",

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=1170414&r1=1170413&r2=1170414&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 Wed Sep 14 02:22:42 2011
@@ -20,6 +20,9 @@ package org.apache.river.container;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.StringTokenizer;
+import org.apache.commons.vfs.FileObject;
+import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.FileType;
 
 /**
  *
@@ -53,4 +56,16 @@ public class Utils {
         }
         return (String[]) strings.toArray(new String[0]);
     }
+    
+    public static List<FileObject> findChildrenWithSuffix(FileObject dir, String suffix) throws FileSystemException {
+        
+        List<FileObject> ret=new ArrayList<FileObject>();
+        
+        for(FileObject fo: dir.getChildren()) {
+            if (fo.getType()==FileType.FILE && fo.getName().getBaseName().endsWith(suffix)) {
+                ret.add(fo);
+            }
+        }
+        return ret;
+    }
 }

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathExpressionParser.jjt
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathExpressionParser.jjt?rev=1170414&r1=1170413&r2=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathExpressionParser.jjt (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathExpressionParser.jjt Wed Sep 14 02:22:42 2011
@@ -56,7 +56,7 @@ SKIP :
 TOKEN :
 {
   	< SYMBOL:
-		["A"-"Z", "a"-"z", "_"] (["0"-"9", "A"-"Z", "a"-"z", ".", "_"])*>
+		["A"-"Z", "a"-"z", "_"] (["0"-"9", "A"-"Z", "a"-"z", ".", "_", "-"])*>
 |	< STRING_LITERAL:
  	("\""
     (   (~["\"","\\","\n","\r"])

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathFilterBuilder.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathFilterBuilder.java?rev=1170414&r1=1170413&r2=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathFilterBuilder.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathFilterBuilder.java Wed Sep 14 02:22:42 2011
@@ -63,12 +63,12 @@ public class ClasspathFilterBuilder {
             Node node = expression.jjtGetChild(i);
             if (node instanceof ASTsymbol) {
                 String resourceName = VirtualFileSystemClassLoader.classToResourceName(node.toString());
-                log.info("Building ResourceAcceptor with string '" + resourceName + "'");
+                log.fine("Building ResourceAcceptor with string '" + resourceName + "'");
                 Acceptor acc = new ResourceAcceptor(resourceName);
                 cpf.getAcceptors().add(acc);
             }
             if (node instanceof ASTstringLiteral) {
-                log.info("Building ResourceAcceptor with string '" + node.toString() + "'");
+                log.fine("Building ResourceAcceptor with string '" + node.toString() + "'");
                 Acceptor acc = new ResourceAcceptor(node.toString());
                 cpf.getAcceptors().add(acc);
             }

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/Strings.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/Strings.java?rev=1170414&r1=1170413&r2=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/Strings.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/Strings.java Wed Sep 14 02:22:42 2011
@@ -30,10 +30,12 @@ public class Strings {
             GET_NAME="getName",
             GET_VALUE="getValue",
             ID="id",
+            JAR="jar",
             JJT_GET_CHILD="jjtGetChild",
             JJT_GET_NUM_CHILDREN="jjtGetNumChildren",
             JJTLITERAL="JJTLITERAL",
             JJTSYMBOL="JJTSYMBOL",
+            LIB="lib",
             LPAREN="(",
             RPAREN=")",
             SLASH="/",

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=1170414&r1=1170413&r2=1170414&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 Wed Sep 14 02:22:42 2011
@@ -42,6 +42,8 @@
     <!--cfg:component class="org.apache.river.container.ShowContextToConsole"/-->
     <cfg:component class="org.apache.river.container.AnnotatedClassDeployer"/>
 
+    <cfg:component class="org.apache.river.container.el.ArgsParserImpl"/>
+    
     <cfg:property name="deploymentDirectory" value="deploy"/>
 
     <cfg:component class="org.apache.river.container.SystemClassloaderInitializer"/>

Added: river/jtsk/skunk/surrogate/src/org/apache/river/container/el/ArgsParser.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/el/ArgsParser.java?rev=1170414&view=auto
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/el/ArgsParser.java (added)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/el/ArgsParser.java Wed Sep 14 02:22:42 2011
@@ -0,0 +1,22 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.apache.river.container.el;
+
+/**
+ *
+ * @author trasukg
+ */
+public interface ArgsParser {
+
+    /**
+     * Take a command line as one string and break it into a set
+     * of arguments as expected by main(String[] args).
+     *
+     * @param input
+     * @return
+     */
+    String[] toArgs(String input);
+    
+}

Added: river/jtsk/skunk/surrogate/src/org/apache/river/container/el/ArgsParserImpl.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/el/ArgsParserImpl.java?rev=1170414&view=auto
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/el/ArgsParserImpl.java (added)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/el/ArgsParserImpl.java Wed Sep 14 02:22:42 2011
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.river.container.el;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+/**
+ *
+ * @author trasukg
+ */
+public class ArgsParserImpl implements ArgsParser {
+    /**
+    Take a command line as one string and break it into a set
+    of arguments as expected by main(String[] args).
+    
+    @param input
+    @return 
+    */
+    @Override
+    public String[] toArgs(String input) {
+        List<String> args=new ArrayList<String>();
+        StringTokenizer tok=new StringTokenizer(input," ");
+        while(tok.hasMoreTokens()) {
+            args.add(tok.nextToken());
+        }
+        return args.toArray(new String[0]);
+    }
+}

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/liaison/Strings.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/liaison/Strings.java?rev=1170414&r1=1170413&r2=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/liaison/Strings.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/liaison/Strings.java Wed Sep 14 02:22:42 2011
@@ -28,5 +28,6 @@ package org.apache.river.container.liais
 public class Strings {
     public static final String
             DASH="-",
-            ERROR_CLOSING_FILE="Error Closing File";
+            ERROR_CLOSING_FILE="Error Closing File",
+            JAR="jar";
 }

Copied: river/jtsk/skunk/surrogate/src/org/apache/river/container/liaison/VirtualFileSystemConfiguration.java (from r1165577, river/jtsk/skunk/surrogate/src/org/apache/river/container/liaison/WorkingDirFileConfiguration.java)
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/liaison/VirtualFileSystemConfiguration.java?p2=river/jtsk/skunk/surrogate/src/org/apache/river/container/liaison/VirtualFileSystemConfiguration.java&p1=river/jtsk/skunk/surrogate/src/org/apache/river/container/liaison/WorkingDirFileConfiguration.java&r1=1165577&r2=1170414&rev=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/liaison/WorkingDirFileConfiguration.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/liaison/VirtualFileSystemConfiguration.java Wed Sep 14 02:22:42 2011
@@ -15,64 +15,88 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.river.container.liaison;
 
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.io.Reader;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import net.jini.config.Configuration;
 import net.jini.config.ConfigurationException;
 import net.jini.config.ConfigurationFile;
 import net.jini.config.ConfigurationNotFoundException;
+import org.apache.commons.vfs.FileObject;
+import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.FileSystemManager;
+import org.apache.commons.vfs.VFS;
 
 /**
  *
  * @author trasukg
  */
-public class WorkingDirFileConfiguration 
+public class VirtualFileSystemConfiguration
         implements Configuration {
 
-    private static File workingDirectory=null;
-
-    private static Map<String, Object> specialEntries=
+    private static FileObject rootDirectory = null;
+    private static Map<String, Object> specialEntries =
             new HashMap<String, Object>();
+    private Configuration delegate = null;
 
-    private Configuration delegate=null;
-
-    /** Inject the working directory for this application.  This injection is
-     done using reflection by the ServiceStarterDeployer when the application
-     is setup.  This way, the Configuration can be loaded without any hard-coded
-     directories, etc.
-     @param workingDirectory
+    /** Inject the working directory for this application  (which might actually
+    be a jar file).  This injection is
+    done using reflection by the ServiceStarterDeployer when the application
+    is setup.  This way, the Configuration can be loaded without any hard-coded
+    directories, etc.
+    @param workingDirectory
      */
     public static void setWorkingDirectory(File workingDirectory) {
-        WorkingDirFileConfiguration.workingDirectory = workingDirectory;
+        try {
+            if (workingDirectory.isDirectory()) {
+                FileObject root = VFS.getManager().toFileObject(workingDirectory);
+                VirtualFileSystemConfiguration.rootDirectory = root;
+            } else { /* Try to create a virtual file system based on the file. */
+                FileObject rootFileObject = VFS.getManager().toFileObject(workingDirectory);
+                FileObject root = VFS.getManager().createFileSystem(Strings.JAR, rootFileObject);
+                VirtualFileSystemConfiguration.rootDirectory = root;
+            }
+        } catch (FileSystemException ex) {
+            /* Problem here is that we can't just throw the exception,
+            because we expect to be called reflectively from code in a 
+            different classloader, that won't have the exception class.
+            So, we have to instead throw an exception that is part of the 
+            jre platform.
+             */
+            throw new RuntimeException(ex.getMessage());
+        }
+
     }
 
-    public static File getWorkingDirectory() {
-        return workingDirectory;
+    public static FileObject getRootDirectory() {
+        return rootDirectory;
     }
+
     /**
-     Set the value of a 'Special Entry' as defined in ConfigurationFile, that
-     can be accessed within the configuration by using the '$entryName'
-     construct.
-     @param name The name of the special entry, which must start with '$'.
-     @param o The object to store.
+    Set the value of a 'Special Entry' as defined in ConfigurationFile, that
+    can be accessed within the configuration by using the '$entryName'
+    construct.
+    @param name The name of the special entry, which must start with '$'.
+    @param o The object to store.
      */
     public static void putSpecialEntry(String name, Object o) {
         specialEntries.put(name, o);
     }
 
-    public WorkingDirFileConfiguration(String[] options, ClassLoader cl) throws ConfigurationException {
+    public VirtualFileSystemConfiguration(String[] options, ClassLoader cl) throws ConfigurationException {
 
         /* no options; just delegate. */
-        if (options == null || options.length==0) {
-            delegate=new MyConfigurationFile(options, cl);
+        if (options == null || options.length == 0) {
+            delegate = new MyConfigurationFile(options, cl);
             return;
         }
 
@@ -83,18 +107,18 @@ public class WorkingDirFileConfiguration
         }
 
         /* Else, find the configuration file inside the working directory and
-         open it.
-         TODO: Should probably check to make sure that the supplied file
-         name does not include absolute path or '..' path, i.e. make sure
-         that the resolved file is actually a descendant of the working
-         directory.
+        open it.
+        TODO: Should probably check to make sure that the supplied file
+        name does not include absolute path or '..' path, i.e. make sure
+        that the resolved file is actually a descendant of the working
+        directory.
          */
-        File configFile=new File(workingDirectory, options[0]);
-        Reader reader=null;
+        Reader reader = null;
         try {
-            reader=new FileReader(configFile);
+            FileObject configFile = rootDirectory.resolveFile(options[0]);
+            reader = new InputStreamReader(configFile.getContent().getInputStream());
             delegate = new MyConfigurationFile(reader, options, cl);
-        } catch (FileNotFoundException ex) {
+        } catch (FileSystemException ex) {
             throw new ConfigurationNotFoundException(options[0], ex);
         } finally {
             if (reader != null) {
@@ -145,7 +169,5 @@ public class WorkingDirFileConfiguration
             }
             return super.getSpecialEntryType(name);
         }
-
-
     }
 }

Modified: river/jtsk/skunk/surrogate/test/org/apache/river/container/AnnotatedClassDeployerTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/test/org/apache/river/container/AnnotatedClassDeployerTest.java?rev=1170414&r1=1170413&r2=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/test/org/apache/river/container/AnnotatedClassDeployerTest.java (original)
+++ river/jtsk/skunk/surrogate/test/org/apache/river/container/AnnotatedClassDeployerTest.java Wed Sep 14 02:22:42 2011
@@ -118,6 +118,7 @@ public class AnnotatedClassDeployerTest 
         UUT.put(harness.getClass().getName(), harness);
         assertTrue("Init method wasn't called", harness.initialized);
         assertTrue("Second init method wasn't called", harness.secondInitCalled);
+        assertEquals("Init was called more than once:", 1, harness.initCount);
     }
 
     /**
@@ -193,10 +194,11 @@ public class AnnotatedClassDeployerTest 
         Context context = null;
         boolean initialized = false;
         boolean secondInitCalled=false;
-
+        int initCount=0;
         @Init
         void init() {
             initialized = true;
+            initCount++;
         }
 
         @Init void initAgain() {

Modified: river/jtsk/skunk/surrogate/test/org/apache/river/container/CommonsVFSTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/test/org/apache/river/container/CommonsVFSTest.java?rev=1170414&r1=1170413&r2=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/test/org/apache/river/container/CommonsVFSTest.java (original)
+++ river/jtsk/skunk/surrogate/test/org/apache/river/container/CommonsVFSTest.java Wed Sep 14 02:22:42 2011
@@ -17,6 +17,7 @@
  */
 package org.apache.river.container;
 
+import java.util.List;
 import org.junit.Ignore;
 import java.io.File;
 import org.apache.commons.vfs.FileObject;
@@ -69,7 +70,21 @@ public class CommonsVFSTest {
     public void testBaseFile() throws Exception {
         FileObject fo = fileSystemManager.resolveFile(new File("."), ".");
         System.out.println("fo=" + fo);
-        assertTrue(fo.toString().endsWith("testfiles/testroot"));
+        assertTrue(fo.toString().endsWith("build/testroot"));
+    }
+
+    /**
+    Should be able to get the current directory, and it should end with
+    'testfiles/testroot'.
+    @throws Exception
+     */
+    @Test
+    public void testSuffixSelector() throws Exception {
+        FileObject fo = fileSystemManager.resolveFile(new File("."), "lib");
+        System.out.println("fo=" + fo);
+        assertTrue(fo.toString().endsWith("build/testroot/lib"));
+        List<FileObject> jars=Utils.findChildrenWithSuffix(fo, Strings.DOT_JAR);
+        assertTrue("Didn't get any jar files.", jars.size()>0);
     }
 
     /**

Modified: river/jtsk/skunk/surrogate/test/org/apache/river/container/PropertiesFileReaderTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/test/org/apache/river/container/PropertiesFileReaderTest.java?rev=1170414&r1=1170413&r2=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/test/org/apache/river/container/PropertiesFileReaderTest.java (original)
+++ river/jtsk/skunk/surrogate/test/org/apache/river/container/PropertiesFileReaderTest.java Wed Sep 14 02:22:42 2011
@@ -121,7 +121,7 @@ public class PropertiesFileReaderTest {
         @Override
         public FileObject getProfileDirectory() throws IOException {
             FileSystemManager fileSystemManager=VFS.getManager();
-            FileObject fo = fileSystemManager.resolveFile(new File("."), "..");
+            FileObject fo = fileSystemManager.resolveFile(new File("../../testfiles"), ".");
             
             return fo;
         }

Modified: river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/VFSClassLoaderTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/VFSClassLoaderTest.java?rev=1170414&r1=1170413&r2=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/VFSClassLoaderTest.java (original)
+++ river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/VFSClassLoaderTest.java Wed Sep 14 02:22:42 2011
@@ -42,6 +42,7 @@ public class VFSClassLoaderTest {
 
     FileSystemManager fileSystemManager = null;
     FileObject reggieModuleRoot = null;
+    FileObject libRoot=null;
     ClassLoader extensionLoader = Bootstrap.class.getClassLoader().getParent();
 
     public VFSClassLoaderTest() {
@@ -60,8 +61,10 @@ public class VFSClassLoaderTest {
         fileSystemManager = VFS.getManager();
         FileObject currentDir = fileSystemManager.toFileObject(new File("."));
         FileObject reggieModuleJar =
-                currentDir.resolveFile("../../build/test/files/reggie-module.jar");
-        reggieModuleRoot = fileSystemManager.createFileSystem(reggieModuleJar);
+                currentDir.resolveFile("../test/files/reggie-module.ssar");
+        reggieModuleRoot = fileSystemManager.createFileSystem(Strings.JAR,
+                reggieModuleJar);
+        libRoot=reggieModuleRoot.resolveFile(Strings.LIB);
     }
 
     @After
@@ -93,7 +96,7 @@ public class VFSClassLoaderTest {
         VirtualFileSystemClassLoader UUT =
                 new VirtualFileSystemClassLoader(null, extensionLoader);
         try {
-            UUT.addClassPathEntry(reggieModuleRoot, "nonexistent.jar");
+            UUT.addClassPathEntry(libRoot, "nonexistent.jar");
             fail("Should have thrown an invalid classpath entry exception");
         } catch (LocalizedRuntimeException ex) {
             assertEquals(MessageNames.INVALID_CLASSPATH_ENTRY, ex.getMessageKey());
@@ -109,7 +112,7 @@ public class VFSClassLoaderTest {
     @Test
     public void testClassLoaderResourceLoading() throws Exception {
         VirtualFileSystemClassLoader UUT =
-                new VirtualFileSystemClassLoader(reggieModuleRoot, extensionLoader);
+                new VirtualFileSystemClassLoader(libRoot, extensionLoader);
         UUT.addClassPathEntry("reggie.jar");
         InputStream is = UUT.getResourceAsStream("META-INF/PREFERRED.LIST");
         assertNotNull("Failed to get resource stream for META-INF/PREFERRED.LIST",
@@ -128,7 +131,7 @@ public class VFSClassLoaderTest {
     @Test
     public void testClassLoading() throws Exception {
         VirtualFileSystemClassLoader UUT =
-                new VirtualFileSystemClassLoader(reggieModuleRoot, extensionLoader);
+                new VirtualFileSystemClassLoader(libRoot, extensionLoader);
         UUT.addClassPathEntry("reggie.jar");
         Class c = UUT.loadClass("com.sun.jini.reggie.ClassMapper");
         assertNotNull(c);
@@ -145,7 +148,7 @@ public class VFSClassLoaderTest {
     @Test
     public void testParentClassLoading() throws Exception {
         VirtualFileSystemClassLoader UUT =
-                new VirtualFileSystemClassLoader(reggieModuleRoot, extensionLoader);
+                new VirtualFileSystemClassLoader(libRoot, extensionLoader);
         UUT.addClassPathEntry("reggie.jar");
         Class c = UUT.loadClass("java.util.List");
         assertNotNull(c);
@@ -157,7 +160,7 @@ public class VFSClassLoaderTest {
     @Test
     public void testCodebaseAnnotation() throws Exception {
         VirtualFileSystemClassLoader UUT =
-                new VirtualFileSystemClassLoader(reggieModuleRoot, extensionLoader);
+                new VirtualFileSystemClassLoader(libRoot, extensionLoader);
         UUT.addClassPathEntry("reggie.jar");
         /* At this point, there should be no urls on the reported codebase. */
         URL[] actual=UUT.getURLs();
@@ -185,7 +188,7 @@ public class VFSClassLoaderTest {
     @Test
     public void testFilteredClassLoading() throws Exception {
         VirtualFileSystemClassLoader UUT =
-                new VirtualFileSystemClassLoader(reggieModuleRoot, extensionLoader);
+                new VirtualFileSystemClassLoader(libRoot, extensionLoader);
         UUT.addClassPathEntry("reggie.jar(com.sun.jini.reggie.ClassMapper)");
         /* We should now be able to load the ClassMapper class, but nothing
         else.

Added: river/jtsk/skunk/surrogate/test/org/apache/river/container/el/ArgParserTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/test/org/apache/river/container/el/ArgParserTest.java?rev=1170414&view=auto
==============================================================================
--- river/jtsk/skunk/surrogate/test/org/apache/river/container/el/ArgParserTest.java (added)
+++ river/jtsk/skunk/surrogate/test/org/apache/river/container/el/ArgParserTest.java Wed Sep 14 02:22:42 2011
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.river.container.el;
+
+import org.apache.river.container.Utils;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author trasukg
+ */
+public class ArgParserTest {
+
+    public ArgParserTest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+    ArgsParserImpl UUT = new ArgsParserImpl();
+
+    @Before
+    public void setUp() {
+    }
+
+    @After
+    public void tearDown() {
+    }
+
+    @Test
+    public void testSimpleLine() {
+        String input = "A B C";
+        String[] expected = {"A", "B", "C"};
+
+        String[] actual = UUT.toArgs(input);
+
+        checkStringArray(expected, actual);
+    }
+
+    private void checkStringArray(String[] expected, String[] actual) {
+        boolean fail = false;
+        if (actual.length != expected.length) {
+            fail = true;
+        }
+
+        for (int i = 0; fail == false && i < expected.length; i++) {
+            if (expected[i] == null) {
+                fail = actual[i] == null;
+                continue;
+            }
+            fail = !expected[i].equals(actual[i]);
+        }
+        if (fail) {
+            fail("Expected " + Utils.format(expected) + ", got " + Utils.format(actual));
+            
+        }
+    }
+}

Modified: river/jtsk/skunk/surrogate/testfiles/hosted-reggie.properties
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/testfiles/hosted-reggie.properties?rev=1170414&r1=1170413&r2=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/testfiles/hosted-reggie.properties (original)
+++ river/jtsk/skunk/surrogate/testfiles/hosted-reggie.properties Wed Sep 14 02:22:42 2011
@@ -16,7 +16,5 @@
  # limitations under the License.
  #
 
-classpath=reggie.jar
-codebase=reggie-dl.jar
 startClass=com.sun.jini.reggie.TransientRegistrarImpl
 startParameters=transient-jeri-reggie.config

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=1170414&r1=1170413&r2=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/config.xml (original)
+++ river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/config.xml Wed Sep 14 02:22:42 2011
@@ -27,5 +27,5 @@
     </cfg:discovery-context>
     <cfg:component class="org.apache.river.container.codebase.DummyCodebaseHandler"/>
     <cfg:component class="org.apache.river.container.StarterServiceDeployer"/>
-
+    <cfg:component class="org.apache.river.container.ShowContextToConsole"/>
 </cfg:container-config>

Modified: river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/service-starter.properties
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/service-starter.properties?rev=1170414&r1=1170413&r2=1170414&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/service-starter.properties (original)
+++ river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/service-starter.properties Wed Sep 14 02:22:42 2011
@@ -15,10 +15,20 @@
  # limitations under the License.
  #
 
+# These are the jar files from the container's 'lib' directory that are
+# included in the application's classpath.
+# At minimum, these will include the jini platform jars.
+# In addition, we include the commons-vfs jar and its dependencies so that the
+# application can make use of the VirtualFileSystemConfiguration, to access its
+# configuration files without any need to know the physical location of these
+# files on disk.
 platformJars=\
-    jsk-platform.jar\
+    commons-vfs-1.0.jar\
+    :commons-logging-1.1.1.jar\
+    :jsk-platform.jar\
     :jsk-lib.jar\
     :jsk-resources.jar\
-    :RiverSurrogate.jar(org.apache.river.container.liaison.*, "META-INF/*")
+    :RiverSurrogate.jar(org.apache.river.container.liaison.Strings,\
+    org.apache.river.container.liaison.VirtualFileSystemConfiguration, "META-INF/*")
 
 platformCodebase=jsk-dl.jar