#!/bin/sh - # $Id: s_java_stat,v 1.33 2004/09/28 19:30:36 mjc Exp $ # # Build the Java files. msgjava="/*- * DO NOT EDIT: automatically built by dist/s_java_stat. * * See the file LICENSE for redistribution information. * * Copyright (c) 2002-2004 * Sleepycat Software. All rights reserved. */" s=/tmp/__java.sed t=/tmp/__java c=/tmp/__javajnic u1=/tmp/__javautil1 u2=/tmp/__javautil2 trap 'rm -f $t $c $u1 $u2; exit 0' 0 1 2 3 13 15 # Script to convert DB C structure declarations into Java declarations. jclass() { cat > $s < $s <> $c echo " jobject jobj, struct __db_$1 *statp) {" >> $c sed -n -f $s < ../dbinc/db.in >> $c echo ' return (0);' >> $c echo '}' >> $c } jni_fieldid_decls() { cat > $s <> $u1 } jni_fieldids() { cat > $s <> $u2 } # Script to convert DB C structure declarations into a toString method body jclass_toString() { cat > $s < $t jclass_jni $1 $2 f=../java/src/com/sleepycat/db/$j_class.java cmp $t $f > /dev/null 2>&1 || (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f) } echo "$msgjava" > $c > $u1 > $u2 stat_class bt_stat BtreeStats " extends DatabaseStats" stat_class h_stat HashStats " extends DatabaseStats" stat_class lock_stat LockStats stat_class log_stat LogStats stat_class mpool_fstat CacheFileStats stat_class mpool_stat CacheStats stat_class qam_stat QueueStats " extends DatabaseStats" stat_class rep_stat ReplicationStats stat_class seq_stat SequenceStats # Build TransactionStats.java - special because of embedded Active class (echo "$msgjava" echo echo 'package com.sleepycat.db;' echo echo 'import com.sleepycat.db.internal.DbUtil;' echo echo "public class TransactionStats" echo '{' echo " // no public constructor" echo " protected TransactionStats() {}" echo echo -n " public static class Active {" echo " // no public constructor" echo " protected Active() {}" jclass txn_active " " jclass_toString txn_active Active " " echo ' };' jclass txn_stat jclass_toString txn_stat TransactionStats echo '}' echo '// end of TransactionStats.java') > $t jclass_jni txn_stat __dbj_fill_txn_stat jclass_jni txn_active __dbj_fill_txn_active f=../java/src/com/sleepycat/db/TransactionStats.java cmp $t $f > /dev/null 2>&1 || (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f) mv $c $t f=../libdb_java/java_stat_auto.c cmp $t $f > /dev/null 2>&1 || (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f) f=../libdb_java/java_util.i sed '/BEGIN-STAT-FIELD-DECLS/q' < $f > $t cat $u1 >> $t sed -n '/END-STAT-FIELD-DECLS/,/BEGIN-STAT-FIELDS/p' < $f >> $t cat $u2 >> $t sed -n '/END-STAT-FIELDS/,$p' < $f >> $t cmp $t $f > /dev/null 2>&1 || (echo "Building $f" && rm -f $f && cp $t $f && chmod 644 $f)