类org.apache.hadoop.hbase.coprocessor.MasterObserver源码实例Demo

下面列出了怎么用org.apache.hadoop.hbase.coprocessor.MasterObserver的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: phoenix   文件: PhoenixAccessController.java
@Override
public void preAlterTable(ObserverContext<PhoenixMetaDataControllerEnvironment> ctx, String tenantId,
        String tableName, TableName physicalTableName, TableName parentPhysicalTableName, PTableType tableType) throws IOException {
    if (!accessCheckEnabled) { return; }
    for (MasterObserver observer : getAccessControllers()) {
        if (tableType != PTableType.VIEW) {
        observer.preModifyTable(getMasterObsevrverContext(), physicalTableName,
                TableDescriptorBuilder.newBuilder(physicalTableName).build());
        }
    }
    if (tableType == PTableType.VIEW) {
        if(execPermissionsCheckEnabled) {
            requireAccess("Alter "+tableType, parentPhysicalTableName, Action.READ, Action.EXEC);
        } else {
            requireAccess("Alter "+tableType, parentPhysicalTableName, Action.READ);
        }
    }
}
 
源代码2 项目: hbase   文件: MasterCoprocessorHost.java
public void preStopMaster() throws IOException {
  // While stopping master all coprocessors method should be executed first then the coprocessor
  // environment should be cleaned up.
  if (coprocEnvironments.isEmpty()) {
    return;
  }
  execShutdown(new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preStopMaster(this);
    }
    @Override
    public void postEnvCall() {
      // invoke coprocessor stop method
      shutdown(this.getEnvironment());
    }
  });
}
 
源代码3 项目: phoenix   文件: PhoenixAccessController.java
private List<MasterObserver> getAccessControllers() throws IOException {
    ArrayList<MasterObserver> oldAccessControllers = accessControllers.get();
    if (oldAccessControllers == null) {
        oldAccessControllers = new ArrayList<>();
        RegionCoprocessorHost cpHost = this.env.getCoprocessorHost();
        for (RegionCoprocessor cp : cpHost.findCoprocessors(RegionCoprocessor.class)) {
            if (cp instanceof AccessControlService.Interface && cp instanceof MasterObserver) {
                oldAccessControllers.add((MasterObserver)cp);
                if(cp.getClass().getName().equals(org.apache.hadoop.hbase.security.access.AccessController.class.getName())) {
                    hbaseAccessControllerEnabled = true;
                }
            }
        }
        accessControllers.set(oldAccessControllers);
    }
    return accessControllers.get();
}
 
源代码4 项目: phoenix   文件: PhoenixAccessController.java
@Override
public void preIndexUpdate(ObserverContext<PhoenixMetaDataControllerEnvironment> ctx, String tenantId,
        String indexName, TableName physicalTableName, TableName parentPhysicalTableName, PIndexState newState)
        throws IOException {
    if (!accessCheckEnabled) { return; }
    for (MasterObserver observer : getAccessControllers()) {
        observer.preModifyTable(getMasterObsevrverContext(), physicalTableName,
                TableDescriptorBuilder.newBuilder(physicalTableName).build());
    }
    // Check for read access in case of rebuild
    if (newState == PIndexState.BUILDING) {
        if(execPermissionsCheckEnabled) {
            requireAccess("Rebuild:", parentPhysicalTableName, Action.READ, Action.EXEC);
        } else {
            requireAccess("Rebuild:", parentPhysicalTableName, Action.READ);
        }
    }
}
 
源代码5 项目: hbase   文件: MasterCoprocessorHost.java
public void preGetClusterMetrics() throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preGetClusterMetrics(this);
    }
  });
}
 
源代码6 项目: hbase   文件: MasterCoprocessorHost.java
public void postSwitchRpcThrottle(final boolean oldValue, final boolean newValue)
    throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postSwitchRpcThrottle(this, oldValue, newValue);
    }
  });
}
 
源代码7 项目: hbase   文件: MasterCoprocessorHost.java
public void preGrant(UserPermission userPermission, boolean mergeExistingPermissions)
    throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preGrant(this, userPermission, mergeExistingPermissions);
    }
  });
}
 
源代码8 项目: hbase   文件: MasterCoprocessorHost.java
public void preGetTableNames(final List<TableDescriptor> descriptors,
    final String regex) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preGetTableNames(this, descriptors, regex);
    }
  });
}
 
源代码9 项目: hbase   文件: MasterCoprocessorHost.java
public void preTransitReplicationPeerSyncReplicationState(String peerId,
    SyncReplicationState state) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preTransitReplicationPeerSyncReplicationState(this, peerId, state);
    }
  });
}
 
源代码10 项目: hbase   文件: MasterCoprocessorHost.java
public void postGetConfiguredNamespacesAndTablesInRSGroup(final String groupName)
  throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {

    @Override
    protected void call(MasterObserver observer) throws IOException {
      observer.postGetConfiguredNamespacesAndTablesInRSGroup(this, groupName);
    }
  });
}
 
源代码11 项目: hbase   文件: MasterCoprocessorHost.java
public void postCreateNamespace(final NamespaceDescriptor ns) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postCreateNamespace(this, ns);
    }
  });
}
 
源代码12 项目: hbase   文件: MasterCoprocessorHost.java
public void preDeleteNamespace(final String namespaceName) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preDeleteNamespace(this, namespaceName);
    }
  });
}
 
源代码13 项目: hbase   文件: MasterCoprocessorHost.java
public void postDeleteNamespace(final String namespaceName) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postDeleteNamespace(this, namespaceName);
    }
  });
}
 
源代码14 项目: hbase   文件: MasterCoprocessorHost.java
public void postMoveTables(final Set<TableName> tables, final String targetGroup)
    throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postMoveTables(this, tables, targetGroup);
    }
  });
}
 
源代码15 项目: hbase   文件: MasterCoprocessorHost.java
public void postRequestLock(String namespace, TableName tableName, RegionInfo[] regionInfos,
    LockType type, String description) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postRequestLock(this, namespace, tableName, regionInfos, description);
    }
  });
}
 
源代码16 项目: hbase   文件: MasterCoprocessorHost.java
public void postGetNamespaceDescriptor(final NamespaceDescriptor ns)
    throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postGetNamespaceDescriptor(this, ns);
    }
  });
}
 
源代码17 项目: hbase   文件: MasterCoprocessorHost.java
public void preListNamespaces(final List<String> namespaces) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver oserver) throws IOException {
      oserver.preListNamespaces(this, namespaces);
    }
  });
}
 
源代码18 项目: hbase   文件: MasterCoprocessorHost.java
public void preUpdateRSGroupConfig(final String groupName,
                                   final Map<String, String> configuration) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    protected void call(MasterObserver observer) throws IOException {
      observer.preUpdateRSGroupConfig(this, groupName, configuration);
    }
  });
}
 
源代码19 项目: hbase   文件: MasterCoprocessorHost.java
public void postUpdateRSGroupConfig(final String groupName,
                                    final Map<String, String> configuration) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    protected void call(MasterObserver observer) throws IOException {
      observer.postUpdateRSGroupConfig(this, groupName, configuration);
    }
  });
}
 
源代码20 项目: hbase   文件: MasterCoprocessorHost.java
public void preSwitchExceedThrottleQuota(boolean enable) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preSwitchExceedThrottleQuota(this, enable);
    }
  });
}
 
源代码21 项目: hbase   文件: MasterCoprocessorHost.java
public void postCloneSnapshot(final SnapshotDescription snapshot,
    final TableDescriptor hTableDescriptor) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postCloneSnapshot(this, snapshot, hTableDescriptor);
    }
  });
}
 
源代码22 项目: hbase   文件: MasterCoprocessorHost.java
public void postRevoke(UserPermission userPermission) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postRevoke(this, userPermission);
    }
  });
}
 
源代码23 项目: hbase   文件: MasterCoprocessorHost.java
public void postCompletedCreateTableAction(
    final TableDescriptor htd, final RegionInfo[] regions, final User user) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation(user) {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postCompletedCreateTableAction(this, htd, regions);
    }
  });
}
 
源代码24 项目: hbase   文件: MasterCoprocessorHost.java
public void postLockHeartbeat(LockProcedure proc, boolean keepAlive) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postLockHeartbeat(this);
    }
  });
}
 
源代码25 项目: phoenix   文件: PhoenixAccessController.java
@Override
public void preCreateSchema(ObserverContext<PhoenixMetaDataControllerEnvironment> ctx, String schemaName)
        throws IOException {
    if (!accessCheckEnabled) { return; }
    for (MasterObserver observer : getAccessControllers()) {
        observer.preCreateNamespace(getMasterObsevrverContext(),
                NamespaceDescriptor.create(schemaName).build());
    }
}
 
源代码26 项目: hbase   文件: MasterCoprocessorHost.java
public void postRemoveReplicationPeer(final String peerId) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postRemoveReplicationPeer(this, peerId);
    }
  });
}
 
源代码27 项目: hbase   文件: MasterCoprocessorHost.java
public void postSetUserQuota(
    final String user, final TableName table, final GlobalQuotaSettings quotas)
        throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postSetUserQuota(this, user, table, quotas);
    }
  });
}
 
源代码28 项目: hbase   文件: MasterCoprocessorHost.java
public void postTruncateTable(final TableName tableName) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postTruncateTable(this, tableName);
    }
  });
}
 
源代码29 项目: hbase   文件: MasterCoprocessorHost.java
public void preListReplicationPeers(final String regex) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preListReplicationPeers(this, regex);
    }
  });
}
 
源代码30 项目: hbase   文件: MasterCoprocessorHost.java
public void postCompletedTruncateTableAction(final TableName tableName, final User user)
    throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation(user) {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postCompletedTruncateTableAction(this, tableName);
    }
  });
}
 
 类所在包
 类方法
 同包方法