public abstract class NetworkServer extends Object
Base class for server implementations for different protocols.
Modifier and Type | Field and Description |
---|---|
protected static int |
SHUTDOWN_TIMEOUT |
Constructor and Description |
---|
NetworkServer(String proto,
ServerConfiguration config)
Class constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addServerListener(ServerListener l)
Add a server listener to this server
|
void |
addSessionListener(SessionListener l)
Add a new session listener to the network server.
|
void |
clearException()
Clear the stored server exception
|
SharedDevice |
findShare(String host,
String name,
int typ,
SrvSession sess,
boolean create)
Find the shared device with the specified name.
|
protected void |
fireServerEvent(int event)
Fire a server event to the registered listener
|
protected void |
fireSessionClosedEvent(SrvSession sess)
Trigger a closed session event to all registered session listeners.
|
protected void |
fireSessionLoggedOnEvent(SrvSession sess)
Trigger a new session event to all registered session listeners.
|
protected void |
fireSessionOpenEvent(SrvSession sess)
Trigger a new session event to all registered session listeners.
|
AccessControlManager |
getAccessControlManager()
Return the access control manager
|
ServerConfiguration |
getConfiguration()
Return the server configuration.
|
Exception |
getException()
Return the stored exception
|
SharedDeviceList |
getFullShareList(String host,
SrvSession sess)
Return the complete shared device list.
|
GlobalConfigSection |
getGlobalConfiguration()
Return the global configuration
|
String |
getProtocolName()
Return the server protocol name
|
SecurityConfigSection |
getSecurityConfiguration()
Return the security configuration
|
InetAddress[] |
getServerAddresses()
Return the list of IP addresses that the server is bound to.
|
SharedDeviceList |
getShareList(String host,
SrvSession sess)
Return the available shared device list.
|
ShareMapper |
getShareMapper()
Return the share mapper
|
boolean |
hasAccessControlManager()
Determine if an access control manager is configured
|
boolean |
hasDebug()
Determine if debug output is enabled
|
boolean |
hasDebugFlag(int flg)
Determine if the specified debug flag is enabled
|
boolean |
hasException()
Check if there is a stored server exception
|
boolean |
hasShutdown()
Check if the shutdown flag is set
|
boolean |
isActive()
Determine if the server is active.
|
boolean |
isEnabled()
Determine if the server is enabled
|
String |
isVersion()
Return the server version string, in 'n.n.n' format
|
void |
removeServerListener(ServerListener l)
Remove the server listener
|
void |
removeSessionListener(SessionListener l)
Remove a session listener from the network server.
|
protected void |
setActive(boolean active)
Set/clear the server active flag
|
protected void |
setDebug(boolean dbg)
Enable/disable debug output for the server
|
protected void |
setDebugFlags(int flags)
Set the debug flags
|
protected void |
setEnabled(boolean ena)
Set/clear the server enabled flag
|
protected void |
setException(Exception ex)
Set the stored server exception
|
protected void |
setServerAddresses(InetAddress[] addrs)
Set the addresses that the server is bound to
|
protected void |
setShutdown(boolean ena)
Set/clear the shutdown flag
|
protected void |
setVersion(String ver)
Set the server version
|
abstract void |
shutdownServer(boolean immediate)
Shutdown the network server
|
abstract void |
startServer()
Start the network server
|
protected static final int SHUTDOWN_TIMEOUT
public NetworkServer(String proto, ServerConfiguration config)
proto
- Stringconfig
- ServerConfigurationpublic final ServerConfiguration getConfiguration()
public final boolean hasAccessControlManager()
public final AccessControlManager getAccessControlManager()
public final InetAddress[] getServerAddresses()
public final ShareMapper getShareMapper()
public final SharedDeviceList getShareList(String host, SrvSession sess)
host
- Stringsess
- SrvSessionpublic final SharedDeviceList getFullShareList(String host, SrvSession sess)
host
- Stringsess
- SrvSessionpublic final GlobalConfigSection getGlobalConfiguration()
public final SecurityConfigSection getSecurityConfiguration()
public final SharedDevice findShare(String host, String name, int typ, SrvSession sess, boolean create) throws Exception
host
- Host name from the UNC pathname
- Name of the shared device to find.typ
- Shared device typesess
- Session detailscreate
- Create share flag, false indicates lookup onlyException
public final boolean isActive()
public final boolean isEnabled()
public final String isVersion()
public final boolean hasException()
public final Exception getException()
public final void clearException()
public final String getProtocolName()
public final boolean hasDebug()
public final boolean hasDebugFlag(int flg)
public final boolean hasShutdown()
protected void setActive(boolean active)
active
- booleanprotected void setEnabled(boolean ena)
ena
- booleanprotected final void setException(Exception ex)
ex
- Exceptionprotected final void setServerAddresses(InetAddress[] addrs)
addrs
- InetAddress[]protected final void setVersion(String ver)
ver
- Stringprotected final void setDebug(boolean dbg)
dbg
- booleanprotected final void setDebugFlags(int flags)
flags
- intprotected final void setShutdown(boolean ena)
ena
- booleanpublic final void addServerListener(ServerListener l)
l
- ServerListenerpublic final void removeServerListener(ServerListener l)
l
- ServerListenerpublic final void addSessionListener(SessionListener l)
l
- SessionListenerpublic final void removeSessionListener(SessionListener l)
l
- SessionListenerprotected final void fireServerEvent(int event)
event
- intpublic abstract void startServer()
public abstract void shutdownServer(boolean immediate)
immediate
- booleanprotected final void fireSessionClosedEvent(SrvSession sess)
sess
- SrvSessionprotected final void fireSessionLoggedOnEvent(SrvSession sess)
sess
- SrvSessionprotected final void fireSessionOpenEvent(SrvSession sess)
sess
- SrvSessionCopyright © 2005–2018 Alfresco Software. All rights reserved.