com.hardcode.gdbms.engine.strategies
Class UnionDataSource

java.lang.Object
  extended by com.hardcode.gdbms.engine.strategies.OperationDataSource
      extended by com.hardcode.gdbms.engine.strategies.UnionDataSource
All Implemented Interfaces:
DataSource, ReadAccess

public class UnionDataSource
extends OperationDataSource

DataSource que hace la union de dos datasources

Author:
Fernando González Cortés

Field Summary
 
Fields inherited from interface com.hardcode.gdbms.engine.data.DataSource
COHERENT_ROW_ORDER, DIRECT_MODE, DISPATCH, IGNORE, STORE
 
Constructor Summary
UnionDataSource(DataSource ds1, DataSource ds2)
          Creates a new UnionDataSource object.
 
Method Summary
 Metadata getDataSourceMetadata()
          Gets the meta data about the source of this DataSource
 int getFieldIndexByName(java.lang.String fieldName)
          Obtiene el indice de un campo a partir de su nombre o -1 si no existe un campo con ese nombre
 Value getFieldValue(long rowIndex, int fieldId)
          Obtiene el valor que se encuentra en la fila y columna indicada
 Memento getMemento()
          Gets a memento object with the current status of the DataSource
 long getRowCount()
          Obtiene el número de registros del DataSource
 void start()
          Opens the DataSource to access the data it contains.
 void stop()
          Closes the DataSource.
 
Methods inherited from class com.hardcode.gdbms.engine.strategies.OperationDataSource
addEditionListener, addField, addField, addMetadataEditionListener, addSelectionListener, beginTrans, canRedo, canUndo, check, commitTrans, deleteRow, getAlias, getAsString, getDataSourceFactory, getDispatchingMode, getDriver, getDriverMetadata, getFieldNames, getName, getRow, getSelectedRows, getSQL, getWhereFilter, insertEmptyRow, insertEmptyRowAt, insertFilledRow, insertFilledRowAt, isModified, redo, remove, removeEditionListener, removeField, removeMetadataEditionListener, removeSelectionListener, rollBackTrans, saveData, setAlias, setDataSourceFactory, setDispatchingMode, setFieldName, setFieldValue, setName, setSelectedRows, setSQL, undo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnionDataSource

public UnionDataSource(DataSource ds1,
                       DataSource ds2)
Creates a new UnionDataSource object.

Parameters:
ds1 - Primera tabla de la union
ds2 - Segunda tabla de la union
Method Detail

start

public void start()
           throws DriverException
Description copied from interface: DataSource
Opens the DataSource to access the data it contains. If the data is accessed without a previous opening a ClosedDataSourceException is thrown. If this method is invoked twice then only the second call to stop will close the DataSource.
If the DataSource was obtained with an AUTOMATIC_OPENING mode, there's no need to open the DataSource. Indeed start calls are ignored. It's possible to close the DataSource by a single call to the close method

Throws:
DriverException - if the operation fails
See Also:
com.hardcode.gdbms.engine.data.DataSource#open()

stop

public void stop()
          throws DriverException
Description copied from interface: DataSource
Closes the DataSource. After a DataSource is closed it's data cannot be retrieved. Any attempt to do so will result in a DataSourceClosedException

Throws:
DriverException - If the operation fails
See Also:
com.hardcode.gdbms.engine.data.DataSource#close()

getFieldIndexByName

public int getFieldIndexByName(java.lang.String fieldName)
                        throws DriverException
Description copied from interface: DataSource
Obtiene el indice de un campo a partir de su nombre o -1 si no existe un campo con ese nombre

Specified by:
getFieldIndexByName in interface DataSource
Overrides:
getFieldIndexByName in class OperationDataSource
Parameters:
fieldName - Nombre del campo
Returns:
Indice del campo con el nombre dado o -1 si el campo no existe
Throws:
DriverException - Si se produce un error accediendo a los datos
See Also:
com.hardcode.gdbms.engine.data.FieldNameAccess#getFieldIndexByName(java.lang.String)

getFieldValue

public Value getFieldValue(long rowIndex,
                           int fieldId)
                    throws DriverException
Description copied from interface: ReadAccess
Obtiene el valor que se encuentra en la fila y columna indicada

Parameters:
rowIndex - fila
fieldId - columna
Returns:
subclase de Value con el valor del origen de datos. Never null (use ValueFactory.createNullValue() instead)
Throws:
DriverException - Si se produce un error accediendo al DataSource
See Also:
ReadAccess.getFieldValue(long, int)

getRowCount

public long getRowCount()
                 throws DriverException
Description copied from interface: ReadAccess
Obtiene el número de registros del DataSource

Returns:
Throws:
DriverException - Si se produce algún error accediendo al DataSource
See Also:
ReadAccess.getRowCount()

getMemento

public Memento getMemento()
                   throws MementoException
Description copied from interface: DataSource
Gets a memento object with the current status of the DataSource

Specified by:
getMemento in interface DataSource
Overrides:
getMemento in class OperationDataSource
Returns:
DataSourceMemento
Throws:
MementoException - If the state cannot be obtained
See Also:
DataSource.getMemento()

getDataSourceMetadata

public Metadata getDataSourceMetadata()
                               throws DriverException
Description copied from interface: DataSource
Gets the meta data about the source of this DataSource

Returns:
DataSourceMetadata
Throws:
DriverException - If cannot get the DataSource metadata


Copyright © 2005-2006 . All Rights Reserved.