|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.hardcode.gdbms.engine.data.DataSourceFactory
public class DataSourceFactory
Factory of DataSource implementations. It has method to register DataSourceDefinitions and to create DataSource from this asociations. It's also possible to execute SQL statements with the executeSQL method. After using the DataSourceFactory it's hardly recomended to call freeResources method.
Field Summary | |
---|---|
static int |
AUTOMATIC_OPENING
DataSources open automatically and so close (but can be closed manually) |
static int |
MANUAL_OPENING
DataSources need a explicit call to start() |
static int |
UNDOABLE
|
Constructor Summary | |
---|---|
DataSourceFactory()
|
Method Summary | |
---|---|
void |
addDataSource(DataSourceDefinition dsd)
Añade una fuente de datos de objeto. |
void |
changeDataSourceName(java.lang.String oldName,
java.lang.String newName)
Cambia el nombre de una fuente de datos. |
void |
createDataSource(DataSourceCreation dsc)
Creates a data source defined by the DataSourceCreation object |
DataSource |
createRandomDataSource(Memento m)
Creates a DataSource from a memento object with the manual opening mode |
DataSource |
createRandomDataSource(Memento m,
int mode)
Creates a DataSource from a memento object with the specified opening mode |
DataSource |
createRandomDataSource(SelectAdapter instr,
int mode)
A partir de una instrucción select se encarga de obtener el DataSource resultado de la ejecución de dicha instrucción |
DataSource |
createRandomDataSource(java.lang.String tableName)
Dado el nombre de una tabla, se busca la fuente de datos asociada a dicha tabla y se obtiene un datasource adecuado en funcion del tipo de fuente de datos accediendo al subsistema de drivers |
DataSource |
createRandomDataSource(java.lang.String tableName,
int mode)
Dado el nombre de una tabla, se busca la fuente de datos asociada a dicha tabla y se obtiene un datasource adecuado en funcion del tipo de fuente de datos accediendo al subsistema de drivers |
DataSource |
createRandomDataSource(java.lang.String tableName,
java.lang.String tableAlias)
Dado el nombre de una tabla, se busca la fuente de datos asociada a dicha tabla y se obtiene un datasource adecuado en funcion del tipo de fuente de datos accediendo al subsistema de drivers. |
DataSource |
createRandomDataSource(java.lang.String tableName,
java.lang.String tableAlias,
int mode)
Dado el nombre de una tabla, se busca la fuente de datos asociada a dicha tabla y se obtiene un datasource adecuado en funcion del tipo de fuente de datos accediendo al subsistema de drivers. |
DataSource |
createRandomDataSource(UnionAdapter instr,
int mode)
Obtiene el DataSource resultado de ejecutar la instrucción de union |
DataSource |
executeSQL(java.lang.String sql,
int mode)
Executes a SQL statement where the table names must be valid data source names. |
void |
freeResources()
Frees all resources used during execution |
DataSource |
getDataSource(CustomAdapter instr,
int mode)
Creates a DataSource as a result of a custom query |
DataSourceDefinition |
getDataSourceDefinition(java.lang.String dataSourceName)
Obtiene la información de la fuente de datos cuyo nombre se pasa como parámetro |
DataSourceDefinition[] |
getDataSourcesDefinition()
Gets the information of all data sources registered in the system |
DelegatingStrategy |
getDelegatingStrategy()
|
com.hardcode.driverManager.DriverManager |
getDriverManager()
Gets a driver manager reference |
java.lang.String |
getTempFile()
Gets the URL of a file in the temporary directory. |
java.lang.String |
getUID()
Get's a unique id in the tableSource and nameOperationDataSource key sets |
void |
initialize()
Initializes the system. |
void |
initialize(java.lang.String tempDir)
Initializes the system |
java.lang.String |
nameAndAddDataSource(DataSourceDefinition dsd)
Añade una fuente de datos de objeto. |
void |
remove(DataSource ds)
Removes the association between the name and the data sources |
void |
removeAllDataSources()
Removes all associations between names and data sources. |
void |
setClosingDelay(long delay)
Sets the minimum delay between accesses needed to close the DataSource. |
void |
setDriverManager(com.hardcode.driverManager.DriverManager dm)
Establece el DriverManager que se usará para instanciar DataSource's. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int UNDOABLE
public static final int MANUAL_OPENING
public static final int AUTOMATIC_OPENING
Constructor Detail |
---|
public DataSourceFactory()
Method Detail |
---|
public java.lang.String getUID()
public void removeAllDataSources()
DriverException
- If the resources could not be freedpublic void remove(DataSource ds)
ds
- Name of the data source to removepublic void createDataSource(DataSourceCreation dsc) throws DriverException
dsc
-
DriverException
- if the source creation failspublic void addDataSource(DataSourceDefinition dsd)
rd
- objeto con la informaciónname
- Nombre de la fuente de datospublic java.lang.String nameAndAddDataSource(DataSourceDefinition dsd)
rd
- objeto con la información
public DataSourceDefinition getDataSourceDefinition(java.lang.String dataSourceName)
dataSourceName
- Nombre de la base de datos
public DataSourceDefinition[] getDataSourcesDefinition()
public void changeDataSourceName(java.lang.String oldName, java.lang.String newName) throws NoSuchTableException
oldName
- Nombre actual de la fuente de datos que se quiere cambiarnewName
- Nombre que se le quiere poner a la fuente de datos
NoSuchTableException
- Si no hay ninguna fuente de datos de nombre
'oldName'public void setClosingDelay(long delay)
delay
- time un millisecondspublic DataSource createRandomDataSource(java.lang.String tableName) throws com.hardcode.driverManager.DriverLoadException, NoSuchTableException, DataSourceCreationException
tableName
- Nombre de la fuente de datos
com.hardcode.driverManager.DriverLoadException
- If the driver loading fails
NoSuchTableException
- If the 'tableName' data source does not exists
DataSourceCreationException
- If the DataSource could not be createdpublic DataSource createRandomDataSource(java.lang.String tableName, int mode) throws com.hardcode.driverManager.DriverLoadException, NoSuchTableException, DataSourceCreationException
tableName
- Nombre de la fuente de datosmode
- opening mode: AUTOMATIC_OPENING -> the DataSource opens automatically and closes after a
while. It can be closed manually. MANUAL_OPENING -> the DataSource opens and closes manually
com.hardcode.driverManager.DriverLoadException
- If the driver loading fails
NoSuchTableException
- If the 'tableName' data source does not exists
DataSourceCreationException
- If the DataSource could not be createdpublic DataSource createRandomDataSource(java.lang.String tableName, java.lang.String tableAlias) throws NoSuchTableException, com.hardcode.driverManager.DriverLoadException, DataSourceCreationException
tableName
- Nombre de la fuente de datostableAlias
- Alias que tiene el DataSource en una instrucción
com.hardcode.driverManager.DriverLoadException
- If the driver loading fails
NoSuchTableException
- If the 'tableName' data source does not exists
DataSourceCreationException
- If the DataSource could not be createdpublic DataSource createRandomDataSource(java.lang.String tableName, java.lang.String tableAlias, int mode) throws NoSuchTableException, com.hardcode.driverManager.DriverLoadException, DataSourceCreationException
tableName
- Nombre de la fuente de datostableAlias
- Alias que tiene el DataSource en una instrucciónmode
- openning mode
com.hardcode.driverManager.DriverLoadException
- If the driver loading fails
NoSuchTableException
- If the 'tableName' data source does not exists
DataSourceCreationException
- If the DataSource could not be createdpublic DataSource createRandomDataSource(Memento m) throws NoSuchTableException, ExecutionException, DataSourceCreationException
m
- memento
DataSourceCreationException
- If the DataSource creation fails
NoSuchTableException
- If the memento information is wrong
ExecutionException
- If DataSource execution failspublic DataSource createRandomDataSource(Memento m, int mode) throws NoSuchTableException, DataSourceCreationException, ExecutionException
m
- mementomode
- opening mode
DataSourceCreationException
- If the DataSource creation fails
NoSuchTableException
- If the memento information is wrong
ExecutionException
- If DataSource execution failspublic DataSource createRandomDataSource(SelectAdapter instr, int mode) throws ExecutionException
instr
- Instrucción select origen del datasourcemode
- opening mode
ExecutionException
public DataSource createRandomDataSource(UnionAdapter instr, int mode) throws ExecutionException
instr
- instrucción de unionmode
- opening mode
ExecutionException
public DataSource getDataSource(CustomAdapter instr, int mode) throws ExecutionException
instr
- Root node of the adapter tree of the custom query
instructionmode
- opening mode
ExecutionException
public DataSource executeSQL(java.lang.String sql, int mode) throws SyntaxException, com.hardcode.driverManager.DriverLoadException, NoSuchTableException, ExecutionException
sql
- sql statementmode
- opening mode MANUAL_OPENING or AUTOMATIC_OPENING
SyntaxException
- If instruction parsing fails
com.hardcode.driverManager.DriverLoadException
- If a driver cannot be loaded
NoSuchTableException
- If the instruction references a data source that doesn't exist
ExecutionException
- If the execution of the statement failspublic void setDriverManager(com.hardcode.driverManager.DriverManager dm)
dm
- El manager que se encarga de cargar los driverspublic com.hardcode.driverManager.DriverManager getDriverManager()
public void freeResources() throws DataSourceFinalizationException
DataSourceFinalizationException
- If cannot free resourcespublic void initialize() throws InitializationException
InitializationException
- If the initializationpublic void initialize(java.lang.String tempDir) throws InitializationException
tempDir
- temporary directory to write data
InitializationException
- If the initialization failspublic java.lang.String getTempFile()
public DelegatingStrategy getDelegatingStrategy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |