summaryrefslogtreecommitdiffstats
path: root/java/rasj/rnp
diff options
context:
space:
mode:
authorConstantin <jucovschi@gmail.com>2010-06-14 11:27:05 +0200
committerConstantin <jucovschi@gmail.com>2010-06-14 11:55:14 +0200
commitdd1ba9ad320e297f1acf1027604a368f1ddbde6c (patch)
tree3d76f2e701e9bb939f25475598967516bdd168f0 /java/rasj/rnp
parent45325282eaf5e902962bd39d3c8b5aaf14a505d5 (diff)
downloadrasdaman-upstream-dd1ba9ad320e297f1acf1027604a368f1ddbde6c.tar.gz
rasdaman-upstream-dd1ba9ad320e297f1acf1027604a368f1ddbde6c.tar.xz
rasdaman-upstream-dd1ba9ad320e297f1acf1027604a368f1ddbde6c.zip
changed build system of java/ folder from makefile to ant (big compilation time improvement)
Diffstat (limited to 'java/rasj/rnp')
-rw-r--r--java/rasj/rnp/MD5.classbin7543 -> 0 bytes
-rw-r--r--java/rasj/rnp/MD5State.classbin791 -> 0 bytes
-rw-r--r--java/rasj/rnp/Makefile61
-rw-r--r--java/rasj/rnp/Makefile.dep0
-rw-r--r--java/rasj/rnp/ParameterDouble64.classbin1595 -> 0 bytes
-rw-r--r--java/rasj/rnp/ParameterFloat32.classbin1590 -> 0 bytes
-rw-r--r--java/rasj/rnp/ParameterInt32.classbin1578 -> 0 bytes
-rw-r--r--java/rasj/rnp/ParameterOpaque.classbin1876 -> 0 bytes
-rw-r--r--java/rasj/rnp/ParameterString.classbin1959 -> 0 bytes
-rw-r--r--java/rasj/rnp/RasRNPImplementation.classbin30295 -> 0 bytes
-rw-r--r--java/rasj/rnp/RasRNPImplementation.java1761
-rw-r--r--java/rasj/rnp/Rnp.classbin668 -> 0 bytes
-rw-r--r--java/rasj/rnp/Rnp.java54
-rw-r--r--java/rasj/rnp/RnpBaseClientComm.classbin6519 -> 0 bytes
-rw-r--r--java/rasj/rnp/RnpBaseClientComm.java207
-rw-r--r--java/rasj/rnp/RnpDecoder.classbin3851 -> 0 bytes
-rw-r--r--java/rasj/rnp/RnpDecoder.java170
-rw-r--r--java/rasj/rnp/RnpEncoder.classbin2439 -> 0 bytes
-rw-r--r--java/rasj/rnp/RnpEncoder.java102
-rw-r--r--java/rasj/rnp/RnpException.classbin340 -> 0 bytes
-rw-r--r--java/rasj/rnp/RnpException.java44
-rw-r--r--java/rasj/rnp/RnpFragment.classbin3779 -> 0 bytes
-rw-r--r--java/rasj/rnp/RnpFragment.java152
-rw-r--r--java/rasj/rnp/RnpFragmentHeader.classbin1899 -> 0 bytes
-rw-r--r--java/rasj/rnp/RnpFragmentHeader.java93
-rw-r--r--java/rasj/rnp/RnpMessage.classbin1902 -> 0 bytes
-rw-r--r--java/rasj/rnp/RnpMessage.java83
-rw-r--r--java/rasj/rnp/RnpMessageHeader.classbin2701 -> 0 bytes
-rw-r--r--java/rasj/rnp/RnpMessageHeader.java150
-rw-r--r--java/rasj/rnp/RnpParameter.classbin2965 -> 0 bytes
-rw-r--r--java/rasj/rnp/RnpParameter.java325
-rw-r--r--java/rasj/rnp/test/Client.java104
32 files changed, 0 insertions, 3306 deletions
diff --git a/java/rasj/rnp/MD5.class b/java/rasj/rnp/MD5.class
deleted file mode 100644
index 03ef314..0000000
--- a/java/rasj/rnp/MD5.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/MD5State.class b/java/rasj/rnp/MD5State.class
deleted file mode 100644
index 0feea29..0000000
--- a/java/rasj/rnp/MD5State.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/Makefile b/java/rasj/rnp/Makefile
deleted file mode 100644
index 8597847..0000000
--- a/java/rasj/rnp/Makefile
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*-Makefile-*- (for Emacs)
-#
-# This file is part of rasdaman community.
-#
-# Rasdaman community 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 3 of the License, or
-# (at your option) any later version.
-#
-# Rasdaman community 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 rasdaman community. If not, see <http://www.gnu.org/licenses/>.
-#
-# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
-# rasdaman GmbH.
-#
-# For more information please see <http://www.rasdaman.org>
-# or contact Peter Baumann via <baumann@rasdaman.com>. # Top Level makefile. This points to the various modules that have to be build
-# and/or deployed
-#
-# MAKEFILE FOR:
-# package rasj/odmg
-#
-# COMMENTS:
-#
-##################################################################
-######################### Definitions ############################
-
-# standard include with general options
-include $(RMANBASE)/Makefile.inc
-
-SRCS = RasRNPImplementation.java Rnp.java RnpBaseClientComm.java \
- RnpDecoder.java RnpEncoder.java RnpException.java RnpFragment.java\
- RnpFragmentHeader.java RnpMessage.java RnpMessageHeader.java \
- RnpParameter.java
-OBJS = ${SRCS:%.java=%.class}
-MISCCLEAN = *.class
-
-# directory where HTML documentation is created
-DOCDIR := $(DOCBASE)/java/rasj/odmg
-
-########################### Targets ##############################
-
-# compile everything
-.PHONY : all
-all: $(OBJS)
-
-# delete all files
-empty:
- -rm -f $(SRCS) $(MISCCLEAN)
-
-############################ Dependencies #######################
-
-# general rules
-include $(RMANBASE)/Makefile.rel
-
-
diff --git a/java/rasj/rnp/Makefile.dep b/java/rasj/rnp/Makefile.dep
deleted file mode 100644
index e69de29..0000000
--- a/java/rasj/rnp/Makefile.dep
+++ /dev/null
diff --git a/java/rasj/rnp/ParameterDouble64.class b/java/rasj/rnp/ParameterDouble64.class
deleted file mode 100644
index 3e9136b..0000000
--- a/java/rasj/rnp/ParameterDouble64.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/ParameterFloat32.class b/java/rasj/rnp/ParameterFloat32.class
deleted file mode 100644
index d231c42..0000000
--- a/java/rasj/rnp/ParameterFloat32.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/ParameterInt32.class b/java/rasj/rnp/ParameterInt32.class
deleted file mode 100644
index 40874de..0000000
--- a/java/rasj/rnp/ParameterInt32.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/ParameterOpaque.class b/java/rasj/rnp/ParameterOpaque.class
deleted file mode 100644
index df732e9..0000000
--- a/java/rasj/rnp/ParameterOpaque.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/ParameterString.class b/java/rasj/rnp/ParameterString.class
deleted file mode 100644
index 98dd4c3..0000000
--- a/java/rasj/rnp/ParameterString.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/RasRNPImplementation.class b/java/rasj/rnp/RasRNPImplementation.class
deleted file mode 100644
index 913fa64..0000000
--- a/java/rasj/rnp/RasRNPImplementation.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/RasRNPImplementation.java b/java/rasj/rnp/RasRNPImplementation.java
deleted file mode 100644
index 23baac2..0000000
--- a/java/rasj/rnp/RasRNPImplementation.java
+++ /dev/null
@@ -1,1761 +0,0 @@
-/*
-* This file is part of rasdaman community.
-*
-* Rasdaman community 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 3 of the License, or
-* (at your option) any later version.
-*
-* Rasdaman community 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 rasdaman community. If not, see <http://www.gnu.org/licenses/>.
-*
-* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
-rasdaman GmbH.
-*
-* For more information please see <http://www.rasdaman.org>
-* or contact Peter Baumann via <baumann@rasdaman.com>.
-*/
-/** ***********************************************************
- * <pre>
- *
- * PURPOSE:
- *
- * COMMENTS:
- *
- * </pre>
- *********************************************************** */
-
-package rasj.rnp;
-
-import rasj.odmg.*;
-import rasj.*;
-import rasj.global.*;
-import rasj.clientcommhttp.*;
-import org.odmg.*;
-import rasj.odmg.RasOQLQuery;
-
-import java.io.*;
-import java.net.*;
-import java.lang.*;
-import java.util.*;
-
-public class RasRNPImplementation extends RnpBaseClientComm implements RasImplementationInterface, RasCommDefs,RasGlobalDefs
- {
- public static final int pmt_none = 0;
- public static final int pmt_clientid = 1;
- public static final int pmt_rErrorString = 2;
- public static final int pmt_dbname = 3;
- public static final int pmt_accesmode = 4;
- public static final int pmt_queryString = 5;
- public static final int pmt_httpqanswer = 6;
- public static final int pmt_oidstring = 7;
- public static final int pmt_capability = 8;
- public static final int pmt_transstatus = 9;
- public static final int pmt_objecttype =10;
-
- public static final int cmd_none = 0;
- public static final int cmd_connect = 1;
- public static final int cmd_disconnect = 2;
- public static final int cmd_opendb = 3;
- public static final int cmd_closedb = 4;
- public static final int cmd_beginta = 5;
- public static final int cmd_committa = 6;
- public static final int cmd_abortta = 7;
- public static final int cmd_istaopen = 8;
- public static final int cmd_queryhttp = 9;
- public static final int cmd_getnewoid =10;
-
- public static final int rasServerId = 3072002;
-
- private String rasServer = "";
- private String rasMgr = "";
- private int rasMgrPort = 7001;
- private String userIdentification = "rasguest:8e70a429be359b6dace8b5b2500dedb0";
- private String databaseName = "";
- private String capability = "dummy";
- private int maxRetry = 5; // was 120; -- PB 2003-nov-20
-
- private RasTransaction transaction = null;
- private RasDatabase database = null;
- private RasOQLQuery query = null;
-
- private int accessMode = 0;
- private boolean readWrite = false;
- private int dbIsOpen = 0;
- private int taIsOpen = 0;
- private int clientID = 0;
-
- private String errorStatus = "";
-
- public static boolean useTurbo = true; // whenever possible pack multiple requests into one call
-
-
-
- public RasRNPImplementation(String server)
- {
- super(rasServerId);
-
- Debug.enterVerbose( "RasRNPImplementation.RasRNPImplementation start. server=" + server );
- try
- {
- StringTokenizer t=new StringTokenizer (server,"/");
- String xxx=t.nextToken();
- rasMgr =t.nextToken("/:");
- String portStr = t.nextToken(":");
- rasMgrPort = Integer.parseInt(portStr);
- }
- catch(NoSuchElementException e)
- {
- Debug.talkCritical( "RasRNPImplementation.RasRNPImplementation: " + e.getMessage() );
- Debug.leaveVerbose( "RasRNPImplementation.RasRNPImplementation done: " + e.getMessage() );
- throw new RasConnectionFailedException(RasGlobalDefs.URL_FORMAT_ERROR, server);
- }
- Debug.leaveVerbose( "RasRNPImplementation.RasRNPImplementation done." );
- } // RasRNPImplementation()
-
- public String getErrorStatus()
- {
- Debug.talkSparse( "RasRNPImplementation.getErrorStatus: " + errorStatus );
- return errorStatus;
- }
-
- public String getRasServer()
- {
- Debug.talkSparse( "RasRNPImplementation.getRasServer: " + rasServer );
- return rasServer;
- }
-
- public int dbIsOpen()
- {
- Debug.talkSparse( "RasRNPImplementation.dbIsOpen: " + dbIsOpen );
- return dbIsOpen;
- }
-
- public int getClientID()
- {
- Debug.talkSparse( "RasRNPImplementation.getClientID: " + clientID );
- return clientID;
- }
-
- public int getAccessMode()
- {
- Debug.talkSparse( "RasRNPImplementation.getAccessMode: " + accessMode );
- return accessMode;
- }
-
- public Transaction newTransaction()
- {
- transaction = new RasTransaction(this);
- Debug.talkSparse( "RasRNPImplementation.newTransaction." );
- return transaction;
- }
-
- public Transaction currentTransaction()
- {
- Debug.talkSparse( "RasRNPImplementation.currentTransaction." );
- return transaction;
- }
-
- public Database newDatabase()
- {
- database=new RasDatabase(this);
- Debug.talkSparse( "RasRNPImplementation.newDatabase." );
- return database;
- }
-
- public OQLQuery newOQLQuery()
- {
- query=new RasOQLQuery(this);
- Debug.talkSparse( "RasRNPImplementation.newOQLQuery." );
- return query;
- }
-
- public DList newDList()
- {
- Debug.talkSparse( "RasRNPImplementation.newDList." );
- return new RasList();
- }
-
- public DBag newDBag()
- {
- Debug.talkSparse( "RasRNPImplementation.newDBag." );
- return new RasBag();
- }
-
- public DSet newDSet()
- {
- Debug.talkSparse( "RasRNPImplementation.newDSet." );
- return new RasSet();
- }
-
- public DArray newDArray()
- {
- Debug.talkCritical( "RasRNPImplementation.newDArray: not yet implemented." );
- throw new NotImplementedException();
- }
-
- public DMap newDMap()
- {
- Debug.talkCritical( "RasRNPImplementation.newDMap: not yet implemented." );
- throw new NotImplementedException();
- }
-
- public Database getDatabase(Object obj)
- {
- Debug.talkCritical( "RasRNPImplementation.getDatabase: not yet implemented." );
- throw new NotImplementedException();
- }
-
- public String getObjectId(Object obj)
- {
- Debug.enterVerbose( "RasRNPImplementation.getObjectId start." );
- String oid = null;
- if (obj instanceof RasObject)
- {
- RasOID roid = ((RasObject)obj).getOID();
- oid = roid.toString();
- if (!((RasObject)obj).getOID().isValid())
- {
- roid = executeGetNewObjectId();
- oid = roid.toString();
- ((RasObject)obj).setOID(roid);
- }
- else
- {
- Debug.leaveCritical( "RasRNPImplementation.getObjectId done. not yet implemented." );
- throw new NotImplementedException();
- }
- }
- Debug.leaveVerbose( "RasRNPImplementation.getObjectId done. oid=" + oid );
- return oid;
- }
-
- public void setMaxRetry(int newRetry)
- {
- Debug.talkVerbose( "RasRNPImplementation.setMaxRetry: setting to " + newRetry );
- maxRetry = newRetry;
- }
-
- public int getMaxRetry()
- {
- Debug.talkVerbose( "RasRNPImplementation.getMaxRetry: is " + maxRetry );
- return maxRetry;
- }
-
- public void openDB(String name, int accessMode) throws ODMGException
- {
- Debug.enterVerbose( "RasRNPImplementation.openDB start. db=" + name + ", accessMode=" + accessMode );
- databaseName = name;
- this.accessMode = accessMode;
- readWrite = (accessMode != Database.OPEN_READ_ONLY) ? true:false;
- getFreeServer(false); // fake server
-
- // "turbo" doesn't work because connect delivers the client id needed for later calls
- // if(useTurbo==false)
- // {
- executeConnect();
- executeOpenDB(databaseName);
- executeCloseDB();
- executeDisconnect();
- // }
- // else executeTurboOpen(name);
-
- dbIsOpen = 1;
- Debug.leaveVerbose( "RasRNPImplementation.openDB done." );
- }
-
- public void closeDB() throws ODMGException
- {
- Debug.talkVerbose( "RasRNPImplementation.closeDB." );
- dbIsOpen = 0;
- }
-
- public void beginTA()
- {
- Debug.enterVerbose( "RasRNPImplementation.beginTA start." );
- if(useTurbo==false)
- {
- try
- {
- getFreeServer(true);
- executeConnect();
- executeOpenDB(databaseName);
- executeBeginTA();
- }
- catch(ODMGException e)
- {
- errorStatus = e.getMessage();
- Debug.talkCritical( "RasRNPImplementation.beginTA: " + errorStatus );
- }
- }
- else
- {
- try
- {
- getFreeServer(true);
- executeTurboBegin(databaseName);
- }
- catch(ODMGException e)
- {
- errorStatus = e.getMessage();
- Debug.talkCritical( "RasRNPImplementation.beginTA: " + errorStatus );
- }
- }
- Debug.leaveVerbose( "RasRNPImplementation.beginTA done." );
- }
-
- public boolean isOpenTA()
- {
- Debug.enterVerbose( "RasRNPImplementation.isOpenTA start." );
- boolean result = false;
- try
- {
- if(executeIsOpenTA()!=0)
- result = true;
- }
- catch(ODMGException e)
- {
- errorStatus = e.getMessage();
- Debug.talkCritical( "RasRNPImplementation.isOpenTA: " + errorStatus );
- }
- Debug.leaveVerbose( "RasRNPImplementation.isOpenTA done. result=" + result );
- return result;
- }
-
- public void commitTA()
- {
- Debug.enterVerbose( "RasRNPImplementation.commitTA start." );
- if(useTurbo==false)
- {
- try
- {
- executeCommitTA();
- executeCloseDB();
- executeDisconnect();
- }
- catch(ODMGException e)
- {
- errorStatus = e.getMessage();
- Debug.talkCritical( "RasRNPImplementation.commitTA: " + errorStatus );
- }
- }
- else
- {
- try
- {
- executeTurboCommit();
- }
- catch(ODMGException e)
- {
- errorStatus = e.getMessage();
- Debug.talkCritical( "RasRNPImplementation.commitTA: " + errorStatus );
- }
- }
- Debug.leaveVerbose( "RasRNPImplementation.commitTA done." );
- }
-
- public void abortTA()
- {
- Debug.enterVerbose( "RasRNPImplementation.abortTA done." );
- if (useTurbo==false)
- {
- try
- {
- executeAbortTA();
- executeCloseDB();
- executeDisconnect();
- }
- catch(ODMGException e)
- {
- errorStatus = e.getMessage();
- Debug.talkCritical( "RasRNPImplementation.abortTA: " + errorStatus );
- }
- }
- else
- {
- try
- {
- executeTurboAbort();
- }
- catch(ODMGException e)
- {
- errorStatus = e.getMessage();
- Debug.talkCritical( "RasRNPImplementation.abortTA: " + errorStatus );
- }
- }
- Debug.leaveVerbose( "RasRNPImplementation.abortTA done." );
- }
-
- public Object queryRequest(String parameters) throws RasQueryExecutionFailedException
- {
- Debug.talkVerbose( "RasRNPImplementation.queryRequest." );
- return executeQueryRequest(parameters);
- }
-
- private void executeTurboOpen(String name) throws ODMGException
- {
- Debug.enterVerbose( "RasRNPImplementation.executeTurboOpen start. name=" + name );
- clientID = 0;
- startMessage();
-
- //connect
- startFragment(cmd_connect);
- encoder.addParameterInt32(pmt_clientid,clientID);
- encoder.addParameterString(pmt_capability,capability);
- endFragment();
-
- //opendb
- startFragment(cmd_opendb);
- encoder.addParameterInt32(pmt_clientid,clientID);
- encoder.addParameterString(pmt_dbname,name);
- endFragment();
-
- //close db
- startFragment(cmd_closedb);
- encoder.addParameterInt32(pmt_clientid,clientID);
- endFragment();
-
- //disconnect
- startFragment(cmd_disconnect);
- encoder.addParameterInt32(pmt_clientid,clientID);
- endFragment();
-
- endMessage();
-
- //send message and receive answer
- turboSendRequestGetAnswer();
-
- // connect answer
- RnpFragment fragment=decoder.getFirstFragment();
- checkForError();
- decoder.getFirstParameter();
- clientID=decoder.getDataAsInteger();
-
- //opendb answer
- fragment=decoder.getNextFragment(fragment);
- checkForError();
-
- //closedb answer
- fragment=decoder.getNextFragment(fragment);
- checkForError();
-
- //disconnect answer
- decoder.getNextFragment(fragment);
- checkForError();
- clientID = 0;
- Debug.leaveVerbose( "RasRNPImplementation.executeTurboOpen done." );
- }
-
- private void executeTurboBegin(String name) throws ODMGException
- {
- Debug.enterVerbose( "RasRNPImplementation.executeTurboBegin start. name=" + name );
- clientID = 0;
- startMessage();
-
- //connect
- startFragment(cmd_connect);
- encoder.addParameterInt32(pmt_clientid,clientID);
- encoder.addParameterString(pmt_capability,capability);
- endFragment();
-
- //opendb
- startFragment(cmd_opendb);
- encoder.addParameterInt32(pmt_clientid,clientID);
- encoder.addParameterString(pmt_dbname,name);
- endFragment();
-
- // begin ta
- startFragment(cmd_beginta);
- encoder.addParameterInt32(pmt_clientid,clientID);
- encoder.addParameterInt32(pmt_accesmode, readWrite ? 1:0);
- endFragment();
-
- endMessage();
-
- //send message and receive answer
- turboSendRequestGetAnswer();
-
- // connect answer
- RnpFragment fragment=decoder.getFirstFragment();
- checkForError();
- decoder.getFirstParameter();
- clientID=decoder.getDataAsInteger();
-
- //opendb answer
- fragment=decoder.getNextFragment(fragment);
- checkForError();
-
- // begin ta answer
- decoder.getNextFragment(fragment);
- checkForError();
- Debug.leaveVerbose( "RasRNPImplementation.executeTurboBegin done." );
- }
-
- private void executeTurboCommit() throws ODMGException
- {
- Debug.enterVerbose( "RasRNPImplementation.executeTurboCommit start." );
- startMessage();
-
- //commit
- startFragment(cmd_committa);
- encoder.addParameterInt32(pmt_clientid,clientID);
- endFragment();
-
- //close
- startFragment(cmd_closedb);
- encoder.addParameterInt32(pmt_clientid,clientID);
- endFragment();
-
- //disconnect
- startFragment(cmd_disconnect);
- encoder.addParameterInt32(pmt_clientid,clientID);
- endFragment();
-
- endMessage();
-
- //send message and receive answer
- turboSendRequestGetAnswer();
-
- //commit answer
- RnpFragment fragment=decoder.getFirstFragment();
- checkForError();
-
- //close answer
- fragment=decoder.getNextFragment(fragment);
- checkForError();
-
- //disconnect answer
- decoder.getNextFragment(fragment);
- checkForError();
- clientID = 0;
- Debug.leaveVerbose( "RasRNPImplementation.executeTurboCommit done." );
- }
-
- private void executeTurboAbort() throws ODMGException
- {
- Debug.enterVerbose( "RasRNPImplementation.executeTurboAbort start." );
- startMessage();
-
- //abort
- startFragment(cmd_abortta);
- encoder.addParameterInt32(pmt_clientid,clientID);
- endFragment();
-
- //close
- startFragment(cmd_closedb);
- encoder.addParameterInt32(pmt_clientid,clientID);
- endFragment();
-
- //disconnect
- startFragment(cmd_disconnect);
- encoder.addParameterInt32(pmt_clientid,clientID);
- endFragment();
-
- endMessage();
-
- //send message and receive answer
- turboSendRequestGetAnswer();
-
- //abort answer
- RnpFragment fragment=decoder.getFirstFragment();
- checkForError();
-
- //close answer
- fragment=decoder.getNextFragment(fragment);
- checkForError();
-
- //disconnect answer
- decoder.getNextFragment(fragment);
- checkForError();
- clientID = 0;
- Debug.leaveVerbose( "RasRNPImplementation.executeTurboAbort done." );
- }
-
- private RasOID executeGetNewObjectId()
- {
- Debug.enterVerbose( "RasRNPImplementation.executeGetNewObjectId start." );
- startRequest(cmd_getnewoid);
- encoder.addParameterInt32(pmt_clientid,clientID);
- encoder.addParameterInt32(pmt_objecttype,1);
- sendRequestGetAnswer();
- decoder.getFirstParameter();
- RasOID result = new RasOID(decoder.getDataAsString());
- Debug.leaveVerbose( "RasRNPImplementation.executeGetNewObjectId done." );
- return result;
- }
-
- private int executeIsOpenTA()throws ODMGException
- {
- startRequest(cmd_istaopen);
- encoder.addParameterInt32(pmt_clientid,clientID);
- sendRequestGetAnswer();
- decoder.getFirstParameter();
- int result = decoder.getDataAsInteger();
- Debug.leaveVerbose( "RasRNPImplementation.executeIsOpenTA done. result=" + result );
- return result;
- }
-
-//######## These functions are kept only for testing purpose, we will emove them soon ####
- private void executeConnect() throws ODMGException
- {
- startRequest(cmd_connect);
- encoder.addParameterInt32(pmt_clientid,clientID);
- encoder.addParameterString(pmt_capability,capability);
- sendRequestGetAnswer();
- checkForError();
- decoder.getFirstParameter();
- clientID=decoder.getDataAsInteger();
- }
-
- private void executeDisconnect() throws ODMGException
- {
- startRequest(cmd_disconnect);
- encoder.addParameterInt32(pmt_clientid,clientID);
- sendRequestGetAnswer();
- checkForError();
- }
-
- private void executeOpenDB(String name) throws ODMGException
- {
- startRequest(cmd_opendb);
- encoder.addParameterInt32(pmt_clientid,clientID);
- encoder.addParameterString(pmt_dbname,name);
- sendRequestGetAnswer();
- checkForError();
- }
-
- private void executeCloseDB() throws ODMGException
- {
- startRequest(cmd_closedb);
- encoder.addParameterInt32(pmt_clientid,clientID);
- sendRequestGetAnswer();
- checkForError();
- }
-
- private void executeBeginTA() throws ODMGException
- {
- startRequest(cmd_beginta);
- encoder.addParameterInt32(pmt_clientid,clientID);
- encoder.addParameterInt32(pmt_accesmode, readWrite ? 1:0);
- sendRequestGetAnswer();
- checkForError();
- }
-
- private void executeCommitTA()throws ODMGException
- {
- startRequest(cmd_committa);
- encoder.addParameterInt32(pmt_clientid,clientID);
- sendRequestGetAnswer();
- checkForError();
- }
-
- private void executeAbortTA()throws ODMGException
- {
- startRequest(cmd_abortta);
- encoder.addParameterInt32(pmt_clientid,clientID);
- sendRequestGetAnswer();
- checkForError();
- }
-
-//################################################################################
-
- public void getFreeServer(boolean realServer)throws RasQueryExecutionFailedException, RasConnectionFailedException
- {
- Debug.enterVerbose( "RasRNPImplementation.getFreeServer start. realServer=" + realServer );
- String uniqueID = uniqueRequestID();
-
- for (int retryCount = 0; ;retryCount++)
- {
- try
- {
- executeGetFreeServer(realServer,uniqueID);
- break;
- }
- catch(RasConnectionFailedException e)
- {
- int errno = e.getErrorNo();
- // FIXME: adapt algorithm to that of http, see RasODMGImplementation.java
- if ( ( errno==RasGlobalDefs.MANAGER_BUSY
- // || errno==RasGlobalDefs.NO_ACTIVE_SERVERS // if server doesn't run waiting won't help -- PB 2003-nov-20
- || errno==RasGlobalDefs.WRITE_TRANS_IN_PROGRESS)
- && retryCount < maxRetry)
- {
- int millisec = 50 * retryCount + 50;
- if(millisec > 1000)
- millisec = 1000;
- Debug.talkVerbose( "RasRNPImplementation.getFreeServer: retry #" + retryCount + ", sleeping " + millisec + "msecs" );
- try
- {
- Thread.sleep(millisec);
- }
- catch(InterruptedException intex)
- {
- // wake up
- }
- }
- else
- {
- Debug.talkCritical( "RasRNPImplementation.getFreeServer: " + e.getMessage() );
- Debug.leaveVerbose( "RasRNPImplementation.getFreeServer done: " + e.getMessage() );
- throw(e);
- }
- } // catch
- } // for
-
- Debug.leaveVerbose( "RasRNPImplementation.getFreeServer done." );
- } // getFreeServer
-
- private void executeGetFreeServer(boolean realServer, String uniqueID)
- throws RasQueryExecutionFailedException, RasConnectionFailedException
- {
- Debug.enterVerbose( "RasRNPImplementation.executeGetFreeServer start. realServer=" + realServer + ", uniqueID=" + uniqueID );
- try
- {
- Debug.talkVerbose( "RasRNPImplementation.executeGetFreeServer: rasmgr=" + rasMgr + ", port=" + rasMgrPort );
- Socket socket = new Socket(rasMgr,rasMgrPort);
- Debug.talkVerbose( "RasRNPImplementation.executeGetFreeServer: socket=" + socket );
- PrintStream ps = new PrintStream(socket.getOutputStream());
- String accessFlag = (accessMode == Database.OPEN_READ_ONLY ? "ro":"rw");
- String body = databaseName + " RNP " + accessFlag + ' ' + uniqueID + " \0";
- if (realServer)
- ps.print("POST getfreeserver RNP/1.1\r\nAccept: text/plain\r\nContent-type: text/plain\r\n"
- + "User-Agent: RasDaMan Java Client1.0\r\nAuthorization: ras " + userIdentification
- + "\r\nContent length: " + body.length()+"\r\n\r\n" + body);
- else
- ps.print("POST getfreeserver2 RNP/1.1\r\nAccept: text/plain\r\nContent-type: text/plain\r\n"
- + "User-Agent: RasDaMan Java Client1.0\r\nAuthorization: ras " + userIdentification
- + "\r\nContent length: " + body.length()+"\r\n\r\n" + body);
- ps.flush();
-
- BufferedReader ds = new BufferedReader(new InputStreamReader(socket.getInputStream()));
- int resultCode = getResultCode(ds);
- String bodyLine = getBodyLine(ds);
- Debug.talkVerbose( "RasRNPImplementation.executeGetFreeServer: bodyLine: " + bodyLine );
-
- ps.close();
- ds.close();
- socket.close();
- Debug.talkVerbose( "RasRNPImplementation.executeGetFreeServer: socket closed: " + socket );
-
- if (resultCode==200)
- {
- StringTokenizer t=new StringTokenizer(bodyLine," ");
- String host=t.nextToken();
- String port=t.nextToken(" ");
- capability=t.nextToken(" \t\r\n\0");
- rasServer="http://" + host + ":" + port;
- setConnectionParameters(host,Integer.parseInt(port));
- }
- else
- {
- StringTokenizer t=new StringTokenizer(bodyLine," ");
- String errorStr = t.nextToken();
- int errorCode = Integer.parseInt(errorStr);
- if( resultCode < 1000 )
- {
- Debug.talkCritical( "RasRNPImplementation.executeGetFreeServer: " + errorCode );
- Debug.leaveVerbose( "RasRNPImplementation.executeGetFreeServer: done. errorcode=" + errorCode );
- throw new RasConnectionFailedException(errorCode,null);
- }
- else
- {
- Debug.talkCritical( "RasRNPImplementation.executeGetFreeServer: " + errorCode );
- Debug.leaveVerbose( "RasRNPImplementation.executeGetFreeServer: done. errorcode=" + errorCode );
- throw new RasConnectionFailedException(RasGlobalDefs.REQUEST_FORMAT_ERROR," code=" + errorCode);
- }
- }
- }
- catch(MalformedURLException e)
- {
- Debug.talkCritical( "RasRNPImplementation.executeGetFreeServer: " + e.getMessage() );
- Debug.leaveVerbose( "RasRNPImplementation.executeGetFreeServer: done. " + e.getMessage() );
- throw new RasConnectionFailedException(RasGlobalDefs.MANAGER_CONN_FAILED,rasMgr);
- }
- catch(IOException e)
- {
- Debug.talkCritical( "RasRNPImplementation.executeGetFreeServer: " + e.getMessage() );
- Debug.leaveVerbose( "RasRNPImplementation.executeGetFreeServer: done. " + e.getMessage() );
- throw new RasClientInternalException("RasODMGImplementation","getFreeServer()",e.getMessage());
- }
- catch(NumberFormatException e)
- {
- Debug.talkCritical( "RasRNPImplementation.executeGetFreeServer: cannot decode integer: " + e.getMessage() );
- Debug.leaveVerbose( "RasRNPImplementation.executeGetFreeServer: done. " + e.getMessage() );
- throw new RasClientInternalException("RasODMGImplementation","getFreeServer()",e.getMessage());
- }
- Debug.leaveVerbose( "RasRNPImplementation.executeGetFreeServer done." );
- }
-
- public int getResultCode(BufferedReader ds) throws IOException
- {
- Debug.enterVerbose( "RasRNPImplementation.getResultCode: start." );
-
- String s = ds.readLine();
- StringTokenizer t = new StringTokenizer(s," ");
- String http = t.nextToken(); // FIXME: never used
- String resultString = t.nextToken(" ");
- int result = 0;
- try
- {
- result = Integer.parseInt(resultString);
- }
- catch(NumberFormatException e)
- {
- Debug.talkCritical( "RasRNPImplementation.getResultCode: cannot decode integer: " + e.getMessage() );
- result = 0; // FIXME: set to some real error code
- }
-
- Debug.leaveVerbose( "RasRNPImplementation.getResultCode: done. result=" + result );
- return result;
- }
-
- public String getBodyLine(BufferedReader ds)throws IOException
- {
- Debug.enterVerbose( "RasRNPImplementation.getBodyLine: start." );
-
- // obviously we are searching for what follows an empty line:
- for(;;)
- {
- String s=ds.readLine();
- if(s==null)
- {
- Debug.talkCritical( "RasRNPImplementation.getBodyLine: done. Unexpected EOF in rasmgr answer." );
- Debug.leaveVerbose( "RasRNPImplementation.getBodyLine: done, with eof exception." );
- throw new IOException("Unexpected EOF in rasmgr answer.");
- }
- if(s.length()==0)
- break;
- }
- String result = ds.readLine();
-
- Debug.leaveVerbose( "RasRNPImplementation.getBodyLine: done. result=" + result );
- return result;
- }
-
- private Object executeQueryRequest(String parameters) throws RasQueryExecutionFailedException
- {
- Debug.enterVerbose( "RasRNPImplementation.executeQueryRequest: start. parameters=" + parameters );
-
- startRequest(cmd_queryhttp);
- encoder.addParameterInt32(pmt_clientid,clientID);
- try
- {
- encoder.addParameterOpaque(pmt_queryString,parameters.getBytes("8859_1"));
- }
- catch(UnsupportedEncodingException e)
- {
- Debug.talkCritical( "RasRNPImplementation.executeQueryRequest: " + e.getMessage() );
- Debug.leaveVerbose( "RasRNPImplementation.executeQueryRequest: done, " + e.getMessage() );
- throw new RasClientInternalException("RasRNPImplementation","executeQueryRequest()",e.getMessage());
- }
- sendRequestGetAnswer();
- checkForError();
- decoder.getFirstParameter();
- Object result= getResponse(decoder.getDataOpaque());
-
- Debug.leaveVerbose( "RasRNPImplementation.executeQueryRequest: done. result=" + result );
- return result;
- }
-
- private Object getResponse(byte[] opaqueAnswer)
- throws RasQueryExecutionFailedException
- {
- Debug.enterVerbose( "RasRNPImplementation.getResponse: start." );
-
- Object result=null;
- DataInputStream in =new DataInputStream(new ByteArrayInputStream(opaqueAnswer));
- byte[] b1 = new byte[1];
- byte[] b4 = new byte[4];
- byte endianess = 0;
- String collType = null;
- int numberOfResults = 0;
- int dataSize = 0;
- byte[] binData = null;
- int readBytes = 0;
- int readBytesTmp = 0;
- DBag resultBag;
- RasGMArray res = null;
- try
- {
- in.read(b1);
- int resultType = b1[0];
- switch( resultType )
- {
- case RESPONSE_OK:
- case RESPONSE_OK_NEGATIVE:
- //Nothing todo
- break;
-
- // +++++++++++++++++++++++++++++++++++++++++++++++++
- case RESPONSE_MDDS:
- // read Endianess
- while(in.read(b1) == 0);
- endianess = b1[0];
-
- // read Collection Type
- collType = RasUtils.readString(in);
-
- // read NumberOfResults
- while(in.available() < 4);
- in.read(b4);
- numberOfResults = RasUtils.ubytesToInt(b4,endianess);
-
- // Initialize return-set and parameters
- resultBag = new RasBag();
- String mddBaseType = null;
- String domain = null;
- String oid = "";
- RasOID roid = null;
-
- // do this for each result
- for(int x = 0; x < numberOfResults; x++)
- {
- //read mddBaseType
- mddBaseType = RasUtils.readString(in);
-
- // read spatialDomain
- domain = RasUtils.readString(in);
-
- // read OID
- oid = RasUtils.readString(in);
- roid = new RasOID(oid);
-
- // read size of binData
- while(in.available() < 4);
- in.read(b4);
-
- dataSize = RasUtils.ubytesToInt(b4,endianess);
-
- // read binData
- binData = new byte[dataSize];
- readBytes = 0;
- readBytesTmp = 0;
-
- while( (readBytesTmp != -1) && (readBytes < dataSize) )
- {
- readBytesTmp = in.read(binData,readBytes,dataSize-readBytes);
- readBytes += readBytesTmp;
- }
-
- RasType rType = RasType.getAnyType(mddBaseType);
- RasBaseType rb = null;
-
- if(rType.getClass().getName().equals("rasj.RasMArrayType"))
- {
- RasMArrayType tmp = (RasMArrayType)rType;
- rb = tmp.getBaseType();
- }
- else
- {
- Debug.talkCritical( "RasRNPImplementation.getResponse: collection element is no MArray." );
- Debug.leaveVerbose( "RasRNPImplementation.getResponse: done, with exception." );
- throw new RasClientInternalException("RasHttpRequest","execute()","element of MDD Collection is no MArray");
- }
- if(rb.isBaseType())
- {
- if(rb.isStructType())
- {
- RasStructureType sType = (RasStructureType)rb;
- res = new RasGMArray(new RasMInterval(domain), 0);
- res.setTypeLength(rb.getSize());
- res.setArraySize(dataSize);
- res.setArray(binData);
- //insert into result set
- resultBag.add(res);
- break;
- }
- else
- {
- // It is a primitiveType
- RasPrimitiveType pType = (RasPrimitiveType)rb;
- switch(pType.getTypeID())
- {
- case RAS_BOOLEAN:
- case RAS_BYTE:
- case RAS_CHAR:
- res = new RasMArrayByte(new RasMInterval(domain));
- break;
- case RAS_SHORT:
- res = new RasMArrayShort(new RasMInterval(domain));
- break;
-
- case RAS_USHORT:
- byte[] tmData = new byte[dataSize*2];
- for(int i=0;i<dataSize*2;)
- {
- tmData[i] = 0;
- tmData[i+1] = 0;
- tmData[i+2] = binData[i/2];
- tmData[i+3] = binData[i/2+1];
- i = i+SIZE_OF_INTEGER;
- }
- binData = tmData;
- res = new RasMArrayInteger(new RasMInterval(domain));
- break;
-
- case RAS_INT:
- case RAS_LONG:
- res = new RasMArrayInteger(new RasMInterval(domain));
- break;
- case RAS_ULONG:
- byte[] tmpData = new byte[dataSize*2];
- for(int i=0;i<dataSize*2;)
- {
- tmpData[i] = 0;
- tmpData[i+1] = 0;
- tmpData[i+2] = 0;
- tmpData[i+3] = 0;
- tmpData[i+4] = binData[i/2];
- tmpData[i+5] = binData[i/2+1];
- tmpData[i+6] = binData[i/2+2];
- tmpData[i+7] = binData[i/2+3];
- i = i+SIZE_OF_LONG;
- }
- binData = tmpData;
- res = new RasMArrayLong(new RasMInterval(domain));
- break;
- case RAS_FLOAT:
- res = new RasMArrayFloat(new RasMInterval(domain));
- break;
- case RAS_DOUBLE:
- res = new RasMArrayDouble(new RasMInterval(domain));
- break;
- default:
- res = new RasGMArray(new RasMInterval(domain), pType.getSize());
- }
- res.setArray(binData);
- res.setOID(roid);
- resultBag.add(res);
- }
- }
- else
- {
- Debug.talkCritical( "RasRNPImplementation.getResponse: type is not base type." );
- Debug.leaveVerbose( "RasRNPImplementation.getResponse: done, type is not base type." );
- throw new RasClientInternalException("RasHttpRequest","execute()","Type of MDD is no Base Type");
- }
- } // for
-
- result = resultBag;
- in.close();
-
- break;
-
- // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- case RESPONSE_SKALARS:
- // read Endianess
- while(in.read(b1) == 0);
- endianess = b1[0];
- // read Collection Type
- collType = RasUtils.readString(in);
- RasType rt = new RasType();
- try
- {
- rt = rt.getAnyType(collType);
- }
- catch(Exception e)
- {
- Debug.talkCritical( "RasRNPImplementation.getResponse: type not supported: " + rt );
- Debug.leaveVerbose( "RasRNPImplementation.getResponse: done, unsupported type" );
- throw new RasTypeNotSupportedException(rt + " as RasCollectionType");
- }
- if(rt.getTypeID()!=RasGlobalDefs.RAS_COLLECTION)
- {
- Debug.leaveCritical( "RasRNPImplementation.getResponse: done. type not supported: " + rt );
- throw new RasTypeNotSupportedException(rt + " as RasCollectionType");
- }
-
- // read NumberOfResults
- while(in.available() < 4)
- ;
- in.read(b4);
- numberOfResults = RasUtils.ubytesToInt(b4,endianess);
-
- // Initailize return-list
- resultBag = new RasBag();
-
- // do this for each result
- for(int x = 0; x < numberOfResults; x++)
- {
- // read elementType
- String elementType = RasUtils.readString(in);
- RasType et = new RasType();
- et = ((RasCollectionType)rt).getElementType();
- // read size of binData
- while(in.available() < 4)
- ;
- in.read(b4);
- dataSize = RasUtils.ubytesToInt(b4,endianess);
- // read binData
- binData = new byte[dataSize];
- readBytes = 0;
- readBytesTmp = 0;
- while( (readBytesTmp != -1) && (readBytes < dataSize) )
- {
- readBytesTmp = in.read(binData,readBytes,dataSize-readBytes);
- readBytes += readBytesTmp;
- }
-
- ByteArrayInputStream bis = new ByteArrayInputStream(binData);
- DataInputStream dis = new DataInputStream(bis);
- // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- switch(et.getTypeID())
- {
- case RasGlobalDefs.RAS_MINTERVAL:
- resultBag.add(new RasMInterval(new String(binData)));
- break;
- case RasGlobalDefs.RAS_SINTERVAL:
- resultBag.add(new RasSInterval(new String(binData)));
- break;
- case RasGlobalDefs.RAS_POINT:
- resultBag.add(new RasPoint(new String(binData)));
- break;
- case RasGlobalDefs.RAS_OID:
- resultBag.add(new RasOID(new String(binData)));
- break;
- case RAS_BOOLEAN:
- case RAS_BYTE:
- case RAS_CHAR:
- byte b = binData[0];
- resultBag.add(new Byte(b));
- break;
- case RAS_DOUBLE:
- double d = dis.readDouble();
- resultBag.add(new Double(d));
- break;
- case RAS_FLOAT:
- float f = dis.readFloat();
- resultBag.add(new Float(f));
- break;
- case RAS_ULONG:
- byte[] bu = new byte[8];
- bu[0] = 0;
- bu[1] = 0;
- bu[2] = 0;
- bu[3] = 0;
- bu[4] = dis.readByte();
- bu[5] = dis.readByte();
- bu[6] = dis.readByte();
- bu[7] = dis.readByte();
- ByteArrayInputStream bis2 = new ByteArrayInputStream(bu);
- DataInputStream dis2 = new DataInputStream(bis2);
- long ul = dis2.readLong();
- resultBag.add(new Long(ul));
- break;
- case RAS_LONG:
- case RAS_INT:
- int i = dis.readInt();
- resultBag.add(new Integer(i));
- break;
- case RAS_USHORT:
- int j = dis.readUnsignedShort();
- resultBag.add(new Integer(j));
- break;
- case RAS_SHORT:
- short s = dis.readShort();
- resultBag.add(new Short(s));
- break;
- default:
- Debug.talkCritical( "RasRNPImplementation.getResponse: type not supported: " + et );
- Debug.leaveVerbose( "RasRNPImplementation.getResponse: done, unsupported type." );
- throw new RasTypeNotSupportedException(et + " as ElementType ");
- }
- }
- result = resultBag;
- // close stream
- in.close();
- break;
-
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- case RESPONSE_ERROR:
- // read Endianess
- while(in.read(b1) == 0);
- endianess = b1[0];
- // read Error Number
- while(in.available() < 4)
- ;
- in.read(b4);
- int errNo = RasUtils.ubytesToInt(b4,endianess);
- // read Line Number
- while(in.available() < 4)
- ;
- in.read(b4);
- int lineNo = RasUtils.ubytesToInt(b4,endianess);
- // read Column Number
- while(in.available() < 4)
- ;
- in.read(b4);
- int colNo = RasUtils.ubytesToInt(b4,endianess);
- // read token
- String token = RasUtils.readString(in);
- Debug.leaveCritical( "RasRNPImplementation.getResponse: query failed, errNo=" + errNo + ", lineNo=" + lineNo + ", colNo=" + colNo + ", token=" + token );
- throw new RasQueryExecutionFailedException(errNo,lineNo,colNo,token);
- //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- case RESPONSE_INT:
- // read Integer Value
- while(in.available() < 4)
- ;
- in.read(b4);
- result = new Integer(RasUtils.ubytesToInt(b4,endianess));
- break;
-
- //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- case RESPONSE_OID:
- // read Values
- String sys = RasUtils.readString(in);
- String base = RasUtils.readString(in);
- double d = in.readDouble();
- resultBag = new RasBag();
- resultBag.add(new RasOID(sys, base, d));
- result = resultBag;
- // close stream
- in.close();
- break;
- default:
- break;
- }
- }
- catch( IOException e )
- {
- Debug.talkCritical( "RasRNPImplementation.getResponse: " + e.getMessage() );
- Debug.leaveVerbose( "RasRNPImplementation.getResponse: done, communication exception." );
- throw new RasClientInternalException("RasRNPImplementation","getResponse()",e.getMessage());
- }
- catch( RasResultIsNoIntervalException e )
- {
- Debug.talkCritical( "RasRNPImplementation.getResponse: " + e.getMessage() );
- Debug.leaveVerbose( "RasRNPImplementation.getResponse: done, result not an interval." );
- throw new RasClientInternalException("RasRNPImplementation","getResponse()",e.getMessage());
- }
-
- Debug.leaveVerbose( "RasRNPImplementation.getResponse: done. result=" + result );
- return result;
- }
-
- public void setUserIdentification(String userName, String plainPass)
- {
- Debug.enterVerbose( "RasRNPImplementation.setUserIdentification: start." );
- MD5 md5 = new MD5();
- String hex;
- md5.Init();
- md5.Update(plainPass);
- hex = md5.asHex();
- userIdentification= userName + ":" + hex;
- Debug.leaveVerbose( "RasRNPImplementation.setUserIdentification: done." );
- }
-
- private String strHostID = null;
- static private int idcounter = 0;
-
- /**
- generate a unique request ID using IP address, some bit mangling
- is done only once, this id then is used always
- **/
- private String uniqueRequestID()
- {
- Debug.enterVerbose( "RasRNPImplementation.uniqueRequestID: start." );
- if(strHostID == null)
- {
- long hostid = 0;
- try
- {
- InetAddress addr = InetAddress.getLocalHost();
- // Get IP Address
- byte[] ipAddr = addr.getAddress();
-
- for(int i=0;i<ipAddr.length; i++)
- {
- int ss = (int)ipAddr[i];
- if(ss<0) ss = 256 + ss;
- hostid = hostid * 256 + ss;
- }
- }
- catch (UnknownHostException e) // cannot obtain IP address?
- {
- Random random = new Random(); // then use other mechanism
- hostid = random.nextInt();
- }
- idcounter = (idcounter + 1) &0xF;
- // it's unique enough, we don't need such a huge number
- strHostID = "" + hostid + ':' + (System.currentTimeMillis() & 0xFFFFFFF0) + idcounter;
- }
-
- Debug.leaveVerbose( "RasRNPImplementation.uniqueRequestID: done. result=" + strHostID );
- return strHostID;
- }
-
- } // RasRNPImplementation
-
-//##########################################################################################
-class MD5State
- {
- /**
- * 128-byte state
- */
- int state[];
-
- /**
- * 64-bit character count (could be true Java long?)
- */
- int count[];
-
- /**
- * 64-byte buffer (512 bits) for storing to-be-hashed characters
- */
- byte buffer[];
-
- public MD5State()
- {
- buffer = new byte[64];
- count = new int[2];
- state = new int[4];
-
- state[0] = 0x67452301;
- state[1] = 0xefcdab89;
- state[2] = 0x98badcfe;
- state[3] = 0x10325476;
-
- count[0] = count[1] = 0;
- }
-
- /** Create this State as a copy of another state */
- public MD5State (MD5State from)
- {
- this();
-
- int i;
-
- for (i = 0; i < buffer.length; i++)
- this.buffer[i] = from.buffer[i];
-
- for (i = 0; i < state.length; i++)
- this.state[i] = from.state[i];
-
- for (i = 0; i < count.length; i++)
- this.count[i] = from.count[i];
- }
- }; // MD5State
-
-/**
- * Implementation of RSA's MD5 hash generator
- *
- * @version $Revision: 1.8 $
- * @author Santeri Paavolainen <sjpaavol@cc.helsinki.fi>
- */
-
-class MD5
- {
- /**
- * MD5 state
- */
- MD5State state;
-
- /**
- * If Final() has been called, finals is set to the current finals
- * state. Any Update() causes this to be set to null.
- */
- MD5State finals;
-
- /**
- * Padding for Final()
- */
- static byte padding[] =
- {
- (byte) 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- };
-
- /**
- * Initialize MD5 internal state (object can be reused just by
- * calling Init() after every Final()
- */
- public synchronized void Init ()
- {
- state = new MD5State();
- finals = null;
- }
-
- /**
- * Class constructor
- */
- public MD5 ()
- {
- this.Init();
- }
-
- /**
- * Initialize class, and update hash with ob.toString()
- *
- * @param ob Object, ob.toString() is used to update hash
- * after initialization
- */
- public MD5 (Object ob)
- {
- this();
- Update(ob.toString());
- }
-
- private int rotate_left (int x, int n)
- {
- return (x << n) | (x >>> (32 - n));
- }
-
- /* I wonder how many loops and hoops you'll have to go through to
- get unsigned add for longs in java */
-
- private int uadd (int a, int b)
- {
- long aa, bb;
- aa = ((long) a) & 0xffffffffL;
- bb = ((long) b) & 0xffffffffL;
-
- aa += bb;
-
- return (int) (aa & 0xffffffffL);
- }
-
- private int uadd (int a, int b, int c)
- {
- return uadd(uadd(a, b), c);
- }
-
- private int uadd (int a, int b, int c, int d)
- {
- return uadd(uadd(a, b, c), d);
- }
-
- private int FF (int a, int b, int c, int d, int x, int s, int ac)
- {
- a = uadd(a, ((b & c) | (~b & d)), x, ac);
- return uadd(rotate_left(a, s), b);
- }
-
- private int GG (int a, int b, int c, int d, int x, int s, int ac)
- {
- a = uadd(a, ((b & d) | (c & ~d)), x, ac);
- return uadd(rotate_left(a, s), b);
- }
-
- private int HH (int a, int b, int c, int d, int x, int s, int ac)
- {
- a = uadd(a, (b ^ c ^ d), x, ac);
- return uadd(rotate_left(a, s) , b);
- }
-
- private int II (int a, int b, int c, int d, int x, int s, int ac)
- {
- a = uadd(a, (c ^ (b | ~d)), x, ac);
- return uadd(rotate_left(a, s), b);
- }
-
- private int[] Decode (byte buffer[], int len, int shift)
- {
- int out[];
- int i, j;
-
- out = new int[16];
-
- for (i = j = 0; j < len; i++, j += 4)
- {
- out[i] = ((int) (buffer[j + shift] & 0xff)) |
- (((int) (buffer[j + 1 + shift] & 0xff)) << 8) |
- (((int) (buffer[j + 2 + shift] & 0xff)) << 16) |
- (((int) (buffer[j + 3 + shift] & 0xff)) << 24);
- }
- return out;
- }
-
- private void Transform (MD5State state, byte buffer[], int shift)
- {
- int
- a = state.state[0],
- b = state.state[1],
- c = state.state[2],
- d = state.state[3],
- x[];
-
- x = Decode(buffer, 64, shift);
-
- /* Round 1 */
- a = FF (a, b, c, d, x[ 0], 7, 0xd76aa478); /* 1 */
- d = FF (d, a, b, c, x[ 1], 12, 0xe8c7b756); /* 2 */
- c = FF (c, d, a, b, x[ 2], 17, 0x242070db); /* 3 */
- b = FF (b, c, d, a, x[ 3], 22, 0xc1bdceee); /* 4 */
- a = FF (a, b, c, d, x[ 4], 7, 0xf57c0faf); /* 5 */
- d = FF (d, a, b, c, x[ 5], 12, 0x4787c62a); /* 6 */
- c = FF (c, d, a, b, x[ 6], 17, 0xa8304613); /* 7 */
- b = FF (b, c, d, a, x[ 7], 22, 0xfd469501); /* 8 */
- a = FF (a, b, c, d, x[ 8], 7, 0x698098d8); /* 9 */
- d = FF (d, a, b, c, x[ 9], 12, 0x8b44f7af); /* 10 */
- c = FF (c, d, a, b, x[10], 17, 0xffff5bb1); /* 11 */
- b = FF (b, c, d, a, x[11], 22, 0x895cd7be); /* 12 */
- a = FF (a, b, c, d, x[12], 7, 0x6b901122); /* 13 */
- d = FF (d, a, b, c, x[13], 12, 0xfd987193); /* 14 */
- c = FF (c, d, a, b, x[14], 17, 0xa679438e); /* 15 */
- b = FF (b, c, d, a, x[15], 22, 0x49b40821); /* 16 */
-
- /* Round 2 */
- a = GG (a, b, c, d, x[ 1], 5, 0xf61e2562); /* 17 */
- d = GG (d, a, b, c, x[ 6], 9, 0xc040b340); /* 18 */
- c = GG (c, d, a, b, x[11], 14, 0x265e5a51); /* 19 */
- b = GG (b, c, d, a, x[ 0], 20, 0xe9b6c7aa); /* 20 */
- a = GG (a, b, c, d, x[ 5], 5, 0xd62f105d); /* 21 */
- d = GG (d, a, b, c, x[10], 9, 0x2441453); /* 22 */
- c = GG (c, d, a, b, x[15], 14, 0xd8a1e681); /* 23 */
- b = GG (b, c, d, a, x[ 4], 20, 0xe7d3fbc8); /* 24 */
- a = GG (a, b, c, d, x[ 9], 5, 0x21e1cde6); /* 25 */
- d = GG (d, a, b, c, x[14], 9, 0xc33707d6); /* 26 */
- c = GG (c, d, a, b, x[ 3], 14, 0xf4d50d87); /* 27 */
- b = GG (b, c, d, a, x[ 8], 20, 0x455a14ed); /* 28 */
- a = GG (a, b, c, d, x[13], 5, 0xa9e3e905); /* 29 */
- d = GG (d, a, b, c, x[ 2], 9, 0xfcefa3f8); /* 30 */
- c = GG (c, d, a, b, x[ 7], 14, 0x676f02d9); /* 31 */
- b = GG (b, c, d, a, x[12], 20, 0x8d2a4c8a); /* 32 */
-
- /* Round 3 */
- a = HH (a, b, c, d, x[ 5], 4, 0xfffa3942); /* 33 */
- d = HH (d, a, b, c, x[ 8], 11, 0x8771f681); /* 34 */
- c = HH (c, d, a, b, x[11], 16, 0x6d9d6122); /* 35 */
- b = HH (b, c, d, a, x[14], 23, 0xfde5380c); /* 36 */
- a = HH (a, b, c, d, x[ 1], 4, 0xa4beea44); /* 37 */
- d = HH (d, a, b, c, x[ 4], 11, 0x4bdecfa9); /* 38 */
- c = HH (c, d, a, b, x[ 7], 16, 0xf6bb4b60); /* 39 */
- b = HH (b, c, d, a, x[10], 23, 0xbebfbc70); /* 40 */
- a = HH (a, b, c, d, x[13], 4, 0x289b7ec6); /* 41 */
- d = HH (d, a, b, c, x[ 0], 11, 0xeaa127fa); /* 42 */
- c = HH (c, d, a, b, x[ 3], 16, 0xd4ef3085); /* 43 */
- b = HH (b, c, d, a, x[ 6], 23, 0x4881d05); /* 44 */
- a = HH (a, b, c, d, x[ 9], 4, 0xd9d4d039); /* 45 */
- d = HH (d, a, b, c, x[12], 11, 0xe6db99e5); /* 46 */
- c = HH (c, d, a, b, x[15], 16, 0x1fa27cf8); /* 47 */
- b = HH (b, c, d, a, x[ 2], 23, 0xc4ac5665); /* 48 */
-
- /* Round 4 */
- a = II (a, b, c, d, x[ 0], 6, 0xf4292244); /* 49 */
- d = II (d, a, b, c, x[ 7], 10, 0x432aff97); /* 50 */
- c = II (c, d, a, b, x[14], 15, 0xab9423a7); /* 51 */
- b = II (b, c, d, a, x[ 5], 21, 0xfc93a039); /* 52 */
- a = II (a, b, c, d, x[12], 6, 0x655b59c3); /* 53 */
- d = II (d, a, b, c, x[ 3], 10, 0x8f0ccc92); /* 54 */
- c = II (c, d, a, b, x[10], 15, 0xffeff47d); /* 55 */
- b = II (b, c, d, a, x[ 1], 21, 0x85845dd1); /* 56 */
- a = II (a, b, c, d, x[ 8], 6, 0x6fa87e4f); /* 57 */
- d = II (d, a, b, c, x[15], 10, 0xfe2ce6e0); /* 58 */
- c = II (c, d, a, b, x[ 6], 15, 0xa3014314); /* 59 */
- b = II (b, c, d, a, x[13], 21, 0x4e0811a1); /* 60 */
- a = II (a, b, c, d, x[ 4], 6, 0xf7537e82); /* 61 */
- d = II (d, a, b, c, x[11], 10, 0xbd3af235); /* 62 */
- c = II (c, d, a, b, x[ 2], 15, 0x2ad7d2bb); /* 63 */
- b = II (b, c, d, a, x[ 9], 21, 0xeb86d391); /* 64 */
-
- state.state[0] += a;
- state.state[1] += b;
- state.state[2] += c;
- state.state[3] += d;
- }
-
- /**
- * Updates hash with the bytebuffer given (using at maximum length bytes from
- * that buffer)
- *
- * @param state Which state is updated
- * @param buffer Array of bytes to be hashed
- * @param offset Offset to buffer array
- * @param length Use at maximum `length' bytes (absolute
- * maximum is buffer.length)
- */
- public void Update (MD5State stat, byte buffer[], int offset, int length)
- {
- int index, partlen, i, start;
- finals = null;
- /* Length can be told to be shorter, but not inter */
- if ((length - offset)> buffer.length)
- length = buffer.length - offset;
- /* compute number of bytes mod 64 */
- index = (int) (stat.count[0] >>> 3) & 0x3f;
- if ((stat.count[0] += (length << 3)) <
- (length << 3))
- stat.count[1]++;
- stat.count[1] += length >>> 29;
- partlen = 64 - index;
- if (length >= partlen)
- {
- for (i = 0; i < partlen; i++)
- stat.buffer[i + index] = buffer[i + offset];
-
- Transform(stat, stat.buffer, 0);
-
- for (i = partlen; (i + 63) < length; i+= 64)
- Transform(stat, buffer, i);
-
- index = 0;
- }
- else
- i = 0;
- /* buffer remaining input */
- if (i < length)
- {
- start = i;
- for (; i < length; i++)
- stat.buffer[index + i - start] = buffer[i + offset];
- }
- }
-
-
- public void Update (byte buffer[], int offset, int length)
- {
- Update(this.state, buffer, offset, length);
- }
-
- public void Update (byte buffer[], int length)
- {
- Update(this.state, buffer, 0, length);
- }
-
- /**
- * Updates hash with given array of bytes
- *
- * @param buffer Array of bytes to use for updating the hash
- */
- public void Update (byte buffer[])
- {
- Update(buffer, 0, buffer.length);
- }
-
- /**
- * Updates hash with a single byte
- *
- * @param b Single byte to update the hash
- */
- public void Update (byte b)
- {
- byte buffer[] = new byte[1];
- buffer[0] = b;
-
- Update(buffer, 1);
- }
-
- /**
- * Update buffer with given string.
- *
- * @param s String to be update to hash (is used as
- * s.getBytes())
- */
- public void Update (String s)
- {
- byte chars[];
-
- /* deprecated chars = new byte[s.length()];
- s.getBytes(0, s.length(), chars, 0);
- */
- chars = s.getBytes();
-
- Update(chars, chars.length);
- }
-
- /**
- * Update buffer with a single integer (only & 0xff part is used,
- * as a byte)
- *
- * @param i Integer value, which is then converted to
- * byte as i & 0xff
- */
-
- public void Update (int i)
- {
- Update((byte) (i & 0xff));
- }
-
- private byte[] Encode (int input[], int len)
- {
- int i, j;
- byte out[];
-
- out = new byte[len];
-
- for (i = j = 0; j < len; i++, j += 4)
- {
- out[j] = (byte) (input[i] & 0xff);
- out[j + 1] = (byte) ((input[i] >>> 8) & 0xff);
- out[j + 2] = (byte) ((input[i] >>> 16) & 0xff);
- out[j + 3] = (byte) ((input[i] >>> 24) & 0xff);
- }
-
- return out;
- }
-
- /**
- * Returns array of bytes (16 bytes) representing hash as of the
- * current state of this object. Note: getting a hash does not
- * invalidate the hash object, it only creates a copy of the real
- * state which is finalized.
- *
- * @return Array of 16 bytes, the hash of all updated bytes
- */
- public synchronized byte[] Final ()
- {
- byte bits[];
- int index, padlen;
- MD5State fin;
-
- if (finals == null)
- {
- fin = new MD5State(state);
-
- bits = Encode(fin.count, 8);
-
- index = (int) ((fin.count[0] >>> 3) & 0x3f);
- padlen = (index < 56) ? (56 - index) : (120 - index);
-
- Update(fin, padding, 0, padlen);
- /**/
- Update(fin, bits, 0, 8);
-
- /* Update() sets finalds to null */
- finals = fin;
- }
-
- return Encode(finals.state, 16);
- }
-
- /**
- * Turns array of bytes into string representing each byte as
- * unsigned hex number.
- *
- * @param hash Array of bytes to convert to hex-string
- * @return Generated hex string
- */
- public static String asHex (byte hash[])
- {
- StringBuffer buf = new StringBuffer(hash.length * 2);
- int i;
-
- for (i = 0; i < hash.length; i++)
- {
- if (((int) hash[i] & 0xff) < 0x10)
- buf.append("0");
-
- buf.append(Long.toString((int) hash[i] & 0xff, 16));
- }
-
- return buf.toString();
- }
-
- /**
- * Returns 32-character hex representation of this objects hash
- *
- * @return String of this object's hash
- */
- public String asHex ()
- {
- return asHex(this.Final());
- }
- } // MD5
-
-
diff --git a/java/rasj/rnp/Rnp.class b/java/rasj/rnp/Rnp.class
deleted file mode 100644
index 1eb010e..0000000
--- a/java/rasj/rnp/Rnp.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/Rnp.java b/java/rasj/rnp/Rnp.java
deleted file mode 100644
index 7b2c311..0000000
--- a/java/rasj/rnp/Rnp.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-* This file is part of rasdaman community.
-*
-* Rasdaman community 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 3 of the License, or
-* (at your option) any later version.
-*
-* Rasdaman community 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 rasdaman community. If not, see <http://www.gnu.org/licenses/>.
-*
-* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
-rasdaman GmbH.
-*
-* For more information please see <http://www.rasdaman.org>
-* or contact Peter Baumann via <baumann@rasdaman.com>.
-*/
-/*************************************************************
- * <pre>
- *
- * PURPOSE:
- *
- *
- * COMMENTS:
- *
- * </pre>
- *********************************************************** */
-package rasj.rnp;
-
-import java.io.*;
-
-public class Rnp
- {
- public static final int rnpProtocolId = 0xc12d7f01; // this is swap(25112001);
-
- public static final int fgt_None = 0;
- public static final int fgt_Command = 1;
- public static final int fgt_OkAnswer = 2;
- public static final int fgt_Error = 3;
- public static final int fgt_DiscardedRequest = 4;
-
- public static final int dtt_None = 0;
- public static final int dtt_Asciiz = 1;
- public static final int dtt_Int32 = 2;
- public static final int dtt_Float32 = 3;
- public static final int dtt_Double64 = 4;
- public static final int dtt_Opaque = 5;
- }
-
diff --git a/java/rasj/rnp/RnpBaseClientComm.class b/java/rasj/rnp/RnpBaseClientComm.class
deleted file mode 100644
index 0849f81..0000000
--- a/java/rasj/rnp/RnpBaseClientComm.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/RnpBaseClientComm.java b/java/rasj/rnp/RnpBaseClientComm.java
deleted file mode 100644
index 1da636f..0000000
--- a/java/rasj/rnp/RnpBaseClientComm.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
-* This file is part of rasdaman community.
-*
-* Rasdaman community 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 3 of the License, or
-* (at your option) any later version.
-*
-* Rasdaman community 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 rasdaman community. If not, see <http://www.gnu.org/licenses/>.
-*
-* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
-rasdaman GmbH.
-*
-* For more information please see <http://www.rasdaman.org>
-* or contact Peter Baumann via <baumann@rasdaman.com>.
-*/
-/*************************************************************
- * <pre>
- *
- * PURPOSE:
- *
- *
- * COMMENTS:
- *
- * </pre>
- *********************************************************** */
-package rasj.rnp;
-
-import rasj.*;
-import rasj.global.*;
-import java.io.*;
-import java.net.*;
-
-
-public class RnpBaseClientComm
- {
- RnpEncoder encoder;
- RnpDecoder decoder;
- int serverID;
- String rasServerHost;
- int rasServerPort;
-
- public RnpBaseClientComm(int serverType)
- {
- Debug.enterVerbose( "RnpBaseClientComm.RnpBaseClientComm: start. serverType=" + serverType );
- encoder = new RnpEncoder();
- serverID = serverType;
- Debug.leaveVerbose( "RnpBaseClientComm.RnpBaseClientComm: done." );
- }
-
- public void setConnectionParameters(String s, int p)
- {
- Debug.enterVerbose( "RnpBaseClientComm.setConnectionParameters: start. server=" + s + ", port=" + p );
- rasServerHost = s;
- rasServerPort = p;
- Debug.leaveVerbose( "RnpBaseClientComm.setConnectionParameters: done." );
- }
-
- public void startRequest(int commandCode)
- {
- Debug.enterVerbose( "RnpBaseClientComm.startRequest: start. cmdCode=" + commandCode );
- encoder.startMessage(serverID);
- encoder.startFragment(Rnp.fgt_Command,commandCode);
- Debug.leaveVerbose( "RnpBaseClientComm.startRequest: done." );
- }
-
- public void startMessage()
- {
- Debug.enterVerbose( "RnpBaseClientComm.startMessage: start." );
- encoder.startMessage(serverID);
- Debug.leaveVerbose( "RnpBaseClientComm.startMessage: done." );
- }
-
- public void startFragment(int commandCode)
- {
- Debug.enterVerbose( "RnpBaseClientComm.startFragment: start. cmdCode=" + commandCode );
- encoder.startFragment(Rnp.fgt_Command,commandCode);
- Debug.leaveVerbose( "RnpBaseClientComm.startFragment: done." );
- }
-
- public void endFragment()
- {
- Debug.enterVerbose( "RnpBaseClientComm.endFragment: start." );
- encoder.endFragment();
- Debug.leaveVerbose( "RnpBaseClientComm.endFragment: done." );
- }
-
- public void endMessage()
- {
- Debug.enterVerbose( "RnpBaseClientComm.endMessage: start." );
- encoder.endMessage();
- Debug.leaveVerbose( "RnpBaseClientComm.endMessage: done." );
- }
-
- public void turboSendRequestGetAnswer()
- {
- Debug.enterVerbose( "RnpBaseClientComm.turboSendRequestGetAnswer: start." );
- RnpMessage answer=communicate(rasServerHost,rasServerPort,encoder.message);
- decoder = new RnpDecoder(answer);
- Debug.leaveVerbose( "RnpBaseClientComm.turboSendRequestGetAnswer: done." );
- }
-
- public void sendRequestGetAnswer()
- {
- Debug.enterVerbose( "RnpBaseClientComm.sendRequestGetAnswer: start." );
-
- encoder.endFragment();
- encoder.endMessage();
- RnpMessage answer=communicate(rasServerHost,rasServerPort,encoder.message);
- decoder = new RnpDecoder(answer);
- decoder.getFirstFragment();
-
- Debug.leaveVerbose( "RnpBaseClientComm.sendRequestGetAnswer: done." );
- }
-
- public void checkForError() throws RasQueryExecutionFailedException
- {
- Debug.enterVerbose( "RnpBaseClientComm.checkForError: start." );
- if(decoder.getFragmentType() != Rnp.fgt_Error)
- {
- Debug.leaveVerbose( "RnpBaseClientComm.checkForError: done." );
- return;
- }
- decoder.getFirstParameter();// error type
- int errorType = decoder.getParameterType();
- if(errorType == 3) //"ert_Other"
- {
- decoder.getNextParameter();
- String s = decoder.getDataAsString();
- Debug.leaveCritical( "RnpBaseClientComm.checkForError: done. query failed: " + s );
- throw new RasQueryExecutionFailedException(s);
- }
- else
- {
- Debug.leaveCritical( "RnpBaseClientComm.checkForError: done. query failed, unexpected error: " + errorType );
- throw new RasQueryExecutionFailedException(1000,0,0,"");
- }
- // we never get here
- }
-
- public RnpMessage communicate(String server, int port, RnpMessage message)
- {
- Debug.enterVerbose( "RnpBaseClientComm.communicate: start. server=" + server + ", port=" + port );
-
- Socket socket=null;
- RnpMessage receivedMessage= null;
- DataOutputStream dos = null;
-
- try
- {
- Debug.talkVerbose( "RnpBaseClientComm.communicate: server=" + server + ", port=" + port );
- socket=new Socket(server, port);
- }
- catch(UnknownHostException e11)
- {
- Debug.leaveCritical( "RnpBaseClientComm.communicate: error: socket target unknown: " + e11.getMessage() );
- throw new RasConnectionFailedException(RasGlobalDefs.MANAGER_CONN_FAILED,server);
- }
- catch(IOException e12)
- {
- Debug.leaveCritical( "RnpBaseClientComm.communicate: error: socket io exception: " + e12.getMessage() );
- throw new RasClientInternalException("RnpBaseClientComm","communicate()",e12.getMessage());
- }
-
- try
- {
- dos = new DataOutputStream(socket.getOutputStream());
- message.write(dos);
- }
- catch(IOException e2)
- {
- Debug.leaveCritical( "RnpBaseClientComm.communicate: error: cannot write to socket: " + e2.getMessage() );
- throw new RasClientInternalException("RnpBaseClientComm","communicate()",e2.getMessage());
- }
-
- try
- {
- DataInputStream dis = new DataInputStream(socket.getInputStream());
- receivedMessage = new RnpMessage();
- receivedMessage.read(dis);
- //receivedMessage.print();
- dos.close();
- dis.close();
- }
- catch(IOException e3)
- {
- Debug.leaveCritical( "RnpBaseClientComm.communicate: error: rcv io exception: " + e3.getMessage() );
- throw new RasClientInternalException("RnpBaseClientComm","communicate()", e3.getMessage() );
- }
- catch(RnpException e4)
- {
- Debug.leaveCritical( "RnpBaseClientComm.communicate: error: RnpException: " + e4.getMessage() );
- throw new RasClientInternalException("RnpBaseClientComm","communicate()",e4.getMessage());
- }
-
- Debug.leaveVerbose( "RnpBaseClientComm.communicate: done. result=" + receivedMessage );
- return receivedMessage;
- }
-
- } // RnpBaseClientComm
-
diff --git a/java/rasj/rnp/RnpDecoder.class b/java/rasj/rnp/RnpDecoder.class
deleted file mode 100644
index 56ab0ef..0000000
--- a/java/rasj/rnp/RnpDecoder.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/RnpDecoder.java b/java/rasj/rnp/RnpDecoder.java
deleted file mode 100644
index 5eea077..0000000
--- a/java/rasj/rnp/RnpDecoder.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
-* This file is part of rasdaman community.
-*
-* Rasdaman community 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 3 of the License, or
-* (at your option) any later version.
-*
-* Rasdaman community 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 rasdaman community. If not, see <http://www.gnu.org/licenses/>.
-*
-* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
-rasdaman GmbH.
-*
-* For more information please see <http://www.rasdaman.org>
-* or contact Peter Baumann via <baumann@rasdaman.com>.
-*/
-/*************************************************************
- * <pre>
- *
- * PURPOSE:
- *
- *
- *
- * COMMENTS:
- *
- * </pre>
- *********************************************************** */
-package rasj.rnp;
-
-import java.io.*;
-
-
-public class RnpDecoder
- {
-
- public RnpMessage message;
- private RnpFragment currentFragment;
- private RnpParameter currentParameter;
- private int fragmentIndex;
-
-
- RnpDecoder(RnpMessage rnpmessage)
- {
- message=rnpmessage;
- currentFragment = null;
- currentParameter = null;
- fragmentIndex = 0;
- }
-
- void verify() throws RnpException
- {
- if(message.header.protocolId != Rnp.rnpProtocolId)
- throw new RnpException("Not a RNP message");
-
- if(message.header.messageEndianness != 0)
- throw new RnpException("Incorrect endianness");
-
- if(message.header.majorVersion != 1 || message.header.minorVersion != 0 || message.header.dataStart != RnpMessageHeader.length)
- throw new RnpException("Incorrect message version");
- }
-
- int getServerType()
- {
- return message.header.serverType;
- }
-
- byte getDesiredEndianness()
- {
- return message.header.desiredEndianness;
- }
-
- byte getMessageEndianness()
- {
- return message.header.messageEndianness;
- }
-
- int getMessageLength()
- {
- return message.header.totalMessageLength;
- }
-
- int countFragments()
- {
- return message.header.nrFragments;
- }
- byte getMajorVersion()
- {
- return message.header.majorVersion;
- }
- byte getMinorVersion()
- {
- return message.header.minorVersion;
- }
-
- RnpFragment getFirstFragment()
- {
- fragmentIndex = 0;
- currentFragment = (RnpFragment)message.fragments.get(0);
- return currentFragment;
- }
-
- RnpFragment getNextFragment(RnpFragment fragment)
- {
- fragmentIndex++;
- currentFragment = (RnpFragment)message.fragments.get(fragmentIndex);
- return currentFragment;
- }
-
- int getFragmentType()
- {
- //fgt_None, fgt_Command, fgt_OkAnswer, fgt_Error, fgt_DiscardedRequest
- return currentFragment.getFragmentType();
- }
- int countParameters()
- {
- return currentFragment.countParameters();
- }
- RnpParameter getFirstParameter()
- {
- currentParameter = currentFragment.getFirstParameter();
- return currentParameter;
- }
- RnpParameter getNextParameter()
- {
- currentParameter = currentFragment.getNextParameter();
- return currentParameter;
- }
- int getParameterType()
- {
- return currentParameter.paramType;
- }
- int getDataLength()
- {
- return currentParameter.getDataLength();
- }
-
- int getDataType()
- {
- // dtt_None,dtt_Asciiz, dtt_Int32,dtt_Double64, dtt_Opaque
- return currentParameter.dataType;
- }
-
- int getDataAsInteger()
- {
- return ((ParameterInt32)currentParameter).data;
- }
- float getDataAsFloat()
- {
- return((ParameterFloat32)currentParameter).data;
- }
- double getDataAsDouble()
- {
- return((ParameterDouble64)currentParameter).data;
- }
- String getDataAsString()
- {
- return new String(((ParameterString)currentParameter).data);
- }
- byte[] getDataOpaque()
- {
- return((ParameterOpaque)currentParameter).data;
- }
- }
-
diff --git a/java/rasj/rnp/RnpEncoder.class b/java/rasj/rnp/RnpEncoder.class
deleted file mode 100644
index c4a9fdf..0000000
--- a/java/rasj/rnp/RnpEncoder.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/RnpEncoder.java b/java/rasj/rnp/RnpEncoder.java
deleted file mode 100644
index d27bfe2..0000000
--- a/java/rasj/rnp/RnpEncoder.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-* This file is part of rasdaman community.
-*
-* Rasdaman community 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 3 of the License, or
-* (at your option) any later version.
-*
-* Rasdaman community 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 rasdaman community. If not, see <http://www.gnu.org/licenses/>.
-*
-* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
-rasdaman GmbH.
-*
-* For more information please see <http://www.rasdaman.org>
-* or contact Peter Baumann via <baumann@rasdaman.com>.
-*/
-/*************************************************************
- * <pre>
- *
- * PURPOSE:
- *
- *
- *
- * COMMENTS:
- *
- * </pre>
- *********************************************************** */
-package rasj.rnp;
-
-import java.io.*;
-import java.util.*;
-
-public class RnpEncoder
- {
- public int serverType = 0;
- RnpMessage message = null;
-
- public void startMessage(int serverType)
- {
- message=new RnpMessage();
- message.header = new RnpMessageHeader(serverType);
- message.fragments = new Vector();
- }
- public void setEndianess()
- {
- }
- public void startFragment(int fragmentType, int command)
- {
- message.currentFragment = new RnpFragment(fragmentType,command);
- }
- void addFragment(RnpFragmentHeader fHeader)
- {
- message.header.nrFragments++;
- message.header.dataLength += fHeader.totalLength;
- message.header.totalMessageLength += fHeader.totalLength;
- }
-
- void addParameterInt32(int parameterType, int data)
- {
- message.currentFragment.addParameterInt32(parameterType,data);
- }
-
- void addParameterFloat32(int parameterType, float data)
- {
- message.currentFragment.addParameterFloat32(parameterType,data);
- }
-
- void addParameterDouble64(int parameterType, double data)
- {
- message.currentFragment.addParameterDouble64(parameterType,data);
- }
-
- void addParameterString(int parameterType, String data)
- {
- message.currentFragment.addParameterString(parameterType,data);
- }
-
- void addParameterOpaque(int parameterType, byte[] data)
- {
- message.currentFragment.addParameterOpaque(parameterType,data);
- }
-
- void endFragment()
- {
- if(message.currentFragment == null) return; // correct "assert"
- message.fragments.add(message.currentFragment);
- addFragment(message.currentFragment.getHeader());
- message.currentFragment = null;
- }
-
- void endMessage()
- {
- }
-
- }
-
diff --git a/java/rasj/rnp/RnpException.class b/java/rasj/rnp/RnpException.class
deleted file mode 100644
index 8422a28..0000000
--- a/java/rasj/rnp/RnpException.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/RnpException.java b/java/rasj/rnp/RnpException.java
deleted file mode 100644
index 254c304..0000000
--- a/java/rasj/rnp/RnpException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-* This file is part of rasdaman community.
-*
-* Rasdaman community 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 3 of the License, or
-* (at your option) any later version.
-*
-* Rasdaman community 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 rasdaman community. If not, see <http://www.gnu.org/licenses/>.
-*
-* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
-rasdaman GmbH.
-*
-* For more information please see <http://www.rasdaman.org>
-* or contact Peter Baumann via <baumann@rasdaman.com>.
-*/
-/*************************************************************
- * <pre>
- *
- * PURPOSE:
- *
- *
- *
- * COMMENTS:
- *
- * </pre>
- *********************************************************** */
-package rasj.rnp;
-
-
-public class RnpException extends Exception
- {
- public RnpException(String s)
- {
- super(s);
- }
- }
-
diff --git a/java/rasj/rnp/RnpFragment.class b/java/rasj/rnp/RnpFragment.class
deleted file mode 100644
index 3927ada..0000000
--- a/java/rasj/rnp/RnpFragment.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/RnpFragment.java b/java/rasj/rnp/RnpFragment.java
deleted file mode 100644
index 204744f..0000000
--- a/java/rasj/rnp/RnpFragment.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
-* This file is part of rasdaman community.
-*
-* Rasdaman community 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 3 of the License, or
-* (at your option) any later version.
-*
-* Rasdaman community 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 rasdaman community. If not, see <http://www.gnu.org/licenses/>.
-*
-* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
-rasdaman GmbH.
-*
-* For more information please see <http://www.rasdaman.org>
-* or contact Peter Baumann via <baumann@rasdaman.com>.
-*/
-/*************************************************************
- * <pre>
- *
- * PURPOSE:
- *
- *
- *
- * COMMENTS:
- *
- * </pre>
- *********************************************************** */
-package rasj.rnp;
-
-import java.util.*;
-import java.io.*;
-
-
-public class RnpFragment
- {
- RnpFragmentHeader header;
- Vector parameters;
- int parameterIndex = 0;
-
- RnpFragment(int fragmentType, int command)
- {
- header = new RnpFragmentHeader(fragmentType, command);
- parameters = new Vector();
- }
-
- RnpFragmentHeader getHeader()
- {
- return header;
- }
-
- void addParameterInt32(int parameterType, int data)
- {
- addParameter(new ParameterInt32(parameterType,data));
- }
-
- void addParameterFloat32(int parameterType, float data)
- {
- addParameter(new ParameterFloat32(parameterType,data));
- }
-
- void addParameterDouble64(int parameterType, double data)
- {
- addParameter(new ParameterDouble64(parameterType,data));
- }
- void addParameterString(int parameterType, String data)
- {
- addParameter(new ParameterString(parameterType,data));
- }
-
- void addParameterOpaque(int parameterType, byte[] data)
- {
- addParameter(new ParameterOpaque(parameterType,data));
- }
-
- private void addParameter(RnpParameter param)
- {
- parameters.add(param);
- header.addParameter(param.getTotalLength());
- }
-
- void write(DataOutputStream dataStream) throws IOException
- {
- header.write(dataStream);
- for(int i=0; i < header.countParameters(); i++)
- {
- RnpParameter param = (RnpParameter)parameters.get(i);
- param.write(dataStream);
- }
- }
-
- void read(DataInputStream dataStream) throws IOException, RnpException
- {
- header.read(dataStream);
- for(int i=0; i < header.countParameters(); i++)
- {
- RnpParameter param = RnpParameter.constructFromStream(dataStream);
- parameters.add(param);
- }
- }
-
- void print()
- {
- header.print();
- for(int i=0; i < header.countParameters(); i++)
- {
- System.out.print(" " + i+ " ");
- RnpParameter param = (RnpParameter)parameters.get(i);
- param.print();
- }
- }
-
-
- int getFragmentType()
- {
- return header.fragmType;
- }
-
- int getCommand()
- {
- return header.command;
- }
-
- int countParameters()
- {
- return header.nrParams;
- }
-
- int getFragmentLength()
- {
- return header.totalLength;
- }
-
- RnpParameter getFirstParameter()
- {
- parameterIndex = 0;
- return (RnpParameter)parameters.get(0);
- }
-
- RnpParameter getNextParameter()
- {
- parameterIndex++;
- return (RnpParameter)parameters.get(parameterIndex);
- }
-
- }
-
diff --git a/java/rasj/rnp/RnpFragmentHeader.class b/java/rasj/rnp/RnpFragmentHeader.class
deleted file mode 100644
index 685e967..0000000
--- a/java/rasj/rnp/RnpFragmentHeader.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/RnpFragmentHeader.java b/java/rasj/rnp/RnpFragmentHeader.java
deleted file mode 100644
index e18e0f4..0000000
--- a/java/rasj/rnp/RnpFragmentHeader.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-* This file is part of rasdaman community.
-*
-* Rasdaman community 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 3 of the License, or
-* (at your option) any later version.
-*
-* Rasdaman community 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 rasdaman community. If not, see <http://www.gnu.org/licenses/>.
-*
-* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
-rasdaman GmbH.
-*
-* For more information please see <http://www.rasdaman.org>
-* or contact Peter Baumann via <baumann@rasdaman.com>.
-*/
-/*************************************************************
- * <pre>
- *
- * PURPOSE:
- *
- *
- *
- * COMMENTS:
- *
- * </pre>
- *********************************************************** */
-package rasj.rnp;
-
-import java.util.*;
-import java.io.*;
-
-
-public class RnpFragmentHeader
- {
- int fragmType; //{FragmentType command, okAnswer, error}
- int command;
- int nrParams;
- int totalLength;
-
- public static final int length = 16;
-
- RnpFragmentHeader(int fragmentType, int nCommand)
- {
- fragmType = fragmentType;
- command = nCommand;
- nrParams = 0;
- totalLength = length;
- }
-
- int countParameters()
- {
- return nrParams;
- }
-
- void print()
- {
- System.out.print(" type=" + fragmType);
- System.out.print(" Command=" + command);
- System.out.print(" nrParams=" + nrParams);
- System.out.print(" totalLength=" + totalLength);
- System.out.println();
- }
-
- void write(DataOutputStream dataStream) throws IOException
- {
- dataStream.writeInt(fragmType);
- dataStream.writeInt(command);
- dataStream.writeInt(nrParams);
- dataStream.writeInt(totalLength);
- }
- void read(DataInputStream dataStream) throws IOException
- {
- fragmType = dataStream.readInt();
- command = dataStream.readInt();
- nrParams = dataStream.readInt();
- totalLength = dataStream.readInt();
- }
-
- void addParameter(int size)
- {
- nrParams++;
- totalLength += size;
- }
- }
-
-
diff --git a/java/rasj/rnp/RnpMessage.class b/java/rasj/rnp/RnpMessage.class
deleted file mode 100644
index effbe2d..0000000
--- a/java/rasj/rnp/RnpMessage.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/RnpMessage.java b/java/rasj/rnp/RnpMessage.java
deleted file mode 100644
index 5739ee7..0000000
--- a/java/rasj/rnp/RnpMessage.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-* This file is part of rasdaman community.
-*
-* Rasdaman community 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 3 of the License, or
-* (at your option) any later version.
-*
-* Rasdaman community 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 rasdaman community. If not, see <http://www.gnu.org/licenses/>.
-*
-* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
-rasdaman GmbH.
-*
-* For more information please see <http://www.rasdaman.org>
-* or contact Peter Baumann via <baumann@rasdaman.com>.
-*/
-/*************************************************************
- * <pre>
- *
- * PURPOSE:
- *
- *
- *
- * COMMENTS:
- *
- * </pre>
- *********************************************************** */
-package rasj.rnp;
-
-
-import java.util.*;
-import java.io.*;
-
-
-public class RnpMessage
- {
- public RnpMessageHeader header;
- public Vector fragments;
- public RnpFragment currentFragment = null;
-
- void write(DataOutputStream dataStream) throws IOException
- {
- header.write(dataStream);
- for(int i=0; i < header.countFragments(); i++)
- {
- RnpFragment frag = (RnpFragment)fragments.get(i);
- frag.write(dataStream);
- }
- }
-
- void read(DataInputStream dataStream) throws IOException, RnpException
- {
- header = new RnpMessageHeader(0);
- header.read(dataStream);
- fragments = new Vector();
- for(int i=0; i < header.countFragments(); i++)
- {
- currentFragment = new RnpFragment(0,0);
- currentFragment.read(dataStream);
- fragments.add(currentFragment);
- }
- currentFragment = null;
- }
-
- void print()
- {
- header.print();
- for(int i=0; i < header.countFragments(); i++)
- {
- System.out.print("Fragment " + i + " ");
- RnpFragment frag = (RnpFragment)fragments.get(i);
- frag.print();
- }
- }
-
- }
-
diff --git a/java/rasj/rnp/RnpMessageHeader.class b/java/rasj/rnp/RnpMessageHeader.class
deleted file mode 100644
index edd6cfc..0000000
--- a/java/rasj/rnp/RnpMessageHeader.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/RnpMessageHeader.java b/java/rasj/rnp/RnpMessageHeader.java
deleted file mode 100644
index 5191940..0000000
--- a/java/rasj/rnp/RnpMessageHeader.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
-* This file is part of rasdaman community.
-*
-* Rasdaman community 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 3 of the License, or
-* (at your option) any later version.
-*
-* Rasdaman community 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 rasdaman community. If not, see <http://www.gnu.org/licenses/>.
-*
-* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
-rasdaman GmbH.
-*
-* For more information please see <http://www.rasdaman.org>
-* or contact Peter Baumann via <baumann@rasdaman.com>.
-*/
-/*************************************************************
- * <pre>
- *
- * PURPOSE:
- *
- *
- *
- * COMMENTS:
- *
- * </pre>
- *********************************************************** */
-package rasj.rnp;
-
-
-import java.util.*;
-import java.io.*;
-
-
-public class RnpMessageHeader
- {
- int protocolId;
- byte messageEndianness;
- byte desiredEndianness;
- byte majorVersion;
- byte minorVersion;
- int totalMessageLength;
- int nrFragments;
- int serverType;
- int authInfoStart;
- int authInfoLength;
- int comprInfoStart;
- int comprInfoLength;
- int dataStart;
- int dataLength;
- //int _unused[5];
-
- public static final int length = 64;
-
- RnpMessageHeader(int nServerType)
- {
- protocolId = Rnp.rnpProtocolId;
- messageEndianness = 0; // big endianness
- desiredEndianness = 0; // big also
- majorVersion = 1;
- minorVersion = 0;
- totalMessageLength = length;
- nrFragments = 0;
- serverType = nServerType;
- authInfoStart = 0;
- authInfoLength = 0;
- comprInfoStart = 0;
- comprInfoLength = 0;
- dataStart = length;
- dataLength = 0;
- }
-
- int countFragments()
- {
- return nrFragments;
- }
-
- void print()
- {
- System.out.println("RNP Header");
- System.out.println(" totalLength=" + totalMessageLength);
- System.out.println(" nrFragments=" + nrFragments);
- System.out.println(" serverType=" + serverType);
- System.out.println(" dataStart=" + dataStart);
- System.out.println(" dataLength=" + dataLength);
- System.out.println("");
- }
-
- void write(DataOutputStream dataStream) throws IOException
- {
- dataStream.writeInt(protocolId);
- dataStream.writeByte(messageEndianness);
- dataStream.writeByte(desiredEndianness);
- dataStream.writeByte(majorVersion);
- dataStream.writeByte(minorVersion);
-
- dataStream.writeInt(totalMessageLength);
- dataStream.writeInt(nrFragments);
- dataStream.writeInt(serverType);
- dataStream.writeInt(authInfoStart);
- dataStream.writeInt(authInfoLength);
- dataStream.writeInt(comprInfoStart);
- dataStream.writeInt(comprInfoLength);
- dataStream.writeInt(dataStart);
- dataStream.writeInt(dataLength);
-
- // the unused 5 ints
- dataStream.writeInt(0);
- dataStream.writeInt(0);
- dataStream.writeInt(0);
- dataStream.writeInt(0);
- dataStream.writeInt(0);
-
- }
-
- void read(DataInputStream dataStream) throws IOException, RnpException
- {
- protocolId = dataStream.readInt();
- messageEndianness = dataStream.readByte();
- desiredEndianness = dataStream.readByte();
- majorVersion = dataStream.readByte();
- minorVersion = dataStream.readByte();
-
- totalMessageLength = dataStream.readInt();
- nrFragments = dataStream.readInt();
- serverType = dataStream.readInt();
- authInfoStart = dataStream.readInt();
- authInfoLength = dataStream.readInt();
- comprInfoStart = dataStream.readInt();
- comprInfoLength = dataStream.readInt();
- dataStart = dataStream.readInt();
- dataLength = dataStream.readInt();
-
- // the unused 5 ints
- dataStream.readInt();
- dataStream.readInt();
- dataStream.readInt();
- dataStream.readInt();
- dataStream.readInt();
-
- //verify();
- }
- }
-
diff --git a/java/rasj/rnp/RnpParameter.class b/java/rasj/rnp/RnpParameter.class
deleted file mode 100644
index 183302c..0000000
--- a/java/rasj/rnp/RnpParameter.class
+++ /dev/null
Binary files differ
diff --git a/java/rasj/rnp/RnpParameter.java b/java/rasj/rnp/RnpParameter.java
deleted file mode 100644
index 01cba64..0000000
--- a/java/rasj/rnp/RnpParameter.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
-* This file is part of rasdaman community.
-*
-* Rasdaman community 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 3 of the License, or
-* (at your option) any later version.
-*
-* Rasdaman community 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 rasdaman community. If not, see <http://www.gnu.org/licenses/>.
-*
-* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
-rasdaman GmbH.
-*
-* For more information please see <http://www.rasdaman.org>
-* or contact Peter Baumann via <baumann@rasdaman.com>.
-*/
-/*************************************************************
- * <pre>
- *
- * PURPOSE:
- *
- *
- *
- * COMMENTS:
- *
- * </pre>
- *********************************************************** */
-package rasj.rnp;
-
-import java.io.*;
-
-public abstract class RnpParameter
- {
- int paramType;
- int dataType;
- int dataLength;
- int totalLength;
-
- public static final int headerSize = 16;
-
- protected RnpParameter(int pT, int dT, int dL,int tL)
- {
- paramType = pT;
- dataType = dT;
- dataLength = dL;
- totalLength = tL;
- }
-
- void print()
- {
- System.out.print(" Parameter type=" + paramType);
- System.out.print(" data type=" + dataType);
- System.out.print(" dataLength="+dataLength);
- System.out.print(" totalLength=" + totalLength);
- printSpecific();
- }
-
- void write(DataOutputStream dataStream) throws IOException
- {
- dataStream.writeInt(paramType);
- dataStream.writeInt(dataType);
- dataStream.writeInt(dataLength);
- dataStream.writeInt(totalLength);
- writeSpecific(dataStream);
- }
-
- int getTotalLength()
- {
- return totalLength;
- }
- int getDataLength()
- {
- return dataLength;
- }
- int getPaddLength()
- {
- return totalLength - dataLength - headerSize;
- }
-
- void computeTotalAlignedLength()
- {
- totalLength = (dataLength + headerSize + 3) & 0xFFFFFFFC;
- }
-
- static RnpParameter constructFromStream(DataInputStream dataStream) throws IOException, RnpException
- {
- int paramType = dataStream.readInt();
- int dataType = dataStream.readInt();
- int dataLength = dataStream.readInt();
- int totalLength = dataStream.readInt();
-
- RnpParameter result = null;
- switch(dataType)
- {
- case Rnp.dtt_Int32: result = new ParameterInt32(paramType, dataType, dataLength, totalLength);
- break;
- case Rnp.dtt_Float32: result = new ParameterFloat32(paramType, dataType, dataLength, totalLength);
- break;
- case Rnp.dtt_Double64: result = new ParameterDouble64(paramType, dataType, dataLength, totalLength);
- break;
- case Rnp.dtt_Asciiz: result = new ParameterString(paramType, dataType, dataLength, totalLength);
- break;
- case Rnp.dtt_Opaque: result = new ParameterOpaque(paramType, dataType, dataLength, totalLength);
- break;
- default: throw new RnpException("Incorrect parameter data type: " + dataType);
- }
- result.readSpecific(dataStream);
- //System.out.println("constructFromStream: "); result.print();
- return result;
- }
-
- int getParameterType() { return paramType; }
- int getDataType() { return dataType; }
-
- abstract void writeSpecific(DataOutputStream dataStream) throws IOException;
- abstract void readSpecific(DataInputStream dataStream) throws IOException;
- abstract void printSpecific();
- }
-
-
-
- class ParameterInt32 extends RnpParameter
- {
- int data;
- public static final int length = 4;
-
- ParameterInt32(int parameterType, int nData)
- {
- super(parameterType,Rnp.dtt_Int32, length, length + headerSize);
- data = nData;
- }
-
- ParameterInt32(int pT, int dT, int dL, int tL)
- {
- super(pT, dT, dL,tL);
- }
-
- void printSpecific()
- {
- System.out.println(" value=" + data);
- }
-
- void writeSpecific(DataOutputStream dataStream) throws IOException
- {
- dataStream.writeInt(data);
- }
-
- void readSpecific(DataInputStream dataStream) throws IOException
- {
- data = dataStream.readInt();
- }
-
- int getData()
- {
- return data;
- }
- }
-
-
- class ParameterFloat32 extends RnpParameter
- {
- float data;
- public static final int length = 4;
-
- ParameterFloat32(int parameterType, float nData)
- {
- super(parameterType,Rnp.dtt_Float32, length, length + headerSize);
- data = nData;
- }
-
- ParameterFloat32(int pT, int dT, int dL, int tL)
- {
- super(pT, dT, dL,tL);
- }
-
- void printSpecific()
- {
- System.out.println(" value=" + data);
- }
-
- void writeSpecific(DataOutputStream dataStream) throws IOException
- {
- dataStream.writeFloat(data);
- }
-
- void readSpecific(DataInputStream dataStream) throws IOException
- {
- data = dataStream.readFloat();
- }
-
- float getData()
- {
- return data;
- }
- }
-
-
- class ParameterDouble64 extends RnpParameter
- {
- double data;
- public static final int length = 8;
-
- ParameterDouble64(int parameterType, double nData)
- {
- super(parameterType,Rnp.dtt_Double64, length, length + headerSize);
- data = nData;
- }
- ParameterDouble64(int pT, int dT, int dL, int tL)
- {
- super(pT, dT, dL, tL);
- }
-
- void printSpecific()
- {
- System.out.println(" value=" + data);
- }
-
- void writeSpecific(DataOutputStream dataStream) throws IOException
- {
- dataStream.writeDouble(data);
- }
-
- void readSpecific(DataInputStream dataStream) throws IOException
- {
- data = dataStream.readDouble();
- }
-
- double getData()
- {
- return data;
- }
- }
-
- class ParameterString extends RnpParameter
- {
- byte[] data;
-
- ParameterString(int parameterType, String nData)
- {
- super(parameterType,Rnp.dtt_Asciiz,0,0);
- data = nData.getBytes();
- // do not forget: Strings are ASCIIZ in RNP!!
- dataLength = data.length+1;
- computeTotalAlignedLength();
- }
-
- ParameterString(int pT, int dT, int dL,int tL)
- {
- super(pT, dT, dL,tL);
- }
-
- void printSpecific()
- {
- System.out.println(" value=" + getData());
- }
-
- void writeSpecific(DataOutputStream dataStream) throws IOException
- {
- dataStream.write(data,0,dataLength - 1);
- dataStream.writeByte(0);
-
- for(int i=0;i<getPaddLength();i++) dataStream.writeByte(0);
- }
-
- void readSpecific(DataInputStream dataStream) throws IOException
- {
- data = new byte[dataLength - 1];
- dataStream.readFully(data,0,dataLength - 1);
- dataStream.readByte();
- for(int i=0;i<getPaddLength();i++) dataStream.readByte();
- }
-
- String getData()
- {
- return new String(data);
- }
- }
-
- class ParameterOpaque extends RnpParameter
- {
- byte[] data;
-
- ParameterOpaque(int parameterType, byte[] nData)
- {
- super(parameterType,Rnp.dtt_Opaque,nData.length,0);
- data = nData;
- computeTotalAlignedLength();
- }
-
- ParameterOpaque(int pT, int dT, int dL,int tL)
- {
- super(pT, dT, dL,tL);
- }
-
- void printSpecific()
- {
- System.out.println(" value=(opaque data, size=" + data.length +")");
- }
-
- void writeSpecific(DataOutputStream dataStream) throws IOException
- {
- dataStream.write(data,0,dataLength);
- for(int i=0;i<getPaddLength();i++) dataStream.writeByte(0);
- }
-
- void readSpecific(DataInputStream dataStream) throws IOException
- {
- data = new byte[dataLength];
- dataStream.readFully(data,0,dataLength);
-
- for(int i=0;i<getPaddLength();i++) dataStream.readByte();
- }
-
- byte[] getData()
- {
- return data;
- }
- }
-
diff --git a/java/rasj/rnp/test/Client.java b/java/rasj/rnp/test/Client.java
deleted file mode 100644
index 34c9c45..0000000
--- a/java/rasj/rnp/test/Client.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
-* This file is part of rasdaman community.
-*
-* Rasdaman community 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 3 of the License, or
-* (at your option) any later version.
-*
-* Rasdaman community 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 rasdaman community. If not, see <http://www.gnu.org/licenses/>.
-*
-* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
-rasdaman GmbH.
-*
-* For more information please see <http://www.rasdaman.org>
-* or contact Peter Baumann via <baumann@rasdaman.com>.
-*/
-/** ***********************************************************
- * <pre>
- *
- * PURPOSE:
- * test socket communication.
- *
- *
- * COMMENTS:
- *
- * </pre>
- *********************************************************** */
-
-import java.io.*;
-import java.net.*;
-import java.lang.*;
-import java.util.*;
-
-public class Client
-{
- private static final String DEFAULT_SERVER = "localhost";
- private static final int DEFAULT_PORT = 7001;
-
- private static String server = DEFAULT_SERVER;
- private static int port = DEFAULT_PORT;
-
- private static void communicate()
- {
- System.out.println( "server=" + server + ", port=" + port );
-
- try
- {
- Socket socket = new Socket( server, port );
-
- PrintStream ps = new PrintStream(socket.getOutputStream());
- ps.print("Hello " + server + " at port " + port + " !\n" );
- ps.flush();
-
- BufferedReader ds = new BufferedReader(new InputStreamReader(socket.getInputStream()));
- System.out.println( "server delivered: '" + ds.readLine() );
-
- ps.close();
- ds.close();
- socket.close();
- System.out.println( "socket closed." );
- }
- catch(UnknownHostException e2)
- {
- System.out.println( "host unknown: " + e2.getMessage() );
- }
- catch(IOException e1)
- {
- System.out.println( "io exception: " + e1.getMessage() );
- }
- }
-
- public static void main( String args[] )
- {
- System.out.println( "Socket test started." );
-
- if (args.length != 0 && args.length != 2)
- System.out.println( "usage: java Client [server port]" );
- else if (args.length == 2)
- {
- server = args[0];
- try
- {
- port = Integer.parseInt( args[1] );
- }
- catch(NumberFormatException e)
- {
- System.err.println( "Error: illegal port parameter: " + args[1] );
- return;
- }
- }
-
- communicate();
-
- System.out.println( "Socket test done." );
- }
-}
-
-