public class FtpServer extends IfsServer implements Serializable, FtpConstants
IfsServer.ServerRequest
Modifier and Type | Field and Description |
---|---|
protected int |
m_AcceptQueueSize
Queue size for server socket.
|
protected boolean |
m_AnonymousAllowed
Anonymous session allowed.
|
protected InetAddress |
m_BindAddress
InetAddress to which FtpServer will bind.
|
protected Hashtable |
m_Channels
Session table; hashed by channel sequence.
|
protected int |
m_ChannelSequence
Channel sequence number
|
protected FtpCommandInvoker |
m_CommandInvoker
Command table
|
protected int |
m_ControlPort
Port for control socket.
|
protected ServerSocket |
m_ControlServerSocket
The control ServerSocket object.
|
protected String |
m_DefaultCommandCharacterSet
Default command character set.
|
protected ResourceBundle |
m_FtpResources
FtpResources
|
protected Hashtable |
m_FtpSessions
Hashtable of active sessions; hashed by server produced cookie.
|
protected String |
m_HostAddress
Host machine address where FtpServer will run.
|
protected String |
m_HostName
Name of host machine where FtpServer will run.
|
protected Locale |
m_Locale
Locale of server machine.
|
protected String |
m_LocaleCountry
Locale country code.
|
protected String |
m_LocaleLanguage
Locale language code.
|
protected String |
m_Localhost
Localhost.
|
protected int |
m_MaximumConnections
The maximum number of ftp connections allowed to this ftp server.
|
protected SecureRandom |
m_Random
Random number generator for psession "cookies"
|
protected int |
m_SessionTimeoutPeriod
Period in which session will timeout.
|
protected String |
m_Version
CMSDK version.
|
LEVEL_HIGH, LEVEL_LOW, LEVEL_MEDIUM, LEVEL_OFF
ACCEPT_QUEUE_SIZE, ACCESS_DENIED, ADMIN_COMMAND, ADMIN_OFF, ADMIN_ON, ANONYMOUS_ALLOWED, ANONYMOUS_USER_NOT_ALLOWED, ANONYMOUS_USERNAME, AUTH_COMMAND, BANNER_TEXT, CCC_COMMAND, CDUP_COMMAND, COMMAND_CHARACTER_SET_IS_USER_CHARACTER_SET, CWD_COMMAND, DATA_SOCKET_ERR, DEFAULT_COMMAND_CHARACTER_SET, DEFAULT_PORT, DELE_COMMAND, ERR_SETTING_SOCKET_ACTIVE, ERR_SETTING_SOCKET_PASV, ERR_SSL_SOCKETS, FILE_NOT_FOUND, FILE_RETR_FAIL, FILE_STOR_FAIL, FOLDER_FOUND, FOLDER_HAS_ITEMS, FOLDER_NOT_FOUND, FOLDERLINKS_EXIST, FTP_DESCRIPTIVE_NAME, FTP_NAME, FTP_STATUS, FTPS_NAME, HOST_ADDRESS, HOST_NAME, IMPLICIT_SECURITY, INVALID_ARGUMENT, LAST, LATIN_1, LIBRARY_VERSION, LINK_IS_BROKEN, LIST_COMMAND, LIST_FAIL, LN_COMMAND, LOCALE_COUNTRY, LOCALE_LANGUAGE, LOCALHOST, LOCALHOST_DEFAULT, LOGIN_FAILED, MAXIMUM_CONNECTIONS, MKD_COMMAND, NLST_COMMAND, NO_ERR, NOOP_COMMAND, NORMALIZE_PATH_ERR, NOT_DOCUMENT_TYPE, NOT_FOLDER_TYPE, NOT_LOGGED_IN, PASS_COMMAND, PASV_COMMAND, PBSZ_COMMAND, PORT, PORT_COMMAND, PROT_COMMAND, PWD_COMMAND, QUIT_COMMAND, REQ_DENIED_BY_POLICY, RETR_COMMAND, RMD_COMMAND, RNFR_COMMAND, RNTO_COMMAND, ROOT_FOLDER, SESSION_TIMEOUT_PERIOD, SETCHARACTERSET_COMMAND, SETCOMMANDCHARACTERSET_COMMAND, SETLANGUAGE_COMMAND, SHOWCHARACTERSET_COMMAND, SHOWLANGUAGE_COMMAND, STATS_COMMAND, STOR_COMMAND, SYST_COMMAND, SYSTEM_USERNAME, TOO_MANY_ARGUMENTS, TYPE_COMMAND, UNKNOWN_FLAG, USER_COMMAND, WALLET_LOCATION, XMKD_COMMAND, XPWD_COMMAND, XRMD_COMMAND
SERVERSTATUS_DISPOSED, SERVERSTATUS_RUNNING, SERVERSTATUS_STARTING, SERVERSTATUS_STOPPED, SERVERSTATUS_STOPPING, SERVERSTATUS_SUSPENDED, SERVERSTATUS_UNKNOWN
Constructor and Description |
---|
FtpServer()
Constructs a FtpServer
|
Modifier and Type | Method and Description |
---|---|
Object |
addFtpSession(FtpSession psession,
Long sessid)
Adds a new FtpSession to the server.
|
protected void |
clearDerivedProperties()
Clear derived properties.
|
protected void |
closeSocketServer()
If we have no socket port open we do it here.
|
boolean |
commandCharacterSetIsUserCharacterSet()
Return true if the command character set is derived from the
PrimaryUserProfile's character set.
|
protected FtpServerChannel |
createChannel(Socket commandSocket,
String threadName,
int channelSequence,
boolean reachedMaximumConnections)
Create a channel.
|
void |
dispose()
Disposes this Server.
|
protected void |
establishServerSocket()
If we have no socket port open we do it here.
|
protected String |
getAcceptQueueSizeKey()
Gets the accept queue size key.
|
protected String |
getAnonymousAllowedKey()
Gets the key.
|
String |
getBannerText()
Gets the banner text.
|
InetAddress |
getBindAddress()
Get Server InetAddress on which it is listening.
|
String |
getCachePerformance()
Gets the cache performance statistics for the FtpServer.
|
protected String |
getCommandCharacterSetIsUserCharacterSetKey()
Get boolean of whether the command character set is the same
as the user preference character set.
|
FtpCommandInvoker |
getCommandInvoker()
Gets the command invoker.
|
String |
getConnectionPoolPerformance()
Gets the connection pool performance statistics
for the FtpServer
|
int |
getControlPort()
Gets the control port.
|
int |
getCurrentSessionsCount()
Gets the current number of connected sessions.
|
String |
getDefaultCommandCharacterSet()
Return the Java character set used to encode ftp commands.
|
protected String |
getDefaultCommandCharacterSetKey()
Gets the default command character set.
|
int |
getDefaultPort()
Gets Server's default port.
|
String |
getDescriptiveName()
Gets Server's descriptive name.
|
FdkSession |
getGuestSession()
Get a guest session.
|
protected String |
getHostAddressKey()
Gets the host address key.
|
String |
getHostname()
Get Server Hostname on which it is listening.
|
protected String |
getHostNameKey()
Gets the hostname key.
|
protected String |
getLibraryVersionKey()
Gets the key.
|
Locale |
getLocale()
Gets the Locale.
|
protected String |
getLocalhostKey()
Gets the local host key.
|
IfsLogger |
getLogger()
Gets the appropriate logger for this server.
|
protected IfsLogger |
getLoggerForLegacyLogging()
Gets the IfsLogger to use for legacy logging.
|
int |
getMaximumConnections()
Gets the maximum number of ftp connections allowed.
|
protected String |
getMaximumConnectionsKey()
Gets the maximum connections key.
|
protected String |
getPortKey()
Gets the port key.
|
String |
getResourceString(String key)
Gets the resource string.
|
String |
getResourceString(String key,
Object[] params)
Gets the appropriate resource string.
|
String |
getServerName()
Gets the FTP server's name.
|
protected ServerSocketFactory |
getServerSocketFactory()
Gets the server socket factory.
|
protected String |
getSessionTimeoutKey()
Gets the session timeout key.
|
int |
getSessionTimeoutPeriodProperty()
Gets session timeout property.
|
protected void |
handlePropertyChangeRequest(AttributeValue av)
Handle property change request.
|
protected void |
handlePropertyChangeRequest(LibrarySession session,
String name,
AttributeValue av)
Handle property change request.
|
protected void |
handleStopRequest()
Handle stop request.
|
void |
initialize()
Initializes this Server.
|
boolean |
isAnonymousAllowed()
Whether anonymous login is allowed.
|
boolean |
isPropertyReadonly(String name)
Determine whether a server property is read-only.
|
protected void |
logStartupMsg() |
static void |
main(String[] args)
This is used to run the FtpServer in the standalone mode.
|
protected void |
postRun()
The post-run tasks for this Server.
|
protected void |
preRun()
Pre-run task for this server.
|
protected void |
registerCommands()
Register the Commands that this Server invokes.
|
void |
releaseGuestSession(FdkSession fdksession)
Release a guest session
|
void |
removeChannel(int channelSequence)
Record that a Channel is no longer active.
|
void |
removeFtpSession(FtpSession psession)
Removes a FtpSession from the server.
|
protected void |
run()
The run tasks for this Server.
|
protected boolean |
shouldHandlePropertyRequest(String name)
Check whether should handle property request.
|
void |
shutdown()
Shutdown
|
checkSession, connectSession, constructSession, convertTimerInterval, convertTimerInterval, convertTimerInterval, getLastTimerActivation, getNextTimerActivation, getService, getTimerActivationPeriod, getTimerClassName, getTimerConfiguration, handlePriorityChangeRequest, handlePropertyChangeRequest, handleRequest, handleRequests, handleResumeRequest, handleServerStateControllerRequest, handleSuspendRequest, handleTimerExpired, isNonCompeting, isServiceAvailable, isTimerActive, isTokenNonCompeting, postCheckServerStateRequest, postRequest, processEvent, processEvents, queueEvent, resetTimer, restart, resume, serviceAvailabilityCheckNeeded, setPriority, setProperty, setProperty, start, startTimer, stop, stopRequested, stopTimer, suspend, timerExpired, waitForServiceAvailability, waitServer
acquireSession, constructLibrarySessionPool, createServerState, deregister, disconnectSession, getConfigurationOverridesTable, getConfigurationTable, getCredential, getDesiredStatus, getIfsHome, getInitialConfigurationTable, getName, getNode, getNodeName, getOracleHome, getParameterTable, getPriority, getProperties, getProperty, getServerConfigurationName, getServerState, getServerStateValue, getServerType, getServiceName, getSession, getStateTable, getStatus, getSystemUserCredential, handleServerConfigurationOverrideRequest, handleServerStateEvent, initialize, initialize, isAgent, isDisposed, isInitialized, isLogged, log, log, log, releaseSession, releaseSession, setDesiredStatus, setDesiredStatus, setSessionTimeoutPrevented, setStateProperty, setStatus, startStandalone, startStandalone, supportsPriority, supportsSuspendResume, toStatusLabel, toStatusLabel, toStatusLabel, verifyNotDisposed, verifyNotDisposed
protected String m_Version
protected boolean m_AnonymousAllowed
protected String m_Localhost
protected String m_HostName
protected String m_HostAddress
protected InetAddress m_BindAddress
protected String m_LocaleLanguage
protected String m_LocaleCountry
protected Locale m_Locale
protected int m_ControlPort
protected int m_AcceptQueueSize
protected int m_SessionTimeoutPeriod
protected volatile int m_ChannelSequence
protected Hashtable m_Channels
protected Hashtable m_FtpSessions
protected FtpCommandInvoker m_CommandInvoker
protected SecureRandom m_Random
protected ServerSocket m_ControlServerSocket
protected int m_MaximumConnections
protected ResourceBundle m_FtpResources
protected String m_DefaultCommandCharacterSet
public IfsLogger getLogger()
Typically overridden by subclasses to return the IfsLogger associatged with the specific server.
public String getServerName()
public String getDescriptiveName()
public int getDefaultPort()
protected String getPortKey()
protected String getAnonymousAllowedKey()
protected String getLibraryVersionKey()
protected String getSessionTimeoutKey()
protected String getAcceptQueueSizeKey()
protected String getLocalhostKey()
protected String getHostNameKey()
protected String getHostAddressKey()
protected String getMaximumConnectionsKey()
protected String getDefaultCommandCharacterSetKey()
protected String getCommandCharacterSetIsUserCharacterSetKey()
public Locale getLocale()
public FtpCommandInvoker getCommandInvoker()
public InetAddress getBindAddress()
public String getHostname()
public int getControlPort()
public boolean isAnonymousAllowed()
public int getSessionTimeoutPeriodProperty()
public String getBannerText() throws IfsException
IfsException
public int getMaximumConnections()
public int getCurrentSessionsCount()
public String getResourceString(String key)
public String getResourceString(String key, Object[] params)
public String getDefaultCommandCharacterSet() throws IfsException, Exception
IfsException
Exception
public boolean commandCharacterSetIsUserCharacterSet() throws IfsException, Exception
IfsException
Exception
public String getCachePerformance() throws IfsException
IfsException
public String getConnectionPoolPerformance() throws IfsException
IfsException
public void initialize() throws IfsException, Exception
This method is called when the Server is first loaded.
If this method throws an exception, loading of the Server is aborted.
initialize
in class IfsServer
Exception
- if the operation failsIfsException
protected void registerCommands() throws Exception
Exception
public void dispose() throws IfsException
This deregisters the Server to unload it from the iFS node. The Server must already be stopped.
Subclasses that override this method should call
super.dispose()
unless they intend to
veto the dispose request.
dispose
in interface ServerInterface
dispose
in class IfsServer
IfsException
- (IFS-45169) if the operation failsprotected void preRun() throws Exception
protected void run()
Override this method with tasks to be performed by this
Server. This method is called after preRun
each time this Server is started. The server status is
SERVERSTATUS_RUNNING
while this method executes.
When this method terminates (by returning or throwing), the
status is set to SERVERSTATUS_STOPPING
and
postRun
is invoked.
The run
method should provide a loop to dispatch
requests and events.
protected void postRun()
protected void handleStopRequest() throws Exception
handleStopRequest
in class IfsServer
Exception
- if the operation failspublic boolean isPropertyReadonly(String name) throws IfsException
isPropertyReadonly
in interface ServerInterface
isPropertyReadonly
in class IfsServer
name
- the property namesetProperty
IfsException
- (IFS-45176) if the operation failsprotected void clearDerivedProperties() throws Exception
Exception
protected boolean shouldHandlePropertyRequest(String name)
protected final void handlePropertyChangeRequest(AttributeValue av) throws Exception
handlePropertyChangeRequest
in class IfsServer
av
- the property (name and value assumed to be set)Exception
- if the operation failsprotected void handlePropertyChangeRequest(LibrarySession session, String name, AttributeValue av) throws Exception
Exception
protected void establishServerSocket() throws Exception
Exception
protected void closeSocketServer() throws IOException
IOException
protected ServerSocketFactory getServerSocketFactory()
public void removeChannel(int channelSequence)
channelSequence
- the channelpublic Object addFtpSession(FtpSession psession, Long sessid) throws Exception
Exception
public void removeFtpSession(FtpSession psession) throws Exception
Exception
protected FtpServerChannel createChannel(Socket commandSocket, String threadName, int channelSequence, boolean reachedMaximumConnections) throws Exception
Exception
public FdkSession getGuestSession() throws FdkException
FdkException
public void releaseGuestSession(FdkSession fdksession) throws FdkException
FdkException
protected IfsLogger getLoggerForLegacyLogging()
getLoggerForLegacyLogging
in class Server
Copyright © 2023. All rights reserved.