Package org.globus.ftp

Examples of org.globus.ftp.MlsxEntry


            } else {
                log.debug("children are present: " + kids.size());
                children = new TreeMap<String, GridFtpMlsxFileObject>();

                for (int i = 0; i < kids.size(); i++) {
                    final MlsxEntry child = kids.get(i);
                    if (child == null) {
                        continue;
                    }
                    String childname = child.getFileName();
                    if (childname != null && //!".".equals(childname) && !"..".equals(childname) &&
                            !"./".equals(childname) && !"../".equals(childname)) {

                        // update the child FileObjects MslxEntry
                        FileName fn = null;
                        try {
                            // Resolves a name, relative to the "root" file name.
                            // Refer to NameScope  for a description of how names are resolved.
                            //
                            // Parameters:
                            // root - the base filename (which is'this' GridFtpMlsxFileObject which is the parent)
                            // name - The name to resolve.
                            // scope - The NameScope to use when resolving the name.
                            fn = getFileSystem().getFileSystemManager().
                                resolveName(getName(), UriParser.encode(childname), NameScope.CHILD);
                        }catch(Exception ex){
                            // VFS didn't like the child name for whatever reason,
                            // (prob an illegal file name char?).
                            // Therefore, don't bother adding it as a child as
                            // VFS will trip over if trying to resolve the child FileObject.
                            log.error("Skipping unresolvable child FileObject");
                        }
                        // Need to check that childname == fn.getBaseName()
                        // otherwise, will not be able to resolveFile correctly which causes ex.
                        if (fn != null && childname != null && childname.equals(fn.getBaseName())) {

                            GridFtpMlsxFileObject fo = (GridFtpMlsxFileObject) getFileSystem().resolveFile(fn);
                            //fo.file = client.mlst(childname);
                            fo.file = child;

                            // set this FileObjects FileType by injection
                            // ignore pdir and cdir
                            if (MlsxEntry.TYPE_DIR.equals(child.get(MlsxEntry.TYPE))) {
                                fo.injectType(FileType.FOLDER);
                                children.put(childname, fo);

                            } else if (MlsxEntry.TYPE_FILE.equals(child.get(MlsxEntry.TYPE))) {
                                fo.injectType(FileType.FILE);
                                children.put(childname, fo);
                            }
                        }
View Full Code Here


            } else {
                log.debug("children are present: " + kids.size());
                children = new TreeMap<String, GridFtpMlsxFileObject>();

                for (int i = 0; i < kids.size(); i++) {
                    final MlsxEntry child = kids.get(i);
                    if (child == null) {
                        continue;
                    }
                    String childname = child.getFileName();
                    if (childname != null && //!".".equals(childname) && !"..".equals(childname) &&
                            !"./".equals(childname) && !"../".equals(childname)) {

                        // update the child FileObjects MslxEntry
                        FileName fn = null;
                        try {
                            // Resolves a name, relative to the "root" file name.
                            // Refer to NameScope  for a description of how names are resolved.
                            //
                            // Parameters:
                            // root - the base filename (which is'this' GridFtpMlsxFileObject which is the parent)
                            // name - The name to resolve.
                            // scope - The NameScope to use when resolving the name.
                            fn = getFileSystem().getFileSystemManager().
                                resolveName(getName(), UriParser.encode(childname), NameScope.CHILD);
                        }catch(Exception ex){
                            // VFS didn't like the child name for whatever reason,
                            // (prob an illegal file name char?).
                            // Therefore, don't bother adding it as a child as
                            // VFS will trip over if trying to resolve the child FileObject.
                            log.warn("Skipping unresolvable child FileObject: childname = " + childname);
                        }
                        // Need to check that childname == fn.getBaseName()
                        // otherwise, will not be able to resolveFile correctly which causes ex.
                        if (fn != null && childname != null && childname.equals(fn.getBaseName())) {

                            GridFtpMlsxFileObject fo = (GridFtpMlsxFileObject) getFileSystem().resolveFile(fn);
                            //fo.file = client.mlst(childname);
                            fo.file = child;

                            // set this FileObjects FileType by injection
                            // ignore pdir and cdir
                            if (MlsxEntry.TYPE_DIR.equals(child.get(MlsxEntry.TYPE))) {
                                fo.injectType(FileType.FOLDER);
                                children.put(childname, fo);

                            } else if (MlsxEntry.TYPE_FILE.equals(child.get(MlsxEntry.TYPE))) {
                                fo.injectType(FileType.FILE);
                                children.put(childname, fo);
                            }
                        }
View Full Code Here

            } else {
                log.debug("children are present: " + kids.size());
                children = new TreeMap<String, GridFtpMlsxFileObject>();

                for (int i = 0; i < kids.size(); i++) {
                    final MlsxEntry child = kids.get(i);
                    if (child == null) {
                        continue;
                    }
                    String childname = child.getFileName();
                    if (childname != null && //!".".equals(childname) && !"..".equals(childname) &&
                            !"./".equals(childname) && !"../".equals(childname)) {

                        // update the child FileObjects MslxEntry
                        FileName fn = null;
                        try {
                            // Resolves a name, relative to the "root" file name.
                            // Refer to NameScope  for a description of how names are resolved.
                            //
                            // Parameters:
                            // root - the base filename (which is'this' GridFtpMlsxFileObject which is the parent)
                            // name - The name to resolve.
                            // scope - The NameScope to use when resolving the name.
                            fn = getFileSystem().getFileSystemManager().
                                resolveName(getName(), UriParser.encode(childname), NameScope.CHILD);
                        }catch(Exception ex){
                            // VFS didn't like the child name for whatever reason,
                            // (prob an illegal file name char?).
                            // Therefore, don't bother adding it as a child as
                            // VFS will trip over if trying to resolve the child FileObject.
                            log.error("Skipping unresolvable child FileObject");
                        }
                        // Need to check that childname == fn.getBaseName()
                        // otherwise, will not be able to resolveFile correctly which causes ex.
                        if (fn != null && childname != null && childname.equals(fn.getBaseName())) {

                            GridFtpMlsxFileObject fo = (GridFtpMlsxFileObject) getFileSystem().resolveFile(fn);
                            //fo.file = client.mlst(childname);
                            fo.file = child;

                            // set this FileObjects FileType by injection
                            // ignore pdir and cdir
                            if (MlsxEntry.TYPE_DIR.equals(child.get(MlsxEntry.TYPE))) {
                                fo.injectType(FileType.FOLDER);
                                children.put(childname, fo);

                            } else if (MlsxEntry.TYPE_FILE.equals(child.get(MlsxEntry.TYPE))) {
                                fo.injectType(FileType.FILE);
                                children.put(childname, fo);
                            }
                        }
View Full Code Here

        //Vector<FileInfo> v = client.list(defDefaultDir);

        client.setPassive();
        client.setLocalActive();
        client.changeDir("/");
        MlsxEntry x = client.mlst("/");
        System.out.println("root: "+x.getFileName());
        System.out.println("type: " + x.get(MlsxEntry.TYPE));
    }
View Full Code Here

            } else {
                log.debug("children are present: " + kids.size());
                children = new TreeMap<String, GridFtpMlsxFileObject>();

                for (int i = 0; i < kids.size(); i++) {
                    final MlsxEntry child = kids.get(i);
                    if (child == null) {
                        continue;
                    }
                    String childname = child.getFileName();
                    if (childname != null && //!".".equals(childname) && !"..".equals(childname) &&
                            !"./".equals(childname) && !"../".equals(childname)) {

                       // update the child FileObjects MslxEntry
                        FileName fn = null;
                        try {
                            // Resolves a name, relative to the "root" file name.
                            // Refer to NameScope  for a description of how names are resolved.
                            //
                            // Parameters:
                            // root - the base filename (which is'this' GridFtpMlsxFileObject which is the parent)
                            // name - The name to resolve.
                            // scope - The NameScope to use when resolving the name.
                            fn = getFileSystem().getFileSystemManager().
                                resolveName(getName(), UriParser.encode(childname), NameScope.CHILD);
                        }catch(Exception ex){
                            // VFS didn't like the child name for whatever reason,
                            // (prob an illegal file name char?).
                            // Therefore, don't bother adding it as a child as
                            // VFS will trip over if trying to resolve the child FileObject.
                            log.error("Skipping unresolvable child FileObject");
                        }
                        // Need to check that childname == fn.getBaseName()
                        // otherwise, will not be able to resolveFile correctly which causes ex.
                        if (fn != null && childname != null && childname.equals(fn.getBaseName())) {

                            GridFtpMlsxFileObject fo = (GridFtpMlsxFileObject) getFileSystem().resolveFile(fn);
                            //fo.file = client.mlst(childname);
                            fo.file = child;

                            // set this FileObjects FileType by injection
                            // ignore pdir and cdir
                            if (MlsxEntry.TYPE_DIR.equals(child.get(MlsxEntry.TYPE))) {
                                fo.injectType(FileType.FOLDER);
                                children.put(childname, fo);

                            } else if (MlsxEntry.TYPE_FILE.equals(child.get(MlsxEntry.TYPE))) {
                                fo.injectType(FileType.FILE);
                                children.put(childname, fo);
                            }
                        }
View Full Code Here

        client.changeDir(listdir.getPath());
        final Vector v = client.mlsd(null);
        int len = v.size();
        final ArrayList files = new ArrayList(len);
        while (! v.isEmpty()) {
            final MlsxEntry f = (MlsxEntry)v.remove(0);
            if (f == null) {
                continue; // *** SKIP ***
            }

            final String fileName = f.getFileName();
            if (fileName == null) {
                continue; // *** SKIP ***
            }

            if (fileName.equals(".")) {
View Full Code Here

            debug.println("Size of list return vector: " + len);
        }

        final ArrayList files = new ArrayList(len);
        while (! v.isEmpty()) {
            final MlsxEntry f = (MlsxEntry)v.remove(0);
            if (f == null) {
                if (debug != null) {
                    debug.println("null MlsxEntry received (?)");
                }
                continue;
            }

            final String fileName = f.getFileName();
            if (fileName == null) {
                if (debug != null) {
                    debug.println("no MlsxEntry filename (?)");
                }
                continue;
            }

            if (fileName.equals(".")) {
                len -= 1;
                if (debug != null) {
                    debug.println("'.' is not an interesting file");
                }
                continue;
            }
            if (fileName.equals("..")) {
                len -= 1;
                if (debug != null) {
                    debug.println("'..' is not an interesting file");
                }
                continue;
            }

            final FileListing fl = new FileListing();

            fl.setName(f.getFileName());

            final String sizeStr = f.get("size");
            if (sizeStr == null) {
                fl.setSize(-1);
            } else {
                long x = -1;
                try {
                    x = Long.parseLong(sizeStr);
                } catch (NumberFormatException e) {
                    // pass.
                }
                fl.setSize(x);
            }

            final String modified = f.get("modify");
            // 20080522161726
            if (modified == null || modified.length() != 14) {
                throw new Exception("cannot parse modified time");
            }
            fl.setDate(parseDate(modified));
            fl.setTime(parseTime(modified));

            final String type = f.get("type");
            if (type != null && type.equals("dir")) {
                fl.setDirectory(true);
            }


            // If user is root and perms are group no-write and all no-write,
            // we can, because of several conventions, safely say that the user
            // only has read-only access.
            final String owner = f.get("unix.owner");
            final String mode = f.get("unix.mode");
            if (mode == null) {
                fl.setReadWrite(false);
            } else if (mode.substring(3,4).equals("6")) {
                fl.setReadWrite(true);
            } else if (mode.substring(1,2).equals("6")) {
View Full Code Here

TOP

Related Classes of org.globus.ftp.MlsxEntry

Copyright © 2018 www.massapicom. 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.