|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthep.aida.ref.tuple.TupleFactory
hep.aida.ref.sql.SQLTupleFactory
public class SQLTupleFactory
SQLTupleFactory
creates SQLTuple
s. It creates SQL tables
if neccessary. It reuses some funtionality from
TupleFactory
.
SQLTupleFactory
contains several extensions to
ITupleFactory
:
void delete(String path);
$Log: SQLTupleFactory.java,v $
Revision 1.79 2008/07/25 13:25:03 hrivnac
oracle schema for tags supported improved
Revision 1.78 2007/09/26 07:58:51 hrivnac
cache savable fromjas menu
Revision 1.77 2007/06/11 14:02:29 hrivnac
better support for tags in Oracle
Revision 1.76 2007/05/23 16:38:44 hrivnac
logical connections for Plotter; better UML
Revision 1.75 2007/05/22 23:33:20 hrivnac
Plotter uses real arguments parsing
Revision 1.74 2006/12/12 15:21:43 hrivnac
McKoi replaced with Derby; uppercase-only dbs handled better; moving to JAS 0.8.3
Revision 1.73 2006/11/22 23:55:36 hrivnac
fixed non-double values, added intr database
Revision 1.72 2006/11/15 16:16:01 hrivnac
Oracle work fine in CERN, cache enabled
Revision 1.71 2006/11/14 16:06:18 hrivnac
improving Web Service
Revision 1.70 2005/09/02 14:10:31 hrivnac
moved to JAS3 0.8.2
Revision 1.69 2005/02/10 20:07:52 hrivnac
bug fixes to support new ColMan
Revision 1.68 2004/11/22 18:09:53 hrivnac
Oracle treatment
Revision 1.67 2004/10/29 22:27:25 hrivnac
imports corrected
Revision 1.66 2004/10/28 15:25:40 hrivnac
*** empty log message ***
Revision 1.65 2004/10/22 15:32:59 hrivnac
cleaned
Revision 1.64 2004/10/21 15:46:49 hrivnac
doc improved
Revision 1.63 2004/10/21 10:39:32 hrivnac
works wel with ColMan
Revision 1.62 2004/10/20 23:02:29 hrivnac
Types mapping simplified
Revision 1.61 2004/10/14 13:39:33 hrivnac
unknown types are mapped to Strings
Revision 1.60 2004/10/13 12:25:39 hrivnac
defaults work fine
Revision 1.59 2004/09/02 16:13:25 hrivnac
support for ColMan Replicator
Revision 1.58 2004/09/02 12:16:37 hrivnac
Filter works correctly between different dbs
Revision 1.57 2004/07/12 10:47:16 hrivnac
Bugs/ToDos
Revision 1.56 2004/06/30 13:01:05 hrivnac
oracle sceleton
Revision 1.55 2004/06/23 08:04:53 hrivnac
documentation fixes
Revision 1.54 2004/06/22 08:52:32 hrivnac
allow to skip compatibility test
Revision 1.53 2004/06/16 21:56:43 hrivnac
StringBuffer in SQLTuple.addRow() -> speed
Revision 1.52 2004/05/22 15:12:59 hrivnac
class id reformated
Revision 1.51 2004/04/21 22:04:03 hrivnac
Implementation.properties to configure Inplementation.java, no SQL dependency in code
Revision 1.50 2004/04/21 13:41:32 hrivnac
explicit dependency on MySQL removed
Revision 1.49 2004/04/21 08:24:50 hrivnac
some explicit MySQL dependencies removed
Revision 1.48 2004/04/20 13:42:26 hrivnac
logs updated
Revision 1.47 2004/04/20 12:46:49 hrivnac
tuples use always primitive types
Revision 1.46 2004/04/20 09:28:08 hrivnac
bug fixes
Revision 1.45 2004/04/16 15:32:57 hrivnac
Type.properties to setup Type.class
Revision 1.44 2004/04/15 16:25:04 hrivnac
type mapping improved
Revision 1.43 2004/04/14 13:39:47 hrivnac
1.5 warnings fixed
Revision 1.42 2004/04/13 15:45:54 hrivnac
AIDA URL introduced
Revision 1.41 2004/03/23 23:41:15 hrivnac
new AidaUtils
Revision 1.40 2004/02/10 14:50:58 hrivnac
JavaDoc tags completed
Revision 1.39 2004/02/04 17:02:14 hrivnac
deleting of non-existing ntuple
Revision 1.38 2003/12/01 13:18:20 hrivnac
Prepared for beta3
Revision 1.37 2003/11/26 16:09:46 hrivnac
Functional EventSelector WebService
Revision 1.36 2003/11/24 15:13:22 hrivnac
Logging improved.
Revision 1.35 2003/11/20 17:21:58 hrivnac
Java 1.5 natively supported, Log4J reporting improved.
Revision 1.34 2003/11/18 22:03:45 hrivnac
Root benchmarks.
Revision 1.33 2003/11/12 14:13:48 hrivnac
Access to Pool Collections is provided.
Revision 1.32 2003/11/10 15:34:08 hrivnac
SQLTupleFactory documented
Revision 1.31 2003/11/06 22:47:46 hrivnac
Updated documentation.
Revision 1.30 2003/11/06 16:54:16 hrivnac
Merger works for SQL DBs
Revision 1.29 2003/11/05 19:46:22 hrivnac
- FreeHEP 1.2.1
- JAIDA 3.2.1
Revision 1.16 2003/10/22 17:59:39 hrivnac
Refactored.
Revision 1.15 2003/10/21 13:56:00 hrivnac
Default values supported.
Revision 1.14 2003/10/21 13:24:52 hrivnac
Constructor from columnString implemented.
Revision 1.9 2003/10/10 13:21:36 hrivnac
Works between different DB technologies.
Revision 1.8 2003/10/10 10:12:21 hrivnac
All three testing pgms work.
Revision 1.4 2003/10/08 09:27:49 hrivnac
createFiltered(...) naive way.
Revision 1.3 2003/10/02 10:00:40 hrivnac
Cleaning.
Revision 1.2 2003/09/30 16:46:02 hrivnac
- Writing test in TestWrite
- SQLTuple projections supported
Revision 1.1 2003/09/30 14:11:48 hrivnac
Can created SQLTuples.
Field Summary | |
---|---|
private Accessor |
_accessor
|
private static String |
_cacheFile
|
private static String |
_cacheResource
|
private static Map<String,Object[]> |
_descriptions
|
private String |
_options
|
private StmtSrc |
_stmtSrc
|
private boolean |
_test
|
private static Logger |
log
Logging . |
private static char |
separatorChar
|
private Tree |
tree
|
Constructor Summary | |
---|---|
SQLTupleFactory(ITree tree)
Call superconstructor and register ITree . |
Method Summary | |
---|---|
Accessor |
accessor()
Give associated Accessor . |
ITuple |
create(String path,
String title,
String columns)
Just call the master creation method. |
ITuple |
create(String path,
String title,
String[] columnName,
Class[] columnType)
Just call the the master creation method. |
ITuple |
create(String path,
String title,
String[] columnName,
Class[] columnType,
String options)
Create SQLTuple . |
ITuple |
create(String path,
String title,
String columns,
String options)
Split columns string into columnName and columnType arrays and call master creation method. |
IEvaluator |
createEvaluator(String expression)
Create an evaluator from a expression. |
IFilter |
createFilter(String expression)
Create a filter from a expression. |
IFilter |
createFilter(String expression,
int rowsToProcess)
Create a filter from a expression and a number of rows to be processed. |
IFilter |
createFilter(String expression,
int rowsToProcess,
int startingRow)
Create a filter from a expression and, number of rows to be processed and thye starting row. |
ITuple |
createFiltered(String path,
ITuple tuple,
IFilter filter)
Just extract columnNames and calls the master filtering method. |
ITuple |
createFiltered(String path,
ITuple tuple,
IFilter filter,
String[] columns)
Filter SQLTuple . |
void |
delete(String path)
Delete NTuple (table) from DB if it exists. |
private String |
nameInPath(String path)
|
private String |
parentPath(String path)
|
private void |
readCache()
Read (meta)data description from cache: It tries first local file cache (default is .SQLTuple.descriptions
Then it reads resource hep/aida/ref/sql/SQLTuple.descriptions
|
static void |
saveCache()
Save current (meta)data descriptions into file cache (default is .SQLTuple.descriptions ). |
static void |
setCache(String cacheFile)
Set (meta)data descriptions cache file anme. |
void |
setOptions(String options)
Register options. |
void |
skipCompatibilityTest()
Do not test for compatibility if existing table is reused. |
StmtSrc |
stmtSrc()
Give associated StmtSrc . |
boolean |
tableCompatible(String name,
String[] names0,
Class[] classes0,
Accessor accessor)
Verify if NTuple (table) in the DB is compatible with provided columns description. |
boolean |
tableCreatable(String name,
String[] names0,
Class[] classes0,
Accessor accessor)
Verify if new NTuple (table) can be created from the existing one. |
private boolean |
tableExists(String name)
Verify if NTuple (table) exists in the DB. |
Object[] |
tupleDescription(String name,
Accessor accessor)
Describe NTuple (table) from the SQL database. |
private Class[] |
unbox(Class[] cl)
Replace numeric classes with primitive types where possible. |
Methods inherited from class hep.aida.ref.tuple.TupleFactory |
---|
createChained, createChained, createCopy |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Tree tree
private static final char separatorChar
private StmtSrc _stmtSrc
private Accessor _accessor
private String _options
private boolean _test
private static Map<String,Object[]> _descriptions
private static String _cacheFile
private static String _cacheResource
private static Logger log
Constructor Detail |
---|
public SQLTupleFactory(ITree tree) throws SQLTupleException
ITree
.
Read descriptions cache from the file or resource if possible.
tree
- The ITree
to be used with this ITupleFactory
.
SQLTupleException
- if the ITupleFactory
can't be created.Method Detail |
---|
public ITuple create(String path, String title, String[] columnName, Class[] columnType, String options) throws IllegalArgumentException
SQLTuple
. Reuse (append) existing table, if exists,
create new one otherwise.
All other creating methods just re-shuffle arguments and call this method.
create
in interface ITupleFactory
create
in class TupleFactory
path
- The path to the ITuple
.title
- The title of the ITuple
.columnName
- The names of columns.columnType
- The types of columns.options
- The options to be used to create the ITuple.
IllegalArgumentException
- if the ITuple
can't be created.public ITuple create(String path, String title, String[] columnName, Class[] columnType)
create
in interface ITupleFactory
create
in class TupleFactory
path
- The path to the ITuple
.title
- The title of the ITuple
.columnName
- The names of columns.columnType
- The types of columns.
IllegalArgumentException
- if the ITuple
can't be created.public ITuple create(String path, String title, String columns, String options) throws IllegalArgumentException
create
in interface ITupleFactory
create
in class TupleFactory
path
- The path to the ITuple
.title
- The title of the ITuple
.columns
- The columns definition.options
- The options to be used to create the ITuple
.
IllegalArgumentException
- if the ITuple
can't be created.public ITuple create(String path, String title, String columns)
create
in interface ITupleFactory
create
in class TupleFactory
path
- The path to the ITuple
.title
- The title of the ITuple
.columns
- The columns definition.
IllegalArgumentException
- if the ITuple
can't be created.public ITuple createFiltered(String path, ITuple tuple, IFilter filter, String[] columns) throws IllegalArgumentException
SQLTuple
. Reuse (append) existing table, if exists,
create new one otherwise.
All other creating methods just re-shuffle arguments and call this method.
createFiltered
in interface ITupleFactory
createFiltered
in class TupleFactory
path
- The path to the ITuple
.tuple
- The original ITuple
.filter
- The IFilter
to be used.columns
- The columns to be copied into the new ITuple
.
ITuple
(the result).
IllegalArgumentException
public ITuple createFiltered(String path, ITuple tuple, IFilter filter)
createFiltered
in interface ITupleFactory
createFiltered
in class TupleFactory
path
- The path to the ITuple
.tuple
- The original ITuple
.filter
- The IFilter
to be used.
ITuple
(the result).public Object[] tupleDescription(String name, Accessor accessor) throws SQLTupleException
name
- The name of the existing ITuple
(within the actual DB).accessor
- The Accessor
of existing table to be used.
If null
the current Accessor
is used.
String[]
containing column names
and Class[]
containing column types.
SQLTupleException
- if the information can't be obtained.public boolean tableCompatible(String name, String[] names0, Class[] classes0, Accessor accessor) throws SQLTupleException
name
- The name of the existing ITuple
.names0
- The column names to be tested.classes0
- The column types to be tested.accessor
- The Accessor
of existing table to be used
as source (reference). If null
the current
Accessor
is used.
names0
and classes0
are compatibe with existing ITuple
.
SQLTupleException
- if the information can't be obtained.public boolean tableCreatable(String name, String[] names0, Class[] classes0, Accessor accessor) throws SQLTupleException
name
- The name of the existing ITuple
.names0
- The column names to be tested.classes0
- The column types to be tested.accessor
- The Accessor
of existing table to be used
as source (reference). If null
the current
Accessor
is used.
true
if the ITuple
,
defined by names0
and classes0
can be ceated from the existing ITuple
.
SQLTupleException
- if the information can't be obtained.private boolean tableExists(String name) throws SQLTupleException
name
- The name of the existing ITuple
.
true
if The ITuple
exists.
SQLTupleException
- if the information can't be obtained.public IFilter createFilter(String expression)
SQLTuple
.
createFilter
in interface ITupleFactory
createFilter
in class TupleFactory
expression
- The algebraic (or SQL in case of SQLTuple
) expression.
IFilter
.public IFilter createFilter(String expression, int rowsToProcess)
SQLTuple
and all rows are
processed in SQLTuple
.
createFilter
in interface ITupleFactory
createFilter
in class TupleFactory
expression
- The algebraic (or SQL in case of SQLTuple
) expression.rowsToProcess
- The number of rows to be processed (ignoed for SQLTuple
).
IFilter
.public IFilter createFilter(String expression, int rowsToProcess, int startingRow)
SQLTuple
and all rows are processed in SQLTuple
.
createFilter
in interface ITupleFactory
createFilter
in class TupleFactory
expression
- The algebraic (or SQL in case of SQLTuple
) expression.rowsToProcess
- The number of rows to be processed (ignoed for SQLTuple
).startingRow
- The starting row to be processed (ignoed for SQLTuple
).
IFilter
.public IEvaluator createEvaluator(String expression)
SQLTuple
.
createEvaluator
in interface ITupleFactory
createEvaluator
in class TupleFactory
expression
- The algebraic (or SQL in case of SQLTuple
) expression.
IEvaluator
.public void delete(String path) throws SQLTupleException
ITree
.
path
- The path to ITuple
to be deleted.
SQLTupleException
private Class[] unbox(Class[] cl)
cl
- The array of Class
es representing types,
numeric Class
es are replaced with prmitive
types where possible.
Class
es replaced
with primitive types where possible.public void skipCompatibilityTest()
public void setOptions(String options) throws SQLTupleException
options
- The options to be associated with this ITupleFactory
.
SQLTupleException
- if anything goes wrong.public Accessor accessor()
Accessor
.
Accessor
.public StmtSrc stmtSrc()
StmtSrc
.
StmtSrc
.private String nameInPath(String path)
private String parentPath(String path)
private void readCache()
.SQLTuple.descriptions
hep/aida/ref/sql/SQLTuple.descriptions
public static void saveCache()
.SQLTuple.descriptions
).
public static void setCache(String cacheFile)
cacheFile
- The name of the cache file,
default is .SQLTuple.descriptions
.
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |