#!/bin/sh - # $Id$ # # Build the Java files. msgjava="/*- * Automatically built by dist/s_java_stat. * Only the javadoc comments can be edited. * * See the file LICENSE for redistribution information. * * Copyright (c) 2002, 2010 Oracle and/or its affiliates. All rights reserved. */" s=/tmp/__java.sed t=/tmp/__java t0=/tmp/__java0 c=/tmp/__javajnic u1=/tmp/__javautil1 u2=/tmp/__javautil2 trap 'rm -f $s $t $t0 $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 < ../src/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 < $t0 f=../lang/java/src/com/sleepycat/db/$j_class.java ./s_javadoc_merge $f $t0 > $t cmp $t $f > /dev/null 2>&1 || (echo "Building $f" && rm -f $f && cp $t $f) jclass_jni $1 $2 } echo "$msgjava" > $c > $u1 > $u2 stat_class bt_stat BtreeStats " extends DatabaseStats" # Build CompactStats.java - not purely a statistics class, but close enough to # share this code. (cat < $t0 f=../lang/java/src/com/sleepycat/db/CompactStats.java ./s_javadoc_merge $f $t0 > $t cmp $t $f > /dev/null 2>&1 || (echo "Building $f" && rm -f $f && cp $t $f) jclass_jni compact __dbj_fill_compact 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 mutex_stat MutexStats stat_class qam_stat QueueStats " extends DatabaseStats" stat_class rep_stat ReplicationStats "" " import com.sleepycat.db.internal.DbConstants; " " public static final int REP_CLIENT = DbConstants.DB_REP_CLIENT; public static final int REP_MASTER = DbConstants.DB_REP_MASTER; public static final int REP_NONE = 0;" stat_class repmgr_stat ReplicationManagerStats 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 " /* package */ TransactionStats() {}" echo echo " public static class Active {" echo " // no public constructor" echo " /* package */ Active() {}" jclass txn_active " " jclass_toString txn_active Active " " echo ' };' jclass txn_stat jclass_toString txn_stat TransactionStats echo '}') > $t0 f=../lang/java/src/com/sleepycat/db/TransactionStats.java ./s_javadoc_merge $f $t0 > $t cmp $t $f > /dev/null 2>&1 || (echo "Building $f" && rm -f $f && cp $t $f) jclass_jni txn_stat __dbj_fill_txn_stat jclass_jni txn_active __dbj_fill_txn_active mv $c $t f=../lang/java/libdb_java/java_stat_auto.c cmp $t $f > /dev/null 2>&1 || (echo "Building $f" && rm -f $f && cp $t $f) f=../lang/java/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)