001: /*
002: * ImportExportProcess.java
003: *
004: * Copyright (C) 2002, 2003, 2004, 2005, 2006 Takis Diakoumis
005: *
006: * This program is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU General Public License
008: * as published by the Free Software Foundation; either version 2
009: * of the License, or any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
019: *
020: */
021:
022: package org.executequery.gui.importexport;
023:
024: import java.awt.Dimension;
025:
026: import java.util.Vector;
027: import javax.swing.JDialog;
028: import org.executequery.databasemediators.DatabaseConnection;
029:
030: import org.executequery.databasemediators.MetaDataValues;
031: import org.executequery.gui.browser.ColumnData;
032:
033: /* ----------------------------------------------------------
034: * CVS NOTE: Changes to the CVS repository prior to the
035: * release of version 3.0.0beta1 has meant a
036: * resetting of CVS revision numbers.
037: * ----------------------------------------------------------
038: */
039:
040: /**
041: * Interface defining an import or export
042: * process. This interface will be implemented
043: * by those classes handling data transfer tasks
044: * including both the delimited file import/export
045: * and the XML file import/export.
046: *
047: * <p>Retrieval of common information within each
048: * process is defined in addition to some minor
049: * view information such as the size of child
050: * components within the 'wizard' type functionality
051: * that is each process.
052: *
053: * @author Takis Diakoumis
054: * @version $Revision: 1.6 $
055: * @date $Date: 2006/06/14 15:09:00 $
056: */
057: public interface ImportExportProcess {
058:
059: // ------------------------------------------------
060: // ---- Import/Export process types constants -----
061: // ------------------------------------------------
062:
063: public static final int XML = 12;
064: public static final int DELIMITED = 13;
065: public static final int EXCEL = 14;
066:
067: /** The import from XML process */
068: public static final int IMPORT_XML = 0;
069: /** The export to XML process */
070: public static final int EXPORT_XML = 1;
071: /** The import from delimited file process */
072: public static final int IMPORT_DELIMITED = 2;
073: /** The export to delimited file process */
074: public static final int EXPORT_DELIMITED = 3;
075: /** The export process */
076: public static final int IMPORT = 4;
077: /** The import process */
078: public static final int EXPORT = 5;
079: /** Denotes a single table export process */
080: public static final int SINGLE_TABLE = 6;
081: /** Denotes a multiple table export process */
082: public static final int MULTIPLE_TABLE = 7;
083: /** On error log and continue */
084: public static final int LOG_AND_CONTINUE = 8;
085: /** On error stop transfer */
086: public static final int STOP_TRANSFER = 9;
087: /** A single file export - multiple table */
088: public static final int SINGLE_FILE = 10;
089: /** A multiple file export - multiple table */
090: public static final int MULTIPLE_FILE = 11;
091:
092: /** indicator for commit and end of file */
093: public static final int COMMIT_END_OF_FILE = -99;
094:
095: /** indicator for commit and end of all files */
096: public static final int COMMIT_END_OF_ALL_FILES = -98;
097:
098: /** XML format with schema element */
099: public static final int SCHEMA_ELEMENT = 0;
100:
101: /** XML format with table element only */
102: public static final int TABLE_ELEMENT = 1;
103:
104: /**
105: * Returns the transfer format - XML, CSV etc.
106: */
107: public int getTransferFormat();
108:
109: /**
110: * Stops the current process.
111: */
112: public void stopTransfer();
113:
114: /**
115: * Flags the current transfer process as cancelled.
116: */
117: public void cancelTransfer();
118:
119: /**
120: * Retrieves the selected rollback size for the transfer.
121: *
122: * @return the rollback size
123: */
124: public int getRollbackSize();
125:
126: /**
127: * Retrieves the action on an error occuring during the import/export process.
128: *
129: * @return the action on error -<br>either:
130: * <code>ImportExportProcess.LOG_AND_CONTINUE</code> or
131: * <code>ImportExportProcess.STOP_TRANSFER</code>
132: */
133: public int getOnError();
134:
135: /**
136: * Retrieves the date format for date fields contained within
137: * the data file/database table.
138: *
139: * @return the date format (ie. ddMMyyy)
140: */
141: public String getDateFormat();
142:
143: /**
144: * Returns whether to parse date values.
145: *
146: * @return true | false
147: */
148: public boolean parseDateValues();
149:
150: /**
151: * Retrieves the column names for this process.
152: *
153: * @return the column names
154: */
155: public Vector<ColumnData> getSelectedColumns();
156:
157: /**
158: * Retrieves the size of the child panel to be added to the main base panel.
159: *
160: * @return the size of the child panel
161: */
162: public Dimension getChildDimension();
163:
164: /**
165: * Retrieves the <code>MetaDataValues</code> object defined for this process.
166: *
167: * @return the <code>MetaDataValues</code> helper class
168: */
169: public MetaDataValues getMetaDataUtility();
170:
171: /**
172: * Returns the type of transfer - single or multiple table.
173: *
174: * @return the type of transfer
175: */
176: public int getTableTransferType();
177:
178: /**
179: * Begins an import process.
180: */
181: public void doImport();
182:
183: /**
184: * Begins an export process.
185: */
186: public void doExport();
187:
188: /**
189: * Returns the type of transfer - import or export.
190: *
191: * @return the transfer type - import/export
192: */
193: public int getTransferType();
194:
195: /**
196: * Retrieves the selected tables for this process.
197: *
198: * @return the selected table names
199: */
200: public String[] getSelectedTables();
201:
202: /**
203: * Retrieves the table name for this process in the case
204: * of a single table import/export.
205: *
206: * @return the table name
207: */
208: public String getTableName();
209:
210: /**
211: * Returns the type of multiple table transfer - single or multiple file.
212: *
213: * @return the type of multiple table transfer
214: */
215: public int getMutlipleTableTransferType();
216:
217: /**
218: * Returns the schema name where applicable.
219: *
220: * @return the schema name
221: */
222: public String getSchemaName();
223:
224: /**
225: * Returns the selected database connection properties object.
226: *
227: * @return the connection properties object
228: */
229: public DatabaseConnection getDatabaseConnection();
230:
231: /**
232: * Returns the XML format style for an XML import/export.
233: *
234: * @return the XML format
235: */
236: public int getXMLFormat();
237:
238: /**
239: * Indicates whether the process (import only) should
240: * be run as a batch process.
241: *
242: * @return whether to run as a batch process
243: */
244: public boolean runAsBatchProcess();
245:
246: /**
247: * Returns a <code>Vector</code> of <code>DataTransferObject</code>
248: * objects containing all relevant data for the process.
249: *
250: * @return a <code>Vector</code> of <code>DataTransferObject</code> objects
251: */
252: public Vector getDataFileVector();
253:
254: /**
255: * Returns whether to include column names as the
256: * first row of a delimited export process.
257: *
258: * @return true | false
259: */
260: public boolean includeColumnNames();
261:
262: /**
263: * Retrieves the selected type of delimiter within
264: * the file to be used with this process.
265: *
266: * @return the selected delimiter
267: */
268: public char getDelimiter();
269:
270: /**
271: * Indicates the process has completed successfully or
272: * otherwise as indicated.
273: *
274: * @param success - true | false
275: */
276: public void setProcessComplete(boolean success);
277:
278: /**
279: * Returns whether to trim whitespace on column data values.
280: *
281: * @return true | false
282: */
283: public boolean trimWhitespace();
284:
285: /**
286: * Returns the dialog container for this process.
287: *
288: * @return the dialog or null if there is no dialog
289: */
290: public JDialog getDialog();
291:
292: }
|