Package com.kheops.jmap.net
Class JMapBaseNetworkConnection
java.lang.Object
com.kheops.jmap.net.JMapConnection
com.kheops.jmap.net.JMapBaseNetworkConnection
- All Implemented Interfaces:
KSchedulerClient
- Direct Known Subclasses:
JMapNetworkConnection,JMapSrvConnection
Abstract superclass over JMapConnection.
Encapsulates common instructions and functionalities between
JMapNetworkConnection and JMapSrvConnection.- Since:
- 7.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanstatic final intDeprecated.since JMap 3.1.static final intDeprecated.since JMap 3.1.static final intDeprecated.since JMap 3.1.static final intConnection mode constant.static final intConnection mode constant.protected List<JMapConnectionListener> protected intstatic final intstatic final intstatic final intprotected intprotected Stringprotected intstatic final Stringprotected intprotected Stringprotected intprotected Stringstatic final intDeprecated.protected Stringprotected booleanprotected booleanprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConnectionListener(JMapConnectionListener listener) voiddestroy()protected voidfinalize()protected voidfireConnectionActivity(JMapConnectionRequestEvent event, boolean active) protected voidfireConnectionEvent(JMapRequest lastRequest, boolean wasOffline) protected voidfireDisconnectionEvent(JMapRequest lastRequest) booleanabstract booleanabstract booleangoOnline()booleanReturns the state of the auto reconnect.booleanReturns the state of the auto send pending requests.booleanisOpen()booleanReturns the connection state.abstract voidabstract voidabstract voidabstract voidopen(String protocol, String host, int port, int httpPort, String proxyPath, String serverId, int connectionMode) voidvoidschCallback(int jobId) Called by the scheduler to ping the server periodically.voidsetAutoReconnect(boolean autoReconnect) Sets the state of the auto reconnect.voidsetAutoSendPendingRequests(boolean autoSendPendingRequests) Sets the state of the auto send pending requests.voidsetVerbose(boolean verbose) Methods inherited from class com.kheops.jmap.net.JMapConnection
close, executeRequest, executeRequest, isConnected, pingServer, pushRequest
-
Field Details
-
DEFAULT_DIRECT_CONNECTION_TIMEOUT
public static final int DEFAULT_DIRECT_CONNECTION_TIMEOUT- See Also:
-
DEFAULT_PROXY_CONNECTION_TIMEOUT
public static final int DEFAULT_PROXY_CONNECTION_TIMEOUT- See Also:
-
DEFAULT_READ_TIMEOUT
public static final int DEFAULT_READ_TIMEOUT- See Also:
-
READ_TIMEOUT
Deprecated.Use JMapBaseNetworkConnection.DEFAULT_READ_TIMEOUT- See Also:
-
JMAP_PROXY_SERVLET_PATH
- See Also:
-
CONN_PROXY_ALWAYS
Deprecated.since JMap 3.1. UseCONN_PROXYinstead.Connection mode constant. Specifies that the proxy should always be used.- See Also:
-
CONN_DIRECT_ALWAYS
Deprecated.since JMap 3.1. This connection type is no longer supported. The default behavior for the direct connection is to switch for the proxy mode if the connection can't be made. UseCONN_DIRECTinstead.Connection mode constant. Specifies that a direct socket connection should always be used.- See Also:
-
CONN_PROXY_IFNEEDED
Deprecated.since JMap 3.1. UseCONN_DIRECTinstead.Connection mode constant. Specifies that a direct socket connection should tried first but if it fails, proxy should be used.- See Also:
-
CONNECTION_DIRECT
public static final int CONNECTION_DIRECTConnection mode constant. Specifies that a direct socket connection should tried first but if it fails, proxy should be used.- See Also:
-
CONNECTION_PROXY
public static final int CONNECTION_PROXYConnection mode constant. Specifies that the proxy should always be used.- See Also:
-
protocol
-
host
-
proxyPath
-
serverId
-
port
protected int port -
httpPort
protected int httpPort -
directConnectionTimeout
protected int directConnectionTimeout -
proxyConnectionTimeout
protected int proxyConnectionTimeout -
connectionMode
protected int connectionMode -
useProxy
protected boolean useProxy -
workingOffline
protected boolean workingOffline -
autoReconnect
protected boolean autoReconnect -
autoSendPendingRequests
protected boolean autoSendPendingRequests -
connectionListeners
-
verbose
protected boolean verbose
-
-
Constructor Details
-
JMapBaseNetworkConnection
public JMapBaseNetworkConnection()
-
-
Method Details
-
open
- Throws:
Exception
-
open
public abstract void open(String host, int port, String proxyPath, String serverId) throws Exception - Throws:
Exception
-
open
public abstract void open(String host, int port, int httpPort, String proxyPath, String serverId, int connectionMode) throws Exception - Throws:
Exception
-
open
public abstract void open(String protocol, String host, int port, int httpPort, String proxyPath, String serverId, int connectionMode) throws Exception - Throws:
Exception
-
isOpen
public boolean isOpen() -
setVerbose
public void setVerbose(boolean verbose) - Parameters:
verbose- The verbose mode
-
getVerbose
public boolean getVerbose()- Returns:
- Returns the verbose mode
-
addConnectionListener
- Parameters:
listener-
-
removeConnectionListener
-
fireConnectionEvent
-
fireDisconnectionEvent
-
fireConnectionActivity
-
goOffline
public abstract boolean goOffline() -
goOnline
public abstract boolean goOnline() -
isWorkingOffline
public boolean isWorkingOffline()Returns the connection state.- Returns:
- true if offline; false if online
-
isAutoReconnect
public boolean isAutoReconnect()Returns the state of the auto reconnect. Note :falsewill be returned if offline mode is not allowed.- Returns:
- current state
-
setAutoReconnect
public void setAutoReconnect(boolean autoReconnect) Sets the state of the auto reconnect. Is the connection will try to reconnect each time a request is asked? Note : Setting this flag attruehas no effects if the offline mode is not allowed.- Parameters:
autoReconnect-
-
isAutoSendPendingRequests
public boolean isAutoSendPendingRequests()Returns the state of the auto send pending requests.- Returns:
- current state
-
setAutoSendPendingRequests
public void setAutoSendPendingRequests(boolean autoSendPendingRequests) Sets the state of the auto send pending requests. Iftrue, all pending requests will be executed at next reconnection.- Parameters:
autoSendPendingRequests-
-
schCallback
public void schCallback(int jobId) Called by the scheduler to ping the server periodically.- Specified by:
schCallbackin interfaceKSchedulerClient- Parameters:
jobId- the jobId of the job that has been called back
-
destroy
public void destroy() -
finalize
-