- All Known Implementing Classes:
AbstractCIFSContext,BaseContext,CIFSContextCredentialWrapper,CIFSContextWrapper,SingletonContext
public interface CIFSContext
Encapsulation of client context
A context holds the client configuration, shared services as well as the active credentials.
Usually you will want to create one context per client configuration and then
multiple sub-contexts using different credentials (if necessary).
withDefaultCredentials(), withAnonymousCredentials(), withCredentials(Credentials)
allow to create such sub-contexts.
Implementors of this interface should extend BaseContext or
CIFSContextWrapper to get forward compatibility.- Author:
- mbechler
-
Method Summary
Modifier and TypeMethodDescriptionbooleanclose()Close all connections and release resources associated with this contextGet a resourceGet the buffer cache for efficient memory managementGet the configuration object for this contextGet the credentials associated with this contextgetDfs()Get the DFS resolver for handling distributed file system pathsGet the name service client for NetBIOS name resolutionGet a pipe resourceGet the SID resolver for resolving security identifiersGet the transport pool for managing SMB connectionsGet a URL stream handler for SMB URLsbooleanCheck if default credentials are configuredbooleanrenewCredentials(String locationHint, Throwable error) Attempt to renew credentials after authentication failureCreate a child context with anonymous credentialswithCredentials(Credentials creds) Create a child context with specified credentialsCreate a child context with default credentialsCreate a child context with guest credentials
-
Method Details
-
get
Get a resource- Parameters:
url- the URL of the SMB resource- Returns:
- the SMB resource at the specified location
- Throws:
CIFSException- if the resource cannot be accessed
-
getPipe
Get a pipe resource- Parameters:
url- the URL of the SMB pipe resourcepipeType- the type of the pipe- Returns:
- the SMB pipe resource at the specified location
- Throws:
CIFSException- if the pipe resource cannot be accessed
-
close
Close all connections and release resources associated with this context- Returns:
- whether any connection was still in use
- Throws:
CIFSException- if an error occurs during cleanup
-
getConfig
Configuration getConfig()Get the configuration object for this context- Returns:
- the active configuration
-
getNameServiceClient
NameServiceClient getNameServiceClient()Get the name service client for NetBIOS name resolution- Returns:
- the name server client
-
getBufferCache
BufferCache getBufferCache()Get the buffer cache for efficient memory management- Returns:
- the buffer cache
-
getTransportPool
SmbTransportPool getTransportPool()Get the transport pool for managing SMB connections- Returns:
- the transport pool
-
getDfs
DfsResolver getDfs()Get the DFS resolver for handling distributed file system paths- Returns:
- the DFS instance for this context
-
getSIDResolver
SidResolver getSIDResolver()Get the SID resolver for resolving security identifiers- Returns:
- the SID resolver for this context
-
getCredentials
Credentials getCredentials()Get the credentials associated with this context- Returns:
- the used credentials
-
getUrlHandler
URLStreamHandler getUrlHandler()Get a URL stream handler for SMB URLs- Returns:
- an URL handler using this context
-
hasDefaultCredentials
boolean hasDefaultCredentials()Check if default credentials are configured- Returns:
- whether default credentials are available
-
withDefaultCredentials
CIFSContext withDefaultCredentials()Create a child context with default credentials- Returns:
- a child context using the configured default credentials
-
withAnonymousCredentials
CIFSContext withAnonymousCredentials()Create a child context with anonymous credentials- Returns:
- a child context using anonymous credentials
-
withGuestCredentials
CIFSContext withGuestCredentials()Create a child context with guest credentials- Returns:
- a child context using guest credentials
-
withCredentials
Create a child context with specified credentials- Parameters:
creds- the credentials to use- Returns:
- a child context using using the given credentials
-
renewCredentials
Attempt to renew credentials after authentication failure- Parameters:
locationHint- URL or location hint for credential renewalerror- the error that triggered renewal- Returns:
- whether new credentials are obtained
-