Package lcmc.vm.domain

Examples of lcmc.vm.domain.LinuxFile


    /**
     * Returns cached file object.
     */
    public final LinuxFile getLinuxDir(final String dir, final Host host) {
        LinuxFile ret = linuxFileCache.get(dir);
        if (ret == null) {
            ret = new LinuxFile(this, host, dir, "d", 0, 0);
            linuxFileCache.put(dir, ret);
        }
        return ret;
    }
View Full Code Here


                return getLinuxDir(directory, host);
            }

            @Override
            public Boolean isTraversable(final File f) {
                final LinuxFile lf = linuxFileCache.get(f.toString());
                return lf == null || lf.isDirectory();
            }

            @Override
            public File getParentDirectory(final File dir) {
                return getLinuxDir(dir.getParent(), host);
            }

            @Override
            public File[] getFiles(final File dir, final boolean useFileHiding) {
                final StringBuilder dirSB = new StringBuilder(dir.toString());
                if ("/".equals(dir.toString())) {
                    dirSB.append('*');
                } else {
                    dirSB.append("/*");
                }
                final SshOutput out = host.captureCommandProgressIndicator(
                        "executing...",
                        new ExecCommandConfig().command("stat -c \"%A %a %Y %s %n\" " + dirSB + " 2>/dev/null")
                                .silentOutput());
                final List<LinuxFile> files = new ArrayList<LinuxFile>();
                if (out.getExitCode() == 0) {
                    for (final String line : out.getOutput().split("\r\n")) {
                        if (line.trim().isEmpty()) {
                            continue;
                        }
                        final Matcher m = STAT_PATTERN.matcher(line);
                        if (m.matches()) {
                            final String type = m.group(1);
                            final long lastModified = Long.parseLong(m.group(3)) * 1000;
                            final long size = Long.parseLong(m.group(4));
                            final String filename = m.group(5);
                            LinuxFile lf = linuxFileCache.get(filename);
                            if (lf == null) {
                                lf = new LinuxFile(thisClass, host, filename, type, lastModified, size);
                                linuxFileCache.put(filename, lf);
                            } else {
                                lf.update(type, lastModified, size);
                            }
                            files.add(lf);
                        } else {
                            LOG.appWarning("getFileSystemView: could not match: " + line);
                        }
View Full Code Here

        }
        final HardwareInfo thisClass = this;
        final JFileChooser fc = new JFileChooser(getLinuxDir(directory, host), getFileSystemView(host, directory)) {
            @Override
            public void setCurrentDirectory(final File dir) {
                super.setCurrentDirectory(new LinuxFile(thisClass, host, dir.toString(), "d", 0, 0));
            }
        };
        fc.setBackground(ClusterBrowser.STATUS_BACKGROUND);
        fc.setDialogType(JFileChooser.CUSTOM_DIALOG);
        if (dirOnly) {
View Full Code Here

TOP

Related Classes of lcmc.vm.domain.LinuxFile

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.