Java Code Examples for com.jcabi.aspects.Loggable

The following examples show how to use com.jcabi.aspects.Loggable. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 6 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public Partition exchange_partition(
    Map<String, String> partitionSpecs,
    String source_db,
    String source_table_name,
    String dest_db,
    String dest_table_name)
    throws MetaException, NoSuchObjectException, InvalidObjectException, InvalidInputException, TException {
  DatabaseMapping mapping = checkWritePermissions(source_db);
  mapping.checkWritePermissions(dest_db);
  Partition result = mapping
      .getClient()
      .exchange_partition(partitionSpecs, mapping.transformInboundDatabaseName(source_db), source_table_name,
          mapping.transformInboundDatabaseName(dest_db), dest_table_name);
  return mapping.transformOutboundPartition(result);
}
 
Example 2
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 6 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public List<Partition> exchange_partitions(
    Map<String, String> partitionSpecs,
    String source_db,
    String source_table_name,
    String dest_db,
    String dest_table_name)
    throws MetaException, NoSuchObjectException, InvalidObjectException, InvalidInputException, TException {
  DatabaseMapping mapping = checkWritePermissions(source_db);
  mapping.checkWritePermissions(dest_db);
  List<Partition> result = mapping
      .getClient()
      .exchange_partitions(partitionSpecs, mapping.transformInboundDatabaseName(source_db), source_table_name,
          mapping.transformInboundDatabaseName(dest_db), dest_table_name);
  return mapping.transformOutboundPartitions(result);
}
 
Example 3
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public void alter_database(String dbname, Database db) throws MetaException, NoSuchObjectException, TException {
  DatabaseMapping mapping = checkWritePermissions(dbname);
  mapping.checkWritePermissions(db.getName());
  mapping
      .getClient()
      .alter_database(mapping.transformInboundDatabaseName(dbname), mapping.transformInboundDatabase(db));
}
 
Example 4
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public List<TableMeta> get_table_meta(String db_patterns, String tbl_patterns, List<String> tbl_types)
    throws MetaException, TException {
  return databaseMappingService.getPanopticOperationHandler()
      .getTableMeta(db_patterns, tbl_patterns, tbl_types);
}
 
Example 5
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public List<FieldSchema> get_fields(String db_name, String table_name)
    throws MetaException, UnknownTableException, UnknownDBException, TException {
  DatabaseMapping mapping = databaseMappingService.databaseMapping(db_name);
  return mapping.getClient().get_fields(mapping.transformInboundDatabaseName(db_name), table_name);
}
 
Example 6
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public List<FieldSchema> get_schema(String db_name, String table_name)
    throws MetaException, UnknownTableException, UnknownDBException, TException {
  DatabaseMapping mapping = databaseMappingService.databaseMapping(db_name);
  return mapping.getClient().get_schema(mapping.transformInboundDatabaseName(db_name), table_name);
}
 
Example 7
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public void create_table(Table tbl)
    throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, TException {
  DatabaseMapping mapping = checkWritePermissions(tbl.getDbName());
  mapping.getClient().create_table(mapping.transformInboundTable(tbl));
}
 
Example 8
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public void create_table_with_environment_context(Table tbl, EnvironmentContext environment_context)
    throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, TException {
  DatabaseMapping mapping = checkWritePermissions(tbl.getDbName());
  mapping.getClient().create_table_with_environment_context(mapping.transformInboundTable(tbl), environment_context);
}
 
Example 9
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public int get_num_partitions_by_filter(String db_name, String tbl_name, String filter)
    throws MetaException, NoSuchObjectException, TException {
  DatabaseMapping mapping = databaseMappingService.databaseMapping(db_name);
  return mapping
      .getClient()
      .get_num_partitions_by_filter(mapping.transformInboundDatabaseName(db_name), tbl_name, filter);
}
 
Example 10
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public List<Table> get_table_objects_by_name(String dbname, List<String> tbl_names)
    throws MetaException, InvalidOperationException, UnknownDBException, TException {
  DatabaseMapping mapping = databaseMappingService.databaseMapping(dbname);
  List<Table> tables = mapping
      .getClient()
      .get_table_objects_by_name(mapping.transformInboundDatabaseName(dbname), tbl_names);
  List<Table> outboundTables = new ArrayList<>(tables.size());
  for (Table table : tables) {
    outboundTables.add(mapping.transformOutboundTable(table));
  }
  return outboundTables;
}
 
Example 11
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public List<String> get_table_names_by_filter(String dbname, String filter, short max_tables)
    throws MetaException, InvalidOperationException, UnknownDBException, TException {
  DatabaseMapping mapping = databaseMappingService.databaseMapping(dbname);
  return mapping
      .getClient()
      .get_table_names_by_filter(mapping.transformInboundDatabaseName(dbname), filter, max_tables);
}
 
Example 12
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public LockResponse lock(LockRequest rqst) throws NoSuchTxnException, TxnAbortedException, TException {
  DatabaseMapping mapping = databaseMappingService.primaryDatabaseMapping();
  List<LockComponent> components = rqst.getComponent();
  for (LockComponent component : components) {
    mapping.checkWritePermissions(component.getDbname());
  }
  return mapping.getClient().lock(mapping.transformInboundLockRequest(rqst));
}
 
Example 13
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public void alter_table_with_environment_context(
    String dbname,
    String tbl_name,
    Table new_tbl,
    EnvironmentContext environment_context)
    throws InvalidOperationException, MetaException, TException {
  DatabaseMapping mapping = checkWritePermissions(dbname);
  mapping.checkWritePermissions(new_tbl.getDbName());
  mapping
      .getClient()
      .alter_table_with_environment_context(mapping.transformInboundDatabaseName(dbname), tbl_name,
          mapping.transformInboundTable(new_tbl), environment_context);
}
 
Example 14
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public Partition add_partition_with_environment_context(Partition new_part, EnvironmentContext environment_context)
    throws InvalidObjectException, AlreadyExistsException, MetaException, TException {
  DatabaseMapping mapping = checkWritePermissions(new_part.getDbName());
  Partition result = mapping
      .getClient()
      .add_partition_with_environment_context(mapping.transformInboundPartition(new_part), environment_context);
  return mapping.transformOutboundPartition(result);
}
 
Example 15
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public int add_partitions_pspec(List<PartitionSpec> new_parts)
    throws InvalidObjectException, AlreadyExistsException, MetaException, TException {
  if (!new_parts.isEmpty()) {
    // Need to pick one mapping and use that for permissions and getting the client.
    // If the partitions added are for different databases in different clients that won't work with waggle-dance
    DatabaseMapping mapping = databaseMappingService.databaseMapping(new_parts.get(0).getDbName());
    for (PartitionSpec partitionSpec : new_parts) {
      mapping.checkWritePermissions(partitionSpec.getDbName());
    }
    return mapping.getClient().add_partitions_pspec(mapping.transformInboundPartitionSpecs(new_parts));
  }
  return 0;
}
 
Example 16
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public Partition append_partition(String db_name, String tbl_name, List<String> part_vals)
    throws InvalidObjectException, AlreadyExistsException, MetaException, TException {
  DatabaseMapping mapping = checkWritePermissions(db_name);
  Partition result = mapping
      .getClient()
      .append_partition(mapping.transformInboundDatabaseName(db_name), tbl_name, part_vals);
  return mapping.transformOutboundPartition(result);
}
 
Example 17
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public Partition append_partition_with_environment_context(
    String db_name,
    String tbl_name,
    List<String> part_vals,
    EnvironmentContext environment_context)
    throws InvalidObjectException, AlreadyExistsException, MetaException, TException {
  DatabaseMapping mapping = checkWritePermissions(db_name);
  Partition partition = mapping
      .getClient()
      .append_partition_with_environment_context(mapping.transformInboundDatabaseName(db_name), tbl_name, part_vals,
          environment_context);
  return mapping.transformOutboundPartition(partition);
}
 
Example 18
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public Partition append_partition_by_name(String db_name, String tbl_name, String part_name)
    throws InvalidObjectException, AlreadyExistsException, MetaException, TException {
  DatabaseMapping mapping = checkWritePermissions(db_name);
  Partition partition = mapping
      .getClient()
      .append_partition_by_name(mapping.transformInboundDatabaseName(db_name), tbl_name, part_name);
  return mapping.transformOutboundPartition(partition);
}
 
Example 19
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, String user_name, List<String> group_names)
    throws MetaException, TException {
  DatabaseMapping mapping;
  if (hiveObject.getDbName() == null) {
    mapping = databaseMappingService.primaryDatabaseMapping();
  } else {
    mapping = databaseMappingService.databaseMapping(hiveObject.getDbName());
  }
  return mapping.getClient().get_privilege_set(mapping.transformInboundHiveObjectRef(hiveObject), user_name,
          group_names);
}
 
Example 20
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public boolean drop_partition(String db_name, String tbl_name, List<String> part_vals, boolean deleteData)
    throws NoSuchObjectException, MetaException, TException {
  DatabaseMapping mapping = checkWritePermissions(db_name);
  return mapping
      .getClient()
      .drop_partition(mapping.transformInboundDatabaseName(db_name), tbl_name, part_vals, deleteData);
}
 
Example 21
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public boolean drop_partition_with_environment_context(
    String db_name,
    String tbl_name,
    List<String> part_vals,
    boolean deleteData,
    EnvironmentContext environment_context)
    throws NoSuchObjectException, MetaException, TException {
  DatabaseMapping mapping = checkWritePermissions(db_name);
  return mapping
      .getClient()
      .drop_partition_with_environment_context(mapping.transformInboundDatabaseName(db_name), tbl_name, part_vals,
          deleteData, environment_context);
}
 
Example 22
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public boolean drop_partition_by_name(String db_name, String tbl_name, String part_name, boolean deleteData)
    throws NoSuchObjectException, MetaException, TException {
  DatabaseMapping mapping = checkWritePermissions(db_name);
  return mapping
      .getClient()
      .drop_partition_by_name(mapping.transformInboundDatabaseName(db_name), tbl_name, part_name, deleteData);
}
 
Example 23
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public boolean drop_partition_by_name_with_environment_context(
    String db_name,
    String tbl_name,
    String part_name,
    boolean deleteData,
    EnvironmentContext environment_context)
    throws NoSuchObjectException, MetaException, TException {
  DatabaseMapping mapping = checkWritePermissions(db_name);
  return mapping
      .getClient()
      .drop_partition_by_name_with_environment_context(mapping.transformInboundDatabaseName(db_name), tbl_name,
          part_name, deleteData, environment_context);
}
 
Example 24
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public DropPartitionsResult drop_partitions_req(DropPartitionsRequest req)
    throws NoSuchObjectException, MetaException, TException {
  DatabaseMapping mapping = checkWritePermissions(req.getDbName());
  DropPartitionsResult result = mapping
      .getClient()
      .drop_partitions_req(mapping.transformInboundDropPartitionRequest(req));
  return mapping.transformOutboundDropPartitionsResult(result);
}
 
Example 25
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public Partition get_partition(String db_name, String tbl_name, List<String> part_vals)
    throws MetaException, NoSuchObjectException, TException {
  DatabaseMapping mapping = databaseMappingService.databaseMapping(db_name);
  return mapping
      .transformOutboundPartition(
          mapping.getClient().get_partition(mapping.transformInboundDatabaseName(db_name), tbl_name, part_vals));
}
 
Example 26
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public boolean grant_privileges(PrivilegeBag privileges) throws MetaException, TException {
  if (privileges.isSetPrivileges() && !privileges.getPrivileges().isEmpty()) {
    DatabaseMapping mapping = checkWritePermissionsForPrivileges(privileges);
    return mapping.getClient().grant_privileges(mapping.transformInboundPrivilegeBag(privileges));
  }
  return false;
}
 
Example 27
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public CacheFileMetadataResult cache_file_metadata(CacheFileMetadataRequest req) throws TException {
  DatabaseMapping mapping = databaseMappingService.primaryDatabaseMapping();
  mapping.checkWritePermissions(req.getDbName());
  return mapping.getClient().cache_file_metadata(mapping.transformInboundCacheFileMetadataRequest(req));
}
 
Example 28
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public GetTableResult get_table_req(GetTableRequest req) throws MetaException, NoSuchObjectException, TException {
  DatabaseMapping mapping = databaseMappingService.databaseMapping(req.getDbName());
  GetTableResult result = mapping.getClient().get_table_req(mapping.transformInboundGetTableRequest(req));
  return mapping.transformOutboundGetTableResult(result);
}
 
Example 29
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME, prepend=true)
public List<PartitionSpec> get_partitions_pspec(String db_name, String tbl_name, int max_parts)
    throws NoSuchObjectException, MetaException, TException {
  DatabaseMapping mapping = databaseMappingService.databaseMapping(db_name);
  List<PartitionSpec> partitionSpecs = mapping
      .getClient()
      .get_partitions_pspec(mapping.transformInboundDatabaseName(db_name), tbl_name, max_parts);
  return mapping.transformOutboundPartitionSpecs(partitionSpecs);
}
 
Example 30
Source Project: waggle-dance   Source File: FederatedHMSHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public void compact(CompactionRequest rqst) throws TException {
  DatabaseMapping mapping = databaseMappingService.primaryDatabaseMapping();
  mapping.checkWritePermissions(rqst.getDbname());
  mapping.getClient().compact(mapping.transformInboundCompactionRequest(rqst));
}