Class SmbDirectoryLister

    • Field Detail

      • m_Host

        protected String m_Host
        the SMB host.
      • m_Share

        protected String m_Share
        the share to access.
      • m_Domain

        protected String m_Domain
        the SMB domain.
      • m_User

        protected String m_User
        the SMB user to use.
      • m_Password

        protected BasePassword m_Password
        the SMB password to use.
      • m_ListHidden

        protected boolean m_ListHidden
        whether to show hidden files/dirs.
      • m_SessionProvider

        protected SMBSessionProvider m_SessionProvider
        the session provider to use.
      • m_Client

        protected transient com.hierynomus.smbj.SMBClient m_Client
        the SMB client.
      • m_Connection

        protected transient com.hierynomus.smbj.connection.Connection m_Connection
        the SMB connection.
      • m_Session

        protected transient com.hierynomus.smbj.session.Session m_Session
        the session to use.
      • m_DiskShare

        protected transient com.hierynomus.smbj.share.DiskShare m_DiskShare
        the diskshare in use.
    • Constructor Detail

      • SmbDirectoryLister

        public SmbDirectoryLister()
    • Method Detail

      • setHost

        public void setHost​(String value)
        Sets the host to connect to.
        Parameters:
        value - the host name/ip
      • getHost

        public String getHost()
        Returns the host to connect to.
        Returns:
        the host name/ip
      • setDomain

        public void setDomain​(String value)
        Sets the domain to use.
        Parameters:
        value - the domain
      • getDomain

        public String getDomain()
        Returns the domain to use.
        Returns:
        the domain
      • setShare

        public void setShare​(String value)
        Sets the share to use.
        Parameters:
        value - the share
      • getShare

        public String getShare()
        Returns the share to access.
        Returns:
        the share
      • setUser

        public void setUser​(String value)
        Sets the SMB user to use.
        Parameters:
        value - the user name
      • getUser

        public String getUser()
        Returns the SMB user name to use.
        Returns:
        the user name
      • setListHidden

        public void setListHidden​(boolean value)
        Sets whether to list hidden dirs/files.
        Parameters:
        value - true if to list
      • getListHidden

        public boolean getListHidden()
        Returns whether to list hidden dirs/files.
        Returns:
        true if to list
      • setSessionProvider

        public void setSessionProvider​(SMBSessionProvider value)
        Sets the session provider to use.
        Parameters:
        value - the provider
      • getSessionProvider

        public SMBSessionProvider getSessionProvider()
        Returns the session provider to use.
        Returns:
        the provider
      • getDiskShare

        protected com.hierynomus.smbj.share.DiskShare getDiskShare()
        Obtains the share instance to use.
        Returns:
        the share
      • isLocal

        public boolean isLocal()
        Returns whether the directory lister operates locally or remotely.
        Specified by:
        isLocal in interface DirectoryLister
        Returns:
        true if local lister
      • hasParentDirectory

        public boolean hasParentDirectory()
        Returns whether the watch directory has a parent directory.
        Specified by:
        hasParentDirectory in interface DirectoryLister
        Returns:
        true if parent directory available
      • newDirectory

        public SmbFileObject newDirectory​(String dir)
        Returns a new directory relative to the watch directory.
        Specified by:
        newDirectory in interface DirectoryLister
        Parameters:
        dir - the directory name
        Returns:
        the new wrapper
      • newDirectory

        public SmbFileObject newDirectory​(String parent,
                                          String dir)
        Returns a new directory relative to the parent directory.
        Specified by:
        newDirectory in interface DirectoryLister
        Parameters:
        parent - the parent directory
        dir - the directory name
        Returns:
        the new wrapper
      • search

        protected void search​(String dir,
                              List<SortContainer> files,
                              int depth)
                       throws Exception
        Performs the recursive search. Search goes deeper if != 0 (use -1 to start with for infinite search).
        Parameters:
        dir - the dir to search
        files - the files collected so far
        depth - the depth indicator (searched no deeper, if 0)
        Throws:
        Exception - if listing fails
      • search

        public List<SmbFileObject> search​(String dir)
                                   throws Exception
        Returns the list of files/directories in the watched directory. In case the execution gets stopped, this method returns empty list.
        Parameters:
        dir - the directory to search
        Returns:
        the list of absolute file/directory names
        Throws:
        Exception - if listing fails
      • list

        public String[] list()
        Returns the list of files/directories in the watched directory. In case the execution gets stopped, this method returns a 0-length array.
        Specified by:
        list in interface DirectoryLister
        Returns:
        the array of absolute file/directory names
      • listObjects

        public SmbFileObject[] listObjects()
        Returns the list of files/directories in the watched directory. In case the execution gets stopped, this method returns a 0-length array.
        Specified by:
        listObjects in interface DirectoryLister
        Returns:
        the array of file/directory wrappers
      • cleanUpSmb

        protected void cleanUpSmb()
        Cleans up the SMB components.