Class FileSystem
java.lang.Object
com.northconcepts.datapipeline.core.DataObject
com.northconcepts.datapipeline.core.Endpoint
com.northconcepts.datapipeline.internal.lang.FileSystem
- Direct Known Subclasses:
AmazonS3FileSystem,DropBoxFileSystem,FtpFileSystem,GoogleDriveFileSystem,HdfsFileSystem,SftpFileSystem,ZipFileSystem
Abstract class for reading and writing to virtual file systems.
-
Field Summary
Fields inherited from class com.northconcepts.datapipeline.core.Endpoint
BUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZEFields inherited from class com.northconcepts.datapipeline.core.DataObject
id, log, name, TIMESTAMP_FORMAT -
Constructor Summary
ConstructorsConstructorDescriptionCreates the file system or throws aDataExceptionif the edition or license does not allow file systems. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Wipes this connection cycle's credentials snapshot, then closes this endpoint.protected static StringcredentialValue(Credentials credentials, String key, String fallback) Returns the value for the given key from the resolved credentials orfallbackwhen the credentials arenullor don't contain the key.Returns the resolver supplying this file system's credentials ornullif none is set.protected CredentialsReturns the credentials snapshot resolved for this connection cycle ornullif there isn't one.protected CredentialsForces the resolver to re-fetch (seeCredentialsResolver.refresh()), then resolves a fresh snapshot.protected CredentialsResolves and snapshots credentials for this connection cycle.setCredentialsResolver(CredentialsResolver credentialsResolver) Sets the resolver supplying this file system's credentials.Methods inherited from class com.northconcepts.datapipeline.core.Endpoint
addElapsedtime, addExceptionProperties, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getNestedEndpoint, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getRootEndpoint, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, open, setCaptureElapsedTime, setDescription, toString
-
Constructor Details
-
FileSystem
public FileSystem()Creates the file system or throws aDataExceptionif the edition or license does not allow file systems.
-
-
Method Details
-
getCredentialsResolver
Returns the resolver supplying this file system's credentials ornullif none is set. -
setCredentialsResolver
Sets the resolver supplying this file system's credentials. Subclasses resolve it at the top of theirEndpoint.open()(viaresolveCredentials()) — never at construction — so rotated secrets are picked up on the next connection. -
resolveCredentials
Resolves and snapshots credentials for this connection cycle. Subclasses call this at the top of theirEndpoint.open(). Returnsnullwhen no resolver is set, letting subclasses fall back to ambient/role credentials or backend-specific configuration.The snapshot is an independent
copy;close()wipes it without affecting the resolver's own instance. Any previous snapshot is wiped before resolving so a failed resolve never leaves stale credentials behind.- Throws:
DataException
-
refreshCredentials
Forces the resolver to re-fetch (seeCredentialsResolver.refresh()), then resolves a fresh snapshot. For long-lived connections that need to re-authenticate mid-session — for example whenCredentials.isExpired(long)reports the current snapshot is about to expire.- Throws:
DataException
-
getCurrentCredentials
Returns the credentials snapshot resolved for this connection cycle ornullif there isn't one. -
credentialValue
Returns the value for the given key from the resolved credentials orfallbackwhen the credentials arenullor don't contain the key. Lets connectors mix resolver-supplied secrets with constructor/setter-supplied values per key:Credentials credentials = resolveCredentials(); String userName = credentialValue(credentials, Credentials.USERNAME, this.userName); String password = credentialValue(credentials, Credentials.PASSWORD, this.password);
-
close
Wipes this connection cycle's credentials snapshot, then closes this endpoint.- Overrides:
closein classEndpoint- Throws:
DataException
-