Revision 14594

View differences:

branches/v10/libraries/libGDBMS/src/main/java/com/hardcode/gdbms/engine/data/file/FileDataSourceAdapter.java
4 4
import java.io.IOException;
5 5
import java.sql.Types;
6 6

  
7
import org.apache.log4j.Logger;
8

  
7 9
import com.hardcode.driverManager.Driver;
8 10
import com.hardcode.driverManager.DriverLoadException;
9 11
import com.hardcode.gdbms.engine.data.SourceInfo;
......
17 19

  
18 20
/**
19 21
 * Adapta la interfaz FileDriver a la interfaz DataSource
20
 * 
22
 *
21 23
 * @author Fernando Gonz?lez Cort?s
22 24
 */
23 25
class FileDataSourceAdapter extends AbstractFileDataSource implements
......
59 61
			} else if (sem < 0) {
60 62
				sem=0;
61 63
				driver.close();
62
				throw new RuntimeException("DataSource closed too many times");
64
				Logger.getLogger(this.getClass()).debug("DataSource closed too many times  =  "+ driver.getName());
65
//				throw new RuntimeException("DataSource closed too many times");
63 66
			}
64 67
		} catch (IOException e) {
65 68
			throw new DriverException(e);
......
68 71

  
69 72
	/**
70 73
	 * Asigna el driver al adaptador
71
	 * 
74
	 *
72 75
	 * @param driver
73 76
	 *            The driver to set.
74 77
	 */
......
78 81

  
79 82
	/**
80 83
	 * Sets the source information of the DataSource
81
	 * 
84
	 *
82 85
	 * @param sourceInfo
83 86
	 *            The file to set.
84 87
	 */
......
162 165
	}
163 166

  
164 167
	/**
165
	 * @throws DriverException 
168
	 * @throws DriverException
166 169
	 * @see com.hardcode.gdbms.engine.data.DataSource#getDataWare(int)
167 170
	 */
168 171
	public DataWare getDataWare(int mode) throws DriverException {
......
182 185

  
183 186
	}
184 187

  
185
	public int getFieldWidth(int i) throws DriverException {		
188
	public int getFieldWidth(int i) throws DriverException {
186 189
		return getReadDriver().getFieldWidth(i);
187 190
	}
188
	
191

  
189 192
    public boolean isVirtualField(int fieldId) throws DriverException {
190 193
		// last field is the virtual primary key
191 194
		if (fieldId == this.getFieldCount() - 1)
192
			return true;		
195
			return true;
193 196
		return false;
194 197
    }
195 198

  
196 199
	public void reload() throws DriverException {
197 200
		try {
198
			sem = 0;		
201
			sem = 0;
199 202
			driver.close();
200 203
		} catch (IOException e) {
201 204
			throw new DriverException(e);
202 205
		}
203 206
		this.fieldCount = -1;
204
		
207

  
205 208
		this.start();
206
		
209

  
207 210
		this.raiseEventReloaded();
208
		
211

  
209 212
	}
210 213

  
211 214
}

Also available in: Unified diff