org.apache.hadoop.registry.client.impl

## Class FSRegistryOperationsService

- java.lang.Object
- - org.apache.hadoop.service.AbstractService
  - - org.apache.hadoop.service.CompositeService
    - - org.apache.hadoop.registry.client.impl.FSRegistryOperationsService

- All Implemented Interfaces:
    Closeable, AutoCloseable, RegistryOperations, org.apache.hadoop.service.Service

      public class FSRegistryOperationsService
      extends org.apache.hadoop.service.CompositeService
      implements RegistryOperations

  Filesystem-based implementation of RegistryOperations. This class relies entirely on the configured FS for security and does no extra checks.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.hadoop.service.CompositeService

      `org.apache.hadoop.service.CompositeService.CompositeServiceShutdownHook`

    - ### Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service

      `org.apache.hadoop.service.Service.STATE`

  - ### Field Summary

    - ### Fields inherited from class org.apache.hadoop.service.CompositeService

      `STOP_ONLY_STARTED_SERVICES`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FSRegistryOperationsService()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addWriteAccessor(String id, String pass)` Add a new write access entry to be added to node permissions in all future write operations of a session connected to a secure registry.
    `void` | `bind(String path, ServiceRecord record, int flags)` Bind a path in the registry to a service record
    `void` | `clearWriteAccessors()` Clear all write accessors.
    `void` | `delete(String path, boolean recursive)` Delete a path.
    `boolean` | `exists(String path)` Probe for a path existing.
    `org.apache.hadoop.fs.FileSystem` | `getFs()`
    `List<String>` | `list(String path)` List all entries under a registry path, returning the relative names of the entries.
    `boolean` | `mknode(String path, boolean createParents)` Create a path.
    `ServiceRecord` | `resolve(String path)` Resolve the record at a path
    `protected void` | `serviceInit(org.apache.hadoop.conf.Configuration conf)`
    `RegistryPathStatus` | `stat(String path)` Get the status of a path

    - ### Methods inherited from class org.apache.hadoop.service.CompositeService

      `addIfService, addService, getServices, removeService, serviceStart, serviceStop`

    - ### Methods inherited from class org.apache.hadoop.service.AbstractService

      `close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.hadoop.service.Service

      `close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, registerServiceListener, start, stop, unregisterServiceListener, waitForServiceToStop`

- - ### Constructor Detail

    - #### FSRegistryOperationsService

          public FSRegistryOperationsService()

  - ### Method Detail

    - #### getFs

          public org.apache.hadoop.fs.FileSystem getFs()

    - #### serviceInit

          protected void serviceInit(org.apache.hadoop.conf.Configuration conf)

      Overrides:
        `serviceInit` in class `org.apache.hadoop.service.CompositeService`

    - #### mknode

          public boolean mknode(String path,
                                boolean createParents)
                         throws org.apache.hadoop.fs.PathNotFoundException,
                                InvalidPathnameException,
                                IOException

      Description copied from interface: `RegistryOperations`
      Create a path. It is not an error if the path exists already, be it empty or not. The createParents flag also requests creating the parents. As entries in the registry can hold data while still having child entries, it is not an error if any of the parent path elements have service records.
      Specified by:
        `mknode` in interface `RegistryOperations`
      Parameters:
        `path` - path to create
        `createParents` - also create the parents.
      Returns:
        true if the path was created, false if it existed.
      Throws:
        `org.apache.hadoop.fs.PathNotFoundException` - parent path is not in the registry.
        `InvalidPathnameException` - path name is invalid.
        `IOException` - Any other IO Exception.

    - #### bind

          public void bind(String path,
                           ServiceRecord record,
                           int flags)
                    throws org.apache.hadoop.fs.PathNotFoundException,
                           org.apache.hadoop.fs.FileAlreadyExistsException,
                           InvalidPathnameException,
                           IOException

      Description copied from interface: `RegistryOperations`
      Bind a path in the registry to a service record
      Specified by:
        `bind` in interface `RegistryOperations`
      Parameters:
        `path` - path to service record
        `record` - service record service record to create/update
        `flags` - bind flags
      Throws:
        `org.apache.hadoop.fs.PathNotFoundException` - the parent path does not exist
        `org.apache.hadoop.fs.FileAlreadyExistsException` - path exists but create flags do not include "overwrite"
        `InvalidPathnameException` - path name is invalid.
        `IOException` - Any other IO Exception.

    - #### resolve

          public ServiceRecord resolve(String path)
                                throws org.apache.hadoop.fs.PathNotFoundException,
                                       NoRecordException,
                                       InvalidRecordException,
                                       IOException

      Description copied from interface: `RegistryOperations`
      Resolve the record at a path
      Specified by:
        `resolve` in interface `RegistryOperations`
      Parameters:
        `path` - path to an entry containing a `ServiceRecord`
      Returns:
        the record
      Throws:
        `org.apache.hadoop.fs.PathNotFoundException` - path is not in the registry.
        `NoRecordException` - if there is not a service record
        `InvalidRecordException` - if there was a service record but it could not be parsed.
        `IOException` - Any other IO Exception

    - #### stat

          public RegistryPathStatus stat(String path)
                                  throws org.apache.hadoop.fs.PathNotFoundException,
                                         InvalidPathnameException,
                                         IOException

      Description copied from interface: `RegistryOperations`
      Get the status of a path
      Specified by:
        `stat` in interface `RegistryOperations`
      Parameters:
        `path` - path to query
      Returns:
        the status of the path
      Throws:
        `org.apache.hadoop.fs.PathNotFoundException` - path is not in the registry.
        `InvalidPathnameException` - the path is invalid.
        `IOException` - Any other IO Exception

    - #### exists

          public boolean exists(String path)
                         throws IOException

      Description copied from interface: `RegistryOperations`
      Probe for a path existing. This is equivalent to `RegistryOperations.stat(String)` with any failure downgraded to a
      Specified by:
        `exists` in interface `RegistryOperations`
      Parameters:
        `path` - path to query
      Returns:
        true if the path was found
      Throws:
        `IOException`

    - #### list

          public List<String> list(String path)
                            throws org.apache.hadoop.fs.PathNotFoundException,
                                   InvalidPathnameException,
                                   IOException

      Description copied from interface: `RegistryOperations`
      List all entries under a registry path, returning the relative names of the entries.
      Specified by:
        `list` in interface `RegistryOperations`
      Parameters:
        `path` - path to query
      Returns:
        a possibly empty list of the short path names of child entries.
      Throws:
        `org.apache.hadoop.fs.PathNotFoundException`
        `InvalidPathnameException`
        `IOException`

    - #### delete

          public void delete(String path,
                             boolean recursive)
                      throws org.apache.hadoop.fs.PathNotFoundException,
                             org.apache.hadoop.fs.PathIsNotEmptyDirectoryException,
                             InvalidPathnameException,
                             IOException

      Description copied from interface: `RegistryOperations`
      Delete a path. If the operation returns without an error then the entry has been deleted.
      Specified by:
        `delete` in interface `RegistryOperations`
      Parameters:
        `path` - path delete recursively
        `recursive` - recursive flag
      Throws:
        `org.apache.hadoop.fs.PathNotFoundException` - path is not in the registry.
        `org.apache.hadoop.fs.PathIsNotEmptyDirectoryException` - path has child entries, but recursive is false.
        `InvalidPathnameException` - the path is invalid.
        `IOException` - Any other IO Exception

    - #### addWriteAccessor

          public boolean addWriteAccessor(String id,
                                          String pass)
                                   throws IOException

      Description copied from interface: `RegistryOperations`
      Add a new write access entry to be added to node permissions in all future write operations of a session connected to a secure registry. This does not grant the session any more rights: if it lacked any write access, it will still be unable to manipulate the registry. In an insecure cluster, this operation has no effect.
      Specified by:
        `addWriteAccessor` in interface `RegistryOperations`
      Parameters:
        `id` - ID to use
        `pass` - password
      Returns:
        true if the accessor was added: that is, the registry connection uses permissions to manage access
      Throws:
        `IOException` - on any failure to build the digest

    - #### clearWriteAccessors

          public void clearWriteAccessors()

      Description copied from interface: `RegistryOperations`
      Clear all write accessors. At this point all standard permissions/ACLs are retained, including any set on behalf of the user Only accessors added via `RegistryOperations.addWriteAccessor(String, String)` are removed.
      Specified by:
        `clearWriteAccessors` in interface `RegistryOperations`

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.