Added Files:
.cvsignore LICENSE README build.xml cdg.jar grouper-cli.sh
test-cli.sh
Log Message:
* mark old contrib items as deprecated
* import a modified version of cdg into contrib
--- /dev/null
+++ contrib/cdg/README
@@ -0,0 +1,65 @@
+
+# README
+
+com.devclue.grouper (cdg) is a collection of Java classes (both
+libraries and applications) that use the [Grouper][0] API to assist in
+initializing and maintaining a Groups Registry.
+
+This is a modified version of cdg for inclusion with Grouper.
+
+See <http://grouper.devclue.com/> for the original version and updates.
+
+$Id: README,v 1.1 2005/12/16 21:47:59 blair Exp $
+
+---
+
+## Build
+
+Checkout Grouper from anonymous CVS, build the source and export the
+database schema.
+
+ % ant grouper
+
+Initialize the Groups Registry.
+
+ % ant grouper-cvs-db-init
+
+Build cdg.
+
+ % ant build
+
+## Test
+
+Test the Java classes as libraries.
+
+ % ant test
+
+Test the Java classes as applications.
+
+ % ./test-cli.sh
+
+
+## Use
+
+Information on using cdg as either a library or an application can be
+found in the javadoc located in `doc/html`.
+
+ % ant jar
+
+Builds a jar of all the cdg classes.
+
+To use cdg, either as an application or a library, you will need to
+include the following in your classpath:
+* com.devclue.grouper.jar
+* Grouper.jar
+* Grouper-lib.jar
+* Grouper configuration directory
+* `java/lib/ostermillerutils.jar` if using _cdg.subject.CSV2JDBC_
+
+See `doc/html/index.html` for information on how to use cdg as either a
+library or an application.
+
+---
+
+[0]: <http://middleware.internet2.edu/dir/groups/grouper/>
+
--- /dev/null
+++ contrib/cdg/LICENSE
@@ -0,0 +1,5 @@
+Copyright (C) 2005 blair christensen.
+All Rights Reserved.
+
+You may use and distribute under the same terms as Grouper itself
+
--- /dev/null
+++ contrib/cdg/.cvsignore
@@ -0,0 +1,4 @@
+# $Id: .cvsignore,v 1.1 2005/12/16 21:47:59 blair Exp $
+*.log
+build
+grouper
--- /dev/null
+++ contrib/cdg/grouper-cli.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+#
+# Copyright (C) 2005 blair christensen.
+# All Rights Reserved.
+#
+# You may use and distribute under the same terms as Grouper itself.
+#
+
+#
+# A minimal-and-crude wrapper for running cdg (and presumably
+# grouper) command line apps.
+#
+# $Id: grouper-cli.sh,v 1.1 2005/12/16 21:47:59 blair Exp $
+#
+
+# Set some defaults
+CDG_BASE=${CDG_BASE-`pwd`}
+GROUPER_BASE=${GROUPER_BASE-`pwd`/../../grouper}
+
+_append_classpath () {
+ cp=""
+ jars=`ls ${2}/*.jar 2>/dev/null`
+ if [ "$jars" ]
+ then
+ cp=${1}
+ for f in ${jars}
+ do
+ cp=${cp}:${f}
+ done
+ else
+ cp=${1}:${2}
+ fi
+ echo ${cp}
+}
+
+_build_classpath() {
+ for d in \
+ ${CLASSPATH} \
+ ${CDG_JAR} \
+ ${GROUPER_JAR} \
+ ${GROUPER_LIB_JAR} \
+ ${GROUPER_BASE}/build/grouper ${GROUPER_BASE}/lib \
+ ${CDG_BASE}/build/cdg ${CDG_BASE}/lib \
+ ${GROUPER_BASE}/conf
+ do
+ if [ -e "$d" ]
+ then
+ cp=`_append_classpath ${cp} ${d}`
+ fi
+ done
+ if [ "$cp" ]; then
+ cp="-classpath $cp"
+ fi
+ echo ${cp}
+}
+
+if [ "$1" ]
+then
+ if [ ${1} = "-h" -o ${1} = "-help" -o ${1} = "--help" ]
+ then
+ cat <<EO_HELP
+USAGE: ${0} <class> [arguments]
+
+The following environmental variables are used:
+
+ CDG_BASE: cdg distribution base. Defaults to the current working
+ directory if not set. Is used to help find the cdg class files
+ and third party libraries.
+
+ CDG_JAR: Path to cdg jar. Has precedence over CDG_BASE.
+
+ GROUPER_BASE: Grouper distribution base. Defaults to the current
+ working directory if not set. Is used to help find Grouper
+ class files, third party libraries and configuration.
+
+ GROUPER_JAR: Path to Grouper jar. Has precedence over GROUPER_BASE.
+
+ GROUPER_LIB_JAR: Path to Grouper third party libraries jar. Has
+ precedence over GROUPER_BASE.
+
+EO_HELP
+ else
+ java `_build_classpath` ${@}
+ fi
+else
+ echo >&2 "USAGE: ${0} <class> [arguments]"
+ exit 1
+fi
+
+exit $?
+
--- /dev/null
+++ contrib/cdg/test-cli.sh
@@ -0,0 +1,139 @@
+#!/bin/sh
+
+#
+# Copyright (C) 2005 blair christensen.
+# All Rights Reserved.
+#
+# You may use and distribute under the same terms as Grouper itself.
+#
+
+#
+# Run cdg CLI tests. It wasn't behaving properly within Ant and
+# JUnit and I don't feel debugging that at this moment.
+#
+# $Id: test-cli.sh,v 1.1 2005/12/16 21:47:59 blair Exp $
+#
+
+#
+# TODO
+# * CSV2JDBC
+#
+
+GROUPER="../../"
+
+cp=build/cdg:build/tests
+cp=${cp}:${GROUPER}/build/grouper:${GROUPER}/conf
+for f in lib/*.jar ${GROUPER}/lib/*.jar
+do
+ cp=${cp}:${f}
+done
+
+_fail () {
+ out=`_run ${@}`
+ if [ $? -eq 0 ]
+ then
+ echo >&2 "Fail: ${@} - ${out}"
+ exit 1
+ else
+ echo "Pass: ${@} - ${out}"
+ fi
+}
+
+_pass () {
+ out=`_run ${@}`
+ if [ $? -ne 0 ]
+ then
+ echo >&2 "Fail: ${@} - ${out}"
+ exit 1
+ else
+ echo "Pass: ${@} - ${out}"
+ fi
+}
+
+_run () {
+ java -classpath ${cp} com.devclue.grouper.${@} 2>&1
+}
+
+# make sure we are up-to-date
+ant build
+
+# Reset the registry
+_run registry.Reset
+
+# Now run a series of tests
+_fail stem.StemQ com
+_pass stem.StemAdd com
+_pass stem.StemQ com
+_fail stem.StemQ net
+_fail stem.StemQ org
+_pass stem.StemAdd org
+_pass stem.StemQ org
+_fail stem.StemQ com:devclue
+_pass stem.StemAdd com devclue
+_pass stem.StemQ com:devclue
+_fail stem.StemQ net:devclue
+_fail stem.StemQ org:devclue
+_pass stem.StemAdd org devclue
+_pass stem.StemQ org:devclue
+_fail group.GroupQ com
+_fail group.GroupQ com:devclue
+_pass group.GroupAdd com devclue
+_pass group.GroupQ com:devclue
+_fail group.GroupQ com:devclue:grouper
+_pass group.GroupAdd com:devclue grouper
+_pass group.GroupQ com:devclue:grouper
+_fail group.GroupQ net:devclue
+_fail group.GroupAdd net devclue
+_pass subject.SubjectQ GrouperSystem
+_pass subject.SubjectQ GrouperSystem application
+_fail subject.SubjectQ com
+_fail subject.SubjectQ com group
+_pass subject.SubjectQ com:devclue
+_pass subject.SubjectQ com:devclue group
+_pass subject.SubjectQ com:devclue:grouper
+_pass subject.SubjectQ com:devclue:grouper group
+_fail subject.SubjectQ id0
+_pass subject.SubjectAdd id0
+_pass subject.SubjectQ id0
+_fail subject.SubjectQ id1
+_pass subject.SubjectAdd id1
+_pass subject.SubjectQ id1
+_pass member.MemberAdd com:devclue id0
+_pass member.MemberAdd com:devclue:grouper com:devclue group
+_pass member.MemberQ id0
+_pass member.MemberQ id0 person
+_fail member.MemberQ id1
+_fail member.MemberQ id1 person
+_fail member.MemberQ com:devclue
+_pass member.MemberQ com:devclue group
+_fail member.MemberQ com:devclue:grouper
+_fail member.MemberQ com:devclue:grouper group
+cat <<EO_CSV_PASS | _pass subject.CSV2JDBC
+id10,person
+id11,person,this is id11
+id12,person,this is id12,uid12
+EO_CSV_PASS
+_pass subject.SubjectQ id10
+_pass subject.SubjectQ id10 person
+_pass subject.SubjectQ id11
+_pass subject.SubjectQ id11 person
+_pass subject.SubjectQ id12
+_pass subject.SubjectQ id12 person
+cat <<EO_FAIL_SHORT | _fail subject.CSV2JDBC
+id13
+EO_FAIL_SHORT
+_fail subject.SubjectQ id13
+_fail subject.SubjectQ id13 person
+cat <<EO_FAIL_LONG | _fail subject.CSV2JDBC
+id14,person,this is id14,uid14,chaff
+EO_FAIL_LONG
+_fail subject.SubjectQ id14
+_fail subject.SubjectQ id14 person
+cat <<EO_FAIL_TYPE | _fail subject.CSV2JDBC
+id15,type
+EO_FAIL_TYPE
+_fail subject.SubjectQ id15
+_fail subject.SubjectQ id15 person
+
+exit $?
+
--- /dev/null
+++ contrib/cdg/build.xml
@@ -0,0 +1,127 @@
+<!-- $Id: build.xml,v 1.1 2005/12/16 21:47:59 blair Exp $ -->
+
+<project name="com.devclue.grouper" default="build" basedir=".">
+
+ <!-- Global Properties -->
+ <property name="app.name" value="cdg"/>
+ <property name="build" value="${basedir}/build"/>
+ <property name="build.cdg" value="${build}/cdg"/>
+ <property name="build.javadoc" value="doc/html"/>
+ <property name="build.javadoc" value="doc/html"/>
+ <property name="build.test" value="${build}/tests"/>
+ <property name="impl.vendor" value="devclue.com"/>
+ <property name="impl.url" value="http://grouper.devclue.com/"/>
+ <property name="impl.version" value="0.2"/>
+ <property name="javadoc.packages" value="com.devclue.grouper.*,com.devclue.grouper.*.*"/>
+ <property name="src" value="${basedir}/src"/>
+ <property name="src.cdg" value="${src}/cdg"/>
+ <property name="src.test" value="${src}/tests"/>
+ <property name="test.data" value="${src.test}/data"/>
+
+ <property name="log.build" value="${basedir}/build.log"/>
+ <property name="log.test.build" value="${basedir}/test-build.log"/>
+ <property name="log.test.run" value="${basedir}/test.log"/>
+ <!-- Global Properties -->
+
+ <!-- init -->
+ <target name="init">
+ <tstamp />
+ <mkdir dir="${build.cdg}" />
+ <mkdir dir="${build.test}" />
+ <dirname property="src.grouper" file="../../PROJECT_LAYOUT"/>
+ <path id="project.classpath">
+ <pathelement path="${classpath}"/>
+ <fileset dir="${basedir}/lib">
+ <include name="**/*.jar"/>
+ </fileset>
+ <pathelement location="${build.cdg}"/>
+ <pathelement location="${build.test}"/>
+ <pathelement location="${test.data}"/>
+ <!-- Grouper -->
+ <pathelement location="${src.grouper}/build/grouper"/>
+ <pathelement location="${src.grouper}/conf"/>
+ <fileset dir="${src.grouper}/lib">
+ <include name="**/*.jar"/>
+ </fileset>
+ <!-- Grouper -->
+ </path>
+ </target>
+ <!-- init -->
+
+ <!-- build -->
+ <target name="build" depends="init">
+ <record name="${log.build}" action="start"/>
+ <javac srcdir="${src.cdg}" destdir="${build.cdg}">
+ <classpath refid="project.classpath"/>
+ </javac>
+ <record name="${log.build}" action="stop"/>
+ </target>
+ <!-- build -->
+
+ <!-- clean -->
+ <target name="clean">
+ <delete dir="${build}"/>
+ <delete dir="${src.grouper}"/>
+ </target>
+ <!-- clean -->
+
+ <!-- javadoc -->
+ <target name="javadoc" depends="init">
+ <javadoc sourcepath="${src.cdg}"
+ destdir="${build.javadoc}"
+ classpathref="project.classpath"
+ access="public"
+ author="true"
+ stylesheetfile="${src.grouper}/doc/stylesheet.css"
+ packagenames="${javadoc.packages}"
+ />
+ </target>
+ <!-- javadoc -->
+
+ <!-- jar -->
+ <target name="jar" depends="build">
+ <jar destfile="${basedir}/${app.name}-${DSTAMP}.jar" basedir="${build.cdg}">
+ <manifest>
+ <attribute name="Built-By" value="${user.name}"/>
+ <attribute name="Implementation-Vendor" value="${impl.vendor}"/>
+ <attribute name="Implementation-Title" value="${app.name}"/>
+ <attribute name="Implementation-Version" value="${impl.version}" />
+ <attribute name="Implementation-URL" value="${impl.url}" />
+ </manifest>
+ </jar>
+ <copy
+ file="${basedir}/${app.name}-${DSTAMP}.jar"
+ tofile="${basedir}/${app.name}.jar"/>
+ </target>
+ <!-- jar -->
+
+ <!-- test -->
+ <target name="test" depends="test-run"/>
+ <!-- test -->
+
+ <!-- test-build -->
+ <target name="test-build" depends="build">
+ <record name="${log.test.build}" action="start"/>
+ <javac srcdir="${src.test}" destdir="${build.test}">
+ <classpath refid="project.classpath"/>
+ </javac>
+ <record name="${log.test.build}" action="stop"/>
+ </target>
+ <!-- test-build -->
+
+ <!-- test-run -->
+ <target name="test-run" depends="test-build">
+ <record name="${log.test.run}" action="start"/>
+ <java fork="yes"
+ classname="junit.textui.TestRunner"
+ taskname="junit"
+ failonerror="true">
+ <arg value="test.com.devclue.grouper.TestSuiteAll"/>
+ <classpath refid="project.classpath"/>
+ </java>
+ <record name="${log.test.run}" action="stop"/>
+ </target>
+ <!-- test-run -->
+
+</project>
+