public class NFSServer extends RpcNetworkServer implements RpcProcessor
Contains the main NFS server.
SHUTDOWN_TIMEOUT
Constructor and Description |
---|
NFSServer(ServerConfiguration config)
Class constructor
|
Modifier and Type | Method and Description |
---|---|
protected int |
checkForNewShares()
Check for new shared devices and add them to the share and tree connection lists
|
protected void |
fireSessionClosed(SrvSession sess)
Inform session listeners that a session has been closed
|
protected void |
fireSessionOpened(SrvSession sess)
Inform session listeners that a new session has been created
|
protected String |
generatePath(String dirPath,
String argPath)
Generate a share relative path from the directory path and argument path.
|
protected int |
getFileIdForHandle(byte[] handle)
Get the file id from the specified handle
|
protected byte[] |
getHandleForFile(NFSSrvSession sess,
byte[] handle,
TreeConnection tree,
String fname)
Get the handle for the specified directory handle and file name
|
protected NetworkFile |
getNetworkFileForHandle(NFSSrvSession sess,
byte[] handle,
TreeConnection conn,
boolean readOnly)
Find, or open, the required network file using the file handle
|
protected int |
getNextSessionId()
Return the next session id
|
protected NFSConfigSection |
getNFSConfiguration()
Return the NFS configuration section
|
protected NetworkFile |
getOpenNetworkFileForHandle(NFSSrvSession sess,
byte[] handle,
TreeConnection conn)
Find the required network file using the file handle, or return null if the file has not been opened
|
protected String |
getPathForHandle(NFSSrvSession sess,
byte[] handle,
TreeConnection tree)
Get the path for the specified handle
|
int |
getPort()
Return the port to bind to
|
protected RpcAuthenticator |
getRpcAuthenticator()
Return the configured RPC authenticator
|
ShareDetailsHash |
getShareDetails() |
protected int |
getShareIdFromHandle(byte[] handle)
Get the share id from the specified handle
|
protected TreeConnection |
getTreeConnection(NFSSrvSession sess,
int shareId)
Return the tree connection for the specified share index
|
protected void |
packAttributes3(RpcPacket rpc,
FileInfo finfo,
int fileSysId)
Pack the NFS v3 file attributes structure using the file information
|
protected void |
packDirectoryHandle(int shareId,
int dirId,
RpcPacket rpc)
Pack a directory handle
|
protected void |
packFileHandle(int shareId,
int dirId,
int fileId,
RpcPacket rpc)
Pack a directory handle
|
protected void |
packPostOpAttr(NFSSrvSession sess,
FileInfo finfo,
int fileSysId,
RpcPacket rpc)
Pack the post operation weak cache consistency data for the specified
file/directory
|
protected void |
packPostOpAttr(NFSSrvSession sess,
TreeConnection conn,
byte[] fhandle,
RpcPacket rpc)
Pack the post operation weak cache consistency data for the specified
file/directory
|
protected void |
packPreOpAttr(NFSSrvSession sess,
FileInfo finfo,
RpcPacket rpc)
Pack the pre operation weak cache consistency data for the specified
file/directory
|
protected void |
packPreOpAttr(NFSSrvSession sess,
TreeConnection conn,
byte[] fhandle,
RpcPacket rpc)
Pack the pre operation weak cache consistency data for the specified
file/directory
|
protected void |
packShareHandle(String shareName,
RpcPacket rpc)
Pack a share handle
|
protected void |
packWccData(RpcPacket rpc,
FileInfo finfo)
Pack a weak cache consistency structure
|
protected boolean |
pathHasDirectories(String fpath)
Check if a file path contains any directory components
|
RpcPacket |
processRpc(RpcPacket rpc)
Process an RPC request to the NFS or mount server
|
void |
setPort(int port)
Set the port to use
|
void |
shutdownServer(boolean immediate)
Shutdown the NFS server
|
void |
startServer()
Start the NFS server
|
registerRPCServer, registerRPCServer, setPortMapper, unregisterRPCServer, unregisterRPCServer
addServerListener, addSessionListener, clearException, findShare, fireServerEvent, fireSessionClosedEvent, fireSessionLoggedOnEvent, fireSessionOpenEvent, getAccessControlManager, getConfiguration, getException, getFullShareList, getGlobalConfiguration, getProtocolName, getSecurityConfiguration, getServerAddresses, getShareList, getShareMapper, hasAccessControlManager, hasDebug, hasDebugFlag, hasException, hasShutdown, isActive, isEnabled, isVersion, removeServerListener, removeSessionListener, setActive, setDebug, setDebugFlags, setEnabled, setException, setServerAddresses, setShutdown, setVersion
public static final int DBG_RXDATA
public static final int DBG_TXDATA
public static final int DBG_DUMPDATA
public static final int DBG_SEARCH
public static final int DBG_INFO
public static final int DBG_FILE
public static final int DBG_FILEIO
public static final int DBG_ERROR
public static final int DBG_TIMING
public static final int DBG_DIRECTORY
public static final int DBG_SESSION
public static final String UNIX_SEPERATOR
public static final char UNIX_SEPERATOR_CHAR
public static final String DOS_SEPERATOR
public static final char DOS_SEPERATOR_CHAR
public static final int MODE_STFILE
public static final int MODE_STDIR
public static final int MODE_STREAD
public static final int MODE_STWRITE
public static final int MODE_DIR_DEFAULT
public static final int MODE_FILE_DEFAULT
public static final long COOKIE_RESUMEID_MASK
public static final long COOKIE_SEARCHID_MASK
public static final int COOKIE_SEARCHID_SHIFT
public static final long COOKIE_DOT_DIRECTORY
public static final long COOKIE_DOTDOT_DIRECTORY
public static final int READDIRPLUS_HEADER_LENGTH
public static final int READDIRPLUS_ENTRY_LENGTH
public static final int READDIR_HEADER_LENGTH
public static final int READDIR_ENTRY_LENGTH
public static final long FILE_ID_OFFSET
public static final int MaxRequestSize
public static final int MaxReadSize
public static final int PrefReadSize
public static final int MultReadSize
public static final int MaxWriteSize
public static final int PrefWriteSize
public static final int MultWriteSize
public static final int PrefReadDirSize
public static final long MaxFileSize
public NFSServer(ServerConfiguration config)
config
- ServerConfigurationpublic final int getPort()
protected final NFSConfigSection getNFSConfiguration()
public final void setPort(int port)
port
- intpublic void startServer()
startServer
in class RpcNetworkServer
public void shutdownServer(boolean immediate)
shutdownServer
in class RpcNetworkServer
immediate
- booleanpublic RpcPacket processRpc(RpcPacket rpc) throws IOException
processRpc
in interface RpcProcessor
processRpc
in class RpcNetworkServer
rpc
- RpcPacketIOException
protected final void packAttributes3(RpcPacket rpc, FileInfo finfo, int fileSysId)
rpc
- RpcPacketfinfo
- FileInfofileSysId
- intprotected final void packShareHandle(String shareName, RpcPacket rpc)
shareName
- Stringrpc
- RpcPacketprotected final void packDirectoryHandle(int shareId, int dirId, RpcPacket rpc)
shareId
- intdirId
- intrpc
- RpcPacketprotected final void packFileHandle(int shareId, int dirId, int fileId, RpcPacket rpc)
shareId
- intdirId
- intfileId
- intrpc
- RpcPacketprotected final int getShareIdFromHandle(byte[] handle) throws BadHandleException
handle
- byte[]BadHandleException
protected final String getPathForHandle(NFSSrvSession sess, byte[] handle, TreeConnection tree) throws BadHandleException, StaleHandleException
sess
- NFSSrvSessionhandle
- byte[]tree
- TreeConnectionBadHandleException
StaleHandleException
protected final byte[] getHandleForFile(NFSSrvSession sess, byte[] handle, TreeConnection tree, String fname) throws BadHandleException, StaleHandleException
sess
- NFSSrvSessionhandle
- byte[]tree
- TreeConnectionfname
- StringBadHandleException
StaleHandleException
protected final int getFileIdForHandle(byte[] handle) throws BadHandleException
handle
- byte[]BadHandleException
protected final NetworkFile getNetworkFileForHandle(NFSSrvSession sess, byte[] handle, TreeConnection conn, boolean readOnly) throws BadHandleException, StaleHandleException
sess
- NFSSrvSessionhandle
- byte[]conn
- TreeConnectionreadOnly
- booleanBadHandleException
- If the handle is not validStaleHandleException
- If the file id cannot be converted to a pathprotected final NetworkFile getOpenNetworkFileForHandle(NFSSrvSession sess, byte[] handle, TreeConnection conn) throws BadHandleException, StaleHandleException
sess
- NFSSrvSessionhandle
- byte[]conn
- TreeConnectionBadHandleException
- If the handle is not validStaleHandleException
- If the file id cannot be converted to a pathprotected final TreeConnection getTreeConnection(NFSSrvSession sess, int shareId) throws BadHandleException
sess
- NFSSrvSessionshareId
- intBadHandleException
protected final void packWccData(RpcPacket rpc, FileInfo finfo)
rpc
- RpcPacketfinfo
- FileInfoprotected final boolean pathHasDirectories(String fpath)
fpath
- Stringprotected final void packPreOpAttr(NFSSrvSession sess, FileInfo finfo, RpcPacket rpc)
sess
- NFSSrvSessionfinfo
- FileInforpc
- RpcPacketprotected final void packPreOpAttr(NFSSrvSession sess, TreeConnection conn, byte[] fhandle, RpcPacket rpc) throws BadHandleException, StaleHandleException, InvalidDeviceInterfaceException, IOException
sess
- NFSSrvSessionconn
- TreeConnectionfhandle
- byte[]rpc
- RpcPacketBadHandleException
StaleHandleException
InvalidDeviceInterfaceException
IOException
protected final void packPostOpAttr(NFSSrvSession sess, TreeConnection conn, byte[] fhandle, RpcPacket rpc) throws BadHandleException, StaleHandleException, InvalidDeviceInterfaceException, IOException
sess
- NFSSrvSessionconn
- TreeConnectionfhandle
- byte[]rpc
- RpcPacketBadHandleException
StaleHandleException
InvalidDeviceInterfaceException
IOException
protected final void packPostOpAttr(NFSSrvSession sess, FileInfo finfo, int fileSysId, RpcPacket rpc)
sess
- NFSSrvSessionfinfo
- FileInfofileSysId
- intrpc
- RpcPacketprotected final String generatePath(String dirPath, String argPath)
dirPath
- StringargPath
- Stringprotected final int checkForNewShares()
protected final int getNextSessionId()
protected final RpcAuthenticator getRpcAuthenticator()
public ShareDetailsHash getShareDetails()
protected final void fireSessionOpened(SrvSession sess)
sess
- SrvSessionprotected final void fireSessionClosed(SrvSession sess)
sess
- SrvSessionCopyright © 2005–2018 Alfresco Software. All rights reserved.