Package org.jnode.net.nfs.nfs2

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


        tableEntry.addEntry(entry);
        return entry;
    }

    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);
        }
View Full Code Here


        NFS2Entry entry = getEntry(name);
        if (entry == null) {
            return;
        }

        NFS2Client nfsClient = getNFS2Client();

        if (entry.isDirectory()) {
            try {
                nfsClient.removeDirectory(directoryEntry.getFileHandle(), name);
            } catch (NFS2Exception e) {
                throw new IOException("Can not remove directory " + name + "." + e.getMessage(), e);
            }
        } else {
            try {
                nfsClient.removeFile(directoryEntry.getFileHandle(), name);
            } catch (NFS2Exception e) {
                throw new IOException("Can not remove file " + name + "." + e.getMessage(), e);
            }
        }
        tableEntry.removeEntry(name);
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 {
View Full Code Here

        } else {
            throw new IOException("The url doesn't contains the uid and guid.");
        }

        mountClient = new Mount1Client(InetAddress.getByName(url.getHost()), Protocol.TCP, uid, gid);
        nfsClient = new NFS2Client(InetAddress.getByName(url.getHost()), Protocol.TCP, uid, gid);
        String path = url.getPath();
        List<ExportEntry> exportList;
        try {
            exportList = mountClient.export();
        } catch (MountException e1) {
View Full Code Here

    public NFS2InputStream(URL url) throws IOException {
        // FIXME ... exception handling in this method should be reviewed.  At the very least,
        // there are places where finally clauses should be used.
        mountClient = new Mount1Client(InetAddress.getByName(url.getHost()), Protocol.TCP, -1, -1);
        nfsClient = new NFS2Client(InetAddress.getByName(url.getHost()), Protocol.TCP, -1, -1);
        String path = url.getPath();
        List<ExportEntry> exportList;
        try {
            exportList = mountClient.export();
        } catch (MountException e) {
View Full Code Here

            while (true) {
                length = Math.min(NFS2Client.MAX_DATA, dest.remaining());
                if (length == 0) {
                    return;
                }
                ReadFileResult result =
                        client.readFile(entry.getFileHandle(), (int) fileOffset, length);
                byte[] data = result.getData();
                length = data.length;
                fileOffset += length;
                dest.put(data);
            }
        } catch (NFS2Exception e) {
View Full Code Here

    private int fillBuffer() throws IOException {
        if (fileOffset >= fileAttribute.getSize()) {
            return 0;
        }
        ReadFileResult readFileResult;
        try {
            readFileResult = nfsClient.readFile(fileHandle, (int) fileOffset, DEFAULT_BUFFER_SIZE);
        } catch (NFS2Exception e) {
            throw new IOException(e.getMessage());
        }
        fileAttribute = readFileResult.getFileAttribute();
        fileOffset += readFileResult.getData().length;
        System.arraycopy(readFileResult.getData(), 0, buffer, 0, readFileResult.getData().length);
        bufferPosition = 0;
        bufferCount = readFileResult.getData().length;
        return bufferCount;
    }
View Full Code Here

    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

    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

     * @throws java.io.IOException
     */
    public void setLength(long length) throws IOException {
        NFS2Client client = getNFS2Client();
        try {
            client.setAttribute(entry.getFileHandle(), -1, -1, -1, (int) length, new Time(-1, -1),
                    new Time(-1, -1));
        } catch (NFS2Exception e) {
            throw new IOException(e.getMessage(), e);
        }
    }
View Full Code Here

TOP

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

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.