From d0d68de57b36d8a75f0fc8fff404bada7c586a5f Mon Sep 17 00:00:00 2001 From: hengsin Date: Thu, 16 Dec 2021 17:58:24 +0800 Subject: [PATCH] IDEMPIERE-4723 Clean up iDempiere's code (#1054) * IDEMPIERE-4723 Clean up iDempiere's code * IDEMPIERE-4723 Clean up iDempiere's code --- .../src/org/compiere/MigrateData.java | 129 --- .../src/org/compiere/db/CreateAdempiere.java | 838 ------------------ .../src/org/compiere/db/JDBCInfo.java | 190 ---- .../src/org/compiere/db/TestConnection.java | 231 ----- .../src/org/compiere/model/MRoleTest.java | 92 -- .../compiere/process/RemoteMergeDataVO.java | 55 -- .../org/compiere/process/RemoteSetupVO.java | 59 -- .../org/compiere/process/RemoteUpdateVO.java | 56 -- .../src/org/compiere/tools/RMIUtil.java | 104 --- 9 files changed, 1754 deletions(-) delete mode 100644 org.adempiere.base/src/org/compiere/MigrateData.java delete mode 100644 org.adempiere.base/src/org/compiere/db/CreateAdempiere.java delete mode 100644 org.adempiere.base/src/org/compiere/db/JDBCInfo.java delete mode 100644 org.adempiere.base/src/org/compiere/db/TestConnection.java delete mode 100644 org.adempiere.base/src/org/compiere/model/MRoleTest.java delete mode 100644 org.adempiere.base/src/org/compiere/process/RemoteMergeDataVO.java delete mode 100644 org.adempiere.base/src/org/compiere/process/RemoteSetupVO.java delete mode 100644 org.adempiere.base/src/org/compiere/process/RemoteUpdateVO.java delete mode 100644 org.adempiere.base/src/org/compiere/tools/RMIUtil.java diff --git a/org.adempiere.base/src/org/compiere/MigrateData.java b/org.adempiere.base/src/org/compiere/MigrateData.java deleted file mode 100644 index 8d0db1ecb8..0000000000 --- a/org.adempiere.base/src/org/compiere/MigrateData.java +++ /dev/null @@ -1,129 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * For the text or an alternative of this public license, you may reach us * - * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * - * or via info@compiere.org or http://www.compiere.org/license.html * - *****************************************************************************/ -package org.compiere; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.Properties; -import java.util.logging.Level; - -import org.compiere.model.MProductDownload; -import org.compiere.print.PrintFormatUtil; -import org.compiere.util.CLogger; -import org.compiere.util.DB; -import org.compiere.util.Env; - -/** - * Migrate Data - * @author Jorg Janke - * @version $Id: MigrateData.java,v 1.3 2006/07/30 00:51:06 jjanke Exp $ - */ -public class MigrateData -{ - /** - * Migrate Data. - * Called from DB.afterMigration - */ - public MigrateData () - { - release252c(); - - // Update existing Print Format - PrintFormatUtil pfu = new PrintFormatUtil (Env.getCtx()); - pfu.addMissingColumns((String)null); - } // MigrateData - - /** Logger */ - private static final CLogger log = CLogger.getCLogger (MigrateData.class); - - /** - * Release 252c - */ - private void release252c() - { - String sql = "SELECT COUNT(*) FROM M_ProductDownload"; - int no = DB.getSQLValue(null, sql); - if (no > 0) - { - if (log.isLoggable(Level.FINER)) log.finer("No Need - Downloads #" + no); - return; - } - // - int count = 0; - sql = "SELECT AD_Client_ID, AD_Org_ID, M_Product_ID, Name, DownloadURL " - + "FROM M_Product " - + "WHERE DownloadURL IS NOT NULL"; - PreparedStatement pstmt = null; - ResultSet rs = null; - try - { - pstmt = DB.prepareStatement (sql, null); - rs = pstmt.executeQuery (); - while (rs.next ()) - { - int AD_Client_ID = rs.getInt(1); - int AD_Org_ID = rs.getInt(2); - int M_Product_ID = rs.getInt(3); - String Name = rs.getString(4); - String DownloadURL = rs.getString(5); - // - Properties ctx = new Properties (Env.getCtx()); - Env.setContext(ctx, Env.AD_CLIENT_ID, AD_Client_ID); - Env.setContext(ctx, "AD_Client_ID", AD_Client_ID); - Env.setContext(ctx, Env.AD_ORG_ID, AD_Org_ID); - Env.setContext(ctx, "AD_Org_ID", AD_Org_ID); - MProductDownload pdl = new MProductDownload(ctx, 0, null); - pdl.setM_Product_ID(M_Product_ID); - pdl.setName(Name); - pdl.setDownloadURL(DownloadURL); - if (pdl.save()) - { - count++; - String sqlUpdate = "UPDATE M_Product SET DownloadURL = NULL WHERE M_Product_ID=" + M_Product_ID; - int updated = DB.executeUpdate(sqlUpdate, null); - if (updated != 1) - log.warning("Product not updated"); - } - else - log.warning("Product Download not created M_Product_ID=" + M_Product_ID); - } - } - catch (Exception e) - { - log.log (Level.SEVERE, sql, e); - } - finally - { - DB.close(rs, pstmt); - rs = null; pstmt = null; - } - - if (log.isLoggable(Level.INFO)) log.info("#" + count); - } // release252c - - - /** - * Migrate Data - * @param args ignored - */ - public static void main (String[] args) - { - Adempiere.startup(true); - new MigrateData(); - } // main - -} // MigrateData diff --git a/org.adempiere.base/src/org/compiere/db/CreateAdempiere.java b/org.adempiere.base/src/org/compiere/db/CreateAdempiere.java deleted file mode 100644 index 0aa7480f00..0000000000 --- a/org.adempiere.base/src/org/compiere/db/CreateAdempiere.java +++ /dev/null @@ -1,838 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * For the text or an alternative of this public license, you may reach us * - * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * - * or via info@compiere.org or http://www.compiere.org/license.html * - *****************************************************************************/ -package org.compiere.db; - -import java.io.File; -import java.io.FileWriter; -import java.io.PrintWriter; -import java.math.BigDecimal; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Properties; -import java.util.logging.Level; - -import org.adempiere.exceptions.DBException; -import org.compiere.Adempiere; -import org.compiere.model.MColumn; -import org.compiere.model.MTable; -import org.compiere.model.M_Element; -import org.compiere.util.CLogMgt; -import org.compiere.util.CLogger; -import org.compiere.util.DB; -import org.compiere.util.DisplayType; -import org.compiere.util.Util; - -/** - * Class to Create a new Adempiere Database from a reference DB. - *
- *  - Create User
- *  - Create DDL (table, procedures, functions, etc.)
- *  
- * - * @author Jorg Janke - * @version $Id: CreateAdempiere.java,v 1.5 2006/09/22 23:35:19 jjanke Exp $ - */ -public class CreateAdempiere -{ - /** - * Constructor - * @param databaseType AdempiereDatabase.TYPE_ - * @param databaseHost database host - * @param databasePort database port 0 for default - * @param systemPassword system password - */ - public CreateAdempiere(String databaseType, String databaseHost, int databasePort, - String systemPassword) - { - initDatabase(databaseType); - m_databaseHost = databaseHost; - if (databasePort == 0) - m_databasePort = m_dbTarget.getStandardPort(); - else - m_databasePort = databasePort; - m_systemPassword = systemPassword; - if (log.isLoggable(Level.INFO)) log.info(m_dbTarget.getName() + " on " + databaseHost); - } // create - - /** Adempiere Target Database */ - private AdempiereDatabase m_dbTarget = null; - /** Adempiere Source Database */ - private AdempiereDatabase m_dbSource = null; - // - private String m_databaseHost = null; - private int m_databasePort = 0; - private String m_systemPassword = null; - private String m_adempiereUser = null; - private String m_adempierePassword = null; - private String m_databaseName = null; - private String m_databaseDevice = null; - // - private Properties m_ctx = new Properties (); - /** Cached connection */ - private Connection m_conn = null; - - /** Logger */ - private static final CLogger log = CLogger.getCLogger (CreateAdempiere.class); - - /** - * Create Adempiere Database - * @param databaseType Database.DB_ - */ - private void initDatabase(String databaseType) - { - try - { - m_dbTarget = Database.getDatabase(databaseType); - } - catch (Exception e) - { - log.severe(e.toString ()); - e.printStackTrace(); - } - if (m_dbTarget == null) - throw new IllegalStateException("No database: " + databaseType); - - // Source Database - m_dbSource = DB.getDatabase(); - } // createDatabase - - /** - * Clean Start - drop & re-create DB - */ - public void cleanStart() - { - Connection conn = getConnection(true, true); - if (conn == null) - throw new IllegalStateException("No Database"); - // - dropDatabase(conn); - createUser(conn); - createDatabase(conn); - // - try - { - if (conn != null) - conn.close(); - } - catch (SQLException e2) - { - log.log(Level.SEVERE, "close connection", e2); - } - conn = null; - } // cleanStart - - - /** - * Set Adempiere User - * @param adempiereUser adempiere id - * @param adempierePassword adempiere password - */ - public void setAdempiereUser (String adempiereUser, String adempierePassword) - { - m_adempiereUser = adempiereUser; - m_adempierePassword = adempierePassword; - } // setAdempiereUser - - /** - * Set Database Name - * @param databaseName db name - * @param databaseDevice device or table space - */ - public void setDatabaseName (String databaseName, String databaseDevice) - { - m_databaseName = databaseName; - m_databaseDevice = databaseDevice; - } // createDatabase - - - /** - * Test Connection - * @return connection - */ - public boolean testConnection() - { - String dbUrl = m_dbTarget.getConnectionURL (m_databaseHost, m_databasePort, - m_databaseName, m_dbTarget.getSystemUser()); // adempiere may not be defined yet - if (log.isLoggable(Level.INFO)) log.info(dbUrl + " - " + m_dbTarget.getSystemUser() + "/" + m_systemPassword); - try - { - Connection conn = m_dbTarget.getDriverConnection(dbUrl, m_dbTarget.getSystemUser(), m_systemPassword); - // - JDBCInfo info = new JDBCInfo(conn); - if (CLogMgt.isLevelFinest()) - { - info.listCatalogs(); - info.listSchemas(); - } - } - catch (Exception e) - { - log.log(Level.SEVERE, "test", e); - return false; - } - - return true; - } // testConnection - - - /************************************************************************** - * Create User - * @param sysConn system connection - * @return true if success - */ - public boolean createUser (Connection sysConn) - { - if (log.isLoggable(Level.INFO)) log.info(m_adempiereUser + "/" + m_adempierePassword); - return executeCommands(m_dbTarget.getCommands(AdempiereDatabase.CMD_CREATE_USER), - sysConn, true, false); - } // createUser - - /** - * Create Database (User) - * @param sysConn system connection - * @return true if success - */ - public boolean createDatabase (Connection sysConn) - { - if (log.isLoggable(Level.INFO)) log.info(m_databaseName + "(" + m_databaseDevice + ")"); - return executeCommands(m_dbTarget.getCommands(AdempiereDatabase.CMD_CREATE_DATABASE), - sysConn, true, false); - } // createDatabase - - /** - * Drop Database (User) - * @param sysConn system connection - * @return true if success - */ - public boolean dropDatabase (Connection sysConn) - { - log.info(m_databaseName); - return executeCommands(m_dbTarget.getCommands(AdempiereDatabase.CMD_DROP_DATABASE), - sysConn, true, false); - } // dropDatabase - - - /** - * Create Tables and copy data - * @param whereClause optional where clause - * @param dropFirst drop first - * @return true if executed - */ - public boolean copy (String whereClause, boolean dropFirst) - { - log.info(whereClause); - if (getConnection(false, true) == null) - return false; - // - boolean success = true; - int count = 0; - ArrayList list = new ArrayList(); - String sql = "SELECT * FROM AD_Table"; - if (whereClause != null && whereClause.length() > 0) - sql += " WHERE " + whereClause; - sql += " ORDER BY TableName"; - // - PreparedStatement pstmt = null; - ResultSet rs = null; - try - { - pstmt = DB.prepareStatement (sql, null); - //jz: pstmt.getConnection() could be null - Connection conn = pstmt.getConnection(); - DatabaseMetaData md = null; - if (conn != null) - md = conn.getMetaData(); - else - { - //jz: globalization issue?? - throw new DBException("No Connection"); - } - - rs = pstmt.executeQuery (); - while (rs.next() && success) - { - MTable table = new MTable (m_ctx, rs, null); - if (table.isView()) - continue; - if (dropFirst) - { - executeCommands(new String[] - {"DROP TABLE " + table.getTableName()}, - m_conn, false, false); - } - // - if (createTable (table, md)) - { - list.add(table.getTableName()); - count++; - } - else - success = false; - } - } - catch (Exception e) - { - log.log (Level.SEVERE, sql, e); - success = false; - } - finally - { - DB.close(rs, pstmt); - rs = null; pstmt = null; - } - if (!success) - return false; - - /** Enable Contraints */ - enableConstraints(list); - - databaseBuild(); - - if (log.isLoggable(Level.INFO)) log.info("#" + count); - - try - { - if (m_conn != null) - m_conn.close(); - } - catch (SQLException e2) - { - log.log(Level.SEVERE, "close connection", e2); - } - m_conn = null; - return success; - } // copy - - /** - * Execute Script - * @param script file with script - * @return true if executed - */ - public boolean execute (File script) - { - return false; - } // createTables - - - - /** - * Create Table - * @param mTable table model - * @param md meta data - * @return true if created - */ - private boolean createTable (MTable mTable, DatabaseMetaData md) - { - String tableName = mTable.getTableName(); - log.info(tableName); - String catalog = m_dbSource.getCatalog(); - String schema = m_dbSource.getSchema(); - String table = tableName.toUpperCase(); - // - MColumn[] columns = mTable.getColumns(false); - - StringBuilder sb = new StringBuilder("CREATE TABLE "); - sb.append(tableName).append(" ("); - ResultSet sourceColumns = null; - ResultSet sourcePK = null; - try - { - // Columns - boolean first = true; - sourceColumns = md.getColumns(catalog, schema, table, null); - while (sourceColumns.next()) - { - sb.append(first ? "" : ", "); - first = false; - // Case sensitive Column Name - MColumn column = null; - String columnName = sourceColumns.getString("COLUMN_NAME"); - for (int i = 0; i < columns.length; i++) - { - String cn = columns[i].getColumnName(); - if (cn.equalsIgnoreCase(columnName)) - { - columnName = cn; - column = columns[i]; - break; - } - } - sb.append(columnName).append(" "); - // Data Type & Precision - //int sqlType = sourceColumns.getInt ("DATA_TYPE"); // sql.Types - String typeName = sourceColumns.getString ("TYPE_NAME"); // DB Dependent - int size = sourceColumns.getInt ("COLUMN_SIZE"); - @SuppressWarnings("unused") - int decDigits = sourceColumns.getInt("DECIMAL_DIGITS"); - if (sourceColumns.wasNull()) - decDigits = -1; - if (typeName.equals("NUMBER")) - { - /** Oracle Style * - if (decDigits == -1) - sb.append(typeName); - else - sb.append(typeName).append("(") - .append(size).append(",").append(decDigits).append(")"); - /** Other DBs */ - int dt = column.getAD_Reference_ID(); - if (DisplayType.isID(dt)) - sb.append("INTEGER"); - else - { - int scale = DisplayType.getDefaultPrecision(dt); - sb.append("DECIMAL(") - .append(18+scale).append(",").append(scale).append(")"); - } - } - else if (typeName.equals("DATE") || typeName.equals("BLOB") || typeName.equals("CLOB")) - sb.append(typeName); - else if (typeName.equals("CHAR") || typeName.startsWith("VARCHAR")) - sb.append(typeName).append("(").append(size).append(")"); - else if (typeName.startsWith("NCHAR") || typeName.startsWith("NVAR")) - sb.append(typeName).append("(").append(size/2).append(")"); - else if (typeName.startsWith("TIMESTAMP")) - sb.append("DATE"); - else - log.severe("Do not support data type " + typeName); - // Default - String def = sourceColumns.getString("COLUMN_DEF"); - if (def != null) - { - //jz: replace '' to \', otherwise exception - def = def.replaceAll("''", "\\'"); - sb.append(" DEFAULT ").append(def); - } - // Null - if (sourceColumns.getInt("NULLABLE") == DatabaseMetaData.columnNoNulls) - sb.append(" NOT NULL"); - else - sb.append(" NULL"); - - // Check Contraints - - - } // for all columns - - // Primary Key - sourcePK = md.getPrimaryKeys(catalog, schema, table); - // TABLE_CAT=null, TABLE_SCHEM=REFERENCE, TABLE_NAME=A_ASSET, COLUMN_NAME=A_ASSET_ID, KEY_SEQ=1, PK_NAME=A_ASSET_KEY - first = true; - boolean hasPK = false; - while (sourcePK.next()) - { - hasPK = true; - if (first) - sb.append(", CONSTRAINT ").append(sourcePK.getString("PK_NAME")).append(" PRIMARY KEY ("); - else - sb.append(","); - first = false; - String columnName = sourcePK.getString("COLUMN_NAME"); - sb.append(checkColumnName(columnName)); - } - if (hasPK) // close constraint - sb.append(")"); // USING INDEX TABLESPACE INDX - // - sb.append(")"); // close create table - } - catch (Exception ex) - { - log.log(Level.SEVERE, "createTable", ex); - return false; - } - finally - { - DB.close(sourceColumns); - DB.close(sourcePK); - sourceColumns = null; - sourcePK = null; - } - - // Execute Create Table - if (!executeCommands(new String[]{sb.toString()}, m_conn, false, true)) - return true; // continue - - // Create Inexes - createTableIndexes(mTable, md); - - return createTableData(mTable); - } // createTable - - /** - * Check Column Name - * @param columnName column name - * @return column name with correct case - */ - private String checkColumnName (String columnName) - { - return M_Element.getColumnName (columnName); - } // checkColumnName - - /** - * Create Table Indexes - * @param mTable table - * @param md meta data - */ - private void createTableIndexes(MTable mTable, DatabaseMetaData md) - { - String tableName = mTable.getTableName(); - log.info(tableName); - String catalog = m_dbSource.getCatalog(); - String schema = m_dbSource.getSchema(); - String table = tableName.toUpperCase(); - try - { - @SuppressWarnings("unused") - ResultSet sourceIndex = md.getIndexInfo(catalog, schema, table, false, false); - - } - catch (Exception e) - { - - } - } // createTableIndexes - - - /** - * Create/Copy Table Data - * @param mTable model table - * @return true if data created/copied - */ - private boolean createTableData (MTable mTable) - { - boolean success = true; - int count = 0; - int errors = 0; - long start = System.currentTimeMillis(); - - // Get Table Data - String sql = "SELECT * FROM " + mTable.getTableName(); - PreparedStatement pstmt = null; - ResultSet rs = null; - try - { - pstmt = DB.prepareStatement (sql, mTable.get_TrxName()); - rs = pstmt.executeQuery (); - while (rs.next ()) - { - if (createTableDataRow(rs, mTable)) - count++; - else - errors++; - } - } - catch (Exception e) - { - log.log (Level.SEVERE, sql, e); - success = false; - } - finally - { - DB.close(rs, pstmt); - rs = null; pstmt = null; - } - long elapsed = System.currentTimeMillis() - start; - if (log.isLoggable(Level.CONFIG)) log.config("Inserted=" + count + " - Errors=" + errors - + " - " + elapsed + " ms"); - return success; - } // createTableData - - /** - * Create Table Data Row - * @param rs result set - * @param mTable table - * @return true if created - */ - private boolean createTableDataRow (ResultSet rs, MTable mTable) - { - StringBuilder insert = new StringBuilder ("INSERT INTO ") - .append(mTable.getTableName()).append(" ("); - StringBuilder values = new StringBuilder (); - // - MColumn[] columns = mTable.getColumns(false); - for (int i = 0; i < columns.length; i++) - { - if (i != 0) - { - insert.append(","); - values.append(","); - } - MColumn column = columns[i]; - String columnName = column.getColumnName(); - insert.append(columnName); - // - int dt = column.getAD_Reference_ID(); - try - { - Object value = rs.getObject(columnName); - if (rs.wasNull()) - { - values.append("NULL"); - } - else if (columnName.endsWith("_ID") // Record_ID, C_ProjectType defined as Button - || DisplayType.isNumeric(dt) - || (DisplayType.isID(dt) && !columnName.equals("AD_Language"))) - { - BigDecimal bd = rs.getBigDecimal(columnName); - String s = m_dbTarget.TO_NUMBER(bd, dt); - values.append(s); - } - else if (DisplayType.isDate(dt)) - { - Timestamp ts = rs.getTimestamp(columnName); - String tsString = m_dbTarget.TO_DATE(ts, dt == DisplayType.Date); - values.append(tsString); - } - else if (DisplayType.isLOB(dt)) - { - // ignored - values.append("NULL"); - } - else if (DisplayType.isText(dt) || dt == DisplayType.YesNo - || DisplayType.isList(dt) || dt == DisplayType.Button - || columnName.equals("AD_Language")) - { - String s = rs.getString(columnName); - values.append(DB.TO_STRING(s)); - } - else - { - log.warning("Unknown DisplayType=" + dt - + " - " + value + " [" + value.getClass().getName() + "]"); - values.append("NuLl"); - } - } - catch (Exception e) - { - log.log(Level.SEVERE, columnName, e); - } - } // for all columns - - // - insert.append(") VALUES (").append(values).append(")"); - return executeCommands(new String[]{insert.toString()}, - m_conn, false, false); // do not convert as text is converted - } // createTableDataRow - - - /** - * Enable Constraints - * @param list list - * @return true if constraints enabled/created - */ - private boolean enableConstraints (ArrayList list) - { - log.info(""); - return false; - } // enableConstraints - - - private void databaseBuild() - { - // Build Script - //jz remove hard coded path later - String fileName = "C:\\Adempiere\\adempiere-all2\\db\\database\\DatabaseBuild.sql"; - File file = new File (fileName); - if (!file.exists()) - log.severe("No file: " + fileName); - - // FileReader reader = new FileReader (file); - - - - } // databaseBuild - - /** - * Get Connection - * @param asSystem if true execute as db system administrator - * @param createNew create new connection - * @return connection or null - */ - private Connection getConnection (boolean asSystem, boolean createNew) - { - if (!createNew && m_conn != null) - return m_conn; - // - String dbUrl = m_dbTarget.getConnectionURL(m_databaseHost, m_databasePort, - (asSystem ? m_dbTarget.getSystemDatabase(m_databaseName) : m_databaseName), - (asSystem ? m_dbTarget.getSystemUser() : m_adempiereUser)); - try - { - if (asSystem) - m_conn = m_dbTarget.getDriverConnection(dbUrl, m_dbTarget.getSystemUser(), m_systemPassword); - else - m_conn = m_dbTarget.getDriverConnection(dbUrl, m_adempiereUser, m_adempierePassword); - } - catch (Exception e) - { - log.log(Level.SEVERE, dbUrl, e); - } - return m_conn; - } // getConnection - - - /************************************************************************** - * Execute Commands - * @param cmds array of SQL commands - * @param conn connection - * @param batch tf true commit as batch - * @param doConvert convert to DB specific notation - * @return true if success - */ - private boolean executeCommands (String[] cmds, Connection conn, - boolean batch, boolean doConvert) - { - if (cmds == null || cmds.length == 0) - { - log.warning("No Commands"); - return false; - } - - Statement stmt = null; - String cmd = null; - String cmdOriginal = null; - try - { - if (conn == null) - { - conn = getConnection(false, false); - if (conn == null) - return false; - } - if (conn.getAutoCommit() == batch) - conn.setAutoCommit(!batch); - stmt = conn.createStatement(); - - // Commands - for (int i = 0; i < cmds.length; i++) - { - cmd = cmds[i]; - cmdOriginal = cmds[i]; - if (cmd == null || cmd.length() == 0) - continue; - // - if (cmd.indexOf('@') != -1) - { - cmd = Util.replace(cmd, "@SystemPassword@", m_systemPassword); - cmd = Util.replace(cmd, "@AdempiereUser@", m_adempiereUser); - cmd = Util.replace(cmd, "@AdempierePassword@", m_adempierePassword); - cmd = Util.replace(cmd, "@SystemPassword@", m_systemPassword); - cmd = Util.replace(cmd, "@DatabaseName@", m_databaseName); - if (m_databaseDevice != null) - cmd = Util.replace(cmd, "@DatabaseDevice@", m_databaseDevice); - } - if (doConvert) - cmd = m_dbTarget.convertStatement(cmd); - writeLog(cmd); - log.finer(cmd); - int no = stmt.executeUpdate(cmd); - if (log.isLoggable(Level.FINEST)) log.finest("# " + no); - } - // - if (batch) - conn.commit(); - // - return true; - } - catch (Exception e) - { - String msg = e.getMessage(); - if (msg == null || msg.length() == 0) - msg = e.toString(); - msg += " ("; - if (e instanceof SQLException) - { - msg += "State=" + ((SQLException)e).getSQLState() - + ",ErrorCode=" + ((SQLException)e).getErrorCode(); - } - msg += ")"; - if (cmdOriginal != null && !cmdOriginal.equals(cmd)) - msg += " - " + cmdOriginal; - msg += "\n=>" + cmd; - log.log(Level.SEVERE, msg); - } - finally - { - DB.close(stmt); - stmt = null; - } - return false; - } // execureCommands - - - /** - * Write to File Log - * @param cmd cmd - */ - private void writeLog (String cmd) - { - try - { - if (m_writer == null) - { - File file = File.createTempFile("create", ".log"); - m_writer = new PrintWriter(new FileWriter(file)); - if (log.isLoggable(Level.INFO)) log.info(file.toString()); - } - m_writer.println(cmd); - m_writer.flush(); - } - catch (Exception e) - { - log.severe(e.toString()); - } - } // writeLog - - private PrintWriter m_writer = null; - - - /************************************************************************** - * Create DB - * @param args - */ - public static void main (String[] args) - { - Adempiere.startup(true); - CLogMgt.setLevel(Level.FINE); - CLogMgt.setLoggerLevel(Level.FINE,null); - - // C_UOM_Conversion - // I_BankStatement - // - // Derby - //jz: changed the password from "" to null - //begin vpj-cd e-Evolution 03/03/2005 PostgreSQL - //PostgreSQL - CreateAdempiere cc = new CreateAdempiere (Database.DB_POSTGRESQL, "127.0.0.2", 5432 , "adempiere"); - cc.setAdempiereUser("adempiere", "adempiere"); - cc.setDatabaseName("adempiere", "adempiere"); - // end begin vpj-cd e-Evolution 03/03/2005 PostgreSQL - if (!cc.testConnection()) - return; - cc.cleanStart(); - // - // cc.copy(null, false); - cc.copy("TableName > 'C_RfQResponseLineQty'", false); - } // main - -} // CreateAdempiere diff --git a/org.adempiere.base/src/org/compiere/db/JDBCInfo.java b/org.adempiere.base/src/org/compiere/db/JDBCInfo.java deleted file mode 100644 index 40cf0dc0b3..0000000000 --- a/org.adempiere.base/src/org/compiere/db/JDBCInfo.java +++ /dev/null @@ -1,190 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * For the text or an alternative of this public license, you may reach us * - * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * - * or via info@compiere.org or http://www.compiere.org/license.html * - *****************************************************************************/ -package org.compiere.db; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.util.logging.Level; - -import org.compiere.Adempiere; -import org.compiere.util.CLogMgt; -import org.compiere.util.CLogger; -import org.compiere.util.DB; - -/** - * JDBC Meta Info - * - * @author Jorg Janke - * @version $Id: JDBCInfo.java,v 1.3 2006/07/30 00:55:13 jjanke Exp $ - */ -public class JDBCInfo -{ - /** - * Constructor - * @param conn connection - * @throws SQLException - */ - public JDBCInfo(Connection conn) throws SQLException - { - m_md = conn.getMetaData(); - if (log.isLoggable(Level.INFO)) log.info(m_md.getDatabaseProductName()); - if (log.isLoggable(Level.CONFIG)) log.config(m_md.getDatabaseProductVersion()); - // log.config(m_md.getDatabaseMajorVersion() + "/" + m_md.getDatabaseMinorVersion()); - // - if (log.isLoggable(Level.INFO)) log.info(m_md.getDriverName()); - if (log.isLoggable(Level.CONFIG)){ - log.config(m_md.getDriverVersion()); - log.config(m_md.getDriverMajorVersion() + "/" + m_md.getDriverMinorVersion()); - } - - // - // log.info("JDBC = " + m_md.getJDBCMajorVersion() + "/" + m_md.getJDBCMinorVersion()); - } // JDBCInfo - - /** Mata Data */ - private DatabaseMetaData m_md = null; - - /** Logger */ - private static final CLogger log = CLogger.getCLogger (JDBCInfo.class); - - /** - * List All - */ - public void listAll() - { - try - { - listSchemas(); - } - catch (Exception e) - { - log.severe(e.getMessage()); - } - try - { - listCatalogs(); - } - catch (Exception e) - { - log.severe(e.getMessage()); - } - try - { - listTypes(); - } - catch (Exception e) - { - log.severe(e.getMessage()); - } - } // listAll - - /** - * List Catalogs - * @throws SQLException - */ - public void listCatalogs() throws SQLException - { - if (log.isLoggable(Level.INFO)) log.info(m_md.getCatalogTerm() + " -> " + m_md.getCatalogSeparator()); - ResultSet rs = m_md.getCatalogs(); - while (rs.next()) - { - dump(rs); - } - } // listCatalogs - - /** - * List Schemas - * @throws SQLException - */ - public void listSchemas() throws SQLException - { - if (log.isLoggable(Level.INFO)) log.info(m_md.getSchemaTerm()); - ResultSet rs = m_md.getSchemas(); - while (rs.next()) - { - dump(rs); - } - } // listSchemas - - /** - * List Types - * @throws SQLException - */ - public void listTypes() throws SQLException - { - ResultSet rs = m_md.getTypeInfo(); - while (rs.next()) - { - log.info(""); - dump(rs); - } - } // listTypes - - /** - * Dump the current row of a Result Set - * @param rs result set - * @throws SQLException - */ - public static void dump(ResultSet rs) throws SQLException - { - ResultSetMetaData md = rs.getMetaData(); - for (int i = 0; i < md.getColumnCount(); i++) - { - int index = i + 1; - String info = md.getColumnLabel(index); - String name = md.getColumnName(index); - if (info == null) - info = name; - else if (name != null && !name.equals(info)) - info += " (" + name + ")"; - info += " = " - + rs.getString(index); - info += " [" + md.getColumnTypeName(index) - + "(" + md.getPrecision(index); - if (md.getScale(index) != 0) - info += "," + md.getScale(index); - info += ")]"; - log.fine(info); - } - } // dump - - /************************************************************************** - * Test - * @param args ignored - */ - public static void main (String[] args) - { - Adempiere.startup(true); - CLogMgt.setLevel(Level.ALL); - // - try - { - JDBCInfo info = new JDBCInfo(DB.createConnection(true, Connection.TRANSACTION_READ_COMMITTED)); - info.listCatalogs(); - info.listSchemas(); - info.listTypes(); - } - catch (Exception e) - { - log.log(Level.SEVERE, "", e); - } - } // main - -} // JDBCInfo diff --git a/org.adempiere.base/src/org/compiere/db/TestConnection.java b/org.adempiere.base/src/org/compiere/db/TestConnection.java deleted file mode 100644 index 83c7f94ec2..0000000000 --- a/org.adempiere.base/src/org/compiere/db/TestConnection.java +++ /dev/null @@ -1,231 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * For the text or an alternative of this public license, you may reach us * - * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * - * or via info@compiere.org or http://www.compiere.org/license.html * - *****************************************************************************/ -package org.compiere.db; - -import java.sql.Connection; -import java.sql.Driver; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -/** - * Test Connection (speed) - * - * @author Jorg Janke - * @version $Id: TestConnection.java,v 1.2 2006/07/30 00:55:13 jjanke Exp $ - */ -public class TestConnection -{ - - /** - * Test Connection - * - * @param jdbcURL JDBC URL - * @param uid user - * @param pwd password - */ - public TestConnection (String jdbcURL, String uid, String pwd) - { - System.out.println("Test Connection for " + jdbcURL); - m_jdbcURL = jdbcURL; - m_uid = uid; - m_pwd = pwd; - init(); - if (m_conn != null) - { - long time = test(); - time += test(); - time += test(); - time += test(); - System.out.println(""); - System.out.println("Total Average (" + m_jdbcURL + ")= " + (time/4) + "ms"); - } - } // TestConnection - - private String m_jdbcURL; - private String m_uid = "adempiere"; - private String m_pwd = "adempiere"; - private String m_sql = "SELECT * FROM AD_Element"; - private Connection m_conn; - - /** - * Initialize & Open Connection - */ - private void init() - { - long start = System.currentTimeMillis(); - Driver driver = null; - try - { - driver = DriverManager.getDriver(m_jdbcURL); - } - catch (SQLException ex) - { - // System.err.println("Init - get Driver: " + ex); - } - if (driver == null) - { - try - { - DriverManager.registerDriver(Database.getDatabase(Database.DB_ORACLE).getDriver()); - } - catch (SQLException ex) - { - System.err.println("Init = register Driver: " + ex); - } - } - long end = System.currentTimeMillis(); - System.out.println("(1) Driver = " + (end - start) + "ms"); - // - start = System.currentTimeMillis(); - try - { - m_conn = DriverManager.getConnection(m_jdbcURL, m_uid, m_pwd); - } - catch (SQLException ex) - { - System.err.println("Init = get Connection: " + ex); - } - end = System.currentTimeMillis(); - System.out.println("(2) Get Connection = " + (end - start) + "ms"); - // - start = System.currentTimeMillis(); - try - { - if (m_conn != null) - m_conn.close(); - } - catch (SQLException ex) - { - System.err.println("Init = close Connection: " + ex); - } - end = System.currentTimeMillis(); - System.out.println("(3) Close Connection = " + (end - start) + "ms"); - } // init - - /** - * Test ResultSet - * @return time in ms - */ - private long test() - { - System.out.println(""); - long totalStart = System.currentTimeMillis(); - long start = System.currentTimeMillis(); - try - { - m_conn = DriverManager.getConnection(m_jdbcURL, m_uid, m_pwd); - } - catch (SQLException ex) - { - System.err.println("Test get Connection: " + ex); - return -1; - } - long end = System.currentTimeMillis(); - System.out.println("(A) Get Connection = " + (end - start) + "ms"); - // - try - { - start = System.currentTimeMillis(); - Statement stmt = m_conn.createStatement(); - end = System.currentTimeMillis(); - System.out.println("(B) Create Statement = " + (end - start) + "ms"); - // - start = System.currentTimeMillis(); - ResultSet rs = stmt.executeQuery(m_sql); - end = System.currentTimeMillis(); - System.out.println("(C) Execute Query = " + (end - start) + "ms"); - // - int no = 0; - start = System.currentTimeMillis(); - while (rs.next()) - { - //int i = rs.getInt("AD_Client_ID"); - //String s = rs.getString("Name"); - //i += s.length(); - no++; - } - end = System.currentTimeMillis(); - System.out.println("(D) Read ResultSet = " + (end - start) + "ms - per 10 rows " + ((end - start)/(no/10)) + "ms"); - // - start = System.currentTimeMillis(); - rs.close(); - end = System.currentTimeMillis(); - System.out.println("(E) Close ResultSet = " + (end - start) + "ms"); - // - start = System.currentTimeMillis(); - stmt.close(); - end = System.currentTimeMillis(); - System.out.println("(F) Close Statement = " + (end - start) + "ms"); - } - catch (SQLException e) - { - System.err.println("Test: " + e); - } - // - start = System.currentTimeMillis(); - try - { - if (m_conn != null) - m_conn.close(); - } - catch (SQLException ex) - { - System.err.println("Test close Connection: " + ex); - } - end = System.currentTimeMillis(); - System.out.println("(G) Close Connection = " + (end - start) + "ms"); - - long totalEnd = System.currentTimeMillis(); - System.out.println("Total Test = " + (totalEnd - totalStart) + "ms"); - return (totalEnd - totalStart); - } // test - - /*************************************************************************/ - - /** - * Test Connection. - * java -cp dbPort.jar;oracle.jar org.compiere.db.TestConnection - * @param args arguments optional - * Example: jdbc:oracle:thin:@dev:1521:dev adempiere adempiere - */ - public static void main(String[] args) - { - String url = "jdbc:oracle:thin:@//24.151.26.64:1521/lap11"; - String uid = "adempiere"; - String pwd = "adempiere"; - // - if (args.length == 0) - { - System.out.println("TestConnection "); - System.out.println("Example: jdbc:oracle:thin:@//dev:1521/dev adempiere adempiere"); - System.out.println("Example: jdbc:oracle:oci8:@dev adempiere adempiere"); - } - else if (args.length > 0) - url = args[0]; - else if (args.length > 1) - url = args[1]; - else if (args.length > 2) - url = args[2]; - - System.out.println(""); - @SuppressWarnings("unused") - TestConnection test = new TestConnection(url, uid, pwd); - } // main - -} // TestConnection diff --git a/org.adempiere.base/src/org/compiere/model/MRoleTest.java b/org.adempiere.base/src/org/compiere/model/MRoleTest.java deleted file mode 100644 index 21cd21833a..0000000000 --- a/org.adempiere.base/src/org/compiere/model/MRoleTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * For the text or an alternative of this public license, you may reach us * - * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * - * or via info@compiere.org or http://www.compiere.org/license.html * - *****************************************************************************/ -package org.compiere.model; - -import junit.framework.TestCase; - -import org.compiere.util.Env; - -/** - * The class MRoleTest contains tests for the class MRole - *

- * @author Jorg Janke - * @version $Id: MRoleTest.java,v 1.2 2006/07/30 00:58:37 jjanke Exp $ - */ -public class MRoleTest extends TestCase -{ - /** - * Construct new test instance - * @param name the test name - */ - public MRoleTest(String name) - { - super(name); - } - - private MRole m_role = null; - - /** - * Perform pre-test initialization - * @throws Exception - * @see TestCase#setUp() - */ - protected void setUp() throws Exception, Exception - { - org.compiere.Adempiere.startupEnvironment(true); - m_role = MRole.getDefault(Env.getCtx(), false); - super.setUp(); - } - - /** - * Perform post-test clean up - * - * @throws Exception - * - * @see TestCase#tearDown() - */ - protected void tearDown() throws Exception - { - super.tearDown(); - } - - /** - * Run the String addAccessSQL(String, String, boolean, boolean) method - * test - */ - public void testAddAccessSQL() - { - // add test code here - String sql = m_role.addAccessSQL( - "SELECT r.a,r.b,r.c FROM AD_Role r WHERE EXISTS " - + "(SELECT AD_Column c WHERE c.a=c.b) ORDER BY r.a", - "r", - MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO); - System.out.println(sql); - assertEquals(sql, "SELECT r.a,r.b,r.c FROM AD_Role r WHERE EXISTS (SELECT AD_Column c WHERE c.a=c.b) AND r.AD_Client_ID=0 AND r.AD_Org_ID=0 ORDER BY r.a"); - } - - - /** - * Launch the test. - * @param args String[] - */ - public static void main(String[] args) - { - junit.textui.TestRunner.run(MRoleTest.class); - } - -} // MRoleTest diff --git a/org.adempiere.base/src/org/compiere/process/RemoteMergeDataVO.java b/org.adempiere.base/src/org/compiere/process/RemoteMergeDataVO.java deleted file mode 100644 index 9efc6370a2..0000000000 --- a/org.adempiere.base/src/org/compiere/process/RemoteMergeDataVO.java +++ /dev/null @@ -1,55 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * For the text or an alternative of this public license, you may reach us * - * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * - * or via info@compiere.org or http://www.compiere.org/license.html * - *****************************************************************************/ -package org.compiere.process; - -import java.io.Serializable; - -import javax.sql.RowSet; - -/** - * Merge New Data To/From Remote - * - * @author Jorg Janke - * @version $Id: RemoteMergeDataVO.java,v 1.2 2006/07/30 00:51:02 jjanke Exp $ - */ -public class RemoteMergeDataVO implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 4466234572385621657L; - public Boolean Test = Boolean.FALSE; - public String TableName = null; - public String Sql = null; - public String[] KeyColumns = null; - public RowSet CentralData = null; - - /** - * String Representation - * @return info - */ - public String toString() - { - return "RemoteNewDataVO[test=" + Test - + "-" + TableName - // + "," + Sql - + "]"; - } // toString - - -} // RemoteNewDataVO diff --git a/org.adempiere.base/src/org/compiere/process/RemoteSetupVO.java b/org.adempiere.base/src/org/compiere/process/RemoteSetupVO.java deleted file mode 100644 index 0848fe6ddb..0000000000 --- a/org.adempiere.base/src/org/compiere/process/RemoteSetupVO.java +++ /dev/null @@ -1,59 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * For the text or an alternative of this public license, you may reach us * - * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * - * or via info@compiere.org or http://www.compiere.org/license.html * - *****************************************************************************/ -package org.compiere.process; - -import java.io.Serializable; -import java.math.BigDecimal; - -import javax.sql.RowSet; - -/** - * Remote Setup VO - * - * @author Jorg Janke - * @version $Id: RemoteSetupVO.java,v 1.2 2006/07/30 00:51:02 jjanke Exp $ - */ -public class RemoteSetupVO implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 2767440202354732666L; - public Boolean Test = Boolean.FALSE; - public RowSet ReplicationTable = null; - public BigDecimal IDRangeStart = null; - public BigDecimal IDRangeEnd = null; - public int AD_Client_ID = -1; - public int AD_Org_ID = -1; - public String Prefix = null; - public String Suffix = null; - - /** - * String Representation - * @return info - */ - public String toString() - { - return "RemoteSetupVO[test=" + Test - + ",IDRange=" + IDRangeStart + "-" + IDRangeEnd - + ",AD_Client_ID=" + AD_Client_ID + ",AD_Org_ID=" + AD_Org_ID - + ",Prefix=" + Prefix + ",Suffix=" + Suffix - + "]"; - } // toString - -} // RemoteSetupVO diff --git a/org.adempiere.base/src/org/compiere/process/RemoteUpdateVO.java b/org.adempiere.base/src/org/compiere/process/RemoteUpdateVO.java deleted file mode 100644 index 6b4ba3a35c..0000000000 --- a/org.adempiere.base/src/org/compiere/process/RemoteUpdateVO.java +++ /dev/null @@ -1,56 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * For the text or an alternative of this public license, you may reach us * - * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * - * or via info@compiere.org or http://www.compiere.org/license.html * - *****************************************************************************/ -package org.compiere.process; - -import java.io.Serializable; - -import javax.sql.RowSet; - -/** - * Send New Data To Remote for Update - * - * @author Jorg Janke - * @version $Id: RemoteUpdateVO.java,v 1.2 2006/07/30 00:51:02 jjanke Exp $ - */ -public class RemoteUpdateVO implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = -1609568403006050326L; - public Boolean Test = Boolean.FALSE; -// public Integer AD_Table_ID = null; - public String TableName = null; - public String Sql = null; - public String[] KeyColumns = null; - public RowSet CentralData = null; - - /** - * String Representation - * @return info - */ - public String toString() - { - return "RemoteUpdateVO[test=" + Test - + "-" + TableName - // + "," + Sql - + "]"; - } // toString - - -} // RemoteUpdateVO diff --git a/org.adempiere.base/src/org/compiere/tools/RMIUtil.java b/org.adempiere.base/src/org/compiere/tools/RMIUtil.java deleted file mode 100644 index 6958ea0b3b..0000000000 --- a/org.adempiere.base/src/org/compiere/tools/RMIUtil.java +++ /dev/null @@ -1,104 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * For the text or an alternative of this public license, you may reach us * - * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * - * or via info@compiere.org or http://www.compiere.org/license.html * - *****************************************************************************/ -package org.compiere.tools; - -import java.rmi.Naming; -import java.rmi.registry.LocateRegistry; -import java.rmi.registry.Registry; - -/** - * Test/List RMI Registry - * - * @author Jorg Janke - * @version $Id: RMIUtil.java,v 1.3 2006/07/30 00:51:06 jjanke Exp $ - */ -public class RMIUtil -{ - /** - * RMIUtil - */ - public RMIUtil() - { - // testPort(); - try - { - System.out.println("Registry ------------------------------------"); - Registry registry = LocateRegistry.getRegistry(); - System.out.println("- " + registry); - String[] list = registry.list(); - System.out.println("- size=" + list.length); - for (int i = 0; i < list.length; i++) - { - System.out.println("-- " + list[i]); - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - try - { - System.out.println("Server --------------------------------------"); - // System.out.println("- " + RemoteServer.getClientHost()); - String[] list = Naming.list ("rmi://localhost:1099"); - System.out.println("- size=" + list.length); - for (int i = 0; i < list.length; i++) - { - System.out.println("-- " + list[i]); - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } // RMIUtil - - /*private void testPort() - { - try - { - System.out.println("Test Port -----------------------------------"); - Socket socket = new Socket ("localhost", 1099); - System.out.println("- Socket=" + socket); - // - InputStream in = socket.getInputStream(); - int i = 0; - while (i >= 0) - { - i = in.read(); - if (i >= 0) - System.out.println((char)i); - } - } - catch (IOException ex) - { - ex.printStackTrace(); - } - - }*/ - - /** - * Test - * @param args args - */ - public static void main (String[] args) - { - new RMIUtil(); - } // main - -} // RMIUtil