import java.rmi.Remote; import java.rmi.RemoteException; // This wrapper class only exists because DATA Step can only deal with java objects created with new // and thus can not receive the reference returned by GatewayServer.getReferenceToPersistentManager // // If DATA Step is ever updated to handle javaobj methods that return other java objects, this wrapper // class will not be needed public class DataStepGatewayAdapter { private GatewayInterface dbi; public DataStepGatewayAdapter() throws Exception { dbi = GatewayServer.getReferenceToPersistentManager (); } public int getConnectionHandle (String driverClass, String databaseURL, String username, String password) throws Exception { return dbi.getConnectionHandle (driverClass, databaseURL, username, password); } public int getStatementHandle (double cHandle) throws Exception { return dbi.getStatementHandle ( (int) cHandle); } public void closeConnectionHandle (double cHandle) throws Exception { dbi.closeConnectionHandle ( (int) cHandle); } public void closeStatementHandle (double sHandle) throws Exception { dbi.closeStatementHandle ( (int) sHandle); } public void closeResultSetHandle (double rHandle) throws Exception { dbi.closeResultSetHandle ( (int) rHandle); } public String getExceptionMessage (double handle) throws Exception { return dbi.getExceptionMessage ( (int) handle); } public void executeUpdate (double sHandle, String sql) throws Exception { dbi.executeUpdate ( (int) sHandle, sql); } public int executeQuery (double sHandle, String sql) throws Exception { return dbi.executeQuery ( (int) sHandle, sql); } public boolean nextRow (double rHandle) throws Exception { return dbi.nextRow ( (int) rHandle); } public double getValue (double rHandle, double colNum) throws Exception { return dbi.getValue ( (int) rHandle, (int) colNum); } public String getText (double handle, double colNum) throws Exception { return dbi.getText ( (int) handle, (int) colNum); } public void setValue (double handle, double colNum, double value) throws Exception { dbi.setValue ( (int) handle, (int) colNum, value); } public void setText (double handle, double colNum, String text) throws Exception { dbi.setText ( (int) handle, (int) colNum, text); } public void insertRow (double handle) throws Exception { dbi.insertRow ( (int) handle); } public void moveToInsertRow (double handle) throws Exception { dbi.moveToInsertRow ( (int) handle); } public String getColumnName (double handle, double colNum) throws Exception { return dbi.getColumnName ( (int) handle, (int) colNum); } public int getColumnCount (double handle) throws Exception { return dbi.getColumnCount ( (int) handle); } public int getColumnDisplaySize (double handle, double colNum) throws Exception { return dbi.getColumnDisplaySize ( (int) handle, (int) colNum); } public String getSasColumnType (double handle, double colNum) throws Exception { int type = dbi.getColumnType ( (int) handle, (int) colNum); switch (type) { case java.sql.Types.CHAR: return "C"; case java.sql.Types.VARCHAR: return "C"; case java.sql.Types.BIGINT: return "N"; case java.sql.Types.BINARY: return "N"; case java.sql.Types.BOOLEAN: return "N"; case java.sql.Types.DECIMAL: return "N"; case java.sql.Types.DOUBLE: return "N"; case java.sql.Types.FLOAT: return "N"; case java.sql.Types.INTEGER: return "N"; case java.sql.Types.NUMERIC: return "N"; case java.sql.Types.REAL: return "N"; case java.sql.Types.SMALLINT:return "N"; default: return "?"; } } }