Interface RegistryOperations
- All Superinterfaces:
AutoCloseable,Closeable,Service
- All Known Implementing Classes:
RegistryOperationsClient,RegistryOperationsService
Registry Operations
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
Service.STATE -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddWriteAccessor(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.voidbind(String path, ServiceRecord record, int flags) Bind a path in the registry to a service recordvoidClear all write accessors.voidDelete a path.booleanProbe for a path existing.List all entries under a registry path, returning the relative names of the entries.booleanCreate a path.Resolve the record at a pathGet the status of a pathMethods inherited from interface org.apache.hadoop.service.Service
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, registerServiceListener, start, stop, unregisterServiceListener, waitForServiceToStop
-
Method Details
-
mknode
boolean mknode(String path, boolean createParents) throws org.apache.hadoop.fs.PathNotFoundException, InvalidPathnameException, IOException 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.- Parameters:
path- path to createcreateParents- 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
void bind(String path, ServiceRecord record, int flags) throws org.apache.hadoop.fs.PathNotFoundException, FileAlreadyExistsException, InvalidPathnameException, IOException Bind a path in the registry to a service record- Parameters:
path- path to service recordrecord- service record service record to create/updateflags- bind flags- Throws:
org.apache.hadoop.fs.PathNotFoundException- the parent path does not existFileAlreadyExistsException- path exists but create flags do not include "overwrite"InvalidPathnameException- path name is invalid.IOException- Any other IO Exception.
-
resolve
ServiceRecord resolve(String path) throws org.apache.hadoop.fs.PathNotFoundException, NoRecordException, InvalidRecordException, IOException Resolve the record at a path- Parameters:
path- path to an entry containing aServiceRecord- Returns:
- the record
- Throws:
org.apache.hadoop.fs.PathNotFoundException- path is not in the registry.NoRecordException- if there is not a service recordInvalidRecordException- if there was a service record but it could not be parsed.IOException- Any other IO Exception
-
stat
RegistryPathStatus stat(String path) throws org.apache.hadoop.fs.PathNotFoundException, InvalidPathnameException, IOException Get the status of a path- 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
Probe for a path existing. This is equivalent tostat(String)with any failure downgraded to a- Parameters:
path- path to query- Returns:
- true if the path was found
- Throws:
IOException
-
list
List<String> list(String path) throws org.apache.hadoop.fs.PathNotFoundException, InvalidPathnameException, IOException List all entries under a registry path, returning the relative names of the entries.- Parameters:
path- path to query- Returns:
- a possibly empty list of the short path names of child entries.
- Throws:
org.apache.hadoop.fs.PathNotFoundExceptionInvalidPathnameExceptionIOException
-
delete
void delete(String path, boolean recursive) throws org.apache.hadoop.fs.PathNotFoundException, org.apache.hadoop.fs.PathIsNotEmptyDirectoryException, InvalidPathnameException, IOException Delete a path. If the operation returns without an error then the entry has been deleted.- Parameters:
path- path delete recursivelyrecursive- recursive flag- Throws:
org.apache.hadoop.fs.PathNotFoundException- path is not in the registry.InvalidPathnameException- the path is invalid.org.apache.hadoop.fs.PathIsNotEmptyDirectoryException- path has child entries, but recursive is false.IOException- Any other IO Exception
-
addWriteAccessor
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.- Parameters:
id- ID to usepass- 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
void clearWriteAccessors()Clear all write accessors. At this point all standard permissions/ACLs are retained, including any set on behalf of the user Only accessors added viaaddWriteAccessor(String, String)are removed.
-