public class RegistryAdminService extends RegistryOperationsService
submit(Callable) will be
run asynchronously. The createDirAsync(String, List, boolean)
is an example of such an an action
A key async action is the depth-first tree purge, which supports
pluggable policies for deleting entries. The method
purge(String, NodeSelector, PurgePolicy, BackgroundCallback)
implements the recursive purge operation —the class
{{AsyncPurge}} provides the asynchronous scheduling of this.| Modifier and Type | Class and Description |
|---|---|
class |
RegistryAdminService.AsyncPurge
An async registry purge action taking
a selector which decides what to delete
|
static interface |
RegistryAdminService.NodeSelector
Comparator used for purge logic
|
static class |
RegistryAdminService.PurgePolicy
Policy to purge entries
|
| Modifier and Type | Field and Description |
|---|---|
protected ExecutorService |
executor
Executor for async operations
|
static int |
USER_HOMEDIR_ACL_PERMISSIONS
The ACL permissions for the user's homedir ACL.
|
DEFAULT_REGISTRY_CLIENT_JAAS_CONTEXT, DEFAULT_REGISTRY_ENABLED, DEFAULT_REGISTRY_SECURE, DEFAULT_REGISTRY_SYSTEM_ACCOUNTS, DEFAULT_REGISTRY_USER_ACCOUNTS, DEFAULT_REGISTRY_ZK_QUORUM, DEFAULT_ZK_CONNECTION_TIMEOUT, DEFAULT_ZK_REGISTRY_ROOT, DEFAULT_ZK_RETRY_CEILING, DEFAULT_ZK_RETRY_INTERVAL, DEFAULT_ZK_RETRY_TIMES, DEFAULT_ZK_SESSION_TIMEOUT, KEY_REGISTRY_CLIENT_AUTH, KEY_REGISTRY_CLIENT_AUTHENTICATION_ID, KEY_REGISTRY_CLIENT_AUTHENTICATION_PASSWORD, KEY_REGISTRY_CLIENT_JAAS_CONTEXT, KEY_REGISTRY_ENABLED, KEY_REGISTRY_KERBEROS_REALM, KEY_REGISTRY_SECURE, KEY_REGISTRY_SYSTEM_ACCOUNTS, KEY_REGISTRY_USER_ACCOUNTS, KEY_REGISTRY_ZK_CONNECTION_TIMEOUT, KEY_REGISTRY_ZK_QUORUM, KEY_REGISTRY_ZK_RETRY_CEILING, KEY_REGISTRY_ZK_RETRY_INTERVAL, KEY_REGISTRY_ZK_RETRY_TIMES, KEY_REGISTRY_ZK_ROOT, KEY_REGISTRY_ZK_SESSION_TIMEOUT, PATH_SYSTEM_SERVICES, PATH_USER_SERVICES, PATH_USERS, REGISTRY_CLIENT_AUTH_ANONYMOUS, REGISTRY_CLIENT_AUTH_DIGEST, REGISTRY_CLIENT_AUTH_KERBEROS, REGISTRY_PREFIX, SUBPATH_COMPONENTS, ZK_PREFIX| Constructor and Description |
|---|
RegistryAdminService(String name)
Construct an instance of the service
|
RegistryAdminService(String name,
RegistryBindingSource bindingSource)
construct an instance of the service, using the
specified binding source to bond to ZK
|
| Modifier and Type | Method and Description |
|---|---|
List<org.apache.zookeeper.data.ACL> |
aclsForUser(String username,
int perms)
Set up the ACL for the user.
|
Future<Boolean> |
createDirAsync(String path,
List<org.apache.zookeeper.data.ACL> acls,
boolean createParents)
Asynchronous operation to create a directory
|
void |
createRootRegistryPaths()
Create the initial registry paths
|
protected ExecutorService |
getExecutor()
Get the executor
|
protected String |
homeDir(String username)
Get the path to a user's home dir
|
String |
initUserRegistry(String username)
Create the home path for a user if it does not exist.
|
Future<Boolean> |
initUserRegistryAsync(String shortname)
Start an async operation to create the home path for a user
if it does not exist
|
int |
purge(String path,
RegistryAdminService.NodeSelector selector,
RegistryAdminService.PurgePolicy purgePolicy,
org.apache.curator.framework.api.BackgroundCallback callback)
Recursive operation to purge all matching records under a base path.
|
protected void |
serviceInit(org.apache.hadoop.conf.Configuration conf)
Init operation sets up the system ACLs.
|
protected void |
serviceStart()
Start the service, including creating base directories with permissions
|
protected void |
serviceStop()
Stop the service: halt the executor.
|
protected void |
stopExecutor()
Stop the executor if it is not null.
|
<V> Future<V> |
submit(Callable<V> callable)
Submit a callable
|
protected void |
verifyRealmValidity()
Method to validate the validity of the kerberos realm.
|
bind, delete, exists, getClientAcls, list, mknode, resolve, stat, validatePathaddWriteAccessor, bindingDiagnosticDetails, buildConnectionString, buildSecurityDiagnostics, clearWriteAccessors, createEnsembleProvider, createFullPath, dumpPath, dumpRegistryRobustly, getBindingSource, getRegistrySecurity, isSecure, maybeCreate, operationFailure, operationFailure, supplyBindingInformation, toString, zkCreate, zkDelete, zkGetACLS, zkList, zkMkParentPath, zkMkPath, zkPathExists, zkPathMustExist, zkRead, zkSet, zkStat, zkUpdateaddIfService, addService, getServices, removeServiceclose, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStopclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddWriteAccessor, clearWriteAccessorspublic static final int USER_HOMEDIR_ACL_PERMISSIONS
protected final ExecutorService executor
public RegistryAdminService(String name)
name - service namepublic RegistryAdminService(String name, RegistryBindingSource bindingSource)
name - service namebindingSource - provider of ZK binding informationprotected void serviceStop()
throws Exception
serviceStop in class CuratorServiceException - exception.protected void stopExecutor()
ExecutorService.shutdownNow()
and so does not block until they have completed.protected ExecutorService getExecutor()
public <V> Future<V> submit(Callable<V> callable)
V - type of the final getcallable - callablepublic Future<Boolean> createDirAsync(String path, List<org.apache.zookeeper.data.ACL> acls, boolean createParents) throws IOException
path - pathacls - ACL listcreateParents - flag to indicate parent dirs should be created
as neededIOExceptionprotected void serviceInit(org.apache.hadoop.conf.Configuration conf)
throws Exception
serviceInit in class CuratorServiceconf - configuration of the serviceExceptionprotected void serviceStart()
throws Exception
serviceStart in class CuratorServiceExceptionpublic void createRootRegistryPaths()
throws IOException
IOException - any failureprotected String homeDir(String username)
username - usernamepublic List<org.apache.zookeeper.data.ACL> aclsForUser(String username, int perms) throws IOException
username - user nameperms - permissionsIOException - ACL creation/parsing problemspublic Future<Boolean> initUserRegistryAsync(String shortname) throws IOException
shortname - username, without any @REALM in kerberosIOException - any failure while setting up the operationpublic String initUserRegistry(String username) throws IOException
initUserRegistryAsync(String) and then waits for the
result ... the code path is the same as the async operation; this just
picks up and relays/converts exceptionsusername - usernameIOException - any failureprotected void verifyRealmValidity()
throws org.apache.hadoop.service.ServiceStateException
org.apache.hadoop.service.ServiceStateExceptionpublic int purge(String path, RegistryAdminService.NodeSelector selector, RegistryAdminService.PurgePolicy purgePolicy, org.apache.curator.framework.api.BackgroundCallback callback) throws IOException
path - base pathselector - selector for the purge policypurgePolicy - what to do if there is a matching record with childrencallback - optional curator callbackIOException - problemsorg.apache.hadoop.fs.PathIsNotEmptyDirectoryException - if an entry cannot be deleted
as it has children and the purge policy is FailOnChildrenCopyright © 2022 Apache Software Foundation. All rights reserved.