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 2010/11/24 23:53:32 UTC

svn commit: r1038858 - in /incubator/river/jtsk/skunk/surrogate: ./ docs/ nbproject/ schemas/ test/org/apache/river/container/config/

Author: gtrasuk
Date: Wed Nov 24 22:53:32 2010
New Revision: 1038858

URL: http://svn.apache.org/viewvc?rev=1038858&view=rev
Log:
Created initial schema for config file and setup XJC tasks in build.xml.

Added:
    incubator/river/jtsk/skunk/surrogate/schemas/
    incubator/river/jtsk/skunk/surrogate/schemas/config-sample.xml
    incubator/river/jtsk/skunk/surrogate/schemas/config.xsd
    incubator/river/jtsk/skunk/surrogate/test/org/apache/river/container/config/
    incubator/river/jtsk/skunk/surrogate/test/org/apache/river/container/config/ConfigurationParserTest.java
    incubator/river/jtsk/skunk/surrogate/test/org/apache/river/container/config/config-test-doc.xml
Modified:
    incubator/river/jtsk/skunk/surrogate/README
    incubator/river/jtsk/skunk/surrogate/build.xml
    incubator/river/jtsk/skunk/surrogate/docs/Security.txt
    incubator/river/jtsk/skunk/surrogate/nbproject/build-impl.xml
    incubator/river/jtsk/skunk/surrogate/nbproject/genfiles.properties
    incubator/river/jtsk/skunk/surrogate/nbproject/project.properties

Modified: incubator/river/jtsk/skunk/surrogate/README
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/surrogate/README?rev=1038858&r1=1038857&r2=1038858&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/surrogate/README (original)
+++ incubator/river/jtsk/skunk/surrogate/README Wed Nov 24 22:53:32 2010
@@ -17,3 +17,6 @@ The property file parser is generated us
 available from 'https://javacc.dev.java.net/'.  Download and unpack the tool
 to a convenient location, then create a library as above called 'JavaCC' that
 contains the javacc home directory as its 'sources' directory.
+
+The configuration file schema is bound using JAXB.  It may be necessary to ensure
+that Netbeans has the JAXB libraries defined.
\ No newline at end of file

Modified: incubator/river/jtsk/skunk/surrogate/build.xml
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/surrogate/build.xml?rev=1038858&r1=1038857&r2=1038858&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/surrogate/build.xml (original)
+++ incubator/river/jtsk/skunk/surrogate/build.xml Wed Nov 24 22:53:32 2010
@@ -72,6 +72,14 @@
 
     -->
 
+    <target name="-post-init">
+        <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
+            <classpath>
+                <path path="${libs.jaxb.classpath}" />
+            </classpath>
+        </taskdef>
+
+    </target>
     <!--
     Build the whatever sample artifacts are needed for unit testing.  In
     particular, we need a sample surrogate.
@@ -107,5 +115,10 @@
             outputdirectory="${build.generated.sources.dir}/org/apache/river/container/security"
             javacchome="${libs.JavaCC.src}"
         />
+        <mkdir dir="${build.generated.sources.dir}/org/apache/river/container/config" />
+        <xjc destdir="${build.generated.sources.dir}" schema="schemas/config.xsd"
+        package="org.apache.river.container.config">
+            <produces dir="src/org/apache/river/container/config" includes="*.java" />
+        </xjc>
     </target>
 </project>

Modified: incubator/river/jtsk/skunk/surrogate/docs/Security.txt
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/surrogate/docs/Security.txt?rev=1038858&r1=1038857&r2=1038858&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/surrogate/docs/Security.txt (original)
+++ incubator/river/jtsk/skunk/surrogate/docs/Security.txt Wed Nov 24 22:53:32 2010
@@ -17,7 +17,9 @@ Security in the Container
     - we have a more complicated class loader structure than contemplated by
     the PolicyFile provider.
     - in particular, in a Jini environment, grants to a codebase are pretty
-    meaningless.  Grants to code signed by a particular entity are OK
+    meaningless.  Grants to code signed by a particular entity are OK, but the
+    keystore setup is more appropriate at the container-admin level.  Hence the
+    'keystore' declaration in a policy file is not needed.
     - In all likelihood, we would have a policy file per application deployed
     to the container.
     - Would probably like to support a default application policy and then

Modified: incubator/river/jtsk/skunk/surrogate/nbproject/build-impl.xml
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/surrogate/nbproject/build-impl.xml?rev=1038858&r1=1038857&r2=1038858&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/surrogate/nbproject/build-impl.xml (original)
+++ incubator/river/jtsk/skunk/surrogate/nbproject/build-impl.xml Wed Nov 24 22:53:32 2010
@@ -291,15 +291,18 @@ is divided into following sections:
             <attribute default="${build.classes.dir}" name="destdir"/>
             <sequential>
                 <fail unless="javac.includes">Must set javac.includes</fail>
-                <pathconvert pathsep="," property="javac.includes.binary">
+                <pathconvert pathsep="${line.separator}" property="javac.includes.binary">
                     <path>
                         <filelist dir="@{destdir}" files="${javac.includes}"/>
                     </path>
                     <globmapper from="*.java" to="*.class"/>
                 </pathconvert>
+                <tempfile deleteonexit="true" property="javac.includesfile.binary"/>
+                <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/>
                 <delete>
-                    <files includes="${javac.includes.binary}"/>
+                    <files includesfile="${javac.includesfile.binary}"/>
                 </delete>
+                <delete file="${javac.includesfile.binary}"/>
             </sequential>
         </macrodef>
     </target>

Modified: incubator/river/jtsk/skunk/surrogate/nbproject/genfiles.properties
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/surrogate/nbproject/genfiles.properties?rev=1038858&r1=1038857&r2=1038858&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/surrogate/nbproject/genfiles.properties (original)
+++ incubator/river/jtsk/skunk/surrogate/nbproject/genfiles.properties Wed Nov 24 22:53:32 2010
@@ -3,6 +3,6 @@ build.xml.script.CRC32=8dea2037
 build.xml.stylesheet.CRC32=28e38971@1.38.2.45
 # 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=8d037bdc
-nbproject/build-impl.xml.script.CRC32=c1294c37
-nbproject/build-impl.xml.stylesheet.CRC32=f33e10ff@1.38.2.45
+nbproject/build-impl.xml.data.CRC32=26182442
+nbproject/build-impl.xml.script.CRC32=40951c41
+nbproject/build-impl.xml.stylesheet.CRC32=229523de@1.38.3.45

Modified: incubator/river/jtsk/skunk/surrogate/nbproject/project.properties
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/surrogate/nbproject/project.properties?rev=1038858&r1=1038857&r2=1038858&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/surrogate/nbproject/project.properties (original)
+++ incubator/river/jtsk/skunk/surrogate/nbproject/project.properties Wed Nov 24 22:53:32 2010
@@ -24,7 +24,8 @@ debug.test.classpath=\
 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}
@@ -38,7 +39,8 @@ javac.compilerargs=
 javac.deprecation=false
 javac.processorpath=\
     ${javac.classpath}:\
-    ${libs.JavaCC.classpath}
+    ${libs.JavaCC.classpath}:\
+    ${libs.jaxb.classpath}
 javac.source=1.5
 javac.target=1.5
 javac.test.classpath=\
@@ -58,6 +60,9 @@ 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

Added: incubator/river/jtsk/skunk/surrogate/schemas/config-sample.xml
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/surrogate/schemas/config-sample.xml?rev=1038858&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/surrogate/schemas/config-sample.xml (added)
+++ incubator/river/jtsk/skunk/surrogate/schemas/config-sample.xml Wed Nov 24 22:53:32 2010
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Document   : config-sample.xml
+    Created on : November 24, 2010, 12:11 PM
+    Author     : trasukg
+    Description:
+        Purpose of the document follows.
+-->
+
+<cfg:container-config  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+   xmlns:cfg='http://river.apache.org/xml/ns/container/config/1.0'
+   xsi:schemaLocation='http://river.apache.org/xml/ns/container/config/1.0 file:/home/trasukg/development/surrogate/schemas/config.xsd'>
+    <cfg:default-policy></cfg:default-policy>
+    <cfg:discovery-context is-default="false" id="">
+        <cfg:locator>jini://localhost/</cfg:locator>
+        <cfg:group>TestGroup</cfg:group>
+    </cfg:discovery-context>
+
+</cfg:container-config>

Added: incubator/river/jtsk/skunk/surrogate/schemas/config.xsd
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/surrogate/schemas/config.xsd?rev=1038858&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/surrogate/schemas/config.xsd (added)
+++ incubator/river/jtsk/skunk/surrogate/schemas/config.xsd Wed Nov 24 22:53:32 2010
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://river.apache.org/xml/ns/container/config/1.0"
+    xmlns:tns="http://river.apache.org/xml/ns/container/config/1.0"
+    elementFormDefault="qualified">
+    <xsd:element name="container-config">
+        <xsd:complexType>
+            <xsd:sequence>
+                <xsd:element name="default-policy" type="xsd:string"/>
+                
+                <xsd:choice minOccurs="0" maxOccurs="unbounded">
+                    <xsd:element name="discovery-context" type="tns:DiscoveryContextType"/>
+                </xsd:choice>
+            </xsd:sequence>
+        </xsd:complexType>
+    </xsd:element>
+
+    <xsd:complexType name="DiscoveryContextType">
+        <xsd:sequence>
+            <xsd:element name="locator" type="xsd:anyURI" maxOccurs="unbounded"/>
+            <xsd:element name="group" type="xsd:string" maxOccurs="unbounded"/>
+        </xsd:sequence>
+        <xsd:attribute name="is-default" type="xsd:boolean" default="false"/>
+        <xsd:attribute name="id" type="xsd:string" use="optional"/>
+    </xsd:complexType>
+</xsd:schema>

Added: incubator/river/jtsk/skunk/surrogate/test/org/apache/river/container/config/ConfigurationParserTest.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/surrogate/test/org/apache/river/container/config/ConfigurationParserTest.java?rev=1038858&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/surrogate/test/org/apache/river/container/config/ConfigurationParserTest.java (added)
+++ incubator/river/jtsk/skunk/surrogate/test/org/apache/river/container/config/ConfigurationParserTest.java Wed Nov 24 22:53:32 2010
@@ -0,0 +1,51 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.apache.river.container.config;
+
+import java.io.InputStream;
+import org.junit.After;
+import org.junit.AfterClass;
+import static org.junit.Assert.*;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+
+/**
+ *
+ * @author trasukg
+ */
+public class ConfigurationParserTest {
+
+    public ConfigurationParserTest() {
+    }
+
+    @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 testConfigFileRead() throws Exception {
+        JAXBContext ctx=JAXBContext.newInstance("org.apache.river.container.config");
+        Unmarshaller um=ctx.createUnmarshaller();
+        InputStream is=getClass().getResourceAsStream("config-test-doc.xml");
+        ContainerConfig containerConfig=(ContainerConfig) um.unmarshal(is);
+
+        assertEquals("defPolicy", containerConfig.getDefaultPolicy());
+    }
+}

Added: incubator/river/jtsk/skunk/surrogate/test/org/apache/river/container/config/config-test-doc.xml
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/surrogate/test/org/apache/river/container/config/config-test-doc.xml?rev=1038858&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/surrogate/test/org/apache/river/container/config/config-test-doc.xml (added)
+++ incubator/river/jtsk/skunk/surrogate/test/org/apache/river/container/config/config-test-doc.xml Wed Nov 24 22:53:32 2010
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Document   : config-test-doc.xml
+    Created on : November 24, 2010, 4:13 PM
+    Author     : trasukg
+    Description:
+        Purpose of the document follows.
+-->
+
+<cfg:container-config  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+   xmlns:cfg='http://river.apache.org/xml/ns/container/config/1.0'
+   xsi:schemaLocation='http://river.apache.org/xml/ns/container/config/1.0 file:/home/trasukg/development/surrogate/schemas/config.xsd'>
+    <cfg:default-policy>defPolicy</cfg:default-policy>
+    <cfg:discovery-context is-default="false" id="">
+        <cfg:locator></cfg:locator>
+        <cfg:group></cfg:group>
+    </cfg:discovery-context>
+
+</cfg:container-config>