org.caleigo.core.service
Class JDBCMetaProducer

java.lang.Object
  extended byorg.caleigo.core.service.JDBCMetaProducer
All Implemented Interfaces:
IMetaProducer

public class JDBCMetaProducer
extends java.lang.Object
implements IMetaProducer

Version:
$Revision: 1.1 $
Author:
Mattias Hagstrand

Field Summary
static int MAX_NBR_OF_FIELDS_IN_STATIC
           
static int MAX_NBR_OF_OVERVIEW_FIELDS
           
 
Constructor Summary
JDBCMetaProducer(IProgressReceiver progressReceiver, java.sql.Connection metaDataConn, java.lang.String catalog, java.lang.String schema, java.lang.String dataSourceName)
           
JDBCMetaProducer(IProgressReceiver progressReceiver, java.sql.Connection metaDataConn, java.lang.String catalog, java.lang.String schema, java.lang.String dataSourceName, java.sql.Connection dataConn, boolean performSizesAnalyzis, boolean removeTablePrefixes, boolean removeColumnPrefixes, boolean readDefaultValues, boolean readTables, boolean readViews)
           
 
Method Summary
protected  java.lang.Object convertDefaultValue(DataType dataType, java.lang.Object value)
           
protected  java.lang.String createCodeName(java.lang.String sourceName, boolean isPrimaryKeyColumn, boolean removePlural, boolean isTable)
          Creates a Correct Code name given the source name from the parsed metadata
protected  java.lang.String createDisplayName(java.lang.String sourceName, boolean isPrimaryKeyColumn, boolean removePlural, boolean isTable)
          Creates a correct Display Name given the source Name from the parsed metadata
protected  java.lang.String createEntityRelationCodeName(java.lang.String referenceCodeName, java.lang.String targetCodeName)
           
protected  java.lang.String createEntityRelationSourceName(java.lang.String referenceCodeName, java.lang.String targetCodeName)
           
protected  int getEntityType(java.util.ArrayList columns, java.util.HashMap primaryKeys, java.util.HashMap referenceFields)
           
protected  int getTableSizeType(java.lang.String tableName)
           
protected  boolean isOverviewFieldType(DataType dataType)
           
protected  DataType performTypeRecognition(java.lang.String typeName)
           
 void produce(IMetaConsumer consumer)
          Start the production of meta data.
protected  void removePlural(java.lang.StringBuffer stringBuffer)
          Converts a pluralis word to singularis
protected  void removeTrailingID(java.lang.StringBuffer stringBuffer)
           
protected  DataType translateType(short type, java.lang.String typeName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_NBR_OF_OVERVIEW_FIELDS

public static final int MAX_NBR_OF_OVERVIEW_FIELDS
See Also:
Constant Field Values

MAX_NBR_OF_FIELDS_IN_STATIC

public static final int MAX_NBR_OF_FIELDS_IN_STATIC
See Also:
Constant Field Values
Constructor Detail

JDBCMetaProducer

public JDBCMetaProducer(IProgressReceiver progressReceiver,
                        java.sql.Connection metaDataConn,
                        java.lang.String catalog,
                        java.lang.String schema,
                        java.lang.String dataSourceName)

JDBCMetaProducer

public JDBCMetaProducer(IProgressReceiver progressReceiver,
                        java.sql.Connection metaDataConn,
                        java.lang.String catalog,
                        java.lang.String schema,
                        java.lang.String dataSourceName,
                        java.sql.Connection dataConn,
                        boolean performSizesAnalyzis,
                        boolean removeTablePrefixes,
                        boolean removeColumnPrefixes,
                        boolean readDefaultValues,
                        boolean readTables,
                        boolean readViews)
Method Detail

produce

public void produce(IMetaConsumer consumer)
Description copied from interface: IMetaProducer
Start the production of meta data.

Specified by:
produce in interface IMetaProducer
Parameters:
consumer - the consumer of the meta data.

getEntityType

protected int getEntityType(java.util.ArrayList columns,
                            java.util.HashMap primaryKeys,
                            java.util.HashMap referenceFields)

createCodeName

protected java.lang.String createCodeName(java.lang.String sourceName,
                                          boolean isPrimaryKeyColumn,
                                          boolean removePlural,
                                          boolean isTable)
Creates a Correct Code name given the source name from the parsed metadata

Parameters:
sourceName - The Source Name for the entity
isPrimaryKeyColumn - Set to true if the column is part of the Primary Key constraint
removePlural - Set to true if the method shoul convert pluralis words to singularis
isTable - true if creating a code name for a table
Returns:
Returns the correct Code Name

createDisplayName

protected java.lang.String createDisplayName(java.lang.String sourceName,
                                             boolean isPrimaryKeyColumn,
                                             boolean removePlural,
                                             boolean isTable)
Creates a correct Display Name given the source Name from the parsed metadata

Parameters:
sourceName - The source name for the entity
isPrimaryKeyColumn - Set to true if the column is part of the Primary Key constraint
removePlural - Set to true if the method shoul convert pluralis words to singularis
isTable - true if creating a display name for a table
Returns:
Returns the correct Display Name

removePlural

protected void removePlural(java.lang.StringBuffer stringBuffer)
Converts a pluralis word to singularis

Parameters:
stringBuffer - The StringBuffer containing the word to process

removeTrailingID

protected void removeTrailingID(java.lang.StringBuffer stringBuffer)

translateType

protected DataType translateType(short type,
                                 java.lang.String typeName)

performTypeRecognition

protected DataType performTypeRecognition(java.lang.String typeName)

convertDefaultValue

protected java.lang.Object convertDefaultValue(DataType dataType,
                                               java.lang.Object value)

isOverviewFieldType

protected boolean isOverviewFieldType(DataType dataType)

createEntityRelationSourceName

protected java.lang.String createEntityRelationSourceName(java.lang.String referenceCodeName,
                                                          java.lang.String targetCodeName)

createEntityRelationCodeName

protected java.lang.String createEntityRelationCodeName(java.lang.String referenceCodeName,
                                                        java.lang.String targetCodeName)

getTableSizeType

protected int getTableSizeType(java.lang.String tableName)


Copyright © 2005 Caleigo. All Rights Reserved.