com.hardcode.gdbms.engine.strategies
Class ProjectionDataSource

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

public class ProjectionDataSource
extends OperationDataSource

DataSource que añade características de proyección sobre campos al DataSource subyacente.

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
ProjectionDataSource(DataSource source, Expression[] fields, java.lang.String[] aliases)
          Creates a new ProjectionDataSource object.
 
Method Summary
 Metadata getDataSourceMetadata()
          Gets the meta data about the source of this DataSource
 int getFieldCount()
           
 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
 int getFieldType(int i)
           
 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

ProjectionDataSource

public ProjectionDataSource(DataSource source,
                            Expression[] fields,
                            java.lang.String[] aliases)
Creates a new ProjectionDataSource object.

Parameters:
source - DataSource origen de la información
fields - Con los índices de los campos proyectados
aliases - Nombres asignados en la instrucción a los campos
Method Detail

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.data.DataSource#

getFieldCount

public int getFieldCount()
                  throws DriverException
Throws:
DriverException
See Also:
com.hardcode.gdbms.data.DataSource#

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.data.DataSource#

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:
com.hardcode.gdbms.data.DataSource#

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:
com.hardcode.gdbms.data.DataSource#

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.data.DataSource#

getFieldType

public int getFieldType(int i)
                 throws DriverException
Throws:
DriverException
See Also:
com.hardcode.gdbms.engine.data.driver.ObjectDriver#getFieldType(int)

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.