Module jcifs

Class CIFSContextWrapper

java.lang.Object
org.codelibs.jcifs.smb.context.CIFSContextWrapper
All Implemented Interfaces:
CIFSContext
Direct Known Subclasses:
CIFSContextCredentialWrapper

public class CIFSContextWrapper extends Object implements CIFSContext
A wrapper implementation of CIFSContext that delegates to another context. This class allows for context decoration and customization through delegation.
Author:
mbechler
  • Constructor Details

    • CIFSContextWrapper

      public CIFSContextWrapper(CIFSContext delegate)
      Constructs a wrapper around the specified CIFS context.
      Parameters:
      delegate - context to delegate non-override methods to
  • Method Details

    • get

      public SmbResource get(String url) throws CIFSException
      Get a resource
      Specified by:
      get in interface CIFSContext
      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

      public SmbPipeResource getPipe(String url, int pipeType) throws CIFSException
      Get a pipe resource
      Specified by:
      getPipe in interface CIFSContext
      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
      See Also:
    • wrap

      protected CIFSContext wrap(CIFSContext newContext)
      Wraps a new context, allowing subclasses to provide custom wrapping behavior.
      Parameters:
      newContext - the context to wrap
      Returns:
      the wrapped context
    • getConfig

      public Configuration getConfig()
      Description copied from interface: CIFSContext
      Get the configuration object for this context
      Specified by:
      getConfig in interface CIFSContext
      Returns:
      the active configuration
    • getDfs

      public DfsResolver getDfs()
      Description copied from interface: CIFSContext
      Get the DFS resolver for handling distributed file system paths
      Specified by:
      getDfs in interface CIFSContext
      Returns:
      the DFS instance for this context
    • getCredentials

      public Credentials getCredentials()
      Description copied from interface: CIFSContext
      Get the credentials associated with this context
      Specified by:
      getCredentials in interface CIFSContext
      Returns:
      the used credentials
    • getUrlHandler

      public URLStreamHandler getUrlHandler()
      Description copied from interface: CIFSContext
      Get a URL stream handler for SMB URLs
      Specified by:
      getUrlHandler in interface CIFSContext
      Returns:
      an URL handler using this context
    • getSIDResolver

      public SidResolver getSIDResolver()
      Description copied from interface: CIFSContext
      Get the SID resolver for resolving security identifiers
      Specified by:
      getSIDResolver in interface CIFSContext
      Returns:
      the SID resolver for this context
    • hasDefaultCredentials

      public boolean hasDefaultCredentials()
      Description copied from interface: CIFSContext
      Check if default credentials are configured
      Specified by:
      hasDefaultCredentials in interface CIFSContext
      Returns:
      whether default credentials are available
    • withCredentials

      public CIFSContext withCredentials(Credentials creds)
      Description copied from interface: CIFSContext
      Create a child context with specified credentials
      Specified by:
      withCredentials in interface CIFSContext
      Parameters:
      creds - the credentials to use
      Returns:
      a child context using using the given credentials
    • withDefaultCredentials

      public CIFSContext withDefaultCredentials()
      Description copied from interface: CIFSContext
      Create a child context with default credentials
      Specified by:
      withDefaultCredentials in interface CIFSContext
      Returns:
      a child context using the configured default credentials
    • withAnonymousCredentials

      public CIFSContext withAnonymousCredentials()
      Description copied from interface: CIFSContext
      Create a child context with anonymous credentials
      Specified by:
      withAnonymousCredentials in interface CIFSContext
      Returns:
      a child context using anonymous credentials
    • withGuestCredentials

      public CIFSContext withGuestCredentials()
      Description copied from interface: CIFSContext
      Create a child context with guest credentials
      Specified by:
      withGuestCredentials in interface CIFSContext
      Returns:
      a child context using guest credentials
    • renewCredentials

      public boolean renewCredentials(String locationHint, Throwable error)
      Description copied from interface: CIFSContext
      Attempt to renew credentials after authentication failure
      Specified by:
      renewCredentials in interface CIFSContext
      Parameters:
      locationHint - URL or location hint for credential renewal
      error - the error that triggered renewal
      Returns:
      whether new credentials are obtained
    • getNameServiceClient

      public NameServiceClient getNameServiceClient()
      Description copied from interface: CIFSContext
      Get the name service client for NetBIOS name resolution
      Specified by:
      getNameServiceClient in interface CIFSContext
      Returns:
      the name server client
    • getBufferCache

      public BufferCache getBufferCache()
      Description copied from interface: CIFSContext
      Get the buffer cache for efficient memory management
      Specified by:
      getBufferCache in interface CIFSContext
      Returns:
      the buffer cache
    • getTransportPool

      public SmbTransportPool getTransportPool()
      Description copied from interface: CIFSContext
      Get the transport pool for managing SMB connections
      Specified by:
      getTransportPool in interface CIFSContext
      Returns:
      the transport pool
    • close

      public boolean close() throws CIFSException
      Description copied from interface: CIFSContext
      Close all connections and release resources associated with this context
      Specified by:
      close in interface CIFSContext
      Returns:
      whether any connection was still in use
      Throws:
      CIFSException - if an error occurs during cleanup