diff --git a/.gitattributes b/.gitattributes index 1c07fd725b1dd8281a8e1a72e56521b417a53d13..a61a679d3b88806c16960521d035091f2b04d9c9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -783,8 +783,6 @@ SAS/OTB/MoM-OTDB-adapter/lib/log4j-1.2.8.jar -text SAS/OTB/MoM-OTDB-adapter/lib/xercesImpl.jar -text SAS/OTB/MoM-OTDB-adapter/lib/xml-apis.jar -text SAS/OTB/MoM-OTDB-adapter/sharedlib/jotdb.jar -text -SAS/OTB/jOTDB/src/jOTDB/jOTDBinterface.jar -text svneol=unset#unset -SAS/OTB/jOTDB/src/jOTDB/jOTDBserver.jar -text svneol=unset#unset SAS/OTB/jOTDB2/.cvsignore -text SAS/OTB/jOTDB2/How_to_build_jOTDB2.doc -text SAS/OTB/jOTDB2/make_jar.sh -text svneol=native#application/octet-stream diff --git a/SAS/OTB/jOTDB/Makefile.am b/SAS/OTB/jOTDB/Makefile.am deleted file mode 100644 index a014c15b3e0cc91454edade91ee05c7b57830868..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -SUBDIRS=src - -include $(top_srcdir)/Makefile.common diff --git a/SAS/OTB/jOTDB/bootstrap b/SAS/OTB/jOTDB/bootstrap deleted file mode 100755 index 06f18cde1dbfd6912ef7d927c4d35d25c7137a62..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/bootstrap +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -../../../autoconf_share/bootstrap ../../../autoconf_share diff --git a/SAS/OTB/jOTDB/build.xml b/SAS/OTB/jOTDB/build.xml deleted file mode 100644 index 88944006ab75a0d167979c856d3e4c3d75cb5bd3..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/build.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0"?> - -<!-- build.xml - a simple Ant buildfile --> -<project name="jOTDB Buildfile" default="compile" basedir="."> - - <!-- The directory containing source code --> - <property name="src.dir" value="src/jOTDB"/> - - <!-- Temporary build directories --> - <property name="build.dir" value="build"/> - <property name="build.classes" value="${build.dir}/classes"/> - <property name="build.lib" value="${build.dir}/lib"/> - - <!-- Target to create the build directories prior to the --> - <!-- compile target. --> - <target name="prepare"> - <mkdir dir="${build.dir}"/> - <mkdir dir="${build.classes}"/> - <mkdir dir="${build.lib}"/> - </target> - - <target name="clean" description="Remove all generated files."> - <delete dir="${build.classes}"/> - <delete dir="${build.lib}"/> - </target> - - <target name="compile" depends="prepare" - description="Compiles all source code."> - <javac srcdir="${src.dir}" destdir="${build.classes}"/> - <rmic base="${build.classes}" classname="jOTDB.jConverterAdapter"/> - <rmic base="${build.classes}" classname="jOTDB.jOTDBadapter"/> - <rmic base="${build.classes}" classname="jOTDB.jTreeMaintenanceAdapter"/> - <rmic base="${build.classes}" classname="jOTDB.jTreeValueAdapter"/> - </target> - - <target name="jar" depends="compile" - description="Generates jotdb.jar in the 'dist' directory."> - <!-- Exclude unit tests from the final JAR file --> - <jar jarfile="${build.lib}/jotdb.jar" - basedir="${build.classes}" - excludes="**/*Test.class" - manifest="${src.dir}/Manifest.txt"/> - </target> - - <target name="all" depends="clean,jar" - description="Cleans, compiles, then builds the JAR file."/> - - <target name="install" depends="jar" - description="Copies the generated jotdb.jar to the installation directory."> - <copy file="${build.lib}/jotdb.jar" todir="../../../installed/gnu_debug/lib/"/> - </target> - -</project> diff --git a/SAS/OTB/jOTDB/configure.in b/SAS/OTB/jOTDB/configure.in deleted file mode 100644 index b5c95713e223cdc65eac1a98670652dc12ccf5f7..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/configure.in +++ /dev/null @@ -1,69 +0,0 @@ -dnl -dnl Process this file with autoconf to produce a configure script. -dnl -AC_INIT -dnl AC_CONFIG_AUX_DIR(config) -dnl AM_CONFIG_HEADER(config/config.h) -AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(jOTDB, 1.0, no-define) - -dnl Initialize for LOFAR (may set compilers) -lofar_INIT - -dnl Checks for programs. -AC_PROG_AWK -AC_PROG_YACC -AC_PROG_CC -AC_PROG_CXX -AM_PROG_LEX -AC_PROG_INSTALL -AC_PROG_LN_S -dnl AC_DISABLE_SHARED -AC_PROG_LIBTOOL - -dnl Checks for libraries. - -dnl dnl Replace `main' with a function in -lfl: -dnl AC_CHECK_LIB(fl, main) -dnl dnl Replace `main' with a function in -lcosev_r: -dnl AC_CHECK_LIB(cosev_r, main) -dnl dnl Replace `main' with a function in -lcosnm_r: -dnl AC_CHECK_LIB(cosnm_r, main) -dnl dnl Replace `main' with a function in -lorb_r: -dnl AC_CHECK_LIB(orb_r, main) -dnl dnl Replace `main' with a function in -lpthread: -dnl AC_CHECK_LIB(pthread, main) -dnl dnl Replace `main' with a function in -lvport_r: -dnl AC_CHECK_LIB(vport_r, main) - -dnl Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS(unistd.h) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_SIZE_T - -dnl Checks for library functions. -AC_FUNC_VPRINTF - -dnl -dnl Check for LOFAR specific things -dnl -lofar_GENERAL -dnl lofar_BLITZ -dnl lofar_MPI -lofar_INTERNAL(LCS/Common,Common,,1,Common/LofarTypedefs.h,,) -lofar_INTERNAL(SAS/OTDB,OTDB,,1,OTDB/OTDBnode.h,,) -lofar_INTERNAL(LCS/ACC/APS,APS,,1,APS/ParameterSet.h,,) -lofar_EXTERNAL(boost,1.32,boost/date_time/date.hpp, boost_date_time-gcc) -lofar_EXTERNAL(pqxx,2.5.0,pqxx/pqxx, pqxx) -lofar_EXTERNAL(pq,,libpq-fe.h,) -dnl -dnl Output Makefiles -dnl -AC_OUTPUT( -src/Makefile -dnl test/Makefile -Makefile -) diff --git a/SAS/OTB/jOTDB/package.dox b/SAS/OTB/jOTDB/package.dox deleted file mode 100644 index c484741f60a07d43a6ef14671ff86f94840dd60d..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/package.dox +++ /dev/null @@ -1,2 +0,0 @@ -// \ingroup OTB -// \defgroup jOTDB jOTDB Description diff --git a/SAS/OTB/jOTDB/src/Makefile.am b/SAS/OTB/jOTDB/src/Makefile.am deleted file mode 100644 index 64e7ad12e08b0f1b757bcbae58cd80264f69d47f..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/Makefile.am +++ /dev/null @@ -1,48 +0,0 @@ -# if HAVE_SHMEM -# SUBDIRS = shmem . -# endif - -INSTHDRS = jOTDB_jOTDBconnection.h \ - jOTDB_jTreeMaintenance.h \ - jOTDB_jOTDBcommon.h \ - jOTDB_jTreeValue.h \ - jOTDB_jConverter.h - -NOINSTHDRS = - -TCCHDRS = - -nobase_pkginclude_HEADERS = $(INSTHDRS) $(TCCHDRS) - -noinst_HEADERS = $(NOINSTHDRS) - -DOCHDRS = $(INSTHDRS) $(NOINSTHDRS) - -lib_LTLIBRARIES = libjotdb.la - -libjotdb_la_SOURCES = $(DOCHDRS) \ - jOTDB_jOTDBconnection.cc \ - jOTDB_jTreeMaintenance.cc \ - jOTDB_jTreeValue.cc \ - jOTDB_jConverter.cc - -# AM_YFLAGS = -d -p KeyParse -# AM_LFLAGS = -PKeyTokenize -# LEX_OUTPUT_ROOT = lex.KeyTokenize - -# if HAVE_SHMEM -# libjotdb_la_LIBADD = shmem/libshmem.la -# endif - -bin_PROGRAMS = - -glishdir = $(libexecdir)/glish -dist_glish_SCRIPTS = - -pythondir = $(bindir) -dist_python_SCRIPTS = - -scriptdir = $(bindir) -dist_script_SCRIPTS = - -include $(top_srcdir)/Makefile.common diff --git a/SAS/OTB/jOTDB/src/jOTDB/Manifest.txt b/SAS/OTB/jOTDB/src/jOTDB/Manifest.txt deleted file mode 100644 index 49cdda77211906743dfee63ef513b5261a0b65a4..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/Manifest.txt +++ /dev/null @@ -1 +0,0 @@ -Main-Class: jOTDB.jOTDBserver diff --git a/SAS/OTB/jOTDB/src/jOTDB/jConverter.java b/SAS/OTB/jOTDB/src/jOTDB/jConverter.java deleted file mode 100644 index 15b8417ce5cabb62e6a1290e6b113d4e8276321a..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jConverter.java +++ /dev/null @@ -1,47 +0,0 @@ -//# jConverter.java: Logging. -//# -//# Copyright (C) 2002-2005 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -public class jConverter -{ - public jConverter () - { - initConverter (); - } - - private native void initConverter (); - - public native short getClassif (String aConv); - public native String getClassif (short aConv); - - public native short getParamType (String aConv); - public native String getParamType (short aConv); - - public native short getTreeState (String aConv); - public native String getTreeState (short aConv); - - public native short getTreeType (String aConv); - public native String getTreeType (short aConv); - - public native short getUnit (String aConv); - public native String getUnit (short aConv); -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jConverterAdapter.java b/SAS/OTB/jOTDB/src/jOTDB/jConverterAdapter.java deleted file mode 100644 index 1f3587554d08c3cb0390041e12c41efa8e9c304d..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jConverterAdapter.java +++ /dev/null @@ -1,88 +0,0 @@ -//# jConverterAdapter.java: -//# -//# Copyright (C) 2002-2005 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -import jOTDB.jConverter; -import jOTDB.jConverterInterface; -import java.rmi.server.UnicastRemoteObject; -import java.rmi.RemoteException; - -public class jConverterAdapter extends UnicastRemoteObject implements jConverterInterface -{ - // Constructor - public jConverterAdapter (jConverter adaptee) throws RemoteException - { - this.adaptee = adaptee; - } - - public short getClassif (String aConv) throws RemoteException - { - return adaptee.getClassif (aConv); - } - - public String getClassif (short aConv) throws RemoteException - { - return adaptee.getClassif (aConv); - } - - public short getParamType (String aConv) throws RemoteException - { - return adaptee.getParamType (aConv); - } - - public String getParamType (short aConv) throws RemoteException - { - return adaptee.getParamType (aConv); - } - - public short getTreeState (String aConv) throws RemoteException - { - return adaptee.getTreeState (aConv); - } - - public String getTreeState (short aConv) throws RemoteException - { - return adaptee.getTreeState (aConv); - } - - public short getTreeType (String aConv) throws RemoteException - { - return adaptee.getTreeType (aConv); - } - - public String getTreeType (short aConv) throws RemoteException - { - return adaptee.getTreeType (aConv); - } - - public short getUnit (String aConv) throws RemoteException - { - return adaptee.getUnit (aConv); - } - - public String getUnit (short aConv) throws RemoteException - { - return adaptee.getUnit (aConv); - } - - protected jConverter adaptee; -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jConverterInterface.java b/SAS/OTB/jOTDB/src/jOTDB/jConverterInterface.java deleted file mode 100644 index e438bf60e76b3300706b8f12c2fce9d4d84e7506..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jConverterInterface.java +++ /dev/null @@ -1,47 +0,0 @@ -//# jConverterInterface.java: The RMI interface to the OTDB database. -//# -//# Copyright (C) 2002-2005 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.util.Vector; - -public interface jConverterInterface extends Remote -{ - // Constants - public static final String SERVICENAME = "jConverter"; - - public short getClassif (String aConv) throws RemoteException; - public String getClassif (short aConv) throws RemoteException; - - public short getParamType (String aConv) throws RemoteException; - public String getParamType (short aConv) throws RemoteException; - - public short getTreeState (String aConv) throws RemoteException; - public String getTreeState (short aConv) throws RemoteException; - - public short getTreeType (String aConv) throws RemoteException; - public String getTreeType (short aConv) throws RemoteException; - - public short getUnit (String aConv) throws RemoteException; - public String getUnit (short aConv) throws RemoteException; -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jOTDBadapter.java b/SAS/OTB/jOTDB/src/jOTDB/jOTDBadapter.java deleted file mode 100644 index 4dab8a07b52d5cbe5ea83d5cd7390779eb3f2a05..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jOTDBadapter.java +++ /dev/null @@ -1,86 +0,0 @@ -//# jOTDBadapter.java: The RMI adapter of the OTDB database. -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -import jOTDB.jOTDBtree; -import jOTDB.jOTDBconnection; -import jOTDB.jOTDBinterface; -import java.util.Vector; -import java.rmi.server.UnicastRemoteObject; -import java.rmi.RemoteException; - -public class jOTDBadapter extends UnicastRemoteObject implements jOTDBinterface -{ - // Constructor - public jOTDBadapter (jOTDBconnection adaptee) throws RemoteException - { - this.adaptee = adaptee; - } - - // To test if we are (still) connected. - public boolean isConnected () throws RemoteException - { - return adaptee.isConnected (); - } - - // To connect or reconnect in case the connection was lost - public boolean connect () throws RemoteException - { - return adaptee.connect (); - } - - // get OTDBtree of one specific tree - public jOTDBtree getTreeInfo (int atreeID,boolean isMomID) throws RemoteException - { - return adaptee.getTreeInfo (atreeID,isMomID); - } - - - - // To get a list of all StateChanges - public Vector getStateList (int treeID, boolean isMomID, String beginDate, String endDate) throws RemoteException - { - try { - return adaptee.getStateList (treeID, isMomID, beginDate, endDate); - }catch (Exception e){ - throw new RemoteException(); - } - } - - // To get a list of all OTDB trees available in the database. - public Vector getTreeList (short treeType, short classifiType) throws RemoteException - { - return adaptee.getTreeList (treeType, classifiType); - } - - public String errorMsg () throws RemoteException - { - return adaptee.errorMsg (); - } - - public int getAuthToken () throws RemoteException - { - return adaptee.getAuthToken (); - } - - protected jOTDBconnection adaptee; -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jOTDBconnection.java b/SAS/OTB/jOTDB/src/jOTDB/jOTDBconnection.java deleted file mode 100644 index bb50d25c6ba535fbad48496f094ba990c877709d..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jOTDBconnection.java +++ /dev/null @@ -1,62 +0,0 @@ -//# jOTDBconnection.java: Manages the connection with the OTDB database. -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -import java.util.Vector; -import java.util.Date; - -public class jOTDBconnection -{ - // Just creates an object and registers the connection parameters. - public jOTDBconnection (String username, String passwd, String database) - { - initOTDBconnection (username, passwd, database); - } - - public jOTDBconnection() - { - initOTDBconnection("paulus", "boskabouter", "otdbtest"); - } - - - // Create a OTDBconnection instance - private native void initOTDBconnection (String username, String passwd, String database); - - // To test if we are (still) connected. - public native boolean isConnected(); - - // To connect or reconnect in case the connection was lost - public native boolean connect(); - - // get OTDBtree of one specific tree - public native jOTDBtree getTreeInfo (int atreeID, boolean isMomID); - - public native Vector getStateList(int atreeID, boolean isMomID ,String beginDate, String endDate); - - - // To get a list of all OTDB trees available in the database. - public native Vector getTreeList(short treeType, short classifiType); - - public native String errorMsg(); - - public native int getAuthToken(); -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jOTDBinterface.jar b/SAS/OTB/jOTDB/src/jOTDB/jOTDBinterface.jar deleted file mode 100644 index 89fc055d93396198bdf62b972c28755c2ee1c98e..0000000000000000000000000000000000000000 Binary files a/SAS/OTB/jOTDB/src/jOTDB/jOTDBinterface.jar and /dev/null differ diff --git a/SAS/OTB/jOTDB/src/jOTDB/jOTDBinterface.java b/SAS/OTB/jOTDB/src/jOTDB/jOTDBinterface.java deleted file mode 100644 index c7bbf65af0a6f27af51f52cfcca06e75fcc88d6c..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jOTDBinterface.java +++ /dev/null @@ -1,52 +0,0 @@ -//# jOTDBinterface.java: The RMI interface to the OTDB database. -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -import jOTDB.jOTDBtree; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.util.Vector; - -public interface jOTDBinterface extends Remote -{ - // Constants - public static final String SERVICENAME = "jOTDB"; - - // To test if we are (still) connected. - public boolean isConnected () throws RemoteException; - - // To connect or reconnect in case the connection was lost - public boolean connect () throws RemoteException; - - // get OTDBtree of one specific tree - public jOTDBtree getTreeInfo (int atreeID,boolean isMomID) throws RemoteException; - - // To get a list of all OTDB trees available in the database. - public Vector getTreeList (short treeType, short classifiType) throws RemoteException; - - // To get a list of all OTDB trees available in the database. - public Vector getStateList (int treeID, boolean isMomID, String beginDate, String endDate) throws RemoteException; - - public String errorMsg () throws RemoteException; - - public int getAuthToken () throws RemoteException; -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jOTDBnode.java b/SAS/OTB/jOTDB/src/jOTDB/jOTDBnode.java deleted file mode 100644 index f16137b5190f7fe60566b74e4f74dd2aa64ee0e1..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jOTDBnode.java +++ /dev/null @@ -1,69 +0,0 @@ -//# jOTDBnode.java: Structure containing a tree node. -//# -//# Copyright (C) 2002-2005 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -public class jOTDBnode implements java.io.Serializable -{ - public jOTDBnode (int treeID, int nodeID, int parentID, int paramDefID) - { - index = 0; - leaf = false; - instances = 0; - itsTreeID = treeID; - itsNodeID = nodeID; - itsParentID = parentID; - itsParamDefID = paramDefID; - } - - public int treeID() - { - return (itsTreeID); - } - - public int nodeID() - { - return (itsNodeID); - } - - public int parentID() - { - return (itsParentID); - } - - public int paramDefID() - { - return (itsParamDefID); - } - - public String name; - public short index; - public boolean leaf; - public short instances; //# only VICtemplate - public String limits; //# only VICtemplate - public String description; //# only VICtemplate - - // private members - private int itsTreeID; - private int itsNodeID; - private int itsParentID; - private int itsParamDefID; -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jOTDBparam.java b/SAS/OTB/jOTDB/src/jOTDB/jOTDBparam.java deleted file mode 100644 index 05b9b46d47f5e10f948df00170eab2689139973e..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jOTDBparam.java +++ /dev/null @@ -1,61 +0,0 @@ -//# jOTDBparam.java:Structure describing one parameter. -//# -//# Copyright (C) 2002-2005 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -public class jOTDBparam implements java.io.Serializable -{ - public jOTDBparam (int treeID, int paramID, int NodeID) - { - itsTreeID = treeID; - itsParamID = paramID; - itsNodeID = NodeID; - } - - public int treeID() - { - return (itsTreeID); - } - - public int paramID() - { - return (itsParamID); - } - - public int nodeID() - { - return (itsNodeID); - } - - public String name; - public short index; - public short type; // node / bool / int / long / float / etc. - public short unit; - public short pruning; - public short valMoment; - public boolean runtimeMod; - public String limits; - public String description; - - private int itsTreeID; - private int itsParamID; - private int itsNodeID; -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jOTDBserver.jar b/SAS/OTB/jOTDB/src/jOTDB/jOTDBserver.jar deleted file mode 100644 index a91aeda3aad5cdc19fd23af4d96a0768ea52391b..0000000000000000000000000000000000000000 Binary files a/SAS/OTB/jOTDB/src/jOTDB/jOTDBserver.jar and /dev/null differ diff --git a/SAS/OTB/jOTDB/src/jOTDB/jOTDBserver.java b/SAS/OTB/jOTDB/src/jOTDB/jOTDBserver.java deleted file mode 100644 index ef31d9da0c88ed6d53138a685def58539c066c86..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jOTDBserver.java +++ /dev/null @@ -1,131 +0,0 @@ -//# jOTDBserver.java: The RMI server of the OTDB database. -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -import jOTDB.jConverter; -import jOTDB.jConverterInterface; -import jOTDB.jConverterAdapter; -import jOTDB.jTreeValue; -import jOTDB.jTreeValueInterface; -import jOTDB.jTreeValueAdapter; -import jOTDB.jTreeMaintenance; -import jOTDB.jTreeMaintenanceInterface; -import jOTDB.jTreeMaintenanceAdapter; -import jOTDB.jOTDBconnection; -import jOTDB.jOTDBadapter; -import jOTDB.jOTDBinterface; -import java.rmi.Naming; -import java.rmi.registry.*; -import java.rmi.RMISecurityManager; -import java.net.InetAddress; - -public class jOTDBserver -{ - private static jOTDBconnection jOTDBconnAdaptee; - private static jOTDBadapter jOTDBconnAdapter; - private static jTreeMaintenance jTreeMainAdaptee; - private static jTreeMaintenanceAdapter jTreeMainAdapter; - private static jTreeValue jTreeValueAdaptee; - private static jTreeValueAdapter jTreeValueAdapter; - private static jConverter jConverterAdaptee; - private static jConverterAdapter jConverterAdapter; - - static - { - System.loadLibrary("jotdb"); - } - - - public static void main (String[] args) - { - try - { -// if (System.getSecurityManager () == null) -// { -// System.out.println ("No security mananger is running, will start one now..."); -// System.setSecurityManager (new RMISecurityManager ()); -// } - - if (args.length < 4) - { - System.out.println ("Usage: java -jar jOTDBserver.jar <username> <password> <database> <hostname> <portnumber-OPTIONAL>"); - System.exit(0); - } - - - String aHostName = new String(args[3]); - - System.out.println ("Running on: "+aHostName); - System.setProperty ("java.rmi.server.hostname", aHostName); - - System.out.println ("jOTDBserver creating a local RMI registry..."); - Registry localRegistry; - if (args.length == 4) - localRegistry = LocateRegistry.createRegistry (Registry.REGISTRY_PORT); - else { - Integer i = new Integer (args[4]); - localRegistry = LocateRegistry.createRegistry (i.intValue()); - } - - System.out.println ("jOTDBserver creating local object and remote adapter..."); - - // Export jOTDBconnection - jOTDBconnAdaptee = new jOTDBconnection (args[0], args[1], args[2]); - jOTDBconnAdapter = new jOTDBadapter (jOTDBconnAdaptee); - - System.out.println ("jOTDBserver publishing service " + jOTDBinterface.SERVICENAME + " in local registry..."); - localRegistry.rebind (jOTDBinterface.SERVICENAME, jOTDBconnAdapter); - - System.out.println ("Published jOTDBinterface as service " + jOTDBinterface.SERVICENAME + ". Ready..."); - - // Export jTreeMaintenance - jTreeMainAdaptee = new jTreeMaintenance (); - jTreeMainAdapter = new jTreeMaintenanceAdapter (jTreeMainAdaptee); - - System.out.println ("jOTDBserver publishing service " + jTreeMaintenanceInterface.SERVICENAME + " in local registry..."); - localRegistry.rebind (jTreeMaintenanceInterface.SERVICENAME, jTreeMainAdapter); - - // Export jTreeValue - jTreeValueAdaptee = new jTreeValue (); - jTreeValueAdapter = new jTreeValueAdapter (jTreeValueAdaptee); - - System.out.println ("jOTDBserver publishing service " + jTreeValueInterface.SERVICENAME + " in local registry..."); - localRegistry.rebind (jTreeValueInterface.SERVICENAME, jTreeValueAdapter); - - System.out.println ("Published jTreeValueInterface as service " + jTreeValueInterface.SERVICENAME + ". Ready..."); - - // Export jConverter - jConverterAdaptee = new jConverter (); - jConverterAdapter = new jConverterAdapter (jConverterAdaptee); - - System.out.println ("jOTDBserver publishing service " + jConverterInterface.SERVICENAME + " in local registry..."); - localRegistry.rebind (jConverterInterface.SERVICENAME, jConverterAdapter); - - System.out.println ("Published jConverterInterface as service " + jConverterInterface.SERVICENAME + ". Ready..."); - } - - catch (Exception e) - { - System.out.println ("jOTDB server failed: " + e); - } - } -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jOTDBtree.java b/SAS/OTB/jOTDB/src/jOTDB/jOTDBtree.java deleted file mode 100644 index cb736095346454682b669355c4af057d88121ed7..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jOTDBtree.java +++ /dev/null @@ -1,48 +0,0 @@ -//# jOTDBconnection.java: Manages the connection with the OTDB database. -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -public class jOTDBtree implements java.io.Serializable -{ - public jOTDBtree (int treeID) - { - itsTreeID = treeID; - } - - public int treeID() - { - return (itsTreeID); - } - - public int momID; - public short classification; // development / test / operational - public String creator; - public String creationDate; - public short type; // hardware / VItemplate / VHtree - public short state; // idle / configure / ... / active / ... - // -- VIC only -- - public int originalTree; - public String campaign; - public String starttime; - public String stoptime; - private int itsTreeID; -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jOTDBvalue.java b/SAS/OTB/jOTDB/src/jOTDB/jOTDBvalue.java deleted file mode 100644 index e31ff8f93ba168db9baf7a1fdee94c5f579f58bd..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jOTDBvalue.java +++ /dev/null @@ -1,48 +0,0 @@ -//# jOTDBvalue.java: -//# -//# Copyright (C) 2002-2005 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -public class jOTDBvalue implements java.io.Serializable -{ - public jOTDBvalue (int nodeID) - { - itsNodeID = nodeID; - } - - public jOTDBvalue (String aName, String aValue, String aTime) - { - name = aName; - value = aValue; - time = aTime; - } - - public int nodeID () - { - return itsNodeID; - } - - public String name; - public String value; - public String time; - - private int itsNodeID; -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jTreeMaintenance.java b/SAS/OTB/jOTDB/src/jOTDB/jTreeMaintenance.java deleted file mode 100644 index 9785e715280cbcdaa0f4c245a1f69110c499776d..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jTreeMaintenance.java +++ /dev/null @@ -1,111 +0,0 @@ -//# jOTDBtreeMaintenance.java: Maintenance on complete trees. -//# -//# Copyright (C) 2002-2005 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -import jOTDB.jVICnodeDef; -import jOTDB.jOTDBnode; -import jOTDB.jOTDBparam; -import java.util.Vector; - -public class jTreeMaintenance -{ - public jTreeMaintenance () - { - initTreeMaintenance (); - } - - private native void initTreeMaintenance (); - - // Get the node definition of a VC node - public native jVICnodeDef getNodeDef (int aNodeID); - - //# --- VIC maintenance : Templates --- - // From a component tree a template tree can be constructed. In a template - // tree only the structure of the tree is created, there is no replication - // of nodes on the same level. - // Returns 0 on failure, otherwise the ID of the new tree is returned. - public native int buildTemplateTree (int topNodeID, short aClassif); - - // Make a copy of an existing template tree. - // Returns 0 on failure, otherwise the ID of the new tree is returned. - public native int copyTemplateTree (int aTreeID); - - // Get a single node from the VIC template tree - public native jOTDBnode getNode (int aTreeID, int aNodeID); - - public native boolean setMomInfo(int aTreeID, int momID, String campaign); - - // Get a number of levels of children. - public native Vector getItemList (int aTreeID, int topNode, int depth); - - // Get a list of nodes based on a namefragment. Use '%' as wildchar. - public native Vector getItemList (int aTreeID, String aNameFragment); - - // Duplicates the given node (and its parameters and children) - // in the template database. The duplicate gets the new index. - public native int dupNode (int aTreeID, int orgNodeID, short newIndex); - - // Updates the (vector of) OTDBnodes to the database. - public native boolean saveNode (jOTDBnode aNode); - public native boolean saveNodeList (Vector aNodeList); - - // Updates the (vector of) OTDBnodes to the database. - public native boolean deleteNode (jOTDBnode aNode); - public native boolean deleteNodeList (Vector aNodeList); - - // Evaluate the constraints from a (sub)tree. - public native boolean checkTreeConstraints (int aTreeID, int topNode); - - - //# --- VIC maintenance : Hierarchical trees --- - // From a template tree a fully instanciated tree can be build. - // Returns 0 on failure, otherwise the ID of the new tree is returned. - public native int instanciateTree (int baseTree); - - // Prune an instanciated tree to get loss of depricated values. - public native boolean pruneTree (int aTreeID, short pruningLevel); - - //# --- Finally some general tree maintenance --- - // Delete a tree (of any kind) from the database. - public native boolean deleteTree (int aTreeID); - - // Retrieve the topNode of any tree - public native jOTDBnode getTopNode (int aTreeID); - - // Set the classification of any tree. - public native boolean setClassification (int aTreeID, short aClassification); - - // Set the state of any tree. When changing the state of a tree all - // constraints/validations for the current type must be fulfilled. - // When errors occur these can be retrieved with the errorMsg function. - public native boolean setTreeState (int aTreeID, short aState); - - // Whenever an error occurs in one the OTDB functions the message can - // be retrieved with this function. - public native String errorMsg(); - - // Get the parameter definition of a node - public native jOTDBparam getParam (int aTreeID, int aNodeID); - - // Save the parameter definition - public native boolean saveParam (jOTDBparam aParam); -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jTreeMaintenanceAdapter.java b/SAS/OTB/jOTDB/src/jOTDB/jTreeMaintenanceAdapter.java deleted file mode 100644 index d29e92eaa1ef47f694c2b82b4dbd8828825c4eac..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jTreeMaintenanceAdapter.java +++ /dev/null @@ -1,184 +0,0 @@ -//# jTreeMaintenanceAdapter.java: The RMI adapter of the OTDB database. -//# -//# Copyright (C) 2002-2005 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -import jOTDB.jOTDBnode; -import jOTDB.jOTDBparam; -import jOTDB.jVICnodeDef; -import jOTDB.jTreeMaintenance; -import jOTDB.jTreeMaintenanceInterface; -import java.util.Vector; -import java.rmi.server.UnicastRemoteObject; -import java.rmi.RemoteException; - -public class jTreeMaintenanceAdapter extends UnicastRemoteObject implements jTreeMaintenanceInterface -{ - // Constructor - public jTreeMaintenanceAdapter (jTreeMaintenance adaptee) throws RemoteException - { - this.adaptee = adaptee; - } - - // Get the node definition of a VC node - public jVICnodeDef getNodeDef (int aNodeID) throws RemoteException - { - return adaptee.getNodeDef (aNodeID); - } - - - //# --- VIC maintenance : Templates --- - // From a component tree a template tree can be constructed. In a template - // tree only the structure of the tree is created, there is no replication - // of nodes on the same level. - // Returns 0 on failure, otherwise the ID of the new tree is returned. - public int buildTemplateTree (int topNodeID, short aClassif) throws RemoteException - { - return adaptee.buildTemplateTree (topNodeID, aClassif); - } - - // Make a copy of an existing template tree. - // Returns 0 on failure, otherwise the ID of the new tree is returned. - public int copyTemplateTree (int aTreeID) throws RemoteException - { - return adaptee.copyTemplateTree (aTreeID); - } - - // Get a single node from the VIC template tree - public jOTDBnode getNode (int aTreeID, int aNodeID) throws RemoteException - { - return adaptee.getNode (aTreeID, aNodeID); - } - - public boolean setMomInfo(int aTreeID, int momID, String campaign) throws RemoteException - { - return adaptee.setMomInfo(aTreeID, momID, campaign); - } - - // Get a number of levels of children. - public Vector getItemList (int aTreeID, int topNode, int depth) throws RemoteException - { - return adaptee.getItemList (aTreeID, topNode, depth); - } - - // Get a list of nodes based on a namefragment. Use '%' as wildchar. - public Vector getItemList (int aTreeID, String aNameFragment) throws RemoteException - { - return adaptee.getItemList (aTreeID, aNameFragment); - } - - // Duplicates the given node (and its parameters and children) - // in the template database. The duplicate gets the new index. - public int dupNode (int aTreeID, int orgNodeID, short newIndex) throws RemoteException - { - return adaptee.dupNode (aTreeID, orgNodeID, newIndex); - } - - // Updates the (vector of) OTDBnodes to the database. - public boolean saveNode (jOTDBnode aNode) throws RemoteException - { - return adaptee.saveNode (aNode); - } - - public boolean saveNodeList (Vector aNodeList) throws RemoteException - { - return adaptee.saveNodeList (aNodeList); - } - - // Updates the (vector of) OTDBnodes to the database. - public boolean deleteNode (jOTDBnode aNode) throws RemoteException - { - return adaptee.deleteNode (aNode); - } - - public boolean deleteNodeList (Vector aNodeList) throws RemoteException - { - return adaptee.deleteNodeList (aNodeList); - } - - // Evaluate the constraints from a (sub)tree. - public boolean checkTreeConstraints (int aTreeID, int topNode) throws RemoteException - { - return adaptee.checkTreeConstraints (aTreeID, topNode); - } - - //# --- VIC maintenance : Hierarchical trees --- - // From a template tree a fully instanciated tree can be build. - // Returns 0 on failure, otherwise the ID of the new tree is returned. - public int instanciateTree (int baseTree) throws RemoteException - { - return adaptee.instanciateTree (baseTree); - } - - // Prune an instanciated tree to get loss of depricated values. - public boolean pruneTree (int aTreeID, short pruningLevel) throws RemoteException - { - return adaptee.pruneTree (aTreeID, pruningLevel); - } - - //# --- Finally some general tree maintenance --- - // Delete a tree (of any kind) from the database. - public boolean deleteTree (int aTreeID) throws RemoteException - { - return adaptee.deleteTree (aTreeID); - } - - // Retrieve the topNode of any tree - public jOTDBnode getTopNode (int aTreeID) throws RemoteException - { - return adaptee.getTopNode (aTreeID); - } - - // Set the classification of any tree. - public boolean setClassification (int aTreeID, short aClassification) throws RemoteException - { - return adaptee.setClassification (aTreeID, aClassification); - } - - // Set the state of any tree. When changing the state of a tree all - // constraints/validations for the current type must be fulfilled. - // When errors occur these can be retrieved with the errorMsg function. - public boolean setTreeState (int aTreeID, short aState) throws RemoteException - { - return adaptee.setTreeState (aTreeID, aState); - } - - // Whenever an error occurs in one the OTDB functions the message can - // be retrieved with this function. - public String errorMsg() throws RemoteException - { - return adaptee.errorMsg(); - } - - // Get the parameter definition of a node - public jOTDBparam getParam (int aTreeID, int aNodeID) throws RemoteException - { - return adaptee.getParam (aTreeID, aNodeID); - } - - // Save the parameter definition - public boolean saveParam (jOTDBparam aParam) throws RemoteException - { - return adaptee.saveParam (aParam); - } - - protected jTreeMaintenance adaptee; -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jTreeMaintenanceInterface.java b/SAS/OTB/jOTDB/src/jOTDB/jTreeMaintenanceInterface.java deleted file mode 100644 index 8da5384adac5dce9317edbd5f3bf41bb529991ef..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jTreeMaintenanceInterface.java +++ /dev/null @@ -1,110 +0,0 @@ -//# jTreeMaintenanceInterface.java: The RMI interface to the OTDB database. -//# -//# Copyright (C) 2002-2005 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -import jOTDB.jOTDBnode; -import jOTDB.jOTDBparam; -import jOTDB.jVICnodeDef; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.util.Vector; - -public interface jTreeMaintenanceInterface extends Remote -{ - // Constants - public static final String SERVICENAME = "jTreeMaintenance"; - - // Get the node definition of a VC node - public jVICnodeDef getNodeDef (int aNodeID) throws RemoteException; - - //# --- VIC maintenance : Templates --- - // From a component tree a template tree can be constructed. In a template - // tree only the structure of the tree is created, there is no replication - // of nodes on the same level. - // Returns 0 on failure, otherwise the ID of the new tree is returned. - public int buildTemplateTree (int topNodeID, short aClassif) throws RemoteException; - - // Make a copy of an existing template tree. - // Returns 0 on failure, otherwise the ID of the new tree is returned. - public int copyTemplateTree (int aTreeID) throws RemoteException; - - // Get a single node from the VIC template tree - public jOTDBnode getNode (int aTreeID, int aNodeID) throws RemoteException; - - //Add momId to the tree metadata - public boolean setMomInfo(int aTreeID, int momID, String campaign) throws RemoteException; - - // Get a number of levels of children. - public Vector getItemList (int aTreeID, int topNode, int depth) throws RemoteException; - - // Get a list of nodes based on a namefragment. Use '%' as wildchar. - public Vector getItemList (int aTreeID, String aNameFragment) throws RemoteException; - - // Duplicates the given node (and its parameters and children) - // in the template database. The duplicate gets the new index. - public int dupNode (int aTreeID, int orgNodeID, short newIndex) throws RemoteException; - - // Updates the (vector of) OTDBnodes to the database. - public boolean saveNode (jOTDBnode aNode) throws RemoteException; - public boolean saveNodeList (Vector aNodeList) throws RemoteException; - - // Updates the (vector of) OTDBnodes to the database. - public boolean deleteNode (jOTDBnode aNode) throws RemoteException; - public boolean deleteNodeList (Vector aNodeList) throws RemoteException; - - // Evaluate the constraints from a (sub)tree. - public boolean checkTreeConstraints (int aTreeID, int topNode) throws RemoteException; - - - //# --- VIC maintenance : Hierarchical trees --- - // From a template tree a fully instanciated tree can be build. - // Returns 0 on failure, otherwise the ID of the new tree is returned. - public int instanciateTree (int baseTree) throws RemoteException; - - // Prune an instanciated tree to get loss of depricated values. - public boolean pruneTree (int aTreeID, short pruningLevel) throws RemoteException; - - //# --- Finally some general tree maintenance --- - // Delete a tree (of any kind) from the database. - public boolean deleteTree (int aTreeID) throws RemoteException; - - // Retrieve the topNode of any tree - public jOTDBnode getTopNode (int aTreeID) throws RemoteException; - - // Set the classification of any tree. - public boolean setClassification (int aTreeID, short aClassification) throws RemoteException; - - // Set the state of any tree. When changing the state of a tree all - // constraints/validations for the current type must be fulfilled. - // When errors occur these can be retrieved with the errorMsg function. - public boolean setTreeState (int aTreeID, short aState) throws RemoteException; - - // Whenever an error occurs in one the OTDB functions the message can - // be retrieved with this function. - public String errorMsg() throws RemoteException; - - // Get the parameter definition of a node - public jOTDBparam getParam (int aTreeID, int aNodeID) throws RemoteException; - - // Save the parameter definition - public boolean saveParam (jOTDBparam aParam) throws RemoteException; -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jTreeState.java b/SAS/OTB/jOTDB/src/jOTDB/jTreeState.java deleted file mode 100644 index 4f77461d4ffe347f219a572e2590013550389b00..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jTreeState.java +++ /dev/null @@ -1,31 +0,0 @@ -//# jTreeState.java: Manages the connection with the OTDB database. -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -public class jTreeState implements java.io.Serializable -{ - public int treeID; - public int momID; - public short newState; - public String username; - public String timestamp; -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jTreeValue.java b/SAS/OTB/jOTDB/src/jOTDB/jTreeValue.java deleted file mode 100644 index 87cfd409b801a2206c6b8d40697666cba821f729..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jTreeValue.java +++ /dev/null @@ -1,39 +0,0 @@ -//# jTreeValue.java: Logging. -//# -//# Copyright (C) 2002-2005 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -import jOTDB.jOTDBvalue; -import java.util.Vector; - -public class jTreeValue -{ - public jTreeValue () - { - initTreeValue (); - } - - private native void initTreeValue (); - - // Get the node definition of a VC node - public native Vector searchInPeriod (int aTreeID, int topNode, int depth, String beginDate, - String endDate, boolean mostRecentlyOnly); -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jTreeValueAdapter.java b/SAS/OTB/jOTDB/src/jOTDB/jTreeValueAdapter.java deleted file mode 100644 index b393a2f0e159484247e8de785509fa6048f9b7e3..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jTreeValueAdapter.java +++ /dev/null @@ -1,46 +0,0 @@ -//# jTreeValueAdapter.java: -//# -//# Copyright (C) 2002-2005 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -import jOTDB.jOTDBvalue; -import jOTDB.jTreeValue; -import jOTDB.jTreeValueInterface; -import java.util.Vector; -import java.rmi.server.UnicastRemoteObject; -import java.rmi.RemoteException; - -public class jTreeValueAdapter extends UnicastRemoteObject implements jTreeValueInterface -{ - // Constructor - public jTreeValueAdapter (jTreeValue adaptee) throws RemoteException - { - this.adaptee = adaptee; - } - - public Vector searchInPeriod (int aTreeID, int topNode, int depth, String beginDate, - String endDate, boolean mostRecentlyOnly) throws RemoteException - { - return adaptee.searchInPeriod (aTreeID, topNode, depth, beginDate, endDate, mostRecentlyOnly); - } - - protected jTreeValue adaptee; -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jTreeValueInterface.java b/SAS/OTB/jOTDB/src/jOTDB/jTreeValueInterface.java deleted file mode 100644 index 8ce4a13051e70f122382d261c49a93bed68ba625..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jTreeValueInterface.java +++ /dev/null @@ -1,36 +0,0 @@ -//# jTreeValueInterface.java: The RMI interface to the OTDB database. -//# -//# Copyright (C) 2002-2005 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -import jOTDB.jOTDBvalue; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.util.Vector; - -public interface jTreeValueInterface extends Remote -{ - // Constants - public static final String SERVICENAME = "jTreeValue"; - - public Vector searchInPeriod (int aTreeID, int topNode, int depth, String beginDate, - String endDate, boolean mostRecentlyOnly) throws RemoteException; -} diff --git a/SAS/OTB/jOTDB/src/jOTDB/jVICnodeDef.java b/SAS/OTB/jOTDB/src/jOTDB/jVICnodeDef.java deleted file mode 100644 index 557a81aff90e0097fd5ac86533c46775fbb191c2..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB/jVICnodeDef.java +++ /dev/null @@ -1,42 +0,0 @@ -//# jOTDBVICnodeDef.java: Structure containing a VIC node definition -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -package jOTDB; - -public class jVICnodeDef implements java.io.Serializable -{ - public jVICnodeDef() - { - itsNodeID = 0; - } - - public int nodeID() - { - return itsNodeID; - } - - public String name; - public int version; - public short classif; - public String constraints; - public String description; - public int itsNodeID; -} diff --git a/SAS/OTB/jOTDB/src/jOTDB_jConverter.cc b/SAS/OTB/jOTDB/src/jOTDB_jConverter.cc deleted file mode 100644 index 2bddffe4007ea3836c6f81201e8337fc22ada4e0..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB_jConverter.cc +++ /dev/null @@ -1,162 +0,0 @@ -//# jOTDB_jConverter.cc: -//# -//# Copyright (C) 2002-2005 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -//# Includes -#include <Common/LofarLogger.h> -#include <jni.h> -#include <jOTDB/jOTDB_jConverter.h> -#include <string> -#include <iostream> -#include <jOTDB/jOTDB_jOTDBcommon.h> -#include <OTDB/ClassifConv.h> -#include <OTDB/ParamTypeConv.h> -#include <OTDB/TreeStateConv.h> -#include <OTDB/TreeTypeConv.h> -#include <OTDB/UnitConv.h> - -using namespace LOFAR::OTDB; - -static ClassifConv* classifConv; -static ParamTypeConv* paramTypeConv; -static TreeStateConv* treeStateConv; -static TreeTypeConv* treeTypeConv; -static UnitConv* unitConv; - -namespace LOFAR -{ - namespace jOTDB - { - JNIEXPORT void JNICALL Java_jOTDB_jConverter_initConverter - (JNIEnv *, jobject) - { - OTDBconn = getConnection (); - classifConv = new ClassifConv (OTDBconn); - paramTypeConv = new ParamTypeConv (OTDBconn); - treeStateConv = new TreeStateConv (OTDBconn); - treeTypeConv = new TreeTypeConv (OTDBconn); - unitConv = new UnitConv (OTDBconn); - } - - - JNIEXPORT jshort JNICALL Java_jOTDB_jConverter_getClassif__Ljava_lang_String_2 - (JNIEnv *env, jobject, jstring aConv) - { - const char* chars = env->GetStringUTFChars (aConv, 0); - const string str (chars); - - short ret = classifConv->get (str); - - env->ReleaseStringUTFChars (aConv, chars); - - return ret; - } - - JNIEXPORT jstring JNICALL Java_jOTDB_jConverter_getClassif__S - (JNIEnv *env, jobject, jshort aConv) - { - jstring jstr = env->NewStringUTF (classifConv->get(aConv).c_str()); - return jstr; - } - - JNIEXPORT jshort JNICALL Java_jOTDB_jConverter_getParamType__Ljava_lang_String_2 - (JNIEnv *env, jobject, jstring aConv) - { - const char* chars = env->GetStringUTFChars (aConv, 0); - const string str (chars); - - short ret = paramTypeConv->get (str); - - env->ReleaseStringUTFChars (aConv, chars); - - return ret; - } - - JNIEXPORT jstring JNICALL Java_jOTDB_jConverter_getParamType__S - (JNIEnv *env, jobject, jshort aConv) - { - jstring jstr = env->NewStringUTF (paramTypeConv->get(aConv).c_str()); - return jstr; - } - - JNIEXPORT jshort JNICALL Java_jOTDB_jConverter_getTreeState__Ljava_lang_String_2 - (JNIEnv *env, jobject, jstring aConv) - { - const char* chars = env->GetStringUTFChars (aConv, 0); - const string str (chars); - - short ret = treeStateConv->get (str); - - env->ReleaseStringUTFChars (aConv, chars); - - return ret; - } - - JNIEXPORT jstring JNICALL Java_jOTDB_jConverter_getTreeState__S - (JNIEnv *env, jobject, jshort aConv) - { - jstring jstr = env->NewStringUTF (treeStateConv->get(aConv).c_str()); - return jstr; - } - - JNIEXPORT jshort JNICALL Java_jOTDB_jConverter_getTreeType__Ljava_lang_String_2 - (JNIEnv *env, jobject, jstring aConv) - { - const char* chars = env->GetStringUTFChars (aConv, 0); - const string str (chars); - - short ret = treeTypeConv->get (str); - - env->ReleaseStringUTFChars (aConv, chars); - - return ret; - } - - JNIEXPORT jstring JNICALL Java_jOTDB_jConverter_getTreeType__S - (JNIEnv *env, jobject, jshort aConv) - { - jstring jstr = env->NewStringUTF (treeTypeConv->get(aConv).c_str()); - return jstr; - } - - JNIEXPORT jshort JNICALL Java_jOTDB_jConverter_getUnit__Ljava_lang_String_2 - (JNIEnv *env, jobject, jstring aConv) - { - const char* chars = env->GetStringUTFChars (aConv, 0); - const string str (chars); - - short ret = unitConv->get (str); - - env->ReleaseStringUTFChars (aConv, chars); - - return ret; - } - - JNIEXPORT jstring JNICALL Java_jOTDB_jConverter_getUnit__S - (JNIEnv *env, jobject, jshort aConv) - { - jstring jstr = env->NewStringUTF (unitConv->get(aConv).c_str()); - return jstr; - } - } // namespace jOTDB -} // namespace LOFAR diff --git a/SAS/OTB/jOTDB/src/jOTDB_jConverter.h b/SAS/OTB/jOTDB/src/jOTDB_jConverter.h deleted file mode 100644 index a5947c0bec456571c50ef99cb26f4f2ac13e5138..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB_jConverter.h +++ /dev/null @@ -1,105 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include <jni.h> -/* Header for class jOTDB_jConverter */ - -#ifndef _Included_jOTDB_jConverter -#define _Included_jOTDB_jConverter -#ifdef __cplusplus -extern "C" { -#endif - namespace LOFAR - { - namespace jOTDB { -/* - * Class: jOTDB_jConverter - * Method: initConverter - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_jOTDB_jConverter_initConverter - (JNIEnv *, jobject); - -/* - * Class: jOTDB_jConverter - * Method: getClassif - * Signature: (Ljava/lang/String;)S - */ -JNIEXPORT jshort JNICALL Java_jOTDB_jConverter_getClassif__Ljava_lang_String_2 - (JNIEnv *, jobject, jstring); - -/* - * Class: jOTDB_jConverter - * Method: getClassif - * Signature: (S)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_jOTDB_jConverter_getClassif__S - (JNIEnv *, jobject, jshort); - -/* - * Class: jOTDB_jConverter - * Method: getParamType - * Signature: (Ljava/lang/String;)S - */ -JNIEXPORT jshort JNICALL Java_jOTDB_jConverter_getParamType__Ljava_lang_String_2 - (JNIEnv *, jobject, jstring); - -/* - * Class: jOTDB_jConverter - * Method: getParamType - * Signature: (S)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_jOTDB_jConverter_getParamType__S - (JNIEnv *, jobject, jshort); - -/* - * Class: jOTDB_jConverter - * Method: getTreeState - * Signature: (Ljava/lang/String;)S - */ -JNIEXPORT jshort JNICALL Java_jOTDB_jConverter_getTreeState__Ljava_lang_String_2 - (JNIEnv *, jobject, jstring); - -/* - * Class: jOTDB_jConverter - * Method: getTreeState - * Signature: (S)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_jOTDB_jConverter_getTreeState__S - (JNIEnv *, jobject, jshort); - -/* - * Class: jOTDB_jConverter - * Method: getTreeType - * Signature: (Ljava/lang/String;)S - */ -JNIEXPORT jshort JNICALL Java_jOTDB_jConverter_getTreeType__Ljava_lang_String_2 - (JNIEnv *, jobject, jstring); - -/* - * Class: jOTDB_jConverter - * Method: getTreeType - * Signature: (S)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_jOTDB_jConverter_getTreeType__S - (JNIEnv *, jobject, jshort); - -/* - * Class: jOTDB_jConverter - * Method: getUnit - * Signature: (Ljava/lang/String;)S - */ -JNIEXPORT jshort JNICALL Java_jOTDB_jConverter_getUnit__Ljava_lang_String_2 - (JNIEnv *, jobject, jstring); - -/* - * Class: jOTDB_jConverter - * Method: getUnit - * Signature: (S)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_jOTDB_jConverter_getUnit__S - (JNIEnv *, jobject, jshort); - } - } -#ifdef __cplusplus -} -#endif -#endif diff --git a/SAS/OTB/jOTDB/src/jOTDB_jOTDBcommon.h b/SAS/OTB/jOTDB/src/jOTDB_jOTDBcommon.h deleted file mode 100644 index e94a1561db848e08c9e67376a7be77c6db6cff8b..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB_jOTDBcommon.h +++ /dev/null @@ -1,51 +0,0 @@ -//# jOTDB_jOTDBcommon.h: Holds a static OTDBconnection. -//# -//# Copyright (C) 2002-2005 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -#ifndef LOFAR_JOTDB_COMMON_H -#define LOFAR_JOTDB_COMMON_H - -// \file -// Hold a static OTDBconnection, to be -// shared between the different JNI implementation - -//# Never #include <config.h> or #include <lofar_config.h> in a header file! -//# Includes -#include <OTDB/OTDBconnection.h> -#include <OTDB/OTDBnode.h> -#include <OTDB/OTDBvalue.h> - -using namespace LOFAR::OTDB; - -namespace LOFAR { - namespace jOTDB { - - static OTDBconnection* OTDBconn; - - jobject convertOTDBnode (JNIEnv *env, OTDBnode aNode); - OTDBnode convertjOTDBnode (JNIEnv *env, jobject jNode); - jobject convertOTDBvalue (JNIEnv *env, OTDBvalue aValue); - - OTDBconnection* getConnection (); - - } // end namespace LOFAR -} // end namespace jOTDB - -#endif diff --git a/SAS/OTB/jOTDB/src/jOTDB_jOTDBconnection.cc b/SAS/OTB/jOTDB/src/jOTDB_jOTDBconnection.cc deleted file mode 100644 index b1ad21972dcc5238c1eb4361fb68bac98ddbbc09..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB_jOTDBconnection.cc +++ /dev/null @@ -1,257 +0,0 @@ -//# jOTDB_jOTDBconnection.cc: Manages the connection with the OTDB database. -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -//# -#include <Common/LofarLogger.h> -#include <jni.h> -#include <jOTDB/jOTDB_jOTDBconnection.h> -#include <OTDB/OTDBconnection.h> -#include <boost/date_time/posix_time/ptime.hpp> -#include <boost/date_time/posix_time/time_formatters.hpp> -#include <string> -#include <iostream> -#include <jOTDB/jOTDB_jOTDBcommon.h> - - -using namespace boost::posix_time; -using namespace LOFAR::OTDB; -using namespace std; - -namespace LOFAR -{ - namespace jOTDB - { - /* - * Class: jOTDB_jOTDBconnection - * Method: initOTDBconnection - * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V - */ - JNIEXPORT void JNICALL Java_jOTDB_jOTDBconnection_initOTDBconnection - (JNIEnv *env, jobject, jstring username, jstring passwd, jstring database) - { - const char* user = env->GetStringUTFChars(username, 0); - const char* pass = env->GetStringUTFChars(passwd, 0); - const char* db = env->GetStringUTFChars(database, 0); - const string u (user); - const string p (pass); - const string d (db); - - OTDBconn = new OTDBconnection(u, p, d); - - env->ReleaseStringUTFChars(username, user); - env->ReleaseStringUTFChars(passwd, pass); - env->ReleaseStringUTFChars(database, db); - } - - /* - * Class: jOTDB_jOTDBconnection - * Method: isConnected - * Signature: ()Ljava/lang/Boolean; - */ - JNIEXPORT jboolean JNICALL Java_jOTDB_jOTDBconnection_isConnected - (JNIEnv *, jobject) - { - jboolean connected; - connected = OTDBconn->isConnected(); - return connected; - } - - /* - * Class: jOTDB_jOTDBconnection - * Method: connect - * Signature: ()Ljava/lang/Boolean; - */ - JNIEXPORT jboolean JNICALL Java_jOTDB_jOTDBconnection_connect - (JNIEnv *, jobject) - { - jboolean connected; - connected = (jboolean)OTDBconn->connect(); - return connected; - } - - /* - * Class: jOTDB_jOTDBconnection - * Method: getTreeInfo - * Signature: (Ljava/lang/String;)LjOTDB/jOTDBtree; - */ - JNIEXPORT jobject JNICALL Java_jOTDB_jOTDBconnection_getTreeInfo - (JNIEnv *env, jobject, jint treeID, jboolean isMomID) - { - OTDBtree aTree = OTDBconn->getTreeInfo((int)treeID, isMomID); - - // Create a jOTDBtree object - jobject myTree; - jclass class_jOTDBtree = env->FindClass("jOTDB/jOTDBtree"); - jmethodID mid_jOTDBtree_cons = env->GetMethodID(class_jOTDBtree, "<init>", "(I)V"); - myTree = env->NewObject(class_jOTDBtree, mid_jOTDBtree_cons, treeID); - - // Get members - jfieldID fid_jOTDBtree_momID = env->GetFieldID (class_jOTDBtree, "momID", "I"); - jfieldID fid_jOTDBtree_classification = env->GetFieldID (class_jOTDBtree, "classification", "S"); - jfieldID fid_jOTDBtree_creator = env->GetFieldID (class_jOTDBtree, "creator", "Ljava/lang/String;"); - jfieldID fid_jOTDBtree_creationDate = env->GetFieldID (class_jOTDBtree, "creationDate", "Ljava/lang/String;"); - jfieldID fid_jOTDBtree_type = env->GetFieldID (class_jOTDBtree, "type", "S"); - jfieldID fid_jOTDBtree_state = env->GetFieldID (class_jOTDBtree, "state", "S"); - jfieldID fid_jOTDBtree_originalTree = env->GetFieldID (class_jOTDBtree, "originalTree", "I"); - jfieldID fid_jOTDBtree_campaign = env->GetFieldID (class_jOTDBtree, "campaign", "Ljava/lang/String;"); - jfieldID fid_jOTDBtree_starttime = env->GetFieldID (class_jOTDBtree, "starttime", "Ljava/lang/String;"); - jfieldID fid_jOTDBtree_stoptime = env->GetFieldID (class_jOTDBtree, "stoptime", "Ljava/lang/String;"); - - // Fill members - env->SetIntField(myTree, fid_jOTDBtree_momID, (jint)aTree.momID); - env->SetShortField(myTree, fid_jOTDBtree_classification, (jint)aTree.classification); - env->SetObjectField(myTree, fid_jOTDBtree_creator, env->NewStringUTF(aTree.creator.c_str())); - env->SetObjectField(myTree, fid_jOTDBtree_creationDate, env->NewStringUTF(to_simple_string(aTree.creationDate).c_str())); - env->SetShortField(myTree, fid_jOTDBtree_type, aTree.type); - env->SetShortField(myTree, fid_jOTDBtree_state, aTree.state); - env->SetIntField(myTree, fid_jOTDBtree_originalTree, aTree.originalTree); - env->SetObjectField(myTree, fid_jOTDBtree_campaign, env->NewStringUTF(aTree.campaign.c_str())); - env->SetObjectField(myTree, fid_jOTDBtree_starttime, env->NewStringUTF(to_simple_string(aTree.starttime).c_str())); - env->SetObjectField(myTree, fid_jOTDBtree_stoptime, env->NewStringUTF(to_simple_string(aTree.stoptime).c_str())); - - return myTree; - } - - /* - * Class: jOTDB_jOTDBconnection - * Method: getTreeList - * Signature: ()Ljava/util/Vector; - */ - JNIEXPORT jobject JNICALL Java_jOTDB_jOTDBconnection_getTreeList - (JNIEnv *env, jobject, jshort treeType, jshort classifiType) - { - vector<OTDBtree> trees = OTDBconn->getTreeList(treeType, classifiType); - vector<OTDBtree>::iterator treesIterator; - - // Construct java Integer - jobject treeID; - jclass class_Integer = env->FindClass("java/lang/Integer"); - jmethodID mid_Integer_cons = env->GetMethodID(class_Integer, "<init>", "(I)V"); - - // Construct java Vector - jobject vecTreeIDs; - jclass class_Vector = env->FindClass("java/util/Vector"); - jmethodID mid_Vector_cons = env->GetMethodID(class_Vector, "<init>", "()V"); - vecTreeIDs = env->NewObject(class_Vector, mid_Vector_cons); - jmethodID mid_Vector_add = env->GetMethodID(class_Vector, "add", "(Ljava/lang/Object;)Z"); - - for (treesIterator = trees.begin(); treesIterator != trees.end(); treesIterator++) - { - treeID = env->NewObject(class_Integer, mid_Integer_cons, (jint)treesIterator->treeID()); - env->CallObjectMethod(vecTreeIDs, mid_Vector_add, treeID); - } - - return(vecTreeIDs); - } - - jobject convertTreeState (JNIEnv *env, TreeState aTreeState) - { - jobject jTreeState; - jclass class_jTreeState = env->FindClass ("jOTDB/jTreeState"); - jmethodID mid_jTreeState_cons = env->GetMethodID (class_jTreeState, "<init>", "()V"); - jTreeState = env->NewObject (class_jTreeState, mid_jTreeState_cons); - - - jfieldID fid_jTreeState_treeID = env->GetFieldID (class_jTreeState, "treeID", "I"); - jfieldID fid_jTreeState_momID = env->GetFieldID (class_jTreeState, "momID", "I"); - jfieldID fid_jTreeState_newState = env->GetFieldID (class_jTreeState, "newState", "S"); - jfieldID fid_jTreeState_username = env->GetFieldID (class_jTreeState, "username", "Ljava/lang/String;"); - jfieldID fid_jTreeState_timestamp = env->GetFieldID (class_jTreeState, "timestamp", "Ljava/lang/String;"); - - env->SetIntField (jTreeState, fid_jTreeState_treeID, aTreeState.treeID); - env->SetIntField (jTreeState, fid_jTreeState_momID, aTreeState.momID); - env->SetShortField (jTreeState, fid_jTreeState_newState, aTreeState.newState); - env->SetObjectField (jTreeState, fid_jTreeState_username, env->NewStringUTF(aTreeState.username.c_str())); - env->SetObjectField (jTreeState, fid_jTreeState_timestamp, env->NewStringUTF(to_simple_string(aTreeState.timestamp).c_str())); - - return jTreeState; - } - - /* - * Class: jOTDB_jOTDBconnection - * Method: getStateList - * Signature: (IZLjava/lang/String;)Ljava/util/Vector; - */ - JNIEXPORT jobject JNICALL Java_jOTDB_jOTDBconnection_getStateList - (JNIEnv *env, jobject, jint treeID, jboolean isMomID, - jstring beginDate, jstring endDate) - - { - const char* bd = env->GetStringUTFChars (beginDate, 0); - const char* ed = env->GetStringUTFChars (endDate, 0); - - vector<TreeState> states = OTDBconn->getStateList(treeID, isMomID, - time_from_string(bd), time_from_string(ed)); - vector<TreeState>::iterator statesIterator; - - // Construct java Vector - jobject statesVector; - jclass class_Vector = env->FindClass("java/util/Vector"); - jmethodID mid_Vector_cons = env->GetMethodID(class_Vector, "<init>", "()V"); - statesVector = env->NewObject(class_Vector, mid_Vector_cons); - jmethodID mid_Vector_add = env->GetMethodID(class_Vector, "add", "(Ljava/lang/Object;)Z"); - - for (statesIterator = states.begin(); statesIterator != states.end(); statesIterator++) - { - env->CallObjectMethod(statesVector, mid_Vector_add,convertTreeState(env, *statesIterator )); - } - - return(statesVector); - } - - - /* - * Class: jOTDB_jOTDBconnection - * Method: errorMsg - * Signature: ()Ljava/lang/String; - */ - JNIEXPORT jstring JNICALL Java_jOTDB_jOTDBconnection_errorMsg - (JNIEnv *env, jobject) - { - jstring jstr = env->NewStringUTF(OTDBconn->errorMsg().c_str()); - return jstr; - } - - /* - * Class: jOTDB_jOTDBconnection - * Method: getAuthToken - * Signature: ()I - */ - JNIEXPORT jint JNICALL Java_jOTDB_jOTDBconnection_getAuthToken - (JNIEnv *, jobject) - { - jint token = (jint)OTDBconn->getAuthToken(); - return token; - } - - OTDBconnection* getConnection () - { - return OTDBconn; - } - - - - - } // namespace jOTDB -} // namespace LOFAR diff --git a/SAS/OTB/jOTDB/src/jOTDB_jOTDBconnection.h b/SAS/OTB/jOTDB/src/jOTDB_jOTDBconnection.h deleted file mode 100644 index e6936c0ac7c5db92e583f535beb2b92ecbd575fc..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB_jOTDBconnection.h +++ /dev/null @@ -1,87 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include <jni.h> -/* Header for class jOTDB_jOTDBconnection */ - -#ifndef _Included_jOTDB_jOTDBconnection -#define _Included_jOTDB_jOTDBconnection -#ifdef __cplusplus -extern "C" { -#endif - - namespace LOFAR - { - - namespace jOTDB - { - -/* - * Class: jOTDB_jOTDBconnection - * Method: initOTDBconnection - * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_jOTDB_jOTDBconnection_initOTDBconnection - (JNIEnv *, jobject, jstring, jstring, jstring); - -/* - * Class: jOTDB_jOTDBconnection - * Method: isConnected - * Signature: ()Z - */ -JNIEXPORT jboolean JNICALL Java_jOTDB_jOTDBconnection_isConnected - (JNIEnv *, jobject); - -/* - * Class: jOTDB_jOTDBconnection - * Method: connect - * Signature: ()Z - */ -JNIEXPORT jboolean JNICALL Java_jOTDB_jOTDBconnection_connect - (JNIEnv *, jobject); - -/* - * Class: jOTDB_jOTDBconnection - * Method: getTreeInfo - * Signature: (IZ)LjOTDB/jOTDBtree; - */ -JNIEXPORT jobject JNICALL Java_jOTDB_jOTDBconnection_getTreeInfo - (JNIEnv *, jobject, jint, jboolean); - -/* - * Class: jOTDB_jOTDBconnection - * Method: getStateList - * Signature: (IZLjava/lang/String;)Ljava/util/Vector; - */ -JNIEXPORT jobject JNICALL Java_jOTDB_jOTDBconnection_getStateList - (JNIEnv *, jobject, jint, jboolean, jstring, jstring); - -/* - * Class: jOTDB_jOTDBconnection - * Method: getTreeList - * Signature: (SS)Ljava/util/Vector; - */ -JNIEXPORT jobject JNICALL Java_jOTDB_jOTDBconnection_getTreeList - (JNIEnv *, jobject, jshort, jshort); - -/* - * Class: jOTDB_jOTDBconnection - * Method: errorMsg - * Signature: ()Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_jOTDB_jOTDBconnection_errorMsg - (JNIEnv *, jobject); - -/* - * Class: jOTDB_jOTDBconnection - * Method: getAuthToken - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_jOTDB_jOTDBconnection_getAuthToken - (JNIEnv *, jobject); - - } - } - -#ifdef __cplusplus -} -#endif -#endif diff --git a/SAS/OTB/jOTDB/src/jOTDB_jTreeMaintenance.cc b/SAS/OTB/jOTDB/src/jOTDB_jTreeMaintenance.cc deleted file mode 100644 index 9351953ec48ea6a8f8f64987631d60370c3988e8..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB_jTreeMaintenance.cc +++ /dev/null @@ -1,452 +0,0 @@ -//# jOTDB_jTreeMaintenance.cc: Maintenance on complete trees. -//# -//# Copyright (C) 2002-2005 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -//# Includes -#include <Common/LofarLogger.h> -#include <jni.h> -#include <jOTDB/jOTDB_jTreeMaintenance.h> -#include <jOTDB/jOTDB_jOTDBcommon.h> -#include <jOTDB/jOTDB_jOTDBconnection.h> -#include <OTDB/TreeMaintenance.h> -#include <OTDB/VICnodeDef.h> -#include <OTDB/OTDBnode.h> -#include <OTDB/OTDBparam.h> -#include <string> -#include <iostream> - -using namespace LOFAR::OTDB; - -TreeMaintenance *treemain; - -namespace LOFAR -{ - namespace jOTDB - { - JNIEXPORT void JNICALL Java_jOTDB_jTreeMaintenance_initTreeMaintenance - (JNIEnv *, jobject) - { - OTDBconn = getConnection (); - treemain = new TreeMaintenance (OTDBconn); - } - - JNIEXPORT jobject JNICALL Java_jOTDB_jTreeMaintenance_getNodeDef - (JNIEnv *env, jobject, jint aNodeID) - { - VICnodeDef aNodeDef = treemain->getNodeDef (aNodeID); - - jobject jNodeDef; - jclass class_jVICnodeDef = env->FindClass ("jOTDB/jVICnodeDef"); - jmethodID mid_jVICnodeDef_cons = env->GetMethodID (class_jVICnodeDef, "<init>", "()V"); - jNodeDef = env->NewObject (class_jVICnodeDef, mid_jVICnodeDef_cons); - - jfieldID fid_jVICnodeDef_name = env->GetFieldID (class_jVICnodeDef, "name", "Ljava/lang/String;"); - jfieldID fid_jVICnodeDef_version = env->GetFieldID (class_jVICnodeDef, "version", "I"); - jfieldID fid_jVICnodeDef_classif = env->GetFieldID (class_jVICnodeDef, "classif", "S"); - jfieldID fid_jVICnodeDef_constraints = env->GetFieldID (class_jVICnodeDef, "constraints", "Ljava/lang/String;"); - jfieldID fid_jVICnodeDef_description = env->GetFieldID (class_jVICnodeDef, "description", "Ljava/lang/String;"); - jfieldID fid_jVICnodeDef_itsNodeID = env->GetFieldID (class_jVICnodeDef, "itsNodeID", "I"); - - env->SetObjectField (jNodeDef, fid_jVICnodeDef_name, env->NewStringUTF (aNodeDef.name.c_str())); - env->SetIntField (jNodeDef, fid_jVICnodeDef_version, aNodeDef.version); - env->SetShortField (jNodeDef, fid_jVICnodeDef_classif, aNodeDef.classif); - env->SetObjectField (jNodeDef, fid_jVICnodeDef_constraints, env->NewStringUTF (aNodeDef.constraints.c_str())); - env->SetObjectField (jNodeDef, fid_jVICnodeDef_description, env->NewStringUTF (aNodeDef.description.c_str())); - env->SetIntField (jNodeDef, fid_jVICnodeDef_itsNodeID, aNodeDef.nodeID()); - - return jNodeDef; - } - - JNIEXPORT jint JNICALL Java_jOTDB_jTreeMaintenance_buildTemplateTree - (JNIEnv *, jobject, jint topNodeID, jshort aClassif) - { - jint treeID = treemain->buildTemplateTree (topNodeID, aClassif); - return treeID; - } - - JNIEXPORT jint JNICALL Java_jOTDB_jTreeMaintenance_copyTemplateTree - (JNIEnv *, jobject, jint aTreeID) - { - jint treeID = treemain->copyTemplateTree (aTreeID); - return treeID; - } - - JNIEXPORT jobject JNICALL Java_jOTDB_jTreeMaintenance_getNode - (JNIEnv *env, jobject, jint aTreeID, jint aNodeID) - { - OTDBnode aNode = treemain->getNode (aTreeID, aNodeID); - return convertOTDBnode (env, aNode); - } - - JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_setMomInfo - (JNIEnv *env, jobject, jint aTreeID, jint aMomID, jstring aCampaign) - { - jboolean isCopy; - const char* name = env->GetStringUTFChars (aCampaign, &isCopy); - jboolean succes = treemain->setMomInfo (aTreeID, aMomID, name); - env->ReleaseStringUTFChars (aCampaign, name); - - return succes; - } - - JNIEXPORT jobject JNICALL Java_jOTDB_jTreeMaintenance_getItemList__III - (JNIEnv *env, jobject, jint aTreeID, jint topNode, jint depth) - { - vector<OTDBnode> itemList = treemain->getItemList (aTreeID, topNode, depth); - vector<OTDBnode>::iterator itemIterator; - - // Construct java Vector - jobject itemVector; - jclass class_Vector = env->FindClass("java/util/Vector"); - jmethodID mid_Vector_cons = env->GetMethodID(class_Vector, "<init>", "()V"); - itemVector = env->NewObject(class_Vector, mid_Vector_cons); - jmethodID mid_Vector_add = env->GetMethodID(class_Vector, "add", "(Ljava/lang/Object;)Z"); - - for (itemIterator = itemList.begin(); itemIterator != itemList.end(); itemIterator++) - env->CallObjectMethod(itemVector, mid_Vector_add, convertOTDBnode (env, *itemIterator)); - - return itemVector; - } - - JNIEXPORT jobject JNICALL Java_jOTDB_jTreeMaintenance_getItemList__ILjava_lang_String_2 - (JNIEnv *env, jobject, jint aTreeID, jstring aNameFragment) - { - const char* nf = env->GetStringUTFChars (aNameFragment, 0); - const string nameFragment (nf); - - vector<OTDBnode> itemList = treemain->getItemList (aTreeID, nameFragment); - vector<OTDBnode>::iterator itemIterator; - - // Construct java Vector - jobject itemVector; - jclass class_Vector = env->FindClass("java/util/Vector"); - jmethodID mid_Vector_cons = env->GetMethodID(class_Vector, "<init>", "()V"); - itemVector = env->NewObject(class_Vector, mid_Vector_cons); - jmethodID mid_Vector_add = env->GetMethodID(class_Vector, "add", "(Ljava/lang/Object;)Z"); - - for (itemIterator = itemList.begin(); itemIterator != itemList.end(); itemIterator++) - env->CallObjectMethod(itemVector, mid_Vector_add, convertOTDBnode (env, *itemIterator)); - - env->ReleaseStringUTFChars (aNameFragment, nf); - - return itemVector; - } - - JNIEXPORT jint JNICALL Java_jOTDB_jTreeMaintenance_dupNode - (JNIEnv *, jobject, jint aTreeID, jint orgNodeID, jshort newIndex) - { - jint nodeID = treemain->dupNode (aTreeID, orgNodeID, newIndex); - return nodeID; - } - - JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_saveNode - (JNIEnv *env, jobject, jobject jNode) - { - OTDBnode aNode = convertjOTDBnode (env, jNode); - jboolean succes = treemain->saveNode (aNode); - return succes; - } - - JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_saveNodeList - (JNIEnv *env, jobject, jobject aNodeList) - { - jboolean succes; - OTDBnode aNode; - // Construct java Vector - jclass class_Vector = env->FindClass("java/util/Vector"); - jmethodID mid_Vector_elementAt = env->GetMethodID(class_Vector, "elementAt", "(I)Ljava/lang/Object;"); - jmethodID mid_Vector_size = env->GetMethodID(class_Vector, "size", "()I"); - - for (int i = 0; i < env->CallIntMethod (aNodeList, mid_Vector_size); i++) - { - aNode = convertjOTDBnode (env, env->CallObjectMethod (aNodeList, mid_Vector_elementAt, i)); - succes = treemain->saveNode (aNode); - if (!succes) - return succes; - } - - return succes; - } - - JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_deleteNode - (JNIEnv *env, jobject, jobject jNode) - { - jclass class_jOTDBnode = env->FindClass ("jOTDB/jOTDBnode"); - jfieldID fid_jOTDBnode_itsTreeID = env->GetFieldID (class_jOTDBnode, "itsTreeID", "I"); - jfieldID fid_jOTDBnode_itsNodeID = env->GetFieldID (class_jOTDBnode, "itsNodeID", "I"); - - // Get original OTDB node - OTDBnode aNode = treemain->getNode (env->GetIntField (jNode, fid_jOTDBnode_itsTreeID), env->GetIntField (jNode, fid_jOTDBnode_itsNodeID)); - - jboolean succes = treemain->deleteNode (aNode); - return succes; - } - - JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_deleteNodeList - (JNIEnv *env, jobject, jobject jNodeList) - { - jboolean succes; - OTDBnode aNode; - // Construct java Vector - jobject jNode; - jclass class_Vector = env->FindClass ("java/util/Vector"); - jmethodID mid_Vector_elementAt = env->GetMethodID (class_Vector, "elementAt", "(I)Ljava/lang/Object;"); - jmethodID mid_Vector_size = env->GetMethodID (class_Vector, "size", "()I"); - - jclass class_jOTDBnode = env->FindClass ("jOTDB/jOTDBnode"); - jfieldID fid_jOTDBnode_itsTreeID = env->GetFieldID (class_jOTDBnode, "itsTreeID", "I"); - jfieldID fid_jOTDBnode_itsNodeID = env->GetFieldID (class_jOTDBnode, "itsNodeID", "I"); - - for (int i = 0; i < env->CallIntMethod (jNodeList, mid_Vector_size); i++) - { - jNode = env->CallObjectMethod (jNodeList, mid_Vector_elementAt, i); - // Get original OTDB node - aNode = treemain->getNode (env->GetIntField (jNode, fid_jOTDBnode_itsTreeID), env->GetIntField (jNode, fid_jOTDBnode_itsNodeID)); - succes = treemain->deleteNode (aNode); - if (!succes) - return succes; - } - return succes; - } - - JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_checkTreeConstraints - (JNIEnv *, jobject, jint aTreeID, jint topNode) - { - jboolean succes;// = treemain->checkTreeConstraints (aTreeID, topNode); - return succes; - } - - JNIEXPORT jint JNICALL Java_jOTDB_jTreeMaintenance_instanciateTree - (JNIEnv *, jobject, jint baseTree) - { - jboolean succes = treemain->instanciateTree (baseTree); - return succes; - } - - JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_pruneTree - (JNIEnv *, jobject, jint aTreeID, jshort pruningLevel) - { - jboolean succes = treemain->pruneTree (aTreeID, pruningLevel); - return succes; - } - - JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_deleteTree - (JNIEnv *, jobject, jint aTreeID) - { - jboolean succes = treemain->deleteTree (aTreeID); - return succes; - } - - JNIEXPORT jobject JNICALL Java_jOTDB_jTreeMaintenance_getTopNode - (JNIEnv *env, jobject, jint aTreeID) - { - OTDBnode aNode = treemain->getTopNode (aTreeID); - return convertOTDBnode (env, aNode); - } - - - JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_setClassification - (JNIEnv *, jobject, jint aTreeID, jshort aClassification) - { - jboolean succes = treemain->setClassification (aTreeID, aClassification); - return succes; - } - - JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_setTreeState - (JNIEnv *, jobject, jint aTreeID, jshort aState) - { - jboolean succes = treemain->setTreeState (aTreeID, aState); - return succes; - } - - JNIEXPORT jstring JNICALL Java_jOTDB_jTreeMaintenance_errorMsg - (JNIEnv *env, jobject) - { - jstring jstr = env->NewStringUTF(OTDBconn->errorMsg().c_str()); - return jstr; - } - - JNIEXPORT jobject JNICALL Java_jOTDB_jTreeMaintenance_getParam - (JNIEnv *env, jobject, jint aTreeID, jint aParamDefID) - { - OTDBparam aParam = treemain->getParam (aTreeID, aParamDefID); - - jobject jParam; - jclass class_jOTDBparam = env->FindClass ("jOTDB/jOTDBparam"); - jmethodID mid_jOTDBparam_cons = env->GetMethodID (class_jOTDBparam, "<init>", "(III)V"); - jParam = env->NewObject (class_jOTDBparam, mid_jOTDBparam_cons, aParam.treeID (), aParam.paramID (), aParam.nodeID ()); - - jfieldID fid_jOTDBparam_name = env->GetFieldID (class_jOTDBparam, "name", "Ljava/lang/String;"); - jfieldID fid_jOTDBparam_index = env->GetFieldID (class_jOTDBparam, "index", "S"); - jfieldID fid_jOTDBparam_type = env->GetFieldID (class_jOTDBparam, "type", "S"); - jfieldID fid_jOTDBparam_unit = env->GetFieldID (class_jOTDBparam, "unit", "S"); - jfieldID fid_jOTDBparam_pruning = env->GetFieldID (class_jOTDBparam, "pruning", "S"); - jfieldID fid_jOTDBparam_valMoment = env->GetFieldID (class_jOTDBparam, "valMoment", "S"); - jfieldID fid_jOTDBparam_runtimeMod = env->GetFieldID (class_jOTDBparam, "runtimeMod", "Z"); - jfieldID fid_jOTDBparam_limits = env->GetFieldID (class_jOTDBparam, "limits", "Ljava/lang/String;"); - jfieldID fid_jOTDBparam_description = env->GetFieldID (class_jOTDBparam, "description", "Ljava/lang/String;"); - - env->SetObjectField (jParam, fid_jOTDBparam_name, env->NewStringUTF (aParam.name.c_str ())); - env->SetShortField (jParam, fid_jOTDBparam_index, aParam.index); - env->SetShortField (jParam, fid_jOTDBparam_type, aParam.type); - env->SetShortField (jParam, fid_jOTDBparam_unit, aParam.unit); - env->SetShortField (jParam, fid_jOTDBparam_pruning, aParam.pruning); - env->SetShortField (jParam, fid_jOTDBparam_valMoment, aParam.valMoment); - env->SetBooleanField (jParam, fid_jOTDBparam_runtimeMod, aParam.runtimeMod); - env->SetObjectField (jParam, fid_jOTDBparam_limits, env->NewStringUTF (aParam.limits.c_str ())); - env->SetObjectField (jParam, fid_jOTDBparam_description, env->NewStringUTF (aParam.description.c_str ())); - - return jParam; - } - - JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_saveParam - (JNIEnv *env, jobject, jobject jParam) - { - jboolean succes; - jclass class_jOTDBparam = env->FindClass ("jOTDB/jOTDBparam"); - jfieldID fid_jOTDBparam_name = env->GetFieldID (class_jOTDBparam, "name", "Ljava/lang/String;"); - jfieldID fid_jOTDBparam_index = env->GetFieldID (class_jOTDBparam, "index", "S"); - jfieldID fid_jOTDBparam_type = env->GetFieldID (class_jOTDBparam, "type", "S"); - jfieldID fid_jOTDBparam_unit = env->GetFieldID (class_jOTDBparam, "unit", "S"); - jfieldID fid_jOTDBparam_pruning = env->GetFieldID (class_jOTDBparam, "pruning", "S"); - jfieldID fid_jOTDBparam_valMoment = env->GetFieldID (class_jOTDBparam, "valMoment", "S"); - jfieldID fid_jOTDBparam_runtimeMod = env->GetFieldID (class_jOTDBparam, "runtimeMod", "Z"); - jfieldID fid_jOTDBparam_limits = env->GetFieldID (class_jOTDBparam, "limits", "Ljava/lang/String;"); - jfieldID fid_jOTDBparam_description = env->GetFieldID (class_jOTDBparam, "description", "Ljava/lang/String;"); - jmethodID mid_jOTDBparam_treeID = env->GetMethodID (class_jOTDBparam, "treeID", "()I"); - jmethodID mid_jOTDBparam_paramID = env->GetMethodID (class_jOTDBparam, "paramID", "()I"); - - // Get original OTDB param - OTDBparam aParam = treemain->getParam (env->CallIntMethod (jParam, mid_jOTDBparam_treeID), - env->CallIntMethod (jParam, mid_jOTDBparam_paramID)); - - // name - jstring str = (jstring)env->GetObjectField (jParam, fid_jOTDBparam_name); - jboolean isCopy; - const char* n = env->GetStringUTFChars (str, &isCopy); - const string name (n); - aParam.name = name; - env->ReleaseStringUTFChars (str, n); - - aParam.index = (short)env->GetShortField (jParam, fid_jOTDBparam_index); - aParam.type = (short)env->GetShortField (jParam, fid_jOTDBparam_type); - aParam.unit = (short)env->GetShortField (jParam, fid_jOTDBparam_unit); - aParam.pruning = (short)env->GetShortField (jParam, fid_jOTDBparam_pruning); - aParam.valMoment = (short)env->GetShortField (jParam, fid_jOTDBparam_valMoment); - aParam.runtimeMod = (short)env->GetBooleanField (jParam, fid_jOTDBparam_runtimeMod); - - // limits - str = (jstring)env->GetObjectField (jParam, fid_jOTDBparam_limits); - const char* l = env->GetStringUTFChars (str, &isCopy); - const string limits (l); - aParam.limits = limits; - env->ReleaseStringUTFChars (str, l); - - // description - str = (jstring)env->GetObjectField (jParam, fid_jOTDBparam_description); - const char* d = env->GetStringUTFChars (str, &isCopy); - const string description (d); - aParam.description = description; - env->ReleaseStringUTFChars (str, d); - - succes = treemain->saveParam (aParam); - return succes; - } - - jobject convertOTDBnode (JNIEnv *env, OTDBnode aNode) - { - jobject jNode; - jclass class_jOTDBnode = env->FindClass ("jOTDB/jOTDBnode"); - jmethodID mid_jOTDBnode_cons = env->GetMethodID (class_jOTDBnode, "<init>", "(IIII)V"); - jNode = env->NewObject (class_jOTDBnode, mid_jOTDBnode_cons, aNode.treeID (), aNode.nodeID (), - aNode.parentID (), aNode.paramDefID ()); - - jfieldID fid_jOTDBnode_name = env->GetFieldID (class_jOTDBnode, "name", "Ljava/lang/String;"); - jfieldID fid_jOTDBnode_index = env->GetFieldID (class_jOTDBnode, "index", "S"); - jfieldID fid_jOTDBnode_leaf = env->GetFieldID (class_jOTDBnode, "leaf", "Z"); - jfieldID fid_jOTDBnode_instances = env->GetFieldID (class_jOTDBnode, "instances", "S"); - jfieldID fid_jOTDBnode_limits = env->GetFieldID (class_jOTDBnode, "limits", "Ljava/lang/String;"); - jfieldID fid_jOTDBnode_description = env->GetFieldID (class_jOTDBnode, "description", "Ljava/lang/String;"); - - env->SetObjectField (jNode, fid_jOTDBnode_name, env->NewStringUTF (aNode.name.c_str ())); - env->SetShortField (jNode, fid_jOTDBnode_index, aNode.index); - env->SetBooleanField (jNode, fid_jOTDBnode_leaf, aNode.leaf); - env->SetShortField (jNode, fid_jOTDBnode_instances, aNode.instances); - env->SetObjectField (jNode, fid_jOTDBnode_limits, env->NewStringUTF (aNode.limits.c_str ())); - env->SetObjectField (jNode, fid_jOTDBnode_description, env->NewStringUTF (aNode.description.c_str ())); - - return jNode; - } - - OTDBnode convertjOTDBnode (JNIEnv *env, jobject jNode) - { - jclass class_jOTDBnode = env->GetObjectClass (jNode); - jfieldID fid_jOTDBnode_name = env->GetFieldID (class_jOTDBnode, "name", "Ljava/lang/String;"); - jfieldID fid_jOTDBnode_index = env->GetFieldID (class_jOTDBnode, "index", "S"); - jfieldID fid_jOTDBnode_leaf = env->GetFieldID (class_jOTDBnode, "leaf", "Z"); - jfieldID fid_jOTDBnode_instances = env->GetFieldID (class_jOTDBnode, "instances", "S"); - jfieldID fid_jOTDBnode_limits = env->GetFieldID (class_jOTDBnode, "limits", "Ljava/lang/String;"); - jfieldID fid_jOTDBnode_description = env->GetFieldID (class_jOTDBnode, "description", "Ljava/lang/String;"); - jmethodID mid_jOTDBnode_treeID = env->GetMethodID (class_jOTDBnode, "treeID", "()I"); - jmethodID mid_jOTDBnode_nodeID = env->GetMethodID (class_jOTDBnode, "nodeID", "()I"); - - // Get original OTDB node - OTDBnode aNode = treemain->getNode (env->CallIntMethod (jNode, mid_jOTDBnode_treeID), - env->CallIntMethod (jNode, mid_jOTDBnode_nodeID)); - - // name - jstring str = (jstring)env->GetObjectField (jNode, fid_jOTDBnode_name); - jboolean isCopy; - const char* n = env->GetStringUTFChars (str, &isCopy); - const string name (n); - aNode.name = name; - env->ReleaseStringUTFChars (str, n); - - // index - aNode.index = (short)env->GetShortField (jNode, fid_jOTDBnode_index); - - // leaf - aNode.leaf = (bool)env->GetBooleanField (jNode, fid_jOTDBnode_leaf); - - // instances - aNode.instances = (short)env->GetShortField (jNode, fid_jOTDBnode_instances); - - // limits - str = (jstring)env->GetObjectField (jNode, fid_jOTDBnode_limits); - const char* l = env->GetStringUTFChars (str, &isCopy); - const string limits (l); - aNode.limits = limits; - env->ReleaseStringUTFChars (str, l); - - // description - str = (jstring)env->GetObjectField (jNode, fid_jOTDBnode_description); - const char* d = env->GetStringUTFChars (str, &isCopy); - const string description (d); - aNode.description = description; - env->ReleaseStringUTFChars (str, d); - - return aNode; - } - - } // namespace jOTDB -} // namespace LOFAR diff --git a/SAS/OTB/jOTDB/src/jOTDB_jTreeMaintenance.h b/SAS/OTB/jOTDB/src/jOTDB_jTreeMaintenance.h deleted file mode 100644 index 8bf1fb98aadfedcfd06114e1b5b409f84c0e2dfc..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB_jTreeMaintenance.h +++ /dev/null @@ -1,204 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include <jni.h> -/* Header for class jOTDB_jTreeMaintenance */ - -#ifndef _Included_jOTDB_jTreeMaintenance -#define _Included_jOTDB_jTreeMaintenance -#ifdef __cplusplus -extern "C" { -#endif - -namespace LOFAR { - namespace jOTDB { - -/* - * Class: jOTDB_jTreeMaintenance - * Method: initTreeMaintenance - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_jOTDB_jTreeMaintenance_initTreeMaintenance - (JNIEnv *, jobject); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: getNodeDef - * Signature: (I)LjOTDB/jVICnodeDef; - */ -JNIEXPORT jobject JNICALL Java_jOTDB_jTreeMaintenance_getNodeDef - (JNIEnv *, jobject, jint); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: buildTemplateTree - * Signature: (IS)I - */ -JNIEXPORT jint JNICALL Java_jOTDB_jTreeMaintenance_buildTemplateTree - (JNIEnv *, jobject, jint, jshort); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: copyTemplateTree - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_jOTDB_jTreeMaintenance_copyTemplateTree - (JNIEnv *, jobject, jint); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: getNode - * Signature: (II)LjOTDB/jOTDBnode; - */ -JNIEXPORT jobject JNICALL Java_jOTDB_jTreeMaintenance_getNode - (JNIEnv *, jobject, jint, jint); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: setMomInfo - * Signature: (IILjava/lang/String;)Z - */ -JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_setMomInfo - (JNIEnv *, jobject, jint, jint, jstring); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: getItemList - * Signature: (III)Ljava/util/Vector; - */ -JNIEXPORT jobject JNICALL Java_jOTDB_jTreeMaintenance_getItemList__III - (JNIEnv *, jobject, jint, jint, jint); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: getItemList - * Signature: (ILjava/lang/String;)Ljava/util/Vector; - */ -JNIEXPORT jobject JNICALL Java_jOTDB_jTreeMaintenance_getItemList__ILjava_lang_String_2 - (JNIEnv *, jobject, jint, jstring); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: dupNode - * Signature: (IIS)I - */ -JNIEXPORT jint JNICALL Java_jOTDB_jTreeMaintenance_dupNode - (JNIEnv *, jobject, jint, jint, jshort); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: saveNode - * Signature: (LjOTDB/jOTDBnode;)Z - */ -JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_saveNode - (JNIEnv *, jobject, jobject); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: saveNodeList - * Signature: (Ljava/util/Vector;)Z - */ -JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_saveNodeList - (JNIEnv *, jobject, jobject); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: deleteNode - * Signature: (LjOTDB/jOTDBnode;)Z - */ -JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_deleteNode - (JNIEnv *, jobject, jobject); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: deleteNodeList - * Signature: (Ljava/util/Vector;)Z - */ -JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_deleteNodeList - (JNIEnv *, jobject, jobject); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: checkTreeConstraints - * Signature: (II)Z - */ -JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_checkTreeConstraints - (JNIEnv *, jobject, jint, jint); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: instanciateTree - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_jOTDB_jTreeMaintenance_instanciateTree - (JNIEnv *, jobject, jint); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: pruneTree - * Signature: (IS)Z - */ -JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_pruneTree - (JNIEnv *, jobject, jint, jshort); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: deleteTree - * Signature: (I)Z - */ -JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_deleteTree - (JNIEnv *, jobject, jint); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: getTopNode - * Signature: (I)LjOTDB/jOTDBnode; - */ -JNIEXPORT jobject JNICALL Java_jOTDB_jTreeMaintenance_getTopNode - (JNIEnv *, jobject, jint); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: setClassification - * Signature: (IS)Z - */ -JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_setClassification - (JNIEnv *, jobject, jint, jshort); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: setTreeState - * Signature: (IS)Z - */ -JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_setTreeState - (JNIEnv *, jobject, jint, jshort); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: errorMsg - * Signature: ()Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_jOTDB_jTreeMaintenance_errorMsg - (JNIEnv *, jobject); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: getParam - * Signature: (II)LjOTDB/jOTDBparam; - */ -JNIEXPORT jobject JNICALL Java_jOTDB_jTreeMaintenance_getParam - (JNIEnv *, jobject, jint, jint); - -/* - * Class: jOTDB_jTreeMaintenance - * Method: saveParam - * Signature: (LjOTDB/jOTDBparam;)Z - */ -JNIEXPORT jboolean JNICALL Java_jOTDB_jTreeMaintenance_saveParam - (JNIEnv *, jobject, jobject); - - } -} - -#ifdef __cplusplus -} -#endif -#endif diff --git a/SAS/OTB/jOTDB/src/jOTDB_jTreeValue.cc b/SAS/OTB/jOTDB/src/jOTDB_jTreeValue.cc deleted file mode 100644 index 2789fe2914220f1e0891f1c4b36caa80049fac26..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB_jTreeValue.cc +++ /dev/null @@ -1,113 +0,0 @@ -//# jOTDB_jTreeValue.cc: Manages the connection with the OTDB database. -//# -//# Copyright (C) 2002-2005 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -//# Includes -#include <Common/LofarLogger.h> -#include <jni.h> -#include <jOTDB/jOTDB_jOTDBconnection.h> -#include <OTDB/TreeValue.h> -#include <OTDB/OTDBvalue.h> -#include <boost/date_time/posix_time/ptime.hpp> -#include <boost/date_time/posix_time/time_formatters.hpp> -#include <boost/date_time/posix_time/time_parsers.hpp> -#include <string> -#include <iostream> -#include <jOTDB/jOTDB_jOTDBcommon.h> -#include <jOTDB/jOTDB_jTreeValue.h> - -using namespace boost::posix_time; -using namespace LOFAR::OTDB; - -TreeValue* treeval; - -namespace LOFAR -{ - namespace jOTDB - { - - JNIEXPORT void JNICALL Java_jOTDB_jTreeValue_initTreeValue - (JNIEnv *, jobject) - { - OTDBconn = getConnection (); - } - - JNIEXPORT jobject JNICALL Java_jOTDB_jTreeValue_searchInPeriod - (JNIEnv *env, jobject, jint aTreeID, jint topNode, jint depth, jstring beginDate, jstring endDate, jboolean mostRecentOnly) - { - // get treevalues - treeval = new TreeValue (OTDBconn, aTreeID); - - const char* bd = env->GetStringUTFChars (beginDate, 0); - const char* ed = env->GetStringUTFChars (endDate, 0); - const string beginTime (bd); - const string endTime (ed); - - // cout << beginTime << endl << endTime << endl; - - const ptime ts (time_from_string (beginTime)); - const ptime te (time_from_string (endTime)); - - // cout << topNode << endl << depth << endl << mostRecentOnly << endl; - - vector<OTDBvalue> valueList = treeval->searchInPeriod (topNode, depth, ts, te, mostRecentOnly); - vector<OTDBvalue>::iterator valueIterator; - - // cout << valueList.size () << endl; - - // Construct java Vector - jobject valueVector; - jclass class_Vector = env->FindClass("java/util/Vector"); - jmethodID mid_Vector_cons = env->GetMethodID(class_Vector, "<init>", "()V"); - valueVector = env->NewObject(class_Vector, mid_Vector_cons); - jmethodID mid_Vector_add = env->GetMethodID(class_Vector, "add", "(Ljava/lang/Object;)Z"); - - for (valueIterator = valueList.begin(); valueIterator != valueList.end(); valueIterator++) - env->CallObjectMethod(valueVector, mid_Vector_add, convertOTDBvalue (env, *valueIterator)); - - env->ReleaseStringUTFChars (beginDate, bd); - env->ReleaseStringUTFChars (endDate, ed); - - return valueVector; - } - - jobject convertOTDBvalue (JNIEnv *env, OTDBvalue aValue) - { - jobject jvalue; - jclass class_jOTDBvalue = env->FindClass ("jOTDB/jOTDBvalue"); - jmethodID mid_jOTDBvalue_cons = env->GetMethodID (class_jOTDBvalue, "<init>", "(I)V"); - jvalue = env->NewObject (class_jOTDBvalue, mid_jOTDBvalue_cons, aValue.nodeID ()); - - jfieldID fid_jOTDBvalue_name = env->GetFieldID (class_jOTDBvalue, "name", "Ljava/lang/String;"); - jfieldID fid_jOTDBvalue_value = env->GetFieldID (class_jOTDBvalue, "value", "Ljava/lang/String;"); - jfieldID fid_jOTDBvalue_time = env->GetFieldID (class_jOTDBvalue, "time", "Ljava/lang/String;"); - - env->SetObjectField (jvalue, fid_jOTDBvalue_name, env->NewStringUTF (aValue.name.c_str ())); - env->SetObjectField (jvalue, fid_jOTDBvalue_value, env->NewStringUTF (aValue.value.c_str ())); - env->SetObjectField (jvalue, fid_jOTDBvalue_time, env->NewStringUTF (to_simple_string(aValue.time).c_str ())); - - return jvalue; - } - - } // namespace jOTDB -} // namespace LOFAR diff --git a/SAS/OTB/jOTDB/src/jOTDB_jTreeValue.h b/SAS/OTB/jOTDB/src/jOTDB_jTreeValue.h deleted file mode 100644 index 434589d53fe1c5982071644badfb3a2a1faccc4b..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/src/jOTDB_jTreeValue.h +++ /dev/null @@ -1,36 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include <jni.h> -/* Header for class jOTDB_jTreeValue */ - -#ifndef _Included_jOTDB_jTreeValue -#define _Included_jOTDB_jTreeValue -#ifdef __cplusplus -extern "C" { -#endif -namespace LOFAR - { - namespace jOTDB - { - - /* - * Class: jOTDB_jTreeValue - * Method: initTreeValue - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_jOTDB_jTreeValue_initTreeValue - (JNIEnv *, jobject); - -/* - * Class: jOTDB_jTreeValue - * Method: getSchedulableItems - * Signature: (IILjava/lang/String;Ljava/lang/String;Z)Ljava/util/Vector; - */ -JNIEXPORT jobject JNICALL Java_jOTDB_jTreeValue_searchInPeriod - (JNIEnv *, jobject, jint, jint, jint, jstring, jstring, jboolean); - } - } - -#ifdef __cplusplus -} -#endif -#endif diff --git a/SAS/OTB/jOTDB/test/Makefile.am b/SAS/OTB/jOTDB/test/Makefile.am deleted file mode 100644 index 80b078babfce319726985c3e2478e96e6970c25e..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/test/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -check_PROGRAMS = - -# programs to run through supplied checktools -CHECKTOOLPROGS = -#ENDCHECKTOOLPROGS - -TESTS = - -XFAIL_TESTS = - - -TESTS_ENVIRONMENT = lofar_sharedir=$(lofar_sharedir) - - -include $(top_srcdir)/Makefile.common diff --git a/SAS/OTB/jOTDB/test/tConnection.java b/SAS/OTB/jOTDB/test/tConnection.java deleted file mode 100644 index d17066f4545a0bdf35a8416553077d7a727617bf..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/test/tConnection.java +++ /dev/null @@ -1,68 +0,0 @@ -import jOTDB.jOTDBtree; -import jOTDB.jOTDBconnection; -import java.util.Vector; -import java.lang.Integer; - -class tConnection -{ - static - { - System.loadLibrary("jotdb"); - } - - - public static void main(String[] args) - { - tConnection tconn = new tConnection(); - tconn.test(); - } - - public void test() - { - // do the test - System.out.println("Starting... "); - - // create a jOTDBconnection - jOTDBconnection conn = new jOTDBconnection("paulus","boskabouter","otdbtest"); - - System.out.println("Trying to connect to the database"); - assert conn.connect() : "Connection failed"; - assert conn.isConnected() : "Connnection flag failed"; - - System.out.println("Connection succesful!"); - - System.out.println("getTreeList(0,0)"); - Vector treeList; - treeList = conn.getTreeList((short)0, (short)0); - if (treeList.size() == 0) { - System.out.println("Error:" + conn.errorMsg()); - } - else { - System.out.println("Collected tree list"); - //showTreeList(treeList); - } - - System.out.println("getTreeInfo(treeList.elementAt(1))"); - Integer i = new Integer((Integer)treeList.elementAt(1)); - jOTDBtree tInfo = conn.getTreeInfo(i.intValue()); - if (tInfo.treeID()==0) { - System.out.println("NOT SUCH TREE FOUND!"); - } - else { - System.out.println(tInfo.classification); - System.out.println(tInfo.creator); - System.out.println(tInfo.creationDate); - System.out.println(tInfo.type); - System.out.println(tInfo.state); - System.out.println(tInfo.originalTree); - System.out.println(tInfo.campaign); - System.out.println(tInfo.starttime); - System.out.println(tInfo.stoptime); - System.out.println(tInfo.treeID()); - } - } - -} - - - diff --git a/SAS/OTB/jOTDB/test/tRemoteConnection.java b/SAS/OTB/jOTDB/test/tRemoteConnection.java deleted file mode 100644 index 5fb6474195330ac8f61e849ba994488620f5ba3d..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/test/tRemoteConnection.java +++ /dev/null @@ -1,79 +0,0 @@ -import jOTDB.jOTDBtree; -//import jOTDB.jOTDBconnection; -import java.util.Vector; -import java.lang.Integer; -import java.rmi.registry.*; -import jOTDB.jOTDBinterface; -import java.rmi.RMISecurityManager; - -class tRemoteConnection -{ - private static jOTDBinterface remoteOTDB; - - public static void main (String[] args) - { - try - { - if (args.length != 1) - { - System.out.println ("Usage: java tRemoteConnection <rmi-registry_hostname>"); - System.exit(0); - } - - System.out.println("Starting... "); - - // create a remote object - Registry remoteRegistry = LocateRegistry.getRegistry (args[0]); - remoteOTDB = (jOTDBinterface) remoteRegistry.lookup (jOTDBinterface.SERVICENAME); - - System.out.println (remoteOTDB); - - // do the test - System.out.println("Trying to connect to the database"); - assert remoteOTDB.connect() : "Connection failed"; - assert remoteOTDB.isConnected() : "Connnection flag failed"; - - System.out.println("Connection succesful!"); - - System.out.println("getTreeList(0,0)"); - Vector treeList; - treeList = remoteOTDB.getTreeList((short)0, (short)0); - if (treeList.size() == 0) - { - System.out.println("Error:" + remoteOTDB.errorMsg()); - System.exit (0); - } - else - { - System.out.println("Collected tree list"); - //showTreeList(treeList); - } - - System.out.println("getTreeInfo(treeList.elementAt(1))"); - Integer i = new Integer((Integer)treeList.elementAt(1)); - jOTDBtree tInfo = remoteOTDB.getTreeInfo(i.intValue()); - if (tInfo.treeID()==0) - { - System.out.println("No such tree found!"); - } - else - { - System.out.println(tInfo.classification); - System.out.println(tInfo.creator); - System.out.println(tInfo.creationDate); - System.out.println(tInfo.type); - System.out.println(tInfo.state); - System.out.println(tInfo.originalTree); - System.out.println(tInfo.campaign); - System.out.println(tInfo.starttime); - System.out.println(tInfo.stoptime); - System.out.println(tInfo.treeID()); - } - } - catch (Exception e) - { - System.out.println ("Remote OTDB via RMI and JNI failed: " + e); - } - - } -} diff --git a/SAS/OTB/jOTDB/test/tRemoteConverter.java b/SAS/OTB/jOTDB/test/tRemoteConverter.java deleted file mode 100644 index 0687be73624f279ffb7aeed4ad5a8c7ddebf2e52..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/test/tRemoteConverter.java +++ /dev/null @@ -1,74 +0,0 @@ -import java.rmi.registry.*; -import jOTDB.jOTDBinterface; -import jOTDB.jConverterInterface; -import java.util.Vector; - -class tRemoteConverter -{ - private static jOTDBinterface conn; - private static jConverterInterface tc; - - public static void main (String[] args) - { - try - { - if (args.length != 1) - { - System.out.println ("Usage: java tRemoteTreeMaintenance <rmi-registry_hostname>"); - System.exit(0); - } - - System.out.println("Starting... "); - - // create a remote object - Registry remoteRegistry = LocateRegistry.getRegistry (args[0]); - conn = (jOTDBinterface) remoteRegistry.lookup (jOTDBinterface.SERVICENAME); - - // do the test - System.out.println ("Starting... "); - - System.out.println ("Trying to connect to the database"); - assert conn.connect () : "Connection failed"; - assert conn.isConnected () : "Connnection flag failed"; - - System.out.println ("Connection succesful!"); - - System.out.println ("Searching for a Template tree"); - Vector treeList; - treeList = conn.getTreeList ((short)20, (short)0); // 20 = template, 0 = all - if (treeList.size () == 0) { - System.out.println ("No template tree found!"); - System.exit (0); - } - - // Test converter - tc = (jConverterInterface) remoteRegistry.lookup (jConverterInterface.SERVICENAME); - System.out.println (tc.getClassif ((short)1)); - System.out.println (tc.getClassif ("development")); - System.out.println (tc.getClassif ((short)2)); - System.out.println (tc.getClassif ("test")); - System.out.println (tc.getClassif ((short)3)); - System.out.println (tc.getClassif ("operational")); - - System.out.println (tc.getParamType ((short)0)); - System.out.println (tc.getParamType ("node")); - System.out.println (tc.getParamType ((short)101)); - System.out.println (tc.getParamType ((short)102)); - System.out.println (tc.getParamType ((short)6)); - System.out.println (tc.getParamType ((short)20)); - - System.out.println (tc.getUnit ((short)1)); - System.out.println (tc.getUnit ((short)2)); - System.out.println (tc.getUnit ((short)3)); - System.out.println (tc.getUnit ((short)4)); - System.out.println (tc.getUnit ((short)5)); - System.out.println (tc.getUnit ((short)6)); - - } - catch (Exception e) - { - System.out.println ("Remote OTDB via RMI and JNI failed: " + e); - } - - } -} diff --git a/SAS/OTB/jOTDB/test/tRemoteTreeMaintenance.java b/SAS/OTB/jOTDB/test/tRemoteTreeMaintenance.java deleted file mode 100644 index 193537333b8a7140da12169be4a99667c5028328..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/test/tRemoteTreeMaintenance.java +++ /dev/null @@ -1,308 +0,0 @@ -import jOTDB.jOTDBtree; -import jOTDB.jOTDBnode; -import jOTDB.jOTDBvalue; -import jOTDB.jOTDBparam; -import jOTDB.jVICnodeDef; -import java.util.Vector; -import java.lang.Integer; -import java.rmi.registry.*; -import jOTDB.jOTDBinterface; -import jOTDB.jTreeMaintenanceInterface; -import jOTDB.jTreeValueInterface; -import java.rmi.RMISecurityManager; - -class tRemoteTreeMaintenance -{ - private static jOTDBinterface conn; - private static jTreeMaintenanceInterface tm; - private static jTreeValueInterface tv; - - public static void showTreeList (Vector trees) - { - try - { - System.out.println ("treeID|Classif|Creator |Creationdate |Type|Campaign|Starttime"); - System.out.println ("------+-------+----------+--------------------+----+--------+------------------"); - - jOTDBtree aTree; - Integer treeID; - - for (int i = 0; i < trees.size (); ++i) - { - treeID = (Integer)trees.elementAt (i); - aTree = (jOTDBtree)conn.getTreeInfo(treeID.intValue ()); - System.out.printf ("%6d|%7d|%-10.10s|%-20.20s|%4d|%-8.8s|%s", aTree.treeID(), aTree.classification, - aTree.creator, aTree.creationDate, aTree.type, aTree.campaign, aTree.starttime); - System.out.println (); - } - System.out.println (trees.size () + " records\n"); - } - catch (Exception e) - { - System.out.println ("Remote OTDB via RMI and JNI failed: " + e); - } - } - - public static void showNodeList (Vector nodes) - { - try - { - System.out.println ("treeID|nodeID|parent|name |index|leaf|inst|description"); - System.out.println ("------+------+------+---------------+-----+----+----+------------------"); - - jOTDBnode aNode; - - for (int i = 0; i < nodes.size (); ++i) - { - aNode = (jOTDBnode)nodes.elementAt (i); - System.out.printf ("%6d|%6d|%6d|%-15.15s|%5d|%s|%4d|%s", - aNode.treeID (), aNode.nodeID (), aNode.parentID (), aNode.name, aNode.index, - aNode.leaf, aNode.instances, aNode.description); - System.out.println (); - } - System.out.println (nodes.size () + " records\n"); - } - catch (Exception e) - { - System.out.println ("Remote OTDB via RMI and JNI failed: " + e); - } - } - - public static void showValueList (Vector items) - { - try - { - System.out.println ("name |value |time"); - System.out.println ("---------------------------------------------+------+--------------------"); - - jOTDBvalue aValue; - - for (int i = 0; i < items.size(); ++i) - { - aValue = (jOTDBvalue)items.elementAt (i); - System.out.printf ("%-45.45s|%-7.7s|%s", aValue.name, aValue.value, aValue.time); - System.out.println (); - } - System.out.println (items.size() + " records\n"); - } - catch (Exception e) - { - System.out.println ("Remote OTDB via RMI and JNI failed: " + e); - } - } - - - public static void main (String[] args) - { - try - { - if (args.length != 1) - { - System.out.println ("Usage: java tRemoteTreeMaintenance <rmi-registry_hostname>"); - System.exit(0); - } - - System.out.println("Starting... "); - - // create a remote object - Registry remoteRegistry = LocateRegistry.getRegistry (args[0]); - conn = (jOTDBinterface) remoteRegistry.lookup (jOTDBinterface.SERVICENAME); - tm = (jTreeMaintenanceInterface) remoteRegistry.lookup (jTreeMaintenanceInterface.SERVICENAME); - - // do the test - System.out.println ("Starting... "); - - System.out.println ("Trying to connect to the database"); - assert conn.connect () : "Connection failed"; - assert conn.isConnected () : "Connnection flag failed"; - - System.out.println ("Connection succesful!"); - - System.out.println ("Searching for a Template tree"); - Vector treeList; - treeList = conn.getTreeList ((short)20, (short)0); // 20 = template, 0 = all - showTreeList (treeList); - if (treeList.size () == 0) { - System.out.println ("No template tree found!"); - System.exit (0); - } - - Integer VTtreeID = new Integer ((Integer)treeList.elementAt (treeList.size () - 1)); - System.out.println ("Using tree " + VTtreeID + " for the tests."); - jOTDBtree treeInfo = conn.getTreeInfo (VTtreeID.intValue ()); - if (treeInfo.treeID () == 0) { - System.out.println ("No such tree found!"); - System.exit (0); - } - - System.out.println("Trying to get the topnode of the tree"); - jOTDBnode topNode = tm.getTopNode (VTtreeID.intValue ()); - System.out.println (topNode.name); - - System.out.println("Trying to get a collection of items on depth=1"); - Vector nodeList = tm.getItemList (VTtreeID.intValue (), topNode.nodeID(), 1); - showNodeList (nodeList); - - System.out.println("Trying to get a collection of items on depth=2"); - nodeList = tm.getItemList (VTtreeID.intValue (), topNode.nodeID(), 2); - showNodeList (nodeList); - - int elemNr = nodeList.size () - 1; - System.out.println ("Zooming in on last element"); - jOTDBnode aNode = tm.getNode (VTtreeID.intValue (), elemNr); - System.out.println (aNode.name); - - System.out.println ("Trying to classify the tree to operational"); - boolean actionOK = tm.setClassification (VTtreeID.intValue (), (short)2); // 2 - operational - assert actionOK : "Setting classification was NOT succesful"; - treeInfo = conn.getTreeInfo (VTtreeID.intValue ()); - System.out.println ("Classification of tree: " + treeInfo.classification); - - short aTreeState = 400; - System.out.println ("Trying to change the state of the tree to active"); - actionOK = tm.setTreeState (VTtreeID.intValue (), aTreeState); // 400 = active - assert actionOK : "Changing the state to active should have NOT have failed!"; - treeInfo = conn.getTreeInfo (VTtreeID.intValue ()); - System.out.println ("State of tree: " + treeInfo.state); - - System.out.println ("========== Testing manipulation of nodes =========="); - - System.out.println ("Searching for node 'Virt Telescope'"); - Vector VtelCol = tm.getItemList (VTtreeID.intValue (), "%Telescope"); - System.out.println ("Found " + VtelCol.size () + " nodes"); - jOTDBnode VtelDef = (jOTDBnode)VtelCol.firstElement (); - assert VtelDef.nodeID () != 0 : "Node 'Virt Telescope' not found"; - System.out.println ("Found definition: " + VtelDef.name); - - // Test the manipulations on the VT - System.out.println ("Trying to duplicate the subtree"); - int nodeID = tm.dupNode (VTtreeID.intValue (), VtelDef.nodeID (), (short)1); - System.out.println ("New subtree starts at node: " + nodeID); - - System.out.println ("Trying to retrieve one node"); - aNode = tm.getNode (VTtreeID.intValue (), nodeID); - System.out.println (aNode.instances); - System.out.println (aNode.limits); - System.out.println ("Modifying the instances and limits"); - aNode.instances = 5; - aNode.limits = "no more limits"; - tm.saveNode (aNode); - System.out.println (aNode.instances); - System.out.println (aNode.limits); - - System.out.println ("Trying to retrieve one node"); - aNode = tm.getNode (VTtreeID.intValue (), nodeID); - System.out.println (aNode.name); - System.out.println ("Removing the just created subtree"); - System.out.println ("nodeID before removal: " + aNode.nodeID ()); - int orgNodeID = aNode.nodeID(); - tm.deleteNode (aNode); - System.out.println ("nodeID after removal : " + aNode.nodeID ()); - - System.out.println ("Trying to retrieve the deleted node"); - aNode = tm.getNode (VTtreeID.intValue (), orgNodeID); - System.out.println (aNode.nodeID ()); - - // Test the manipulations off the parameters - System.out.println ("Duplicating node Beamformer for index + 1"); - Vector BformCol = tm.getItemList (VTtreeID.intValue (), "Beamformer"); - jOTDBnode BformDef = (jOTDBnode)BformCol.lastElement (); - System.out.println ("Beamformer has ID " + BformDef.nodeID()); - System.out.println (VTtreeID.intValue () +" " + BformDef.nodeID ()); - int dupNodeID = BformDef.nodeID (); - System.out.println ("New subtree starts at node: " + dupNodeID); - - jOTDBnode node1 = tm.getNode (VTtreeID.intValue (), dupNodeID+2); - jOTDBnode node2 = tm.getNode (VTtreeID.intValue (), dupNodeID+3); - System.out.println ("Getting attributes info for " + node1.nodeID () + " and " + node2.nodeID ()); - System.out.println (node1.name); - System.out.println (node2.name); - node1.limits = "1.33333"; - node2.limits = "---1---"; - System.out.println ("Changing node " + node1.name + " limits to " + node1.limits); - System.out.println ("Changing node " + node2.name + " limits to " + node2.limits); - tm.saveNode (node1); - tm.saveNode (node2); - - // Get parameters for a node - System.out.println ("Getting param info for " + node1.treeID () + ", " + node1.nodeID ()); - jOTDBparam param1 = tm.getParam (node1.treeID (), node1.paramDefID ()); - System.out.println (param1.name); - System.out.println (param1.type); - System.out.println (param1.pruning); - System.out.println (param1.unit); - param1.type = 104; - tm.saveParam (param1); - - // Setting nr instances to some nice values - System.out.println ("Setting up tree counts"); - Vector aNodeCol = tm.getItemList (VTtreeID.intValue (), "RFI dete%"); - aNode = (jOTDBnode)aNodeCol.firstElement (); - aNode.instances = 40; - tm.saveNode (aNode); - System.out.println ("RFI detectors : 40"); - aNodeCol = tm.getItemList (VTtreeID.intValue (), "Correlator%"); - aNode = (jOTDBnode)aNodeCol.firstElement (); - aNode.instances = 130; - tm.saveNode (aNode); - System.out.println ("Correlators : 130"); - aNodeCol = tm.getItemList (VTtreeID.intValue (), "Storage"); - aNode = (jOTDBnode)aNodeCol.firstElement (); - aNode.instances = 86; - tm.saveNode (aNode); - System.out.println ("Storage : 86"); - aNodeCol = tm.getItemList (VTtreeID.intValue (), "Visua%"); - aNode = (jOTDBnode)aNodeCol.firstElement (); - aNode.instances = 24; - tm.saveNode (aNode); - System.out.println ("Visualisation : 24"); - aNodeCol = tm.getItemList (VTtreeID.intValue (), "Virt Tel%"); - aNode = (jOTDBnode)aNodeCol.firstElement (); - aNode.instances = 8; - tm.saveNode (aNode); - System.out.println ("Virt.Telescopes: 8"); - aNodeCol = tm.getItemList (VTtreeID.intValue (), "Beamfor%"); - aNode = (jOTDBnode)aNodeCol.firstElement (); - aNode.instances = 4; - tm.saveNode (aNode); - System.out.println ("Beamformers : 4"); - - // Test copying a template - System.out.println ("Trying to copy the template tree"); - int secondVTtreeID = tm.copyTemplateTree (VTtreeID); - System.out.println ("ID of new tree is " + secondVTtreeID); - if (secondVTtreeID == 0) { - System.out.println (tm.errorMsg()); - } - jOTDBtree VTtree = conn.getTreeInfo (secondVTtreeID); - System.out.println (VTtree.creator); - - // Test creating a full tree of the template tree - System.out.println ("Trying to instanciate the copied tree"); - int VHtreeID = tm.instanciateTree (secondVTtreeID); - System.out.println ("ID of new tree is " + VHtreeID); - if (VHtreeID == 0) { - System.out.println (tm.errorMsg()); - } - jOTDBtree VHtree = conn.getTreeInfo (VHtreeID); - System.out.println (VHtree.creator); - - // Test values - tv = (jTreeValueInterface) remoteRegistry.lookup (jTreeValueInterface.SERVICENAME); - Vector valueList = tv.searchInPeriod (4, 1868, 0, - "2001-12-31 00:00:00", "2005-12-31 23:59:59", false); - if (valueList.size() == 0) { - System.out.println ("No items found"); - } - else { - showValueList (valueList); - } - - } - catch (Exception e) - { - System.out.println ("Remote OTDB via RMI and JNI failed: " + e); - } - - } -} diff --git a/SAS/OTB/jOTDB/test/tTreeMaintenance.java b/SAS/OTB/jOTDB/test/tTreeMaintenance.java deleted file mode 100644 index 320618b381e1ed1f3b1530c50c5b15d90c014453..0000000000000000000000000000000000000000 --- a/SAS/OTB/jOTDB/test/tTreeMaintenance.java +++ /dev/null @@ -1,241 +0,0 @@ -import jOTDB.jOTDBnode; -import jOTDB.jVICnodeDef; -import jOTDB.jTreeMaintenance; -import jOTDB.jOTDBconnection; -import jOTDB.jOTDBtree; -import java.util.Vector; -import java.lang.Integer; - -class tTreeMaintenance -{ - static - { - System.loadLibrary ("jotdb"); - } - - - public static void main (String[] args) - { - tTreeMaintenance ttreemain = new tTreeMaintenance (); - ttreemain.test (); - } - - public void showTreeList (Vector trees, jOTDBconnection conn) - { - System.out.println ("treeID|Classif|Creator |Creationdate |Type|Campaign|Starttime"); - System.out.println ("------+-------+----------+--------------------+----+--------+------------------"); - - jOTDBtree aTree; - Integer treeID; - - for (int i = 0; i < trees.size (); ++i) - { - treeID = (Integer)trees.elementAt (i); - aTree = (jOTDBtree)conn.getTreeInfo(treeID.intValue ()); - System.out.printf ("%6d|%7d|%-10.10s|%-20.20s|%4d|%-8.8s|%s", aTree.treeID(), aTree.classification, - aTree.creator, aTree.creationDate, aTree.type, aTree.campaign, aTree.starttime); - System.out.println (); - } - System.out.println (trees.size () + " records\n"); - } - - public void showNodeList (Vector nodes) - { - System.out.println ("treeID|nodeID|parent|name |index|leaf|inst|description"); - System.out.println ("------+------+------+---------------+-----+----+----+------------------"); - - jOTDBnode aNode; - - for (int i = 0; i < nodes.size (); ++i) - { - aNode = (jOTDBnode)nodes.elementAt (i); - System.out.printf ("%6d|%6d|%6d|%-15.15s|%5d|%s|%4d|%s", - aNode.treeID (), aNode.nodeID (), aNode.parentID (), aNode.name, aNode.index, - aNode.leaf, aNode.instances, aNode.description); - System.out.println (); - } - System.out.println (nodes.size () + " records\n"); - } - - - public void test () - { - // do the test - System.out.println ("Starting... "); - - // create a jOTDBconnection - jOTDBconnection conn = new jOTDBconnection ("paulus","boskabouter","gerdes"); - - System.out.println ("Trying to connect to the database"); - assert conn.connect () : "Connection failed"; - assert conn.isConnected () : "Connnection flag failed"; - - System.out.println ("Connection succesful!"); - - System.out.println ("Trying to construct a TreeMaintenance object"); - jTreeMaintenance tm = new jTreeMaintenance (); - - System.out.println ("Searching for a Template tree"); - Vector treeList; - treeList = conn.getTreeList ((short)20, (short)0); // 20 = template, 0 = all - showTreeList (treeList, conn); - if (treeList.size () == 0) { - System.out.println ("No template tree found!"); - System.exit (0); - } - - Integer VTtreeID = new Integer ((Integer)treeList.elementAt (treeList.size () - 1)); - System.out.println ("Using tree " + VTtreeID + " for the tests."); - jOTDBtree treeInfo = conn.getTreeInfo (VTtreeID.intValue ()); - if (treeInfo.treeID () == 0) { - System.out.println ("No such tree found!"); - System.exit (0); - } - - System.out.println("Trying to get the topnode of the tree"); - jOTDBnode topNode = tm.getTopNode (VTtreeID.intValue ()); - System.out.println (topNode.name); - - System.out.println("Trying to get a collection of items on depth=1"); - Vector nodeList = tm.getItemList (VTtreeID.intValue (), topNode.nodeID(), 1); - showNodeList (nodeList); - - System.out.println("Trying to get a collection of items on depth=2"); - nodeList = tm.getItemList (VTtreeID.intValue (), topNode.nodeID(), 2); - showNodeList (nodeList); - - int elemNr = nodeList.size () - 1; - System.out.println ("Zooming in on last element"); - jOTDBnode aNode = tm.getNode (VTtreeID.intValue (), elemNr); - System.out.println (aNode.name); - - System.out.println ("Trying to classify the tree to operational"); - boolean actionOK = tm.setClassification (VTtreeID.intValue (), (short)2); // 2 - operational - assert actionOK : "Setting classification was NOT succesful"; - treeInfo = conn.getTreeInfo (VTtreeID.intValue ()); - System.out.println ("Classification of tree: " + treeInfo.classification); - - short aTreeState = 400; - System.out.println ("Trying to change the state of the tree to active"); - actionOK = tm.setTreeState (VTtreeID.intValue (), aTreeState); // 400 = active - assert actionOK : "Changing the state to active should have NOT have failed!"; - treeInfo = conn.getTreeInfo (VTtreeID.intValue ()); - System.out.println ("State of tree: " + treeInfo.state); - - System.out.println ("========== Testing manipulation of nodes =========="); - - System.out.println ("Searching for node 'Virt Telescope'"); - Vector VtelCol = tm.getItemList (VTtreeID.intValue (), "%Telescope"); - System.out.println ("Found " + VtelCol.size () + " nodes"); - jOTDBnode VtelDef = (jOTDBnode)VtelCol.firstElement (); - assert VtelDef.nodeID () != 0 : "Node 'Virt Telescope' not found"; - System.out.println ("Found definition: " + VtelDef.name); - - // Test the manipulations on the VT - System.out.println ("Trying to duplicate the subtree"); - int nodeID = tm.dupNode (VTtreeID.intValue (), VtelDef.nodeID (), (short)1); - System.out.println ("New subtree starts at node: " + nodeID); - - System.out.println ("Trying to retrieve one node"); - aNode = tm.getNode (VTtreeID.intValue (), nodeID); - System.out.println (aNode.instances); - System.out.println (aNode.limits); - System.out.println ("Modifying the instances and limits"); - aNode.instances = 5; - aNode.limits = "no more limits"; - tm.saveNode (aNode); - System.out.println (aNode.instances); - System.out.println (aNode.limits); - - System.out.println ("Trying to retrieve one node"); - aNode = tm.getNode (VTtreeID.intValue (), nodeID); - System.out.println (aNode.name); - System.out.println ("Removing the just created subtree"); - System.out.println ("nodeID before removal: " + aNode.nodeID ()); - int orgNodeID = aNode.nodeID(); - tm.deleteNode (aNode); - System.out.println ("nodeID after removal : " + aNode.nodeID ()); - - System.out.println ("Trying to retrieve the deleted node"); - aNode = tm.getNode (VTtreeID.intValue (), orgNodeID); - System.out.println (aNode.nodeID ()); - - // Test the manipulations off the parameters - System.out.println ("Duplicating node Beamformer for index=3"); - Vector BformCol = tm.getItemList (VTtreeID.intValue (), "Beamformer"); - jOTDBnode BformDef = (jOTDBnode)BformCol.firstElement (); - System.out.println ("Beamformer has ID " + BformDef.nodeID()); - System.out.println (VTtreeID.intValue () +" " + BformDef.nodeID ()); - int dupNodeID = tm.dupNode (VTtreeID.intValue (), BformDef.nodeID (), (short)4); - System.out.println ("New subtree starts at node: " + dupNodeID); - - System.out.println ("Getting param info for " + dupNodeID+2 + " and " + dupNodeID+3); - jOTDBnode param1 = tm.getNode (VTtreeID.intValue (), dupNodeID+2); - jOTDBnode param2 = tm.getNode (VTtreeID.intValue (), dupNodeID+3); - System.out.println (param1.name); - System.out.println (param2.name); - param1.limits = "1.33333"; - param2.limits = "---1---"; - System.out.println ("Changing param " + param1.name + " to " + param1.limits); - System.out.println ("Changing param " + param2.name + " to " + param2.limits); - tm.saveNode (param1); - tm.saveNode (param2); - - // Setting nr instances to some nice values - System.out.println ("Setting up tree counts"); - Vector aNodeCol = tm.getItemList (VTtreeID.intValue (), "RFI dete%"); - aNode = (jOTDBnode)aNodeCol.firstElement (); - aNode.instances = 40; - tm.saveNode (aNode); - System.out.println ("RFI detectors : 40"); - aNodeCol = tm.getItemList (VTtreeID.intValue (), "Correlator%"); - aNode = (jOTDBnode)aNodeCol.firstElement (); - aNode.instances = 130; - tm.saveNode (aNode); - System.out.println ("Correlators : 130"); - aNodeCol = tm.getItemList (VTtreeID.intValue (), "Storage"); - aNode = (jOTDBnode)aNodeCol.firstElement (); - aNode.instances = 86; - tm.saveNode (aNode); - System.out.println ("Storage : 86"); - aNodeCol = tm.getItemList (VTtreeID.intValue (), "Visua%"); - aNode = (jOTDBnode)aNodeCol.firstElement (); - aNode.instances = 24; - tm.saveNode (aNode); - System.out.println ("Visualisation : 24"); - aNodeCol = tm.getItemList (VTtreeID.intValue (), "Virt Tel%"); - aNode = (jOTDBnode)aNodeCol.firstElement (); - aNode.instances = 8; - tm.saveNode (aNode); - System.out.println ("Virt.Telescopes: 8"); - aNodeCol = tm.getItemList (VTtreeID.intValue (), "Beamfor%"); - aNode = (jOTDBnode)aNodeCol.firstElement (); - aNode.instances = 4; - tm.saveNode (aNode); - System.out.println ("Beamformers : 4"); - - // Test copying a template - System.out.println ("Trying to copy the template tree"); - int secondVTtreeID = tm.copyTemplateTree (VTtreeID); - System.out.println ("ID of new tree is " + secondVTtreeID); - if (secondVTtreeID == 0) { - System.out.println (tm.errorMsg()); - } - jOTDBtree VTtree = conn.getTreeInfo (secondVTtreeID); - System.out.println (VTtree.creator); - - // Test creating a full tree of the template tree - System.out.println ("Trying to instanciate the copied tree"); - int VHtreeID = tm.instanciateTree (secondVTtreeID); - System.out.println ("ID of new tree is " + VHtreeID); - if (VHtreeID == 0) { - System.out.println (tm.errorMsg()); - } - jOTDBtree VHtree = conn.getTreeInfo (VHtreeID); - System.out.println (VHtree.creator); - } -} - - - -