java.lang.Object
org.codelibs.jcifs.smb.context.CIFSContextWrapper
- All Implemented Interfaces:
CIFSContext
- Direct Known Subclasses:
CIFSContextCredentialWrapper
A wrapper implementation of CIFSContext that delegates to another context.
This class allows for context decoration and customization through delegation.
- Author:
- mbechler
-
Constructor Summary
ConstructorsConstructorDescriptionCIFSContextWrapper(CIFSContext delegate) Constructs a wrapper around the specified CIFS context. -
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 credentialsprotected CIFSContextwrap(CIFSContext newContext) Wraps a new context, allowing subclasses to provide custom wrapping behavior.
-
Constructor Details
-
CIFSContextWrapper
Constructs a wrapper around the specified CIFS context.- Parameters:
delegate- context to delegate non-override methods to
-
-
Method Details
-
get
Get a resource- Specified by:
getin interfaceCIFSContext- Parameters:
url- the URL of the SMB resource- Returns:
- the SMB resource at the specified location
- Throws:
CIFSException- if the URL is malformed or there is an error creating the SMB resource- See Also:
-
getPipe
Get a pipe resource- Specified by:
getPipein interfaceCIFSContext- 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- See Also:
-
wrap
Wraps a new context, allowing subclasses to provide custom wrapping behavior.- Parameters:
newContext- the context to wrap- Returns:
- the wrapped context
-
getConfig
Description copied from interface:CIFSContextGet the configuration object for this context- Specified by:
getConfigin interfaceCIFSContext- Returns:
- the active configuration
-
getDfs
Description copied from interface:CIFSContextGet the DFS resolver for handling distributed file system paths- Specified by:
getDfsin interfaceCIFSContext- Returns:
- the DFS instance for this context
-
getCredentials
Description copied from interface:CIFSContextGet the credentials associated with this context- Specified by:
getCredentialsin interfaceCIFSContext- Returns:
- the used credentials
-
getUrlHandler
Description copied from interface:CIFSContextGet a URL stream handler for SMB URLs- Specified by:
getUrlHandlerin interfaceCIFSContext- Returns:
- an URL handler using this context
-
getSIDResolver
Description copied from interface:CIFSContextGet the SID resolver for resolving security identifiers- Specified by:
getSIDResolverin interfaceCIFSContext- Returns:
- the SID resolver for this context
-
hasDefaultCredentials
public boolean hasDefaultCredentials()Description copied from interface:CIFSContextCheck if default credentials are configured- Specified by:
hasDefaultCredentialsin interfaceCIFSContext- Returns:
- whether default credentials are available
-
withCredentials
Description copied from interface:CIFSContextCreate a child context with specified credentials- Specified by:
withCredentialsin interfaceCIFSContext- Parameters:
creds- the credentials to use- Returns:
- a child context using using the given credentials
-
withDefaultCredentials
Description copied from interface:CIFSContextCreate a child context with default credentials- Specified by:
withDefaultCredentialsin interfaceCIFSContext- Returns:
- a child context using the configured default credentials
-
withAnonymousCredentials
Description copied from interface:CIFSContextCreate a child context with anonymous credentials- Specified by:
withAnonymousCredentialsin interfaceCIFSContext- Returns:
- a child context using anonymous credentials
-
withGuestCredentials
Description copied from interface:CIFSContextCreate a child context with guest credentials- Specified by:
withGuestCredentialsin interfaceCIFSContext- Returns:
- a child context using guest credentials
-
renewCredentials
Description copied from interface:CIFSContextAttempt to renew credentials after authentication failure- Specified by:
renewCredentialsin interfaceCIFSContext- Parameters:
locationHint- URL or location hint for credential renewalerror- the error that triggered renewal- Returns:
- whether new credentials are obtained
-
getNameServiceClient
Description copied from interface:CIFSContextGet the name service client for NetBIOS name resolution- Specified by:
getNameServiceClientin interfaceCIFSContext- Returns:
- the name server client
-
getBufferCache
Description copied from interface:CIFSContextGet the buffer cache for efficient memory management- Specified by:
getBufferCachein interfaceCIFSContext- Returns:
- the buffer cache
-
getTransportPool
Description copied from interface:CIFSContextGet the transport pool for managing SMB connections- Specified by:
getTransportPoolin interfaceCIFSContext- Returns:
- the transport pool
-
close
Description copied from interface:CIFSContextClose all connections and release resources associated with this context- Specified by:
closein interfaceCIFSContext- Returns:
- whether any connection was still in use
- Throws:
CIFSException- if an error occurs during cleanup
-