public abstract class IfsProtocolServer extends IfsServer
IfsServer.ServerRequest
Modifier and Type | Field and Description |
---|---|
static String |
LOCALE_COUNTRY
Locale Country
|
static String |
LOCALE_LANGUAGE
Locale Language
|
static String |
LOCALE_VARIANT
Locale Variant
|
static String |
LOCALHOST_DEFAULT |
protected int |
m_AcceptQueueSize |
protected boolean |
m_AnonymousAllowed |
protected String |
m_AnonymousName |
protected Stack |
m_AnonymousPool
anonymous session pool
|
protected int |
m_AnonymousPoolsize |
protected InetAddress |
m_BindAddress |
protected Hashtable |
m_Channels
Session table; hashed by channel sequnece.
|
protected int |
m_ChannelSequence
Channel sequence number
|
protected CommandInvoker |
m_Commands
Command table
|
protected int |
m_ControlPort |
protected ServerSocket |
m_ControlSocketServer
The control ServerSocket object.
|
protected String |
m_DateFormat |
protected String |
m_Delimiter |
protected String |
m_HostAddress |
protected String |
m_HostName |
protected long |
m_LastStaleSessionRemoval |
protected Locale |
m_Locale |
protected String |
m_LocaleCountry |
protected String |
m_LocaleLanguage |
protected String |
m_LocaleVariant |
protected String |
m_Localhost |
protected Localizer |
m_Localizer
the localizer for the Strings
|
protected Hashtable |
m_ProtocolSessions
Hastable of active sessions; hashed by server produced cookie.
|
protected Random |
m_Random
Random number genertor for psession "cookies"
|
protected long |
m_SessionStateTimeoutPeriod |
protected int |
m_SessionTimeoutPeriod |
protected long |
m_StaleSessionRemovalPeriod |
protected String |
m_Version |
LEVEL_HIGH, LEVEL_LOW, LEVEL_MEDIUM, LEVEL_OFF
SERVERSTATUS_DISPOSED, SERVERSTATUS_RUNNING, SERVERSTATUS_STARTING, SERVERSTATUS_STOPPED, SERVERSTATUS_STOPPING, SERVERSTATUS_SUSPENDED, SERVERSTATUS_UNKNOWN
Constructor and Description |
---|
IfsProtocolServer()
Construct an IfsProtocolServer.
|
Modifier and Type | Method and Description |
---|---|
Object |
addNewProtocolSession(IfsProtocolSession psession)
Adds a new ProtocolSession to the server.
|
protected void |
clearDerivedProperties() |
protected void |
closeSocketServer()
If we have no socket port open we do it here.
|
protected abstract IfsServerChannel |
constructChannel(Socket socket,
int channelKey,
String threadName)
Construct an IfsServerChannel.
|
void |
dispose()
Disposes this Server.
|
protected void |
establishServerSocket(LibrarySession session)
If we have no socket port open we do it here.
|
protected abstract String |
getAcceptQueueSizeKey() |
boolean |
getAnonymousAllowed() |
protected abstract String |
getAnonymousAllowedKey() |
protected abstract String |
getAnonymousPoolsizeKey() |
protected abstract String |
getAnonymousPoolSizeKey() |
LibrarySession |
getAnonymousSession()
Gets an anonymous session.
|
String |
getAnonymousUserName(LibrarySession session)
Gets the name for the anonymous user from a domain propoerty.
|
InetAddress |
getBindAddress()
Get Server's InetAddrees on which it is listening.
|
CommandInvoker |
getCommandInvoker()
Gets the CommandInvoker of the protocol.
|
int |
getControlPort()
Get Server's control port on which it is listening.
|
protected abstract String |
getDateFormatKey() |
String |
getDateFormatProperty() |
abstract int |
getDefaultPort()
Get Server's default port.
|
protected abstract String |
getDelimiterKey() |
String |
getDelimiterProperty() |
abstract String |
getDescriptiveName()
Get Server's descriptive name.
|
protected abstract String |
getHostAddressKey() |
String |
getHostname()
Get Server's Hostname on which it is listening.
|
protected abstract String |
getHostNameKey() |
protected abstract String |
getLastStaleSessionRemovalPeriodKey() |
protected abstract String |
getLibraryVersionKey() |
Locale |
getLocale()
Returns the locale of the protocol server.
|
protected abstract String |
getLocalhostKey() |
protected abstract String |
getPortKey() |
IfsProtocolSession |
getProtocolSession(Object cookie)
Gets a ProtocolSession from the server.
|
String |
getResourceString(String key) |
String |
getResourceString(String key,
Object[] inserts) |
protected ServerSocket |
getServerSocket()
Gets the ServerSocket used by this server for the main
listener.
|
protected abstract String |
getSessionStateTimeoutKey() |
protected abstract String |
getSessionTimeoutKey() |
int |
getSessionTimeoutPeriodProperty() |
protected abstract String |
getStaleSessionRemovalPeriodKey() |
protected void |
handlePropertyChangeRequest(AttributeValue av)
Called when a dynamic property of this Server is set or changed.
|
protected void |
handlePropertyChangeRequest(LibrarySession session,
String name,
AttributeValue av) |
protected void |
handleStopRequest()
Called when this Server is requested to stop.
|
void |
initialize()
Initializes this Server.
|
boolean |
isPropertyReadonly(String name)
Gets whether the specified dynamic property is readonly.
|
protected void |
postAcceptLoop()
This is called after the server accept loop.
|
protected void |
postRun()
The post-run tasks for this Server.
|
protected void |
preAcceptLoop()
This is called prior to the server accept loop.
|
protected void |
preRun()
The pre-run tasks for this Server.
|
protected void |
registerCommand(Object key,
Command cmd,
ArgumentTranslator argTrans,
ResultTranslator resultTrans)
Conviencve method for registers a Command.
|
protected void |
registerCommand(Object key,
String cmdName)
Conviencve method for registers a Command which is an ArgumentTranslator and
a ResultTranslator.
|
protected void |
registerCommand(Object key,
String cmdName,
ArgumentTranslator argTrans,
ResultTranslator resultTrans)
Conviencve method for registers a Command.
|
protected abstract void |
registerCommands(LibrarySession session)
Register the Commands that this Server invokes.
|
void |
releaseAnonymousSession(LibrarySession sess)
Releases an anonymous session.
|
void |
removeChannel(int channelSequence)
Record that a Channel is no longer active.
|
void |
removeProtocolSession(IfsProtocolSession psession)
Removes a ProtocolSession from the server.
|
protected void |
run()
The run tasks for this Server.
|
protected boolean |
shouldHandlePropertyRequest(String name) |
void |
shutdown() |
boolean |
supportsPriority()
Gets whether this Server supports set/get priority.
|
boolean |
supportsSuspendResume()
Gets whether this Server supports suspend/resume.
|
protected void |
useInitializationSession(LibrarySession session) |
checkSession, connectSession, constructSession, convertTimerInterval, convertTimerInterval, convertTimerInterval, getLastTimerActivation, getLogger, 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, getLoggerForLegacyLogging, 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, toStatusLabel, toStatusLabel, toStatusLabel, verifyNotDisposed, verifyNotDisposed
public static final String LOCALHOST_DEFAULT
public static final String LOCALE_LANGUAGE
public static final String LOCALE_COUNTRY
public static final String LOCALE_VARIANT
protected String m_Version
protected boolean m_AnonymousAllowed
protected int m_AnonymousPoolsize
protected String m_AnonymousName
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 String m_LocaleVariant
protected Locale m_Locale
protected int m_ControlPort
protected int m_AcceptQueueSize
protected String m_Delimiter
protected String m_DateFormat
protected int m_SessionTimeoutPeriod
protected long m_SessionStateTimeoutPeriod
protected long m_StaleSessionRemovalPeriod
protected long m_LastStaleSessionRemoval
protected Localizer m_Localizer
protected int m_ChannelSequence
protected Hashtable m_Channels
protected Hashtable m_ProtocolSessions
protected CommandInvoker m_Commands
protected Random m_Random
protected Stack m_AnonymousPool
protected ServerSocket m_ControlSocketServer
public void initialize() throws 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 failspublic 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 useInitializationSession(LibrarySession session) throws Exception
Exception
public boolean supportsSuspendResume()
Server
If false, then suspend
and resume
will result in stop and start instead.
supportsSuspendResume
in interface ServerInterface
supportsSuspendResume
in class Server
public boolean supportsPriority()
Server
If false, then setPriority
and getPriority
will throw an exception.
supportsPriority
in interface ServerInterface
supportsPriority
in class Server
public boolean isPropertyReadonly(String name) throws IfsException
IfsServer
Readonly properties cannot be set using setProperty
.
isPropertyReadonly
in interface ServerInterface
isPropertyReadonly
in class IfsServer
name
- the property namesetProperty
IfsException
- (IFS-45176) if the operation failsprotected void preRun() throws Exception
IfsServer
This method is invoked each time this Server is started.
Unless overridden, no operation is performed by this method.
The Server status is SERVERSTATUS_STARTING
while this method executes. When this method returns, the
status changes to SERVERSTATUS_RUNNING
and
run
is invoked. However, if this method throws,
the status is set to SERVERSTATUS_STOPPING
and
postRun
is invoked.
protected void preAcceptLoop() throws IfsException
if
- the operation failsIfsException
protected void postAcceptLoop() throws IfsException
if
- the operation failsIfsException
protected void run()
IfsServer
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. The canonical form of this loop is:
try { while (!stopRequested()) { try { handleRequests(); if (stopRequested()) { break; } processEvents(); waitServer(); } catch (Throwable t) { s_Logger.log(Level.WARNING, "Exception in dispatch loop", t); } } catch (Throwable t) { s_Logger.log(Level.WARNING, "Run failed", t); } }
protected void postRun()
IfsServer
This method is invoked each time this Server is stopped, whether by the
run
method returning or either the preRun
or
run
methods throwing. Unless overridden, no operation is
performed by this method. While this method executes, the server status
is SERVERSTATUS_STOPPING
. When this method terminates (by
either returning or throwing), the status of the server is set to
SERVERSTATUS_STOPPED
.
protected boolean shouldHandlePropertyRequest(String name)
protected final void handlePropertyChangeRequest(AttributeValue av) throws Exception
IfsServer
This method is called by handleRequests
. Override
it to perform tasks when a dynamic property is set or changed.
If not overridden, this method simply causes the requested
property to be changed.
The handleRequests
method will rethrow any exception
thrown by this method.
A Server may also call this method to set the value of a dynamic
property. Unlike calling setProperty
, calling this
method sets the property's value synchronously, and also allows
the value of a readonly property to be set.
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
public boolean getAnonymousAllowed()
public int getSessionTimeoutPeriodProperty()
public String getDelimiterProperty()
public String getDateFormatProperty()
protected void handleStopRequest() throws Exception
IfsServer
This method is called by handleRequests
. Override it
to perform tasks upon a request to stop. If not overridden, this
method simply causes subsequent calls to stopRequested
to return true
.
The handleRequests
method will rethrow any exception
thrown by this method.
handleStopRequest
in class IfsServer
Exception
- if the operation failsprotected ServerSocket getServerSocket() throws IOException
IOException
protected void establishServerSocket(LibrarySession session) throws Exception
Exception
protected void closeSocketServer() throws IOException
IOException
protected abstract void registerCommands(LibrarySession session) throws IfsException
IfsException
- if the operation failspublic CommandInvoker getCommandInvoker()
protected void registerCommand(Object key, String cmdName, ArgumentTranslator argTrans, ResultTranslator resultTrans) throws IfsException
IfsException
protected void registerCommand(Object key, String cmdName) throws IfsException
IfsException
protected void registerCommand(Object key, Command cmd, ArgumentTranslator argTrans, ResultTranslator resultTrans) throws IfsException
IfsException
public abstract String getDescriptiveName() throws IfsException
IfsException
public abstract int getDefaultPort() throws IfsException
IfsException
protected abstract IfsServerChannel constructChannel(Socket socket, int channelKey, String threadName) throws Exception
IfsException
- if the operation failsException
protected abstract String getPortKey()
protected abstract String getDelimiterKey()
protected abstract String getDateFormatKey()
protected abstract String getAnonymousAllowedKey()
protected abstract String getLibraryVersionKey()
protected abstract String getAnonymousPoolSizeKey()
protected abstract String getSessionTimeoutKey()
protected abstract String getSessionStateTimeoutKey()
protected abstract String getStaleSessionRemovalPeriodKey()
protected abstract String getAcceptQueueSizeKey()
protected abstract String getLocalhostKey()
protected abstract String getLastStaleSessionRemovalPeriodKey()
protected abstract String getHostNameKey()
protected abstract String getHostAddressKey()
protected abstract String getAnonymousPoolsizeKey()
public InetAddress getBindAddress() throws IfsException
IfsException
public String getHostname() throws IfsException
IfsException
public int getControlPort() throws IfsException
IfsException
public void removeChannel(int channelSequence)
channelSequence
- the channelIfsException
- if the operation fails.public Object addNewProtocolSession(IfsProtocolSession psession) throws IfsException
IfsException
public void removeProtocolSession(IfsProtocolSession psession)
public IfsProtocolSession getProtocolSession(Object cookie) throws Exception
Exception
public String getAnonymousUserName(LibrarySession session) throws IfsException
IfsException
public LibrarySession getAnonymousSession() throws IfsException
IfsException
public void releaseAnonymousSession(LibrarySession sess) throws IfsException
IfsException
public Locale getLocale() throws IfsException
IfsException
public String getResourceString(String key) throws IfsException
IfsException
public String getResourceString(String key, Object[] inserts) throws IfsException
IfsException
Copyright © 2023. All rights reserved.