Module jcifs

Interface CIFSContext

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 Details

    • get

      SmbResource get(String url) throws CIFSException
      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

      SmbPipeResource getPipe(String url, int pipeType) throws CIFSException
      Get a pipe resource
      Parameters:
      url - the URL of the SMB pipe resource
      pipeType - the type of the pipe
      Returns:
      the SMB pipe resource at the specified location
      Throws:
      CIFSException - if the pipe resource cannot be accessed
    • close

      boolean close() throws CIFSException
      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

      CIFSContext withCredentials(Credentials creds)
      Create a child context with specified credentials
      Parameters:
      creds - the credentials to use
      Returns:
      a child context using using the given credentials
    • renewCredentials

      boolean renewCredentials(String locationHint, Throwable error)
      Attempt to renew credentials after authentication failure
      Parameters:
      locationHint - URL or location hint for credential renewal
      error - the error that triggered renewal
      Returns:
      whether new credentials are obtained