Package org.jnode.net.nfs.nfs2

Examples of org.jnode.net.nfs.nfs2.Time


        FileSystemAttribute fileSystemAttribute = getFileSystemAttribute();
        return fileSystemAttribute.getBlockSize() * fileSystemAttribute.getFreeBlockCount();
    }

    public long getTotalSpace() {
        FileSystemAttribute fileSystemAttribute = getFileSystemAttribute();
        return fileSystemAttribute.getBlockSize() * fileSystemAttribute.getBlockCount();
    }
View Full Code Here


        FileSystemAttribute fileSystemAttribute = getFileSystemAttribute();
        return fileSystemAttribute.getBlockSize() * fileSystemAttribute.getBlockCount();
    }

    public long getUsableSpace() {
        FileSystemAttribute fileSystemAttribute = getFileSystemAttribute();
        return fileSystemAttribute.getBlockSize() * fileSystemAttribute.getFreeBlockCount();
    }
View Full Code Here

                    public Set<NFS2Entry> run() throws Exception {
                        Set<Entry> entrySet = new LinkedHashSet<Entry>();
                        boolean eof = false;
                        byte[] cookie = new byte[NFS2Client.COOKIE_SIZE];
                        while (!eof) {
                            ListDirectoryResult result = nfsClient.listDirectory(
                                directoryEntry.getFileHandle(), cookie, 2048);
                            entrySet.addAll(result.getEntryList());
                            if (result.isEof()) {
                                eof = true;
                            } else {
                                // I guess that the list contains at least one entry.
                                cookie = result.getEntryList().get(
                                    result.getEntryList().size() - 1).getCookie();
                            }
                        }

                        if (entrySet.size() == 0) {
                            return new HashSet<NFS2Entry>();
View Full Code Here

        if (entry != null) {
            return entry;
        }

        NFS2Client nfsClient = getNFS2Client();
        LookupResult lookupResult;
        try {
            lookupResult = nfsClient.lookup(directoryEntry.getFileHandle(), name);
        } catch (NFS2Exception e) {
            throw new IOException("Can not call the rpc method." + e.getMessage(), e);
        }
        entry = new NFS2Entry(
            (NFS2FileSystem) getFileSystem(), this, name,
            lookupResult.getFileHandle(), lookupResult.getFileAttribute());
        if (!(entry.isDirectory() || entry.isFile())) {
            return null;
        }
        tableEntry.addEntry(entry);
        return entry;
View Full Code Here

                        Set<NFS2Entry> nfsEntrySet =
                            new LinkedHashSet<NFS2Entry>(entrySet.size());

                        for (Entry entry : entrySet) {
                            LookupResult lookupResult = nfsClient.lookup(
                                directoryEntry.getFileHandle(), entry.getName());

                            NFS2Entry nfsEntry = new NFS2Entry(
                                (NFS2FileSystem) getFileSystem(),
                                NFS2Directory.this, entry.getName(), lookupResult.getFileHandle(),
                                lookupResult.getFileAttribute());

                            if (!(nfsEntry.isDirectory() || nfsEntry.isFile())) {
                                continue;
                            }
                            nfsEntrySet.add(nfsEntry);
View Full Code Here

                String t = tokenizer.nextToken();
                tokenList.add(t);
            }
            for (int i = 0; i < tokenList.size() - 1; i++) {
                String t = tokenList.get(i);
                LookupResult lookup = nfsClient.lookup(tempFileHandle, t);
                if (lookup.getFileAttribute().getType() == FileAttribute.FILE) {
                    throw new IOException("The path contains a file : " + t + '.');
                } else if (lookup.getFileAttribute().getType() == FileAttribute.DIRECTORY) {
                    tempFileHandle = lookup.getFileHandle();
                } else {
                    throw new IOException("The path contains an unknow resource: " + t +
                            ". It is not directory or file");
                }
            }
View Full Code Here

        try {
            String filePath = path.substring(exportEntry.getDirectory().length());
            StringTokenizer tokenizer = new StringTokenizer(filePath, "/");
            while (tokenizer.hasMoreElements()) {
                String t = tokenizer.nextToken();
                LookupResult lookup = nfsClient.lookup(tempFileHandle, t);
                if (lookup.getFileAttribute().getType() == FileAttribute.FILE) {
                    fileHandle = lookup.getFileHandle();
                    fileAttribute = lookup.getFileAttribute();
                    break;
                } else if (lookup.getFileAttribute().getType() == FileAttribute.DIRECTORY) {
                    tempFileHandle = lookup.getFileHandle();
                } else {
                    throw new IOException("The path contains an unknow resource: " + t +
                            ". It is not directory or file");
                }
            }
View Full Code Here

    public void setLastChanged(long lastChanged) throws IOException {
        // TODO: The setAttribute API appears to have no way to do this.
    }

    public void setLastModified(long lastModified) throws IOException {
        NFS2Client client = getNFS2Client();
        try {
            client.setAttribute(getFileHandle(), -1, -1, -1, -1,
                new Time(-1, -1), new Time(lastModified));
        } catch (NFS2Exception e) {
            throw new IOException(e.getMessage(), e);
        }
    }
View Full Code Here

            throw new IOException(e.getMessage(), e);
        }
    }

    public void setLastAccessed(long lastAccessed) throws IOException {
        NFS2Client client = getNFS2Client();
        try {
            client.setAttribute(getFileHandle(), -1, -1, -1, -1,
                new Time(lastAccessed), new Time(-1, -1));
        } catch (NFS2Exception e) {
            throw new IOException(e.getMessage(), e);
        }
    }
View Full Code Here

            throw new IOException(e.getMessage(), e);
        }
    }

    public void setName(String newName) throws IOException {
        NFS2Client client = getNFS2Client();
        NFS2Directory parentDirectory = (NFS2Directory) getParent();
        try {
            client.renameFile(
                parentDirectory.getNFS2Entry().getFileHandle(), name,
                parentDirectory.getNFS2Entry().getFileHandle(), newName);
        } catch (NFS2Exception e) {
            throw new IOException("Can not rename ." + e.getMessage(), e);
        }
View Full Code Here

TOP

Related Classes of org.jnode.net.nfs.nfs2.Time

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.