Modified: river/jtsk/skunk/surrogate/nbproject/genfiles.properties
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/nbproject/genfiles.properties?rev=1127370&r1=1127369&r2=1127370&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/nbproject/genfiles.properties (original)
+++ river/jtsk/skunk/surrogate/nbproject/genfiles.properties Wed May 25 
03:12:05 2011
@@ -1,11 +1,11 @@
-build.xml.data.CRC32=8d037bdc
-build.xml.script.CRC32=8dea2037
[email protected]
-# This file is used by a NetBeans-based IDE to track changes in generated 
files such as build-impl.xml.
-# Do not edit this file. You may delete it but then the IDE will never 
regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=26182442
-nbproject/build-impl.xml.script.CRC32=40951c41
-nbproject/[email protected]
-nbproject/management-build-impl.xml.data.CRC32=318d2fde
-nbproject/management-build-impl.xml.script.CRC32=630dcf8f
-nbproject/[email protected]
+build.xml.data.CRC32=8d037bdc
+build.xml.script.CRC32=8dea2037
[email protected]
+# This file is used by a NetBeans-based IDE to track changes in generated 
files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never 
regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=2c97db21
+nbproject/build-impl.xml.script.CRC32=c7be12f9
+nbproject/[email protected]
+nbproject/management-build-impl.xml.data.CRC32=318d2fde
+nbproject/management-build-impl.xml.script.CRC32=630dcf8f
+nbproject/[email protected]

Modified: river/jtsk/skunk/surrogate/nbproject/project.properties
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/nbproject/project.properties?rev=1127370&r1=1127369&r2=1127370&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/nbproject/project.properties (original)
+++ river/jtsk/skunk/surrogate/nbproject/project.properties Wed May 25 03:12:05 
2011
@@ -1,89 +1,95 @@
-annotation.processing.enabled=true
-annotation.processing.enabled.in.editor=false
-annotation.processing.run.all.processors=true
-annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
-application.title=surrogate
-application.vendor=trasukg
-build.classes.dir=${build.dir}/classes
-build.classes.excludes=**/*.java,**/*.form
-# This directory is removed when the project is cleaned:
-build.dir=build
-build.generated.dir=${build.dir}/generated
-build.generated.sources.dir=${build.dir}/generated-sources
-# Only compile against the classpath explicitly listed here:
-build.sysclasspath=ignore
-build.test.classes.dir=${build.dir}/test/classes
-build.test.results.dir=${build.dir}/test/results
-# Uncomment to specify the preferred debugger connection transport:
-#debug.transport=dt_socket
-debug.classpath=\
-    ${run.classpath}
-debug.test.classpath=\
-    ${run.test.classpath}
-# This directory is removed when the project is cleaned:
-dist.dir=dist
-dist.jar=${dist.dir}/RiverSurrogate.jar
-dist.javadoc.dir=${dist.dir}/javadoc
-endorsed.classpath=
-#endorsed.classpath=\
-#    ${libs.JAXB-ENDORSED.classpath}
-excludes=
-includes=**
-jar.archive.disabled=${jnlp.enabled}
-jar.compress=false
-jar.index=${jnlp.enabled}
-javac.classpath=\
-    ${libs.ApacheRiverPlatform.classpath}:\
-    ${libs.ApacheRiverLib.classpath}
-# Space-separated list of extra javac options
-javac.compilerargs=
-javac.deprecation=false
-javac.processorpath=\
-    ${javac.classpath}:\
-    ${libs.JavaCC.classpath}:\
-    ${libs.jaxb.classpath}
-javac.source=1.5
-javac.target=1.5
-javac.test.classpath=\
-    ${javac.classpath}:\
-    ${build.classes.dir}:\
-    ${libs.junit_4.classpath}
-javac.test.processorpath=\
-    ${javac.test.classpath}
-javadoc.additionalparam=
-javadoc.author=false
-javadoc.encoding=${source.encoding}
-javadoc.noindex=false
-javadoc.nonavbar=false
-javadoc.notree=false
-javadoc.private=false
-javadoc.splitindex=true
-javadoc.use=true
-javadoc.version=false
-javadoc.windowtitle=
-jaxbwiz.gensrc.classpath=${libs.jaxb.classpath}
-jaxbwiz.xjcdef.classpath=${libs.jaxb.classpath}
-jaxbwiz.xjcrun.classpath=${libs.jaxb.classpath}
-jnlp.codebase.type=no.codebase
-jnlp.descriptor=application
-jnlp.enabled=false
-jnlp.mixed.code=defaut
-jnlp.offline-allowed=false
-jnlp.signed=false
-main.class=org.apache.river.container.Bootstrap
-manifest.file=manifest.mf
-meta.inf.dir=${src.dir}/META-INF
-platform.active=default_platform
-run.classpath=\
-    ${javac.classpath}:\
-    ${build.classes.dir}
-# Space-separated list of JVM arguments used when running the project
-# (you may also define separate properties like run-sys-prop.name=value 
instead of -Dname=value
-# or test-sys-prop.name=value to set system properties for unit tests):
-run.jvmargs=
-run.test.classpath=\
-    ${javac.test.classpath}:\
-    ${build.test.classes.dir}
-source.encoding=UTF-8
-src.dir=src
-test.src.dir=test
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+application.title=surrogate
+application.vendor=trasukg
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+    ${run.classpath}
+debug.test.classpath=\
+    ${run.test.classpath}
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/RiverSurrogate.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+endorsed.classpath=
+#endorsed.classpath=\
+#    ${libs.JAXB-ENDORSED.classpath}
+excludes=
+includes=**
+jar.archive.disabled=${jnlp.enabled}
+jar.compress=false
+jar.index=${jnlp.enabled}
+javac.classpath=\
+    ${libs.ApacheRiverPlatform.classpath}:\
+    ${libs.ApacheRiverLib.classpath}:\
+    ${reference.RiverContainerLiaison.jar}:\
+    ${libs.ApacheCommonsLogging-1_1_1.classpath}:\
+    ${libs.ApacheCommonsVFS-1_0.classpath}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.processorpath=\
+    ${javac.classpath}:\
+    ${libs.JavaCC.classpath}:\
+    ${libs.jaxb.classpath}
+javac.source=1.5
+javac.target=1.5
+javac.test.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}:\
+    ${libs.junit_4.classpath}
+javac.test.processorpath=\
+    ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+jaxbwiz.gensrc.classpath=${libs.jaxb.classpath}
+jaxbwiz.xjcdef.classpath=${libs.jaxb.classpath}
+jaxbwiz.xjcrun.classpath=${libs.jaxb.classpath}
+jnlp.codebase.type=no.codebase
+jnlp.descriptor=application
+jnlp.enabled=false
+jnlp.mixed.code=defaut
+jnlp.offline-allowed=false
+jnlp.signed=false
+main.class=org.apache.river.container.Bootstrap
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+platform.active=default_platform
+project.RiverContainerLiaison=../RiverContainerLiaison
+reference.RiverContainerLiaison.jar=${project.RiverContainerLiaison}/dist/RiverContainerLiaison.jar
+run.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}:\
+    ${libs.ApacheRiverServices.classpath}
+# Space-separated list of JVM arguments used when running the project
+# (you may also define separate properties like run-sys-prop.name=value 
instead of -Dname=value
+# or test-sys-prop.name=value to set system properties for unit tests):
+run.jvmargs=
+run.test.classpath=\
+    ${javac.test.classpath}:\
+    ${build.test.classes.dir}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test

Modified: river/jtsk/skunk/surrogate/nbproject/project.xml
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/nbproject/project.xml?rev=1127370&r1=1127369&r2=1127370&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/nbproject/project.xml (original)
+++ river/jtsk/skunk/surrogate/nbproject/project.xml Wed May 25 03:12:05 2011
@@ -1,16 +1,26 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://www.netbeans.org/ns/project/1";>
-    <type>org.netbeans.modules.java.j2seproject</type>
-    <configuration>
-        <data xmlns="http://www.netbeans.org/ns/j2se-project/3";>
-            <name>RiverSurrogate</name>
-            <source-roots>
-                <root id="src.dir"/>
-            </source-roots>
-            <test-roots>
-                <root id="test.src.dir"/>
-            </test-roots>
-        </data>
-        <data xmlns="http://www.netbeans.org/ns/jmx/1"; version="0.4"/>
-    </configuration>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1";>
+    <type>org.netbeans.modules.java.j2seproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/j2se-project/3";>
+            <name>RiverSurrogate</name>
+            <source-roots>
+                <root id="src.dir"/>
+            </source-roots>
+            <test-roots>
+                <root id="test.src.dir"/>
+            </test-roots>
+        </data>
+        <data xmlns="http://www.netbeans.org/ns/jmx/1"; version="0.4"/>
+        <references 
xmlns="http://www.netbeans.org/ns/ant-project-references/1";>
+            <reference>
+                <foreign-project>RiverContainerLiaison</foreign-project>
+                <artifact-type>jar</artifact-type>
+                <script>build.xml</script>
+                <target>jar</target>
+                <clean-target>clean</clean-target>
+                <id>jar</id>
+            </reference>
+        </references>
+    </configuration>
+</project>

Modified: 
river/jtsk/skunk/surrogate/src/org/apache/river/container/FileUtility.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/FileUtility.java?rev=1127370&r1=1127369&r2=1127370&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/FileUtility.java 
(original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/FileUtility.java 
Wed May 25 03:12:05 2011
@@ -18,11 +18,13 @@
 
 package org.apache.river.container;
 
-import java.io.File;
 import java.io.IOException;
+import org.apache.commons.vfs.FileObject;
 
 /**
- *
+ * Utilities for dealing with the files and file systems that the
+ River Container uses.  This class builds on Apache Commons-vfs and uses
+ many of its facilities and classes.
  * @author trasukg
  */
 public interface FileUtility {
@@ -32,14 +34,14 @@ public interface FileUtility {
      @return
      @throws IOException
      */
-    public File getWorkingDirectory(String name) throws IOException;
+    public FileObject getWorkingDirectory(String name) throws IOException;
 
     /**
      Get the 'home' directory for the current container profile.
      @return
      @throws IOException
      */
-    public File getProfileDirectory() throws IOException;
+    public FileObject getProfileDirectory() throws IOException;
 
     
 }

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=1127370&r1=1127369&r2=1127370&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 May 25 03:12:05 2011
@@ -20,6 +20,10 @@ package org.apache.river.container;
 
 import java.io.File;
 import java.io.IOException;
+import org.apache.commons.vfs.FileObject;
+import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.FileSystemManager;
+import org.apache.commons.vfs.VFS;
 
 /**
  *
@@ -30,18 +34,24 @@ public class FileUtilityImpl implements 
     @Injected
     private String profile=null;
 
-    public File getWorkingDirectory(String name) throws IOException {
+    private FileSystemManager fsm=null;
 
-        File workDir=new File(getProfileDirectory(), name);
+    public FileObject getWorkingDirectory(String name) throws IOException {
+
+        FileObject 
workDir=getProfileDirectory().resolveFile(Strings.WORK).resolveFile(name);
         if (!workDir.exists()) {
-            workDir.mkdirs();
+            workDir.createFolder();
         }
         return workDir;
     }
 
-    public File getProfileDirectory() throws IOException {
-        File profileDir = new File(Strings.PROFILE + File.separator + profile);
+    public FileObject getProfileDirectory() throws IOException {
+        FileObject profileDir = fsm.resolveFile(new File(Strings.PROFILE), 
profile);
         return profileDir;
     }
 
+    @Init
+    public void init() throws FileSystemException {
+        fsm=VFS.getManager();
+    }
 }

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=1127370&r1=1127369&r2=1127370&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 May 25 03:12:05 2011
@@ -56,6 +56,7 @@ public class MessageNames {
             INIT_METHOD_HAS_PARAMETERS="initMethodHasParameters",
             INIT_METHOD_NOT_VOID="initMethodIsntVoid",
             INJECT="inject",
+            NO_DEPLOYMENT_DIRECTORY="noDeploymentDirectory",
             PROFILE_CONFIG_EXCEPTION="profileConfigurationException",
             READING_OBJECT="readingObject",
             READING_OBJECT_MEMBER_COUNT="readingObject.memberCount",

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=1127370&r1=1127369&r2=1127370&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 May 25 03:12:05 2011
@@ -37,6 +37,8 @@ Method ''{1}'' on class ''{0}'' has para
 initMethodIsntVoid=A method flagged as @Init must be void return type.  \
 Method ''{1}'' on class ''{0}'' returns ''{2}''.
 inject=Injecting {2} into member ''{1}'' of deployed object {0}.
+noDeploymentDirectory=No deployment directory called {0} found in {1}; \
+skipping deployment.
 profileConfigurationException=Failed to read the configuration for profile {0}.
 readingObject=Reading instance of {1} named ''{0}'' for unresolved 
dependencies.
 readingObject.memberCount={0} members found.

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=1127370&r1=1127369&r2=1127370&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 May 25 03:12:05 2011
@@ -13,6 +13,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
+import org.apache.commons.vfs.FileObject;
 import org.apache.river.container.config.ContainerConfig;
 import org.xml.sax.SAXException;
 
@@ -34,10 +35,10 @@ public class ProfileConfigReader {
 
     private ContainerConfig readProfileConfig() throws SAXException, 
JAXBException, FileNotFoundException, IOException {
         Unmarshaller um = Bootstrap.createConfigUnmarshaller();
-        File profileDir = fileUtility.getProfileDirectory();
-        File configFile = new File(profileDir, Strings.CONFIG_XML);
-        log.log(Level.INFO, MessageNames.CONFIG_FILE, 
configFile.getAbsolutePath());
-        InputStream is = new FileInputStream(configFile);
+        FileObject profileDir = fileUtility.getProfileDirectory();
+        FileObject configFile = profileDir.resolveFile(Strings.CONFIG_XML);
+        log.log(Level.INFO, MessageNames.CONFIG_FILE, configFile.toString());
+        InputStream is = configFile.getContent().getInputStream();
         ContainerConfig containerConfig = (ContainerConfig) um.unmarshal(is);
         return containerConfig;
     }

Added: 
river/jtsk/skunk/surrogate/src/org/apache/river/container/ServiceStarterArchiveFileSelector.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/ServiceStarterArchiveFileSelector.java?rev=1127370&view=auto
==============================================================================
--- 
river/jtsk/skunk/surrogate/src/org/apache/river/container/ServiceStarterArchiveFileSelector.java
 (added)
+++ 
river/jtsk/skunk/surrogate/src/org/apache/river/container/ServiceStarterArchiveFileSelector.java
 Wed May 25 03:12:05 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;
+
+import java.io.File;
+import org.apache.commons.vfs.FileSelectInfo;
+import org.apache.commons.vfs.FileSelector;
+import org.apache.commons.vfs.FileType;
+
+/**
+ *
+ * @author trasukg
+ */
+public class ServiceStarterArchiveFileSelector implements FileSelector {
+
+    public boolean includeFile(FileSelectInfo fileInfo) throws Exception {
+        if (fileInfo.getFile().getType()!=FileType.FILE) {
+            return false;
+        }
+        if (! 
fileInfo.getFile().getName().getExtension().equals(Strings.SSAR)) {
+            return false;
+        }
+        return true;
+    }
+
+    public boolean traverseDescendents(FileSelectInfo fileInfo) throws 
Exception {
+        return false;
+    }
+
+}

Modified: 
river/jtsk/skunk/surrogate/src/org/apache/river/container/SettableCodebaseClassLoader.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/SettableCodebaseClassLoader.java?rev=1127370&r1=1127369&r2=1127370&view=diff
==============================================================================
--- 
river/jtsk/skunk/surrogate/src/org/apache/river/container/SettableCodebaseClassLoader.java
 (original)
+++ 
river/jtsk/skunk/surrogate/src/org/apache/river/container/SettableCodebaseClassLoader.java
 Wed May 25 03:12:05 2011
@@ -149,4 +149,5 @@ public class SettableCodebaseClassLoader
         listString.append("]");
         return listString.toString();
     }
+
 }

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=1127370&r1=1127369&r2=1127370&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 May 25 03:12:05 2011
@@ -16,12 +16,16 @@
  * limitations under the License.
  */
 
+/* TODO: - Rework FileUtility to use commons-vfs */
+/* TODO: - Complete deployment of items that are in the deployment
+ directory.
+ */
 package org.apache.river.container;
 
-import java.io.File;
 import java.io.IOException;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import org.apache.commons.vfs.FileObject;
 
 /**
  *
@@ -37,9 +41,9 @@ public class StarterServiceDeployer {
     @Injected()
     private String deploymentDirectory=null;
 
-    private File deploymentDirectoryFile=null;
+    private FileObject deploymentDirectoryFile=null;
 
-    private File workingDirectory=null;
+    private FileObject workingDirectory=null;
 
     @Init public void init() {
         try {
@@ -55,36 +59,48 @@ public class StarterServiceDeployer {
         /* Setup the working directory. */
         workingDirectory = fileUtility.getWorkingDirectory(myName);
         /* Establish the deployment directory. */
-        deploymentDirectoryFile = new File(fileUtility.getProfileDirectory(),
-                deploymentDirectory);
+        deploymentDirectoryFile = fileUtility.getProfileDirectory()
+                .resolveFile(deploymentDirectory);
+        if (deploymentDirectoryFile==null) {
+            log.log(Level.INFO,MessageNames.NO_DEPLOYMENT_DIRECTORY,
+            new Object[] 
{deploymentDirectory,fileUtility.getProfileDirectory()});
+        }
         /* Read the maximal policy file if there is one. */
         /* Read the configuration file for minimal codebase and
          discovery options.
          */
         /* Go through the deployment directory looking for services to deploy.
          */
-        File[] serviceArchives=
-                deploymentDirectoryFile.listFiles(new 
ServiceStarterArchiveFileFilter());
+        FileObject[] serviceArchives=
+                deploymentDirectoryFile.findFiles(new 
ServiceStarterArchiveFileSelector());
+        if (serviceArchives!=null) {
+            deployServiceArchives(serviceArchives);
+        }
 
+        /* TODO: Establish the interval task to monitor the deployment 
directory
+        for deployment candidate changes.
+         */
+        /* TODO: Establish the interval task to monitor the deployment 
directory
+        for deployment candidate changes.
+         */
+
+    }
+
+    private void deployServiceArchives(FileObject[] serviceArchives) {
         /*
-         Deploy those services.
+        Deploy those services.
          */
-        for (File archiveFile: serviceArchives) {
+        for (FileObject archiveFile : serviceArchives) {
             try {
                 deployService(archiveFile);
-            } catch(Throwable t) {
-                log.log(Level.WARNING,
-                        MessageNames.FAILED_DEPLOY_SERVICE,
-                        archiveFile.getPath());
+            } catch (Throwable t) {
+                log.log(Level.WARNING, MessageNames.FAILED_DEPLOY_SERVICE, 
archiveFile.toString());
                 log.log(Level.WARNING, MessageNames.EXCEPTION_THROWN, t);
             }
         }
-        /* TODO: Establish the interval task to monitor the deployment 
directory
-        for deployment candidate changes.
-         */
     }
 
-    private void deployService(File serviceJar) {
+    private void deployService(FileObject serviceJar) {
         /* Unpack the jar into working dir. */
         /* Create the service classloader. */
         /* Register the service's codebase jars with the codebase service. */

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=1127370&r1=1127369&r2=1127370&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 
May 25 03:12:05 2011
@@ -40,7 +40,10 @@ public class Strings {
             PROFILE = "profile",
             PROFILE_DIR="profileDirectory",
             PUT = "put",
+            SSAR="ssar",
             SET = "set",
             TYPE="type",
-            WHITESPACE_SEPARATORS=" \t\n\r";
+            WHITESPACE_SEPARATORS=" \t\n\r",
+            WORK="work";
+
 }

Added: 
river/jtsk/skunk/surrogate/src/org/apache/river/container/VirtualFileSystemClassLoader.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/VirtualFileSystemClassLoader.java?rev=1127370&view=auto
==============================================================================
--- 
river/jtsk/skunk/surrogate/src/org/apache/river/container/VirtualFileSystemClassLoader.java
 (added)
+++ 
river/jtsk/skunk/surrogate/src/org/apache/river/container/VirtualFileSystemClassLoader.java
 Wed May 25 03:12:05 2011
@@ -0,0 +1,25 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.apache.river.container;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+import org.apache.commons.vfs.FileObject;
+
+/**
+ *
+ * @author trasukg
+ */
+public class VirtualFileSystemClassLoader extends URLClassLoader {
+
+    public VirtualFileSystemClassLoader(FileObject fileSystemRoot, ClassLoader 
parent) {
+        super(new URL[0], parent);
+    }
+
+    void addClassPathEntry(String string) {
+
+    }
+}

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=1127370&r1=1127369&r2=1127370&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 May 25 03:12:05 2011
@@ -39,7 +39,7 @@
    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>
-    <cfg:component class="org.apache.river.container.ShowContextToConsole"/>
+    <!--cfg:component 
class="org.apache.river.container.ShowContextToConsole"/-->
     <cfg:component class="org.apache.river.container.AnnotatedClassDeployer"/>
 
     <cfg:property name="deploymentDirectory" value="deploy"/>

Modified: river/jtsk/skunk/surrogate/src/schemas/config.xsd
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/schemas/config.xsd?rev=1127370&r1=1127369&r2=1127370&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/schemas/config.xsd (original)
+++ river/jtsk/skunk/surrogate/src/schemas/config.xsd Wed May 25 03:12:05 2011
@@ -35,9 +35,9 @@
         <xsd:attribute name="name" type="xsd:string" use="optional"/>
     </xsd:complexType>
     
-    <xsd:element name="classpath" type="xsd:string" minOccurs="0"/>
+    <xsd:element name="classpath" type="xsd:string"/>
 
-    <xsd:element name="codebase" type="xsd:string" minOccurs="0"/>
+    <xsd:element name="codebase" type="xsd:string"/>
 
     <xsd:element name="property">
         <xsd:complexType>
@@ -48,6 +48,9 @@
 
     <xsd:element name="component">
         <xsd:complexType>
+            <xsd:sequence>
+                <xsd:element ref="tns:property" minOccurs="0" 
maxOccurs="unbounded"/>
+            </xsd:sequence>
             <xsd:attribute name="name" type="xsd:string" use="optional"/>
             <xsd:attribute name="class" type="xsd:string" use="required"/>
         </xsd:complexType>
@@ -62,8 +65,8 @@
         </xsd:annotation>
         <xsd:complexType>
             <xsd:sequence>
-                <xsd:element ref="tns:classpath"/>
-                <xsd:element ref="tns:codebase"/>
+                <xsd:element ref="tns:classpath" minOccurs="0"/>
+                <xsd:element ref="tns:codebase" minOccurs="0"/>
                 <xsd:choice maxOccurs="unbounded">
                     <xsd:annotation>
                         <xsd:appinfo>

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=1127370&r1=1127369&r2=1127370&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 May 25 03:12:05 2011
@@ -136,12 +136,32 @@ public class AnnotatedClassDeployerTest 
     }
 
     /**
+    /**
+    Test that if we have two items deployed, one will be injected into the
+    other.
+
+    This injection should occur even if an item is a subclass of the
+    injected field's type.  In other words, if a field wants a java.util.List
+    for instance, it should get a java.util.ArrayList injected if that's the
+    only available object.
+     */
+    @Test
+    public void testDerivedResourceInjected() {
+        log.info("testResourceInjected()");
+        InjectionHarness harness=new InjectionHarnessSubclass();
+        InjectionHarnessWithDependencies harness2=
+                new InjectionHarnessWithDependencies();
+        UUT.put(harness.getClass().getName(), harness);
+        UUT.put(harness2.getClass().getName(), harness2);
+        assertEquals(harness, harness2.harness);
+    }
+
+    /**
     Test that if we have two items deployed, one will be injected into the
     other.
      */
     @Test
     public void testResourceInjectedByName() {
-        InjectionHarness harness=new InjectionHarness();
         InjectionHarnessWithNamedDependencies harness2=
                 new InjectionHarnessWithNamedDependencies();
         UUT.put("this.is.a.name", "Bob");
@@ -149,6 +169,24 @@ public class AnnotatedClassDeployerTest 
         assertEquals("Bob", harness2.injectedVariable);
     }
 
+    @Test
+    /**
+     If we don't specify an explicit name as the value of the @Injected
+     annotation, then the injection should be tried based on the 'implied'
+     name of the member, i.e. the field name or property name for a 'setXYZ'
+     method.  Also we need to make sure that 'byType' injection isn't imposed
+     in a silly way, for instance injecting a string to a field, even though
+     there is a string available to the context under a different name.
+     */
+    public void testInjectByImpliedName() {
+        InjectionHarnessWithDependencies h1=new 
InjectionHarnessWithDependencies();
+        UUT.put(h1.getClass().getName(),h1);
+        UUT.put("name","abc");
+        assertEquals("abc", h1.name);
+        /* Shouldn't inject a silly string! */
+        assertEquals(null, h1.otherName);
+    }
+
     private class InjectionHarness {
 
         @Injected
@@ -163,8 +201,9 @@ public class AnnotatedClassDeployerTest 
 
         @Init void initAgain() {
             secondInitCalled=true;
-        }
-    }
+        }    }
+
+    private class InjectionHarnessSubclass extends InjectionHarness {}
 
     private class InjectionHarnessWithNonVoidInit {
 
@@ -187,6 +226,8 @@ public class AnnotatedClassDeployerTest 
 
         @Injected InjectionHarness harness=null;
 
+        @Injected String name=null;
+        @Injected String otherName=null;
     }
 
     private class InjectionHarnessWithNamedDependencies {

Added: 
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=1127370&view=auto
==============================================================================
--- 
river/jtsk/skunk/surrogate/test/org/apache/river/container/CommonsVFSTest.java 
(added)
+++ 
river/jtsk/skunk/surrogate/test/org/apache/river/container/CommonsVFSTest.java 
Wed May 25 03:12:05 2011
@@ -0,0 +1,76 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.apache.river.container;
+
+import java.io.File;
+import org.apache.commons.vfs.FileObject;
+import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.FileSystemManager;
+import org.apache.commons.vfs.VFS;
+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 CommonsVFSTest {
+
+    FileSystemManager fileSystemManager=null;
+
+    public CommonsVFSTest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+
+    @Before
+    public void setUp() throws FileSystemException {
+        fileSystemManager=VFS.getManager();
+
+    }
+
+    @After
+    public void tearDown() {
+    }
+
+    /**
+     Should be able to get the current directory, and it should end with
+     'testfiles/testroot'.
+     @throws Exception
+     */
+    @Test
+    public void testBaseFile() throws Exception {
+        FileObject fo=fileSystemManager.resolveFile(new File("."),".");
+        System.out.println("fo=" + fo);
+        assertTrue(fo.toString().endsWith("testfiles/testroot"));
+    }
+
+    /**
+     Make sure we can use the jar:syntax to get to the 'start.properties' file
+     inside the constructed reggie module jar.
+     */
+    @Test
+    public void testFileInReggieModuleJar() throws Exception {
+        FileObject reggieJar=
+                fileSystemManager.resolveFile(new 
File("../../build/test/files"), "reggie-module.jar");
+        assertTrue("Bad file:" + 
reggieJar.toString(),reggieJar.toString().endsWith("reggie-module.jar"));
+        FileObject reggieJarFS=fileSystemManager.createFileSystem(reggieJar);
+
+        FileObject startProperties=reggieJarFS.resolveFile("start.properties");
+        assertNotNull(startProperties);
+        assertTrue("Properties file unreadable:" + startProperties.toString() 
+ " type=" + startProperties.getType(), startProperties.isReadable());
+    }
+}
\ No newline at end of file

Added: 
river/jtsk/skunk/surrogate/test/org/apache/river/container/VFSClassLoaderTest.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/test/org/apache/river/container/VFSClassLoaderTest.java?rev=1127370&view=auto
==============================================================================
--- 
river/jtsk/skunk/surrogate/test/org/apache/river/container/VFSClassLoaderTest.java
 (added)
+++ 
river/jtsk/skunk/surrogate/test/org/apache/river/container/VFSClassLoaderTest.java
 Wed May 25 03:12:05 2011
@@ -0,0 +1,101 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.apache.river.container;
+
+import java.io.InputStream;
+import java.io.File;
+import org.apache.commons.vfs.FileObject;
+import org.apache.commons.vfs.FileSystemManager;
+import org.apache.commons.vfs.VFS;
+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 VFSClassLoaderTest {
+
+    FileSystemManager fileSystemManager = null;
+    FileObject reggieModuleRoot=null;
+    ClassLoader extensionLoader=Bootstrap.class.getClassLoader().getParent();
+
+    public VFSClassLoaderTest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        fileSystemManager=VFS.getManager();
+        FileObject currentDir=fileSystemManager.toFileObject(new File("."));
+        FileObject reggieModuleJar=
+                
currentDir.resolveFile("../../build/test/files/reggie-module.jar");
+        reggieModuleRoot=fileSystemManager.createFileSystem(reggieModuleJar);
+    }
+
+    @After
+    public void tearDown() {
+
+    }
+    
+    /**
+     Just to make sure that we have the base setup correct, ensure that we
+     can read the 'start.properties' file inside the reggie-module jar.
+     @throws Exception
+     */
+    @Test
+    public void testCanReadStartDotProperties() throws Exception {
+        FileObject 
startProperties=reggieModuleRoot.resolveFile("start.properties");
+        assertNotNull(startProperties);
+        assertTrue("Properties file unreadable:" 
+                + startProperties.toString() + " type=" + 
startProperties.getType(),
+                startProperties.isReadable());
+    }
+
+    /**
+     Create a VFSClassLoader and see if we can read a resource file from it.
+     As shown below, we're just adding a classpath entry with no filters or
+     codebase.
+     @throws Exception
+     */
+    @Test
+    public void testClassLoaderResourceLoading() throws Exception {
+        VirtualFileSystemClassLoader UUT=
+                new VirtualFileSystemClassLoader(reggieModuleRoot, 
extensionLoader);
+        UUT.addClassPathEntry("reggie.jar");
+        InputStream is=UUT.getResourceAsStream("META-INF/PREFERRED.LIST");
+        assertNotNull("Failed to get resource stream for 
META-INF/PREFERRED.LIST",
+                is);
+    }
+
+    @Test
+    public void testClassLoading() throws Exception {
+
+        fail("Write me. Should test that we can load a class.");
+    }
+
+    @Test
+    public void testCodebaseAnnotation() throws Exception {
+        fail("Write me.  Should test that the codebase annotation can be set"
+                + " externally.");
+    }
+
+    @Test
+    public void testFilteredClassLoading() throws Exception {
+        fail("Write me - test that we can load a particular package's classes "
+                + "from a jar file, but no others (e.g. for 
ContainerLiaison)");
+    }
+}

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=1127370&r1=1127369&r2=1127370&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
 Wed May 25 03:12:05 2011
@@ -13,7 +13,7 @@
    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:discovery-context is-default="false" id="">
+    <cfg:discovery-context name="default">
         <cfg:locator></cfg:locator>
         <cfg:group></cfg:group>
     </cfg:discovery-context>

Added: river/jtsk/skunk/surrogate/testfiles/hosted-reggie.properties
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/testfiles/hosted-reggie.properties?rev=1127370&view=auto
==============================================================================
--- river/jtsk/skunk/surrogate/testfiles/hosted-reggie.properties (added)
+++ river/jtsk/skunk/surrogate/testfiles/hosted-reggie.properties Wed May 25 
03:12:05 2011
@@ -0,0 +1,6 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+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=1127370&r1=1127369&r2=1127370&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/config.xml 
(original)
+++ river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/config.xml 
Wed May 25 03:12:05 2011
@@ -12,13 +12,12 @@
    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>
-    <cfg:property name="testProp" value="ABC"></cfg:property>
-    <cfg:component class="org.apache.river.container.AnnotatedClassDeployer"/>
-    <cfg:component class="org.apache.river.container.MBeanRegistrar"/>
-    <cfg:discovery-context name="abc">
+
+    <cfg:property name="deploymentDirectory" value="deploy"/>
+
+    <cfg:discovery-context name="default">
         <cfg:group>TEST</cfg:group>
     </cfg:discovery-context>
-    <cfg:component class="org.apache.river.container.ShutdownListener"/>
-    <cfg:component class="org.apache.river.container.ShowContextToConsole"/>
+    <cfg:component class="org.apache.river.container.StarterServiceDeployer"/>
 
 </cfg:container-config>


Reply via email to