| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. - |
| 2 | |
| 3 | # The examples must be hand-edited after they are copied: |
| 4 | # - add EnvironmentConfig.setInitializeCache(true), setInitializeLocking(true) |
| 5 | # - add DatabaseConfig.setType(DatabaseType.BTREE) |
| 6 | # - add null databaseName param to openDatabase() and openSecondaryDatabase() |
| 7 | |
| 8 | COPY_EXAMPLES=0 |
| 9 | |
| 10 | JEDIR=$1 |
| 11 | if [scip-shell system . . `[`. $# -eq 1 ] ; then |
| 12 | DBDIR=.. |
| 13 | else |
| 14 | DBDIR=$2 |
| 15 | fi |
| 16 | |
| 17 | if [scip-shell system . . `[`. ! -d "$DBDIR/src/dbinc" -o ! -f "$JEDIR/build.xml" ] ; then |
| 18 | echoscip-shell system . . echo. >&2 "Usage $0 /path/to/je [ /path/to/db ]" |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | JEDIR=$(cd "$JEDIR" ; /bin/pwdscip-shell filesystem . . `/bin/pwd`.) |
| 23 | DBDIR=$(cd "$DBDIR" ; /bin/pwdscip-shell filesystem . . `/bin/pwd`.) |
| 24 | |
| 25 | JESRC="$JEDIR/src" |
| 26 | JETEST="$JEDIR/test" |
| 27 | JEEXAMPLES="$JEDIR/examples" |
| 28 | DBSRC="$DBDIR/lang/java/src" |
| 29 | DBTEST="$DBDIR/test/java/compat/src" |
| 30 | DBEXAMPLES="$DBDIR/examples/java/src" |
| 31 | DIRMATCH="com/sleepycat/\(\(asm\)\|\(bind\)\|\(collections\)\|\(persist\)\|\(util\)\)/" |
| 32 | EXAMPLESMATCH="^\./\(\(collections\)\|\(persist\)\)" |
| 33 | |
| 34 | cd "$JESRC" |
| 35 | for d in `findscip-shell system . . find. . -type d | grepscip-shell system . . grep. -v CVS | grepscip-shell system . . grep. $DIRMATCH` ; do |
| 36 | #echo "$DBSRC/$d" |
| 37 | mkdirscip-shell system . . mkdir. -p "$DBSRC/$d" |
| 38 | done |
| 39 | cd "$JETEST" |
| 40 | for d in `findscip-shell system . . find. . -type d | grepscip-shell system . . grep. -v CVS | grepscip-shell system . . grep. $DIRMATCH` ; do |
| 41 | #echo "$DBTEST/$d" |
| 42 | mkdirscip-shell system . . mkdir. -p "$DBTEST/$d" |
| 43 | done |
| 44 | if [scip-shell system . . `[`. $COPY_EXAMPLES -eq 1 ] ; then |
| 45 | cd "$JEEXAMPLES" |
| 46 | for d in `findscip-shell system . . find. . -type d | grepscip-shell system . . grep. -v CVS | grepscip-shell system . . grep. $EXAMPLESMATCH` ; do |
| 47 | #echo "$DBEXAMPLES/$d" |
| 48 | mkdirscip-shell system . . mkdir. -p "$DBEXAMPLES/$d" |
| 49 | done |
| 50 | fi |
| 51 | |
| 52 | E1='s/com\.sleepycat\.je\.utilint\.IdentityHashMap/java.util.IdentityHashMap/g' |
| 53 | E2='s/com\.sleepycat\.je/com.sleepycat.db/g' |
| 54 | E3='/<!-- begin JE only -->/,/<!-- end JE only -->/dscip-shell filesystem . . `/<!-- begin JE only -->/,/<!-- end JE only -->/d`.' |
| 55 | E4='s/LockConflictException/DeadlockException/g' |
| 56 | E5='s/$Id:.*\$/$Id$/' |
| 57 | E6='s/TransactionGettingStarted/gsg_txn\/JAVA/' |
| 58 | E7='s/OperationFailureException/DatabaseException/g' |
| 59 | EXCLUDESRC="\(\(ClassEnhancerTask\)\|\(DeletedClassException\)\|\(IncompatibleClassException\)\|\(StoreExistsException\)\|\(StoreNotFoundException\)\)" |
| 60 | EXCLUDETESTS="\(\(ConvertAndAddTest\)\|\(DevolutionTest\)\|\(TestVersionCompatibility\)\|\(XACollectionTest\)\|\(AddNewSecKeyToAbstractClassTest\)\|\(EvolveProxyClassTest\)\|\(CreateAbstractClassData\)\|\(CreateSecDupsWithoutComparator\)\|\(CreateSecDupsWithoutComparatorEvolve\)\|\(CreateOldVersionBigDecimalDb\)\|\(CreateStringDataDB\)\|\(ProxyToSimpleTypeTest\)\|\(SecondaryDupOrderEvolveTest\)\|\(SecondaryDupOrderTest\)\|\(StringFormatCompatibilityTest\)\)" |
| 61 | |
| 62 | cd "$JESRC" |
| 63 | for f in `findscip-shell system . . find. . -name '*.java' -o -name "package.html" | grepscip-shell system . . grep. $DIRMATCH | grepscip-shell system . . grep. -v $EXCLUDESRC` ; do |
| 64 | #echo $DBSRC/$f |
| 65 | sedscip-shell system . . sed. -e "$E1" -e "$E2" -e "$E3" -e "$E4" -e "$E5" -e "$E6" -e "$E7" < $f \ |
| 66 | > $DBSRC/$f.sed.out |
| 67 | diffscip-shell system . . diff. -q -I "\$\Id:" $DBSRC/$f $DBSRC/$f.sed.out || \ |
| 68 | mv -f $DBSRC/$f.sed.out $DBSRC/$f |
| 69 | rmscip-shell system . . rm. -f $DBSRC/$f.sed.out |
| 70 | done |
| 71 | |
| 72 | cd "$JETEST" |
| 73 | for f in `findscip-shell system . . find. . -name '*.java' -o -name "*.java.original" | grepscip-shell system . . grep. $DIRMATCH | grepscip-shell system . . grep. -v $EXCLUDETESTS` \ |
| 74 | ; do |
| 75 | #echo $DBTEST/$f |
| 76 | sedscip-shell system . . sed. -e "$E1" -e "$E2" -e "$E3" -e "$E4" -e "$E5" -e "$E6" -e "$E7" < $f \ |
| 77 | > $DBTEST/$f.sed.out |
| 78 | diffscip-shell system . . diff. -q -I "\$\Id:" $DBTEST/$f $DBTEST/$f.sed.out || \ |
| 79 | mv -f $DBTEST/$f.sed.out $DBTEST/$f |
| 80 | rmscip-shell system . . rm. -f $DBTEST/$f.sed.out |
| 81 | done |
| 82 | |
| 83 | if [scip-shell system . . `[`. $COPY_EXAMPLES -eq 1 ] ; then |
| 84 | cd "$JEEXAMPLES" |
| 85 | for f in `findscip-shell system . . find. . -name '*.java' | grepscip-shell system . . grep. $EXAMPLESMATCH` ; do |
| 86 | #echo $DBEXAMPLES/$f |
| 87 | sedscip-shell system . . sed. -e "$E1" -e "$E2" -e "$E3" -e "$E4" -e "$E5" -e "$E6" -e "$E7" < $f \ |
| 88 | > $DBEXAMPLES/$f.sed.out |
| 89 | diffscip-shell system . . diff. -q -I "\$\Id:" $DBEXAMPLES/$f $DBEXAMPLES/$f.sed.out || \ |
| 90 | mv -f $DBEXAMPLES/$f.sed.out $DBEXAMPLES/$f |
| 91 | rmscip-shell system . . rm. -f $DBEXAMPLES/$f.sed.out |
| 92 | done |
| 93 | fi |
| 94 | |
| 95 | exit 0 |