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/06/06 07:21:47 UTC

svn commit: r1132526 - in /river/jtsk/skunk/surrogate: ./ src/org/apache/river/container/ src/org/apache/river/container/classloading/ src/org/apache/river/container/security/ test/org/apache/river/container/ test/org/apache/river/container/classloadin...

Author: gtrasuk
Date: Mon Jun  6 05:21:46 2011
New Revision: 1132526

URL: http://svn.apache.org/viewvc?rev=1132526&view=rev
Log:
Continued work on the container classloading infrastructure.  Began work on ClasspathFilterBuilder and associated classpath expression parser (see org.apache.river.container.classloading for info).  Also added correct license header to several files.

Added:
    river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/
    river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ASTNode.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathExpressionParser.jjt
    river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathFilter.java
    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/classloading/VirtualFileSystemClassLoader.java
      - copied, changed from r1131212, river/jtsk/skunk/surrogate/src/org/apache/river/container/VirtualFileSystemClassLoader.java
    river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/
    river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/ClasspathFilterParserTest.java
    river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/VFSClassLoaderTest.java
      - copied, changed from r1131212, river/jtsk/skunk/surrogate/test/org/apache/river/container/VFSClassLoaderTest.java
Removed:
    river/jtsk/skunk/surrogate/src/org/apache/river/container/VirtualFileSystemClassLoader.java
    river/jtsk/skunk/surrogate/test/org/apache/river/container/VFSClassLoaderTest.java
Modified:
    river/jtsk/skunk/surrogate/build.xml
    river/jtsk/skunk/surrogate/src/org/apache/river/container/DeploymentListener.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/MBeanRegistrar.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/ShowContextToConsole.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/security/ASTNode.java
    river/jtsk/skunk/surrogate/src/org/apache/river/container/security/PermissionFileParser.jjt
    river/jtsk/skunk/surrogate/test/org/apache/river/container/CommonsVFSTest.java
    river/jtsk/skunk/surrogate/test/org/apache/river/container/security/PermissionFileParserTest.java
    river/jtsk/skunk/surrogate/test/org/apache/river/surrogate/sample/SampleSurrogate.java
    river/jtsk/skunk/surrogate/testfiles/hosted-reggie.properties

Modified: river/jtsk/skunk/surrogate/build.xml
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/build.xml?rev=1132526&r1=1132525&r2=1132526&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/build.xml (original)
+++ river/jtsk/skunk/surrogate/build.xml Mon Jun  6 05:21:46 2011
@@ -125,6 +125,7 @@
 
     <!-- Pre-compiler target to run javacc against our parser sources. -->
     <target name="-pre-compile">
+        <!-- Do parser generation for the Permissions parser -->
         <mkdir dir="${build.generated.sources.dir}/org/apache/river/container/security"/>
         <jjtree
             target="${basedir}/src/org/apache/river/container/security/PermissionFileParser.jjt"
@@ -136,6 +137,19 @@
             outputdirectory="${build.generated.sources.dir}/org/apache/river/container/security"
             javacchome="${libs.JavaCC.src}"
         />
+
+        <!-- Do parser generation for the classpath filter expression parser. -->
+        <mkdir dir="${build.generated.sources.dir}/org/apache/river/container/classloading"/>
+        <jjtree
+            target="${basedir}/src/org/apache/river/container/classloading/ClasspathExpressionParser.jjt"
+            outputdirectory="${build.generated.sources.dir}/org/apache/river/container/classloading"
+            javacchome="${libs.JavaCC.src}"
+        />
+        <javacc
+            target="${build.generated.sources.dir}/org/apache/river/container/classloading/ClasspathExpressionParser.jj"
+            outputdirectory="${build.generated.sources.dir}/org/apache/river/container/classloading"
+            javacchome="${libs.JavaCC.src}"
+        />
         <mkdir dir="${build.generated.sources.dir}/org/apache/river/container/config" />
         <xjc destdir="${build.generated.sources.dir}" schema="src/schemas/config.xsd"
         package="org.apache.river.container.config">

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/DeploymentListener.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/DeploymentListener.java?rev=1132526&r1=1132525&r2=1132526&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/DeploymentListener.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/DeploymentListener.java Mon Jun  6 05:21:46 2011
@@ -1,8 +1,20 @@
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * 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;
 
 /**

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/MBeanRegistrar.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/MBeanRegistrar.java?rev=1132526&r1=1132525&r2=1132526&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/MBeanRegistrar.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/MBeanRegistrar.java Mon Jun  6 05:21:46 2011
@@ -1,8 +1,20 @@
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * 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.lang.management.ManagementFactory;

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=1132526&r1=1132525&r2=1132526&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 Mon Jun  6 05:21:46 2011
@@ -42,6 +42,7 @@ public class MessageNames {
 
     public static final String
             ANNOTATED_OBJECT_DEPLOYER_HAS_UNRESOLVED_DEPENDENCIES="annotatedObjectDeployerHasUnresolvedDependencies",
+            BAD_CLASSPATH_EXPR="badClasspathExpression",
             BAD_MEMBER_FOR_INJECTED_ANNOTATION="badMemberForInjectedAnnotation",
             BAD_MEMBER_FOR_NAME_ANNOTATION="badMemberForNameAnnotation",
             CONFIG_FILE="configFile",

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=1132526&r1=1132525&r2=1132526&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 Mon Jun  6 05:21:46 2011
@@ -19,6 +19,7 @@
 annotatedObjectDeployerHasUnresolvedDependencies=Initialization failed because \
 one or more dependencies flagged with @Injected or @Name annotations \
 are unresolved.
+badClasspathExpression=Bad Classpath Expression {0} {1}.
 badMemberForInjectedAnnotation=@Injected annotation must be applied to a field or\
  setter method only: Member {1} on class {0} doesn't qualify.
 badMemberForNameAnnotation=@Name annotation must be applied to a String field or\

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=1132526&r1=1132525&r2=1132526&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 Mon Jun  6 05:21:46 2011
@@ -1,8 +1,20 @@
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.apache.river.container;
+ * 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 java.io.FileInputStream;

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=1132526&r1=1132525&r2=1132526&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 Mon Jun  6 05:21:46 2011
@@ -1,8 +1,20 @@
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * 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.util.ResourceBundle;

Added: river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ASTNode.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ASTNode.java?rev=1132526&view=auto
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ASTNode.java (added)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ASTNode.java Mon Jun  6 05:21:46 2011
@@ -0,0 +1,84 @@
+/*
+ * 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.classloading;
+
+/**
+ *
+ * @author trasukg
+ */
+public class ASTNode extends SimpleNode {
+
+    private Object value=null;
+
+    public Object getValue() {
+        return value;
+    }
+
+    public void setValue(Object value) {
+        this.value = value;
+    }
+
+    
+    public ASTNode(int i) {
+        super(i);
+    }
+
+    public ASTNode(ClasspathExpressionParser p, int i) {
+        super(p, i);
+    }
+
+    public String getName() {
+        return ClasspathExpressionParserTreeConstants.jjtNodeName[id];
+    }
+
+    public String toString() {
+        if (id==ClasspathExpressionParserTreeConstants.JJTSYMBOL) {
+            return getValue().toString();
+        }
+        String childList = childList();
+        if (!Strings.EMPTY.equals(childList)) {
+            return getName() + " " + childList;
+        } else {
+            return getName();
+        }
+    }
+
+    public String childList() {
+        StringBuffer sb = new StringBuffer();
+        if (jjtGetNumChildren() != 0) {
+            boolean first = true;
+            for (int i = 0; i < jjtGetNumChildren(); i++) {
+                if (!first) {
+                    sb.append(" ");
+                } else {
+                    first = false;
+                }
+                String childStr = jjtGetChild(i).toString();
+                if (childStr.indexOf(Strings.SPACE) != -1) {
+                    sb.append(Strings.LPAREN);
+                    sb.append(childStr);
+                    sb.append(Strings.RPAREN);
+                } else {
+                    sb.append(jjtGetChild(i).toString());
+                }
+            }
+        }
+        return sb.toString();
+    }
+}

Added: 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=1132526&view=auto
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathExpressionParser.jjt (added)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathExpressionParser.jjt Mon Jun  6 05:21:46 2011
@@ -0,0 +1,101 @@
+options {
+  LOOKAHEAD = 1;
+  CHOICE_AMBIGUITY_CHECK = 2;
+  OTHER_AMBIGUITY_CHECK = 1;
+  STATIC = false;
+  DEBUG_PARSER = false;
+  DEBUG_LOOKAHEAD = false;
+  DEBUG_TOKEN_MANAGER = false;
+  ERROR_REPORTING = true;
+  JAVA_UNICODE_ESCAPE = false;
+  UNICODE_INPUT = false;
+  IGNORE_CASE = false;
+  USER_TOKEN_MANAGER = false;
+  USER_CHAR_STREAM = false;
+  BUILD_PARSER = true;
+  BUILD_TOKEN_MANAGER = true;
+  SANITY_CHECK = true;
+  BUILD_NODE_FILES = true;
+  FORCE_LA_CHECK = false;
+  MULTI = true;
+  NODE_DEFAULT_VOID = true;
+  VISITOR = true;
+  NODE_CLASS= "ASTNode";
+}
+
+PARSER_BEGIN(ClasspathExpressionParser)
+
+package org.apache.river.container.classloading;
+
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+
+import java.util.logging.Logger;
+
+public class ClasspathExpressionParser {
+	private static final Logger log=
+		Logger.getLogger(ClasspathExpressionParser.class.getName());
+
+
+}
+PARSER_END(ClasspathExpressionParser)
+
+/* WHITE SPACE */
+
+SKIP :
+{
+  " "
+| "\t"
+| "\n"
+| "\r"
+| "\f"
+| <"//" (~["\n","\r"])* ("\n" | "\r" | "\r\n")>
+| <"/*" (~["*"])* "*" ("*" | ~["*","/"] (~["*"])* "*")* "/">}
+
+TOKEN :
+{
+  	< SYMBOL:
+		["A"-"Z", "a"-"z", "_"] (["0"-"9", "A"-"Z", "a"-"z", ".", "_"])*>
+|  	< COMMA: "," >
+|       < LPAREN: "(" >
+|       < RPAREN: ")" >
+}
+
+void cpExpression() #cpExpression:
+{
+    log.fine("cpExpression()");
+}
+{
+    symbol() [ <LPAREN> filterExpression() <RPAREN>]
+}
+
+void filterExpression():
+{
+    log.fine("filterExpression()");
+}
+{
+    filterClause() ( <COMMA> filterClause())*
+}
+
+void filterClause():
+{
+    log.fine("filterClause()");
+}
+{
+    symbol()
+}
+
+
+void symbol() #symbol:
+{
+        log.fine("symbol()");
+        Token t=null;
+}
+{
+        t=<SYMBOL> {
+            jjtThis.setValue(t.image);
+        }
+}
+
+

Added: river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathFilter.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathFilter.java?rev=1132526&view=auto
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathFilter.java (added)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathFilter.java Mon Jun  6 05:21:46 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.classloading;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author trasukg
+ */
+public class ClasspathFilter {
+    private String jarName=null;
+
+    void setJarName(String s) {
+        jarName=s;
+    }
+
+    public String getJarName() {
+        return jarName;
+    }
+
+    List<String> acceptConditions=new ArrayList<String>();
+
+    public List<String> getAcceptConditions() {
+        return acceptConditions;
+    }
+}

Added: 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=1132526&view=auto
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathFilterBuilder.java (added)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/ClasspathFilterBuilder.java Mon Jun  6 05:21:46 2011
@@ -0,0 +1,52 @@
+/*
+ * 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.classloading;
+
+import java.io.Reader;
+import java.io.StringReader;
+import org.apache.river.container.LocalizedRuntimeException;
+import org.apache.river.container.MessageNames;
+
+/**
+ *
+ * @author trasukg
+ */
+public class ClasspathFilterBuilder {
+
+    public ClasspathFilter parseToFilter(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++) {
+                cpf.getAcceptConditions().add(expression.jjtGetChild(i).toString());
+            }
+            return cpf;
+        } catch (ParseException ex) {
+            throw new LocalizedRuntimeException(MessageNames.BUNDLE_NAME,
+                    MessageNames.BAD_CLASSPATH_EXPR,
+                    new Object[] { input, ex.getMessage()});
+        }
+    }
+}

Added: 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=1132526&view=auto
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/Strings.java (added)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/Strings.java Mon Jun  6 05:21:46 2011
@@ -0,0 +1,38 @@
+/*
+ * 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.classloading;
+
+/**
+ *
+ * @author trasukg
+ */
+public class Strings {
+    public static final String
+            EMPTY="",
+            GET_NAME="getName",
+            GET_VALUE="getValue",
+            ID="id",
+            JJT_GET_CHILD="jjtGetChild",
+            JJT_GET_NUM_CHILDREN="jjtGetNumChildren",
+            JJTLITERAL="JJTLITERAL",
+            JJTSYMBOL="JJTSYMBOL",
+            LPAREN="(",
+            RPAREN=")",
+            SPACE=" ";
+}

Copied: river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/VirtualFileSystemClassLoader.java (from r1131212, 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/classloading/VirtualFileSystemClassLoader.java?p2=river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/VirtualFileSystemClassLoader.java&p1=river/jtsk/skunk/surrogate/src/org/apache/river/container/VirtualFileSystemClassLoader.java&r1=1131212&r2=1132526&rev=1132526&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/VirtualFileSystemClassLoader.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/classloading/VirtualFileSystemClassLoader.java Mon Jun  6 05:21:46 2011
@@ -1,9 +1,22 @@
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * 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;
+package org.apache.river.container.classloading;
 
 import java.io.IOException;
 import java.net.URL;
@@ -15,6 +28,9 @@ import java.util.logging.Logger;
 import org.apache.commons.vfs.FileObject;
 import org.apache.commons.vfs.FileSystemException;
 import org.apache.commons.vfs.FileUtil;
+import org.apache.river.container.LocalizedRuntimeException;
+import org.apache.river.container.MessageNames;
+import org.apache.river.container.Strings;
 
 /**
  *

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/security/ASTNode.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/security/ASTNode.java?rev=1132526&r1=1132525&r2=1132526&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/security/ASTNode.java (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/security/ASTNode.java Mon Jun  6 05:21:46 2011
@@ -18,6 +18,11 @@
 
 package org.apache.river.container.security;
 
+import org.apache.river.container.security.PermissionFileParser;
+import org.apache.river.container.security.PermissionFileParserTreeConstants;
+import org.apache.river.container.security.SimpleNode;
+import org.apache.river.container.security.Strings;
+
 /**
  *
  * @author trasukg

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/security/PermissionFileParser.jjt
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/security/PermissionFileParser.jjt?rev=1132526&r1=1132525&r2=1132526&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/security/PermissionFileParser.jjt (original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/security/PermissionFileParser.jjt Mon Jun  6 05:21:46 2011
@@ -35,6 +35,7 @@ import java.util.List;
 
 import java.util.logging.Logger;
 
+
 public class PermissionFileParser {
 	private static final Logger log=
 		Logger.getLogger(PermissionFileParser.class.getName());

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=1132526&r1=1132525&r2=1132526&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 Mon Jun  6 05:21:46 2011
@@ -1,8 +1,20 @@
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * 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;

Added: 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=1132526&view=auto
==============================================================================
--- river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/ClasspathFilterParserTest.java (added)
+++ river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/ClasspathFilterParserTest.java Mon Jun  6 05:21:46 2011
@@ -0,0 +1,63 @@
+/*
+ * 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.classloading;
+
+import java.util.List;
+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 ClasspathFilterParserTest {
+
+    public ClasspathFilterParserTest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+
+    @Before
+    public void setUp() {
+    }
+
+    @After
+    public void tearDown() {
+    }
+
+    @Test
+    public void testParser() throws Exception {
+        ClasspathFilterBuilder UUT=new ClasspathFilterBuilder();
+        ClasspathFilter cpf=UUT.parseToFilter("reggie.jar(org.apache.Abc)");
+        assertEquals("reggie.jar", cpf.getJarName());
+        List<String> actual=cpf.getAcceptConditions();
+        assertEquals("Wrong number of filter clauses.", 1, actual.size());
+        assertEquals("Filter condition", "org.apache.Abc", actual.get(0));
+    }
+}
\ No newline at end of file

Copied: river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/VFSClassLoaderTest.java (from r1131212, 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/classloading/VFSClassLoaderTest.java?p2=river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/VFSClassLoaderTest.java&p1=river/jtsk/skunk/surrogate/test/org/apache/river/container/VFSClassLoaderTest.java&r1=1131212&r2=1132526&rev=1132526&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/test/org/apache/river/container/VFSClassLoaderTest.java (original)
+++ river/jtsk/skunk/surrogate/test/org/apache/river/container/classloading/VFSClassLoaderTest.java Mon Jun  6 05:21:46 2011
@@ -1,15 +1,32 @@
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.apache.river.container;
+ * 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.classloading;
 
+import org.apache.river.container.classloading.VirtualFileSystemClassLoader;
 import java.net.URL;
 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.apache.river.container.Bootstrap;
+import org.apache.river.container.LocalizedRuntimeException;
+import org.apache.river.container.MessageNames;
+import org.apache.river.container.Utils;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -153,9 +170,28 @@ public class VFSClassLoaderTest {
 
     }
 
+    /**
+     We can setup filtered classloading, such that the classloader only
+     supplies classes that match a particular pattern for a given jar.
+     This facility prevents having to create a "subset" jar for cases where
+     we want to have only a few classes loaded by a child class loader.
+     In particular, this is to allow the container liaison classes to be
+     resident in the application's (surrogate's) classloader even though the
+     classes are included in the source tree of the main project (hence in
+     RiverSurrogate.jar).
+     @throws Exception
+     */
     @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)");
+        VirtualFileSystemClassLoader UUT =
+                new VirtualFileSystemClassLoader(reggieModuleRoot, extensionLoader);
+        UUT.addClassPathEntry("reggie.jar(com.sun.jini.reggie.ClassMapper)");
+        /* We should now be able to load the ClassMapper class, but nothing
+        else.
+        */
+        Class classMapperClass=UUT.loadClass("com.sun.jini.reggie.ClassMapper");
+        assertNotNull("loaded class was null", classMapperClass);
+
+        fail("Finish writing the can'tload case");
     }
 }

Modified: river/jtsk/skunk/surrogate/test/org/apache/river/container/security/PermissionFileParserTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/test/org/apache/river/container/security/PermissionFileParserTest.java?rev=1132526&r1=1132525&r2=1132526&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/test/org/apache/river/container/security/PermissionFileParserTest.java (original)
+++ river/jtsk/skunk/surrogate/test/org/apache/river/container/security/PermissionFileParserTest.java Mon Jun  6 05:21:46 2011
@@ -1,8 +1,20 @@
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * 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.security;
 
 import java.io.InputStream;

Modified: river/jtsk/skunk/surrogate/test/org/apache/river/surrogate/sample/SampleSurrogate.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/test/org/apache/river/surrogate/sample/SampleSurrogate.java?rev=1132526&r1=1132525&r2=1132526&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/test/org/apache/river/surrogate/sample/SampleSurrogate.java (original)
+++ river/jtsk/skunk/surrogate/test/org/apache/river/surrogate/sample/SampleSurrogate.java Mon Jun  6 05:21:46 2011
@@ -1,8 +1,20 @@
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * 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.surrogate.sample;
 
 import net.jini.surrogate.HostContext;

Modified: river/jtsk/skunk/surrogate/testfiles/hosted-reggie.properties
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/testfiles/hosted-reggie.properties?rev=1132526&r1=1132525&r2=1132526&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/testfiles/hosted-reggie.properties (original)
+++ river/jtsk/skunk/surrogate/testfiles/hosted-reggie.properties Mon Jun  6 05:21:46 2011
@@ -1,5 +1,21 @@
-# To change this template, choose Tools | Templates
-# and open the template in the editor.
+
+ # 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.
+ #
+
 classpath=reggie.jar
 codebase=reggie-dl.jar
 startClass=com.sun.jini.reggie.TransientRegistrarImpl