KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > knowgate > hipergate > datamodel > ImportLoader


1 /*
2   Copyright (C) 2005 Know Gate S.L. All rights reserved.
3                       C/Oņa, 107 1š2 28050 Madrid (Spain)
4
5   Redistribution and use in source and binary forms, with or without
6   modification, are permitted provided that the following conditions
7   are met:
8
9   1. Redistributions of source code must retain the above copyright
10      notice, this list of conditions and the following disclaimer.
11
12   2. The end-user documentation included with the redistribution,
13      if any, must include the following acknowledgment:
14      "This product includes software parts from hipergate
15      (http://www.hipergate.org/)."
16      Alternately, this acknowledgment may appear in the software itself,
17      if and wherever such third-party acknowledgments normally appear.
18
19   3. The name hipergate must not be used to endorse or promote products
20      derived from this software without prior written permission.
21      Products derived from this software may not be called hipergate,
22      nor may hipergate appear in their name, without prior written
23      permission.
24
25   This library is distributed in the hope that it will be useful,
26   but WITHOUT ANY WARRANTY; without even the implied warranty of
27   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
28
29   You should have received a copy of hipergate License with this code;
30   if not, visit http://www.hipergate.org or mail to info@hipergate.org
31 */

32
33 package com.knowgate.hipergate.datamodel;
34
35 import java.util.ArrayList JavaDoc;
36 import java.sql.SQLException JavaDoc;
37 import java.sql.Connection JavaDoc;
38
39 /**
40  * @author Sergio Montoro Ten
41  * @version 1.0
42  */

43 public interface ImportLoader {
44
45   int MODE_APPEND = 1;
46   int MODE_UPDATE = 2;
47   int MODE_APPENDUPDATE = 3;
48   int WRITE_LOOKUPS = 4;
49
50   /**
51    * Get columns count
52    * @return int
53    */

54   int columnCount();
55
56   /**
57    * Get array of column names
58    * @return String[]
59    */

60   String JavaDoc[] columnNames() throws IllegalStateException JavaDoc;
61
62   /**
63    * Get current value for a column given its index
64    * @param iColumnIndex int [0..columnCount()-1]
65    * @return Object
66    * @throws ArrayIndexOutOfBoundsException
67    */

68   Object JavaDoc get(int iColumnIndex) throws ArrayIndexOutOfBoundsException JavaDoc;
69
70   /**
71    * Get current value for a column given its name
72    * @param sColumnName Case insensitive String
73    * @return Object
74    * @throws ArrayIndexOutOfBoundsException if no column with such name was found
75    */

76   Object JavaDoc get(String JavaDoc sColumnName) throws ArrayIndexOutOfBoundsException JavaDoc;
77
78   /**
79    * Get column index from its name
80    * @param sColumnName String
81    * @return int [0..columnCount()-1] or -1 if column was not found
82    */

83   int getColumnIndex(String JavaDoc sColumnName);
84
85   /**
86    * Put current value for a column
87    * @param iColumnIndex int [0..columnCount()-1]
88    * @param oValue Object
89    * @throws ArrayIndexOutOfBoundsException
90    */

91   void put(int iColumnIndex, Object JavaDoc oValue) throws ArrayIndexOutOfBoundsException JavaDoc;
92
93   /**
94    * Put current value for a column
95    * @param sColumnName String Column name
96    * @param oValue Object
97    * @throws ArrayIndexOutOfBoundsException
98    */

99   void put(String JavaDoc sColumnName, Object JavaDoc oValue) throws ArrayIndexOutOfBoundsException JavaDoc;
100
101   /**
102    * Set all current values to null
103    */

104   void setAllColumnsToNull();
105
106   /**
107    * Prepare ImportLoader for repeated execution
108    * @param oConn Connection
109    * @param oCols ColumnList List of columns that will be inserted or updated at the database
110    * @throws SQLException
111    */

112   void prepare(Connection JavaDoc oConn, ColumnList oCols) throws SQLException JavaDoc;
113
114   /**
115    * <p>Close ImportLoader</p>
116    * Must be always called before ImportLoader is destroyed
117    * @throws SQLException
118    */

119   void close() throws SQLException JavaDoc;
120
121   /**
122    * Store a single row or a set of related rows
123    * @param oConn Connection
124    * @param sWorkArea String
125    * @param iFlags int
126    * @throws SQLException
127    * @throws IllegalArgumentException
128    * @throws NullPointerException
129    */

130   void store(Connection JavaDoc oConn, String JavaDoc sWorkArea, int iFlags) throws SQLException JavaDoc,IllegalArgumentException JavaDoc,NullPointerException JavaDoc;
131 }
132
Popular Tags