org.apache.falcon.catalog
Class AbstractCatalogService

java.lang.Object
  extended by org.apache.falcon.catalog.AbstractCatalogService
Direct Known Subclasses:
HiveCatalogService

public abstract class AbstractCatalogService
extends Object

Interface definition for a catalog registry service such as Hive or HCatalog.


Constructor Summary
AbstractCatalogService()
           
 
Method Summary
abstract  boolean dropPartitions(String catalogUrl, String database, String tableName, Map<String,String> partitions)
          Drops a given partition.
abstract  CatalogPartition getPartition(String catalogUrl, String database, String tableName, Map<String,String> partitionSpec)
          Gets the partition.
abstract  boolean isAlive(String catalogBaseUrl)
          This method checks if the catalog service is alive.
abstract  boolean isTableExternal(String catalogUrl, String database, String tableName)
          Returns if the table is external or not.
abstract  List<CatalogPartition> listPartitionsByFilter(String catalogUrl, String database, String tableName, String filter)
          List partitions by filter.
abstract  boolean tableExists(String catalogUrl, String database, String tableName)
          This method checks if the given table exists in the catalog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCatalogService

public AbstractCatalogService()
Method Detail

isAlive

public abstract boolean isAlive(String catalogBaseUrl)
                         throws FalconException
This method checks if the catalog service is alive.

Parameters:
catalogBaseUrl - url for the catalog service
Returns:
if the service was reachable
Throws:
FalconException - exception

tableExists

public abstract boolean tableExists(String catalogUrl,
                                    String database,
                                    String tableName)
                             throws FalconException
This method checks if the given table exists in the catalog.

Parameters:
catalogUrl - url for the catalog service
database - database the table belongs to
tableName - tableName to check if it exists
Returns:
if the table exists
Throws:
FalconException - exception

isTableExternal

public abstract boolean isTableExternal(String catalogUrl,
                                        String database,
                                        String tableName)
                                 throws FalconException
Returns if the table is external or not.

Parameters:
catalogUrl - url for the catalog service
database - database the table belongs to
tableName - tableName to check if it exists
Returns:
true if external else false
Throws:
FalconException

listPartitionsByFilter

public abstract List<CatalogPartition> listPartitionsByFilter(String catalogUrl,
                                                              String database,
                                                              String tableName,
                                                              String filter)
                                                       throws FalconException
List partitions by filter.

Parameters:
catalogUrl - url for the catalog service
database - database the table belongs to
tableName - tableName to check if it exists
filter - The filter string, for example "part1 = \"p1_abc\" and part2 <= "\p2_test\"". Filtering can be done only on string partition keys.
Returns:
list of partitions
Throws:
FalconException

dropPartitions

public abstract boolean dropPartitions(String catalogUrl,
                                       String database,
                                       String tableName,
                                       Map<String,String> partitions)
                                throws FalconException
Drops a given partition.

Parameters:
catalogUrl - url for the catalog service
database - database the table belongs to
tableName - tableName to check if it exists
partitions - list of partitions as Key=Value pairs
Returns:
if the partition was dropped
Throws:
FalconException

getPartition

public abstract CatalogPartition getPartition(String catalogUrl,
                                              String database,
                                              String tableName,
                                              Map<String,String> partitionSpec)
                                       throws FalconException
Gets the partition.

Parameters:
catalogUrl - url for the catalog service
database - database the table belongs to
tableName - tableName to check if it exists
partitionSpec - The partition specification, {[col_name,value],[col_name2,value2]}. All partition-key-values must be specified.
Returns:
An instance of CatalogPartition.
Throws:
FalconException


Copyright © 2013-2014 Apache Software Foundation. All Rights Reserved.