@Override
	public int open(String path, int flags, FuseOpenSetter openSetter)
			throws FuseException {
		try {
			
			EntityInfo entity = fileSystem.getFileMetaData(path);
			if (entity == null)
				System.err.println("Your file system returned null for getFileMetaData(" + path + ")");

			boolean read = false;
			boolean write = false;
			if ((flags & FilesystemConstants.O_RDONLY) == FilesystemConstants.O_RDONLY)
				read = true;
			
			if ((flags & FilesystemConstants.O_WRONLY) == FilesystemConstants.O_WRONLY)
				write = true;
			
			if ((flags & FilesystemConstants.O_RDWR) == FilesystemConstants.O_RDWR)
			{
				read = true;
				write = true;
			}
			if (write && fileSystem.isReadOnly())
				return Errno.EROFS;
			
			FileHandle handle = fileSystem.openFile(path, read, write);
			handle.read = read;
			handle.write = write;
			openSetter.setFh(handle);
			handle.isEmptyFile = (((FileInfo)entity).getFileSize() == 0); 
			//openSetter.setFh(new FileHandle(node));
		} catch (PathNotFoundException e) {
			return Errno.ENOENT;
		} catch (AccessDeniedException e) {
			return Errno.EACCES;
		} catch (NotAFileException e) {
			return Errno.EISDIR;
		}
		return 0;
	}