Examples of SmbFile


Examples of jcifs.smb.SmbFile

    }
   
    public String[] list() throws IOException {
        if (isFile()) return getFSFile().list();
        if (isSMB()) try {
            SmbFile sf = getSmbFile();
            if (!sf.isDirectory()) return null;
            try {
                return TimeoutRequest.list(sf, SMB_TIMEOUT);
            } catch (SmbException e) {
                throw new IOException("SMB.list SmbException for " + sf.toString() + ": " + e.getMessage());
            }
        } catch (MalformedURLException e) {
            throw new IOException("SMB.list MalformedURLException for " + this.toString() + ": " + e.getMessage());
        }
        return null;
View Full Code Here

Examples of jcifs.smb.SmbFile

            for (String s: l) {
                if (s.startsWith(".")) continue;
                s = MultiProtocolURI.escape(s).toString();
                if (!s.endsWith("/") && !s.endsWith("\\")) {
                    // check if this is a directory
                    SmbFile sf = new SmbFile(u + s);
                    if (sf.isDirectory()) s = s + "/";
                }
                list.add(u + s);
            }
        
            StringBuilder content = FTPClient.dirhtml(u, null, null, null, list, true);
View Full Code Here

Examples of jcifs.smb.SmbFile

    public static void main(String[] args) {
        //jcifs.Config.setProperty( "jcifs.netbios.wins", "192.168.1.220" );
        //NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("domain", "username", "password");
        SmbFileInputStream in;
        try {
            SmbFile sf = new SmbFile(args[0]);
            if (sf.isDirectory()) {
                String[] s = sf.list();
                for (String t: s) System.out.println(t);
            } else {
                in = new SmbFileInputStream(sf);
                byte[] b = new byte[8192];
                int n;
View Full Code Here

Examples of jcifs.smb.SmbFile

            // login
            Subject subject = new Subject();
            login(subject);

            // list file
            SmbFile file = new SmbFile(URL, new Kerb5Authenticator(subject));
            SmbFile[] files = file.listFiles();
            for( int i = 0; i < files.length; i++ ) {
                System.out.println( "-->" + files[i].getName() );
                System.out.println("DFS path: " + files[0].getDfsPath());
            }
View Full Code Here

Examples of jcifs.smb.SmbFile

      try
      {
        // use NtlmPasswordAuthentication so that we can reuse credential for DFS support
        pa = new NtlmPasswordAuthentication(domain,username,password);
        SmbFile smbconnection = new SmbFile("smb://" + server + "/",pa);
        smbconnectionPath = getFileCanonicalPath(smbconnection);
      }
      catch (MalformedURLException e)
      {
        Logging.connectors.error("Unable to access SMB/CIFS share: "+"smb://" + ((domain==null)?"":domain)+";"+username+":<password>@"+ server + "/\n" + e);
View Full Code Here

Examples of jcifs.smb.SmbFile

      documentIdentifier = documentIdentifiers[i];
      try
      {
        if (Logging.connectors.isDebugEnabled())
          Logging.connectors.debug("JCIFS: getVersions(): documentIdentifiers[" + i + "] is: " + documentIdentifier);
        SmbFile file = new SmbFile(documentIdentifier,pa);

        // File has to exist AND have a non-null canonical path to be readable.  If the canonical path is
        // null, it means that the windows permissions are not right and directory/file is not readable!!!
        String newPath = getFileCanonicalPath(file);
        // We MUST check the specification here, otherwise a recrawl may not delete what it's supposed to!
View Full Code Here

Examples of jcifs.smb.SmbFile

      if (Logging.connectors.isDebugEnabled())
        Logging.connectors.debug("JCIFS: Processing '"+documentIdentifier+"'");
      try
      {

        SmbFile file = new SmbFile(documentIdentifier,pa);

        if (fileExists(file))
        {
          if (fileIsDirectory(file))
          {
            if (Logging.connectors.isDebugEnabled())
              Logging.connectors.debug("JCIFS: '"+documentIdentifier+"' is a directory");

            // Queue up stuff for directory
            // DFS special support no longer needed, because JCifs now does the right thing.

            // This is the string we replace in the child canonical paths.
            // String matchPrefix = "";
            // This is what we replace it with, to get back to a DFS path.
            // String matchReplace = "";

            // DFS resolved.

            // Use a filter to actually do the work here.  This prevents large arrays from being
            // created when there are big directories.
            ProcessDocumentsFilter filter = new ProcessDocumentsFilter(activities,spec);
            fileListFiles(file,filter);
            filter.checkAndThrow();
          }
          else
          {
            if (Logging.connectors.isDebugEnabled())
              Logging.connectors.debug("JCIFS: '"+documentIdentifier+"' is a file");

            if (!scanOnly[i])
            {
              // We've already avoided queuing documents that we
              // don't want, based on file specifications.
              // We still need to check based on file data.

              // DFS support is now implicit in JCifs.

              long startFetchTime = System.currentTimeMillis();
              String fileName = getFileCanonicalPath(file);
              if (fileName != null && !file.isHidden())
              {
                // Initialize repository document with common stuff, and find the URI
                RepositoryDocument rd = new RepositoryDocument();
                String uri = prepareForIndexing(rd,file,version);
View Full Code Here

Examples of jcifs.smb.SmbFile

  public String check()
    throws ManifoldCFException
  {
    getSession();
    String serverURI = smbconnectionPath;
    SmbFile server = null;
    try
    {
      server = new SmbFile(serverURI,pa);
    }
    catch (MalformedURLException e1)
    {
      return "Malformed URL: '"+serverURI+"': "+e1.getMessage();
    }
    try
    {
      // check to make sure it's a server or a folder
      int type = getFileType(server);
      if (type==SmbFile.TYPE_SERVER || type==SmbFile.TYPE_SHARE
        || type==SmbFile.TYPE_FILESYSTEM)
      {
        try
        {
          server.connect();
          if (!server.exists())
            return "Server or path does not exist";
        }
        catch (java.net.SocketTimeoutException e)
        {
          return "Timeout connecting to server: "+e.getMessage();
View Full Code Here

Examples of jcifs.smb.SmbFile

  protected String mapToIdentifier(String path)
    throws IOException
  {
    String smburi = smbconnectionPath;
    String uri = smburi + path + "/";
    return getFileCanonicalPath(new SmbFile(uri,pa));
  }
View Full Code Here

Examples of jcifs.smb.SmbFile

  */
  public SmbFile[] getShareNames(String serverURI)
    throws ManifoldCFException
  {
    getSession();
    SmbFile server = null;
    try
    {
      server = new SmbFile(serverURI,pa);
    }
    catch (MalformedURLException e1)
    {
      throw new ManifoldCFException("MalformedURLException tossed",e1);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.