Author: gtrasuk
Date: Tue Sep 6 01:02:19 2011
New Revision: 1165466
URL: http://svn.apache.org/viewvc?rev=1165466&view=rev
Log:
Continuing work on the surrogate classloading and container startup code.
Added:
river/jtsk/skunk/surrogate/src/org/apache/river/container/FileSuffixSelector.java
river/jtsk/skunk/surrogate/src/org/apache/river/container/SystemClassloaderInitializer.java
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/CodebaseContext.java
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/CodebaseHandler.java
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/DummyCodebaseHandler.java
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/Strings.java
river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/service-starter.properties
Modified:
river/jtsk/skunk/surrogate/build.xml
river/jtsk/skunk/surrogate/nbproject/project.properties
river/jtsk/skunk/surrogate/src/org/apache/river/container/FileUtility.java
river/jtsk/skunk/surrogate/src/org/apache/river/container/FileUtilityImpl.java
river/jtsk/skunk/surrogate/src/org/apache/river/container/ServiceStarterArchiveFileSelector.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/VirtualFileSystemClassLoader.java
river/jtsk/skunk/surrogate/src/org/apache/river/container/core-config.xml
river/jtsk/skunk/surrogate/test/org/apache/river/container/PropertiesFileReaderTest.java
river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/ClasspathFilterParserTest.java
river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/config.xml
Modified: river/jtsk/skunk/surrogate/build.xml
URL:
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/build.xml?rev=1165466&r1=1165465&r2=1165466&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/build.xml (original)
+++ river/jtsk/skunk/surrogate/build.xml Tue Sep 6 01:02:19 2011
@@ -156,5 +156,24 @@
<produces dir="src/org/apache/river/container/config"
includes="*.java" />
</xjc>
</target>
+
+ <target name="-post-jar">
+ <antcall target="-build-testroot" inheritall="true"/>
+ </target>
+
+ <target name="-build-testroot">
+ <property name="build.testroot" value="${basedir}/build/testroot"/>
+ <mkdir dir="${build.testroot}"/>
+ <copy toDir="${build.testroot}">
+ <fileset dir="${basedir}/testfiles/testroot"/>
+ </copy>
+ <mkdir dir="${build.testroot}/lib"/>
+ <copy toDir="${build.testroot}/lib">
+ <fileset dir="${basedir}/dist/lib">
+ <include name="jsk-*.jar"/>
+ <include name="commons-*.jar"/>
+ </fileset>
+ </copy>
+ </target>
</project>
Modified: river/jtsk/skunk/surrogate/nbproject/project.properties
URL:
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/nbproject/project.properties?rev=1165466&r1=1165465&r2=1165466&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/nbproject/project.properties (original)
+++ river/jtsk/skunk/surrogate/nbproject/project.properties Tue Sep 6 01:02:19
2011
@@ -1,97 +1,97 @@
-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.ApacheCommonsLogging-1_1_1.classpath}:\
- ${libs.ApacheCommonsVFS-1_0.classpath}:\
- ${libs.ApacheRiverLib.classpath}:\
- ${libs.ApacheRiverPlatform.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.6
-javac.target=1.6
-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=web
-jnlp.codebase.url=$$$$codebase
-jnlp.descriptor=application
-jnlp.enabled=false
-jnlp.mixed.code=default
-jnlp.offline-allowed=false
-jnlp.signed=false
-jnlp.signing=
-jnlp.signing.alias=
-jnlp.signing.keystore=
-main.class=org.apache.river.container.Bootstrap
-manifest.file=manifest.mf
-meta.inf.dir=${src.dir}/META-INF
-mkdist.disabled=false
-platform.active=JDK_1.6
-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
+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.ApacheCommonsLogging-1_1_1.classpath}:\
+ ${libs.ApacheCommonsVFS-1_0.classpath}:\
+ ${libs.ApacheRiverLib.classpath}:\
+ ${libs.ApacheRiverPlatform.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.6
+javac.target=1.6
+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=web
+jnlp.codebase.url=$$$$codebase
+jnlp.descriptor=application
+jnlp.enabled=false
+jnlp.mixed.code=default
+jnlp.offline-allowed=false
+jnlp.signed=false
+jnlp.signing=
+jnlp.signing.alias=
+jnlp.signing.keystore=
+main.class=org.apache.river.container.Bootstrap
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+mkdist.disabled=false
+platform.active=JDK_1.6
+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=-classpath lib/RiverSurrogate.jar
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
Added:
river/jtsk/skunk/surrogate/src/org/apache/river/container/FileSuffixSelector.java
URL:
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/FileSuffixSelector.java?rev=1165466&view=auto
==============================================================================
---
river/jtsk/skunk/surrogate/src/org/apache/river/container/FileSuffixSelector.java
(added)
+++
river/jtsk/skunk/surrogate/src/org/apache/river/container/FileSuffixSelector.java
Tue Sep 6 01:02:19 2011
@@ -0,0 +1,50 @@
+/*
+ * 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 FileSuffixSelector implements FileSelector {
+ private String suffix=null;
+
+ public FileSuffixSelector(String s) {
+ suffix=s;
+ }
+
+ public boolean includeFile(FileSelectInfo fileInfo) throws Exception {
+ if (fileInfo.getFile().getType()!=FileType.FILE) {
+ return false;
+ }
+ if (! fileInfo.getFile().getName().getExtension().equals(suffix)) {
+ return false;
+ }
+ return true;
+ }
+
+ public boolean traverseDescendents(FileSelectInfo fileInfo) throws
Exception {
+ return false;
+ }
+
+}
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=1165466&r1=1165465&r2=1165466&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
Tue Sep 6 01:02:19 2011
@@ -43,5 +43,7 @@ public interface FileUtility {
*/
public FileObject getProfileDirectory() throws IOException;
+ public FileObject getLibDirectory() 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=1165466&r1=1165465&r2=1165466&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
Tue Sep 6 01:02:19 2011
@@ -54,4 +54,10 @@ public class FileUtilityImpl implements
public void init() throws FileSystemException {
fsm=VFS.getManager();
}
+
+ @Override
+ public FileObject getLibDirectory() throws IOException {
+ FileObject profileDir = fsm.resolveFile(Strings.LIB);
+ return profileDir;
+ }
}
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=1165466&r1=1165465&r2=1165466&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
Tue Sep 6 01:02:19 2011
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-/* TODO: - Rework FileUtility to use commons-vfs */
/* TODO: - Complete deployment of items that are in the deployment
directory.
*/
@@ -27,7 +26,10 @@ 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.river.container.classloading.VirtualFileSystemClassLoader;
+import org.apache.river.container.codebase.CodebaseContext;
+import org.apache.river.container.codebase.CodebaseHandler;
/**
*
@@ -39,8 +41,8 @@ public class StarterServiceDeployer {
@Injected private FileUtility fileUtility=null;
@Injected private ClassLoader systemClassLoader=null;
@Name private String myName=null;
-
- @Injected()
+ @Injected private CodebaseHandler codebaseHandler=null;
+ @Injected
private String deploymentDirectory=null;
@Injected(Strings.STARTER_SERVICE_DEPLOYER_PROPERTIES)
@@ -70,7 +72,7 @@ public class StarterServiceDeployer {
/* Go through the deployment directory looking for services to deploy.
*/
FileObject[] serviceArchives=
- deploymentDirectoryFile.findFiles(new
ServiceStarterArchiveFileSelector());
+ deploymentDirectoryFile.findFiles(new
FileSuffixSelector(Strings.SSAR));
if (serviceArchives!=null) {
deployServiceArchives(serviceArchives);
}
@@ -90,7 +92,7 @@ public class StarterServiceDeployer {
*/
for (FileObject archiveFile : serviceArchives) {
try {
- deployService(archiveFile);
+ deployServiceArchive(archiveFile);
} catch (Throwable t) {
log.log(Level.WARNING, MessageNames.FAILED_DEPLOY_SERVICE,
archiveFile.toString());
log.log(Level.WARNING, MessageNames.EXCEPTION_THROWN, t);
@@ -98,16 +100,60 @@ public class StarterServiceDeployer {
}
}
- private void deployService(FileObject serviceJar) {
+ private void deployServiceArchive(FileObject serviceArchive) throws
IOException {
+ FileObject serviceRoot=
+ serviceArchive.getFileSystem().getFileSystemManager()
+ .createVirtualFileSystem(serviceArchive);
+ deployService(serviceRoot);
+ }
+
+ private void deployService(FileObject serviceRoot) throws IOException {
/* Create the service classloader. */
VirtualFileSystemClassLoader cl=
new VirtualFileSystemClassLoader(null, systemClassLoader);
/* Include platform jars from the container's lib directory. */
+ String
platformJarSpec=configProperties.getProperty(Strings.PLATFORM_JARS);
+ 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);
+ for (FileObject jarFile : jarFiles) {
+ cl.addClassPathEntry(libDir, jarFile.getName().getBaseName());
+ }
+ /* Create a codebase context. */
+ 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);
+ 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);
+ 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. */
+ // 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?
+
/* Launch the 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=1165466&r1=1165465&r2=1165466&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 Tue
Sep 6 01:02:19 2011
@@ -35,19 +35,26 @@ public class Strings {
DEFAULT_DISCOVERY_CONTEXT = "defaultDiscoveryContext",
DOT=".",
DOT_CLASS=".class",
+ DOT_JAR=".jar",
DOT_PROPERTIES=".properties",
DOT_SSAR=".ssar",
EMPTY = "",
FILE_UTILITY="fileUtility",
INIT_COMPLETE="initComplete",
+ LIB="lib",
+ LIB_DL="lib-dl",
NAME="name",
+ PLATFORM_JARS="platformJars",
+ PLATFORM_CODEBASE="platformCodebase",
PROFILE = "profile",
PROFILE_DIR="profileDirectory",
PUT = "put",
+ SPACE=" ",
SSAR="ssar",
SET = "set",
SLASH="/",
STARTER_SERVICE_DEPLOYER_PROPERTIES="service-starter.properties",
+ SYSTEM_CLASS_LOADER="systemClassLoader",
TYPE="type",
WHITESPACE_SEPARATORS=" \t\n\r",
WORK="work";
Added:
river/jtsk/skunk/surrogate/src/org/apache/river/container/SystemClassloaderInitializer.java
URL:
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/SystemClassloaderInitializer.java?rev=1165466&view=auto
==============================================================================
---
river/jtsk/skunk/surrogate/src/org/apache/river/container/SystemClassloaderInitializer.java
(added)
+++
river/jtsk/skunk/surrogate/src/org/apache/river/container/SystemClassloaderInitializer.java
Tue Sep 6 01:02:19 2011
@@ -0,0 +1,18 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.apache.river.container;
+
+/**
+ This class simply sets the systemClassLoader property in the context.
+ * @author trasukg
+ */
+public class SystemClassloaderInitializer {
+ @Injected private Context context=null;
+
+ @Init
+ public void init() {
+ context.put(Strings.SYSTEM_CLASS_LOADER,
this.getClass().getClassLoader().getParent());
+ }
+}
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=1165466&r1=1165465&r2=1165466&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 Tue
Sep 6 01:02:19 2011
@@ -17,6 +17,10 @@
*/
package org.apache.river.container;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
/**
*
* @author trasukg
@@ -41,4 +45,12 @@ public class Utils {
return sb.toString();
}
+ public static String[] splitOnWhitespace(String input) {
+ List<String> strings=new ArrayList<String>();
+ StringTokenizer tok=new StringTokenizer(Strings.WHITESPACE_SEPARATORS);
+ while (tok.hasMoreTokens()) {
+ strings.add(tok.nextToken());
+ }
+ return (String[]) strings.toArray(new String[0]);
+ }
}
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=1165466&r1=1165465&r2=1165466&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
Tue Sep 6 01:02:19 2011
@@ -85,6 +85,7 @@ TOKEN :
matchedToken.image=image.toString();
}
| < COMMA: "," >
+| < COLON: ":" >
| < LPAREN: "(" >
| < RPAREN: ")" >
}
@@ -94,6 +95,14 @@ void cpExpression() #cpExpression:
log.fine("cpExpression()");
}
{
+ cpClause() ( <COLON> cpClause())*
+}
+
+void cpClause() #cpClause:
+{
+ log.fine("cpClause()");
+}
+{
symbol() [ <LPAREN> filterExpression() <RPAREN>]
}
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=1165466&r1=1165465&r2=1165466&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
Tue Sep 6 01:02:19 2011
@@ -19,6 +19,8 @@ package org.apache.river.container.class
import java.io.Reader;
import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
import java.util.logging.Logger;
import org.apache.river.container.LocalizedRuntimeException;
import org.apache.river.container.MessageNames;
@@ -28,44 +30,55 @@ import org.apache.river.container.Messag
* @author trasukg
*/
public class ClasspathFilterBuilder {
- private static final Logger
log=Logger.getLogger(ClasspathFilterBuilder.class.getName());
- public ClasspathFilter parseToFilter(String input) {
+ private static final Logger log =
Logger.getLogger(ClasspathFilterBuilder.class.getName());
+
+ public List<ClasspathFilter> parseToFilters(String input) {
try {
Reader r = new StringReader(input);
ClasspathExpressionParser parser = new
ClasspathExpressionParser(r);
parser.cpExpression();
ASTcpExpression expression = (ASTcpExpression)
parser.jjtree.popNode();
- /* First node is the jar name. Subsequent nodes are the filter
- conditions.
- */
- ClasspathFilter cpf = new ClasspathFilter();
- cpf.setJarName(expression.jjtGetChild(0).toString());
- for (int i=1; i<expression.jjtGetNumChildren(); i++) {
- Node node=expression.jjtGetChild(i);
- if (node instanceof ASTsymbol) {
- String
resourceName=VirtualFileSystemClassLoader.classToResourceName(node.toString());
- log.info("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() + "'");
- Acceptor acc=new ResourceAcceptor(node.toString());
- cpf.getAcceptors().add(acc);
- }
- }
- /* If there were no filter clauses, hence no acceptors, allow all
- patterns.
- */
- if (cpf.getAcceptors().isEmpty()) {
- cpf.getAcceptors().add(new AllAcceptor());
+ List<ClasspathFilter> filters = new ArrayList<ClasspathFilter>();
+ for (int i = 0; i < expression.jjtGetNumChildren(); i++) {
+ ASTcpClause clause = (ASTcpClause) expression.jjtGetChild(i);
+ ClasspathFilter cpf = makeFilter(clause);
+ filters.add(cpf);
}
- return cpf;
+ return filters;
} catch (ParseException ex) {
throw new LocalizedRuntimeException(MessageNames.BUNDLE_NAME,
MessageNames.BAD_CLASSPATH_EXPR,
- new Object[] { input, ex.getMessage()});
+ new Object[]{input, ex.getMessage()});
+ }
+ }
+
+ public ClasspathFilter makeFilter(ASTcpClause expression) {
+ /* First node is the jar name. Subsequent nodes are the filter
+ conditions.
+ */
+ ClasspathFilter cpf = new ClasspathFilter();
+ cpf.setJarName(expression.jjtGetChild(0).toString());
+ for (int i = 1; i < expression.jjtGetNumChildren(); i++) {
+ Node node = expression.jjtGetChild(i);
+ if (node instanceof ASTsymbol) {
+ String resourceName =
VirtualFileSystemClassLoader.classToResourceName(node.toString());
+ log.info("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() + "'");
+ Acceptor acc = new ResourceAcceptor(node.toString());
+ cpf.getAcceptors().add(acc);
+ }
+ }
+ /* If there were no filter clauses, hence no acceptors, allow all
+ patterns.
+ */
+ if (cpf.getAcceptors().isEmpty()) {
+ cpf.getAcceptors().add(new AllAcceptor());
}
+ return cpf;
}
}
Modified:
river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/VirtualFileSystemClassLoader.java
URL:
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/VirtualFileSystemClassLoader.java?rev=1165466&r1=1165465&r2=1165466&view=diff
==============================================================================
---
river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/VirtualFileSystemClassLoader.java
(original)
+++
river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/VirtualFileSystemClassLoader.java
Tue Sep 6 01:02:19 2011
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.river.container.classloading;
import java.io.IOException;
@@ -31,20 +30,18 @@ import org.apache.commons.vfs.FileUtil;
import org.apache.river.container.LocalizedRuntimeException;
import org.apache.river.container.MessageNames;
-
/**
*
* @author trasukg
*/
public class VirtualFileSystemClassLoader extends URLClassLoader {
- private FileObject fileSystemRoot=null;
-
- private List<ClasspathEntry> classpathEntries=new
ArrayList<ClasspathEntry>();
+ private FileObject fileSystemRoot = null;
+ private List<ClasspathEntry> classpathEntries = new
ArrayList<ClasspathEntry>();
public VirtualFileSystemClassLoader(FileObject fileSystemRoot, ClassLoader
parent) {
super(new URL[0], parent);
- this.fileSystemRoot=fileSystemRoot;
+ this.fileSystemRoot = fileSystemRoot;
}
public static String classToResourceName(String name) {
@@ -52,35 +49,50 @@ public class VirtualFileSystemClassLoade
return resourceName;
}
- void addClassPathEntry(String fileName) {
-
- addClassPathEntry(fileSystemRoot, fileName);
- }
-
- void addClassPathEntry(FileObject fileRoot, String fileName) {
-
+ /**
+ Add the given classpath to this classloader, based on the default root
supplied at
+ construction time.
+ @param classPath
+ */
+ public void addClassPathEntry(String classPath) {
+
+ addClassPathEntry(fileSystemRoot, classPath);
+ }
+
+ /**
+ Add the given classpath to this classloader, based on the given fileRoot.
+ The classpath can contain multiple entries, separated by colons, e.g.
+ 'jsk-platform.jar:jsk-lib.jar'.<br>
+ Each entry can either be a jar file or a jar file with a list of classes
that the
+ jar file can be used to provide. For instance,
'surrogate.jar(org.apache.ABC, org.apache.DEF)'.
+
+ @param fileRoot
+ @param classPath
+ */
+ public void addClassPathEntry(FileObject fileRoot, String classPath) {
+
try {
/* Classpath entry is a jar file with filter expressions that can
- be understood by ClasspathFilterBuilder. */
+ be understood by ClasspathFilterBuilder. */
/* Create a nested file system from it and add it to the file
objects.
*/
- ClasspathFilter filter=new
ClasspathFilterBuilder().parseToFilter(fileName);
-
- FileObject entryObject = fileRoot.resolveFile(filter.getJarName());
- FileObject entryFileSystem=
- fileRoot.getFileSystem().getFileSystemManager()
- .createFileSystem(entryObject);
- classpathEntries.add(new ClasspathEntry(filter, entryFileSystem));
+ List<ClasspathFilter> filters = new
ClasspathFilterBuilder().parseToFilters(classPath);
+ for (ClasspathFilter filter : filters) {
+ FileObject entryObject =
fileRoot.resolveFile(filter.getJarName());
+ FileObject entryFileSystem =
+
fileRoot.getFileSystem().getFileSystemManager().createFileSystem(entryObject);
+ classpathEntries.add(new ClasspathEntry(filter,
entryFileSystem));
+ }
} catch (FileSystemException ex) {
- throw new LocalizedRuntimeException(ex, MessageNames.BUNDLE_NAME,
MessageNames.INVALID_CLASSPATH_ENTRY, fileName);
+ throw new LocalizedRuntimeException(ex, MessageNames.BUNDLE_NAME,
MessageNames.INVALID_CLASSPATH_ENTRY, classPath);
}
}
/**
- Find a resource by searching through all the classpath entries that have
- been set up.
- @param name
- @return
+ Find a resource by searching through all the classpath entries that have
+ been set up.
+ @param name
+ @return
*/
@Override
public URL findResource(String name) {
@@ -93,16 +105,16 @@ public class VirtualFileSystemClassLoade
}
/**
- Find the file object for a resource by searching through all the classpath
- entries that have been set up.
- @param name
- @return
+ Find the file object for a resource by searching through all the classpath
+ entries that have been set up.
+ @param name
+ @return
*/
public FileObject findResourceFileObject(String name) {
- for (ClasspathEntry cpEntry:classpathEntries) {
+ for (ClasspathEntry cpEntry : classpathEntries) {
try {
FileObject fo = cpEntry.resolveFile(name);
- if (fo!=null &&fo.isReadable()) {
+ if (fo != null && fo.isReadable()) {
return fo;
}
} catch (FileSystemException ex) {
@@ -114,15 +126,15 @@ public class VirtualFileSystemClassLoade
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
- String resourceName=classToResourceName(name);
- FileObject resourceFileObject=findResourceFileObject(resourceName);
- if (resourceFileObject==null) {
- throw new ClassNotFoundException(name+"(" + resourceName + ")");
+ String resourceName = classToResourceName(name);
+ FileObject resourceFileObject = findResourceFileObject(resourceName);
+ if (resourceFileObject == null) {
+ throw new ClassNotFoundException(name + "(" + resourceName + ")");
}
try {
- byte[] bytes=FileUtil.getContent(resourceFileObject);
- return defineClass(name,bytes,0,bytes.length);
- } catch(IOException ioe) {
+ byte[] bytes = FileUtil.getContent(resourceFileObject);
+ return defineClass(name, bytes, 0, bytes.length);
+ } catch (IOException ioe) {
throw new ClassNotFoundException(name, ioe);
}
}
@@ -135,7 +147,7 @@ public class VirtualFileSystemClassLoade
* @param codebase
*/
public void setCodebase(URL[] codebase) {
- if (codebase == null || codebase.length==0) {
+ if (codebase == null || codebase.length == 0) {
codebaseURLs = new URL[]{};
return;
}
@@ -156,10 +168,8 @@ public class VirtualFileSystemClassLoade
public URL[] getURLs() {
return codebaseURLs;
}
-
/** Stores the codebase that will be returned as the codebase annotation.
*
*/
private URL codebaseURLs[] = new URL[0];
-
}
Added:
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/CodebaseContext.java
URL:
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/CodebaseContext.java?rev=1165466&view=auto
==============================================================================
---
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/CodebaseContext.java
(added)
+++
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/CodebaseContext.java
Tue Sep 6 01:02:19 2011
@@ -0,0 +1,44 @@
+/*
+ * 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.codebase;
+
+import java.net.URL;
+import org.apache.commons.vfs.FileObject;
+
+/**
+ Context that interfaces with the codebase handling system to make
+ codebase files available for remote download, and supply the codebase
+ annotation that should be used by the classloader.
+ * @author trasukg
+ */
+public interface CodebaseContext {
+
+ /**
+ Add the given file into the exported set.
+ @param file
+ */
+ public void addFile(FileObject file);
+
+ /**
+ Get a string that represents the codebase annotation that should be
returned
+ by the classloader to correspond to this set.
+ @return
+ */
+ public URL[] getCodebaseAnnotation();
+
+}
Added:
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/CodebaseHandler.java
URL:
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/CodebaseHandler.java?rev=1165466&view=auto
==============================================================================
---
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/CodebaseHandler.java
(added)
+++
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/CodebaseHandler.java
Tue Sep 6 01:02:19 2011
@@ -0,0 +1,37 @@
+/*
+ * 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.codebase;
+
+/**
+ Interface for a component that makes codebase files available for download.
+ * @author trasukg
+ */
+public interface CodebaseHandler {
+ /**
+ Create a codebase context.
+ @return
+ */
+ public CodebaseContext createContext();
+
+ /**
+ Destroy a codebase context, cancelling the provision of all the files
+ contained in that context.
+ @param context
+ */
+ public void destroyContext(CodebaseContext context);
+}
Added:
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/DummyCodebaseHandler.java
URL:
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/DummyCodebaseHandler.java?rev=1165466&view=auto
==============================================================================
---
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/DummyCodebaseHandler.java
(added)
+++
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/DummyCodebaseHandler.java
Tue Sep 6 01:02:19 2011
@@ -0,0 +1,60 @@
+/*
+ * 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.codebase;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.vfs.FileObject;
+
+/**
+ *
+ * @author trasukg
+ */
+public class DummyCodebaseHandler implements CodebaseHandler {
+
+ @Override
+ public CodebaseContext createContext() {
+ return new DummyContext();
+ }
+
+ @Override
+ public void destroyContext(CodebaseContext context) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ private class DummyContext implements CodebaseContext {
+
+ List<URL> urls=new ArrayList<URL>();
+
+ @Override
+ public void addFile(FileObject file) {
+ try {
+ urls.add(new URL("http://unknown.com/" +
file.getName().getBaseName()));
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @Override
+ public URL[] getCodebaseAnnotation() {
+ return urls.toArray(new URL[0]);
+ }
+
+ }
+}
Added:
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/Strings.java
URL:
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/Strings.java?rev=1165466&view=auto
==============================================================================
---
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/Strings.java
(added)
+++
river/jtsk/skunk/surrogate/src/org/apache/river/container/codebase/Strings.java
Tue Sep 6 01:02:19 2011
@@ -0,0 +1,27 @@
+/*
+ * 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.codebase;
+
+/**
+ *
+ * @author trasukg
+ */
+public class Strings {
+ public static final String
+ DUMMY_ANNOTATION="http://www.demo.com/unknown.jar";
+}
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=1165466&r1=1165465&r2=1165466&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
Tue Sep 6 01:02:19 2011
@@ -44,6 +44,7 @@
<cfg:property name="deploymentDirectory" value="deploy"/>
+ <cfg:component
class="org.apache.river.container.SystemClassloaderInitializer"/>
<cfg:component
class="org.apache.river.container.CommandLineArgumentParser"/>
<cfg:component class="org.apache.river.container.MBeanRegistrar"/>
<cfg:component class="org.apache.river.container.ShutdownListener"/>
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=1165466&r1=1165465&r2=1165466&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
Tue Sep 6 01:02:19 2011
@@ -125,5 +125,10 @@ public class PropertiesFileReaderTest {
return fo;
}
+
+ @Override
+ public FileObject getLibDirectory() throws IOException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
}
Modified:
river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/ClasspathFilterParserTest.java
URL:
http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/ClasspathFilterParserTest.java?rev=1165466&r1=1165465&r2=1165466&view=diff
==============================================================================
---
river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/ClasspathFilterParserTest.java
(original)
+++
river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/ClasspathFilterParserTest.java
Tue Sep 6 01:02:19 2011
@@ -61,7 +61,8 @@ public class ClasspathFilterParserTest {
@Test
public void testParser() throws Exception {
ClasspathFilterBuilder UUT = new ClasspathFilterBuilder();
- ClasspathFilter cpf = UUT.parseToFilter("reggie.jar(org.apache.Abc)");
+ List<ClasspathFilter> cpfs =
UUT.parseToFilters("reggie.jar(org.apache.Abc)");
+ ClasspathFilter cpf=cpfs.get(0);
assertEquals("reggie.jar", cpf.getJarName());
List<Acceptor> actual = cpf.getAcceptors();
assertEquals("Wrong number of filter clauses.", 1, actual.size());
@@ -77,7 +78,8 @@ public class ClasspathFilterParserTest {
public void testParserOnMultipleClasses() throws Exception {
ClasspathFilterBuilder UUT = new ClasspathFilterBuilder();
String jarSpec = "reggie.jar(org.apache.ABC, org.apache.DEF)";
- ClasspathFilter cpf = UUT.parseToFilter(jarSpec);
+ List<ClasspathFilter> cpfs = UUT.parseToFilters(jarSpec);
+ ClasspathFilter cpf=cpfs.get(0);
assertEquals("reggie.jar", cpf.getJarName());
List<Acceptor> actual = cpf.getAcceptors();
assertEquals("Wrong number of filter clauses.", 2, actual.size());
@@ -97,7 +99,8 @@ public class ClasspathFilterParserTest {
public void testFilterAcceptance() throws Exception {
ClasspathFilterBuilder UUT = new ClasspathFilterBuilder();
String jarSpec = "reggie.jar(org.apache.ABC, org.apache.DEF,
\"META-INF/*\")";
- ClasspathFilter cpf = UUT.parseToFilter(jarSpec);
+ List<ClasspathFilter> cpfs = UUT.parseToFilters(jarSpec);
+ ClasspathFilter cpf=cpfs.get(0);
assertEquals("reggie.jar", cpf.getJarName());
assertTrue(cpf.acceptsResource("org/apache/ABC.class"));
assertFalse(cpf.acceptsResource("org/apache/XYZ.class"));
@@ -113,7 +116,8 @@ public class ClasspathFilterParserTest {
public void testFilterAcceptanceWithJarOnly() throws Exception {
ClasspathFilterBuilder UUT = new ClasspathFilterBuilder();
String jarSpec = "reggie.jar";
- ClasspathFilter cpf = UUT.parseToFilter(jarSpec);
+ List<ClasspathFilter> cpfs = UUT.parseToFilters(jarSpec);
+ ClasspathFilter cpf=cpfs.get(0);
assertEquals("reggie.jar", cpf.getJarName());
assertTrue(cpf.acceptsResource("org/apache/ABC.class"));
assertTrue(cpf.acceptsResource("org/apache/XYZ.class"));
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=1165466&r1=1165465&r2=1165466&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/config.xml
(original)
+++ river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/config.xml
Tue Sep 6 01:02:19 2011
@@ -11,13 +11,21 @@
<cfg:container-config xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:cfg='http://river.apache.org/xml/ns/container/config/1.0'
xsi:schemaLocation='http://river.apache.org/xml/ns/container/config/1.0
file:/home/trasukg/development/surrogate/src/schemas/config.xsd'>
- <cfg:classpath>../../dist/RiverSurrogate.jar</cfg:classpath>
+ <cfg:classpath>
+ lib/RiverSurrogate.jar
+ lib/commons-logging-1.1.1.jar
+ lib/commons-vfs.jar
+ lib/jsk-platform.jar
+ lib/jsk-dl.jar
+ lib/jsk-resources.jar
+ </cfg:classpath>
<cfg:property name="deploymentDirectory" value="deploy"/>
<cfg:discovery-context name="default">
<cfg:group>TEST</cfg:group>
</cfg:discovery-context>
+ <cfg:component
class="org.apache.river.container.codebase.DummyCodebaseHandler"/>
<cfg:component class="org.apache.river.container.StarterServiceDeployer"/>
</cfg:container-config>
Added:
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=1165466&view=auto
==============================================================================
---
river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/service-starter.properties
(added)
+++
river/jtsk/skunk/surrogate/testfiles/testroot/profile/default/service-starter.properties
Tue Sep 6 01:02:19 2011
@@ -0,0 +1,24 @@
+# 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.
+ #
+
+platformJars=\
+ jsk-platform.jar\
+ :jsk-lib.jar\
+ :jsk-resources.jar\
+ :RiverSurrogate.jar(org.apache.river.container.liaison.*, "META-INF/*")
+
+platformCodebase=jsk-dl.jar