Package org.jnode.net.nfs.nfs2

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


    public FSEntry addDirectory(String name) throws IOException {

        NFS2Client nfsClient = getNFS2Client();

        CreateDirectoryResult result;
        try {
            result = nfsClient.createDirectory(directoryEntry.getFileHandle(), name,
                DEFAULT_PERMISSION, -1, -1, -1, new Time(-1, -1), new Time(-1, -1));
        } catch (NFS2Exception e) {
            throw new IOException("Can not create the directory " + name + "." + e.getMessage(), e);
        }

        NFS2Entry entry =
            new NFS2Entry((NFS2FileSystem) getFileSystem(), this, name, result.getFileHandle(),
                result.getFileAttribute());
        tableEntry.addEntry(entry);
        return entry;
    }
View Full Code Here


    }

    public FSEntry addFile(String name) throws IOException {
        NFS2Client nfsClient = getNFS2Client();

        CreateFileResult result;
        try {
            result = nfsClient.createFile(directoryEntry.getFileHandle(), name, DEFAULT_PERMISSION,
                -1, -1, -1, new Time(-1, -1), new Time(-1, -1));
        } catch (NFS2Exception e) {
            throw new IOException("Can not create the file " + name + "." + e.getMessage(), e);
        }

        NFS2Entry entry =
            new NFS2Entry((NFS2FileSystem) getFileSystem(), this, name, result.getFileHandle(),
                result.getFileAttribute());

        tableEntry.addEntry(entry);

        return entry;
    }
View Full Code Here

                } else {
                    throw new IOException("The path contains an unknow resource: " + t +
                            ". It is not directory or file");
                }
            }
            CreateFileResult result =
                    nfsClient.createFile(tempFileHandle, tokenList.get(tokenList.size() - 1),
                            DEFAULT_PERMISSION, uid, gid, 0, new Time(-1, -1), new Time(-1, -1));
            fileHandle = result.getFileHandle();
            fileAttribute = result.getFileAttribute();
        } catch (NFS2Exception e) {
            try {
                mountClient.unmount(mountDirectory);
            } catch (MountException e1) {
                // ignore
View Full Code Here

     * All elements returned by the iterator must be instanceof FSEntry.
     */
    public Iterator<? extends NFS2Entry> iterator() throws IOException {
        final NFS2Client nfsClient = getNFS2Client();

        @SuppressWarnings("unused")
        FileAttribute fileAttribute;
        try {
            fileAttribute =
                AccessController.doPrivileged(new PrivilegedExceptionAction<FileAttribute>() {
                    public FileAttribute run() throws Exception {
View Full Code Here

        mountClient = new Mount1Client(device.getHost(), device.getProtocol(), device.getUid(), device.getGid());
        nfsClient = new NFS2Client(device.getHost(), device.getProtocol(), device.getUid(), device.getGid());

        // Mount the file system
        MountResult result;
        FileAttribute fileAttribute;
        try {
            result = mountClient.mount(device.getRemoteDirectory());
            fileAttribute = nfsClient.getAttribute(result.getFileHandle());
        } catch (IOException e) {
            try {
View Full Code Here

    public boolean isReadOnly() {
        return readOnly;
    }

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

        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

TOP

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

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.