private HTableDescriptor getTableDescriptor ( Class < ? > clazz , EntityType < ? > entityType , String tableName ) { try { AbstractManagedType < ? > ent = ( AbstractManagedType < ? > ) entityType ; HTableDescriptor tableDescriptor = null ; String hTableName = HBaseUtils . getHTableName ( databaseName , tableName ) ; tableDescriptor = ! admin . tableExists ( TableName . valueOf ( hTableName ) ) ? new HTableDescriptor ( TableName . valueOf ( hTableName ) ) : admin . getTableDescriptor ( TableName . valueOf ( hTableName ) ) ; addColumnFamilyAndSetProperties ( tableDescriptor , tableName ) ; // Add column families for @SecondaryTable List < String > secondaryTables = ( ( DefaultEntityAnnotationProcessor ) ent . getEntityAnnotation ( ) ) . getSecondaryTablesName ( ) ; for ( String secTable : secondaryTables ) { addColumnFamilyAndSetProperties ( tableDescriptor , secTable ) ; } // handle @JoinTable for @ManyToMany List < Relation > relations = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , clazz ) . getRelations ( ) ; addJoinTable ( relations ) ; // @CollectionTable is not handled. return tableDescriptor ; } catch ( IOException ex ) { logger . error ( "Either table isn't in enabled state or some network problem, Caused by: " , ex ) ; throw new SchemaGenerationException ( ex , "Hbase" ) ; } }
Gets the table descriptor .