public abstract class AbstractGatewayConnection extends java.lang.Object implements GatewayConstants, GatewayConnection, PushNotificationListener, GatewayInterface.GatewayExceptionMonitor
| Modifier and Type | Field and Description |
|---|---|
protected java.beans.PropertyChangeSupport |
changeSupport |
static java.lang.String |
CONNECT_FAIL |
static java.lang.String |
CONNECT_SUCCESS |
static java.lang.String |
CONNECT_UNKNOWN |
static java.lang.String |
CONNECTING |
protected int |
connectTimeout |
protected HttpURL |
currentAddress
The current address that we are communicating with
|
protected java.util.List<HttpURL> |
gatewayAddresses
A list of all gateway addresses that were passed in.
|
protected java.lang.String |
gatewayNodeRole |
protected java.util.TimeZone |
gatewayTimeZone |
static java.lang.String |
GET_ADDRESSES_ERROR |
protected ScopeVersionHash |
hash |
protected int |
httpConcurrency |
static java.lang.String |
INDEPENDENT |
protected LaunchContext |
launchContext |
protected javax.swing.event.EventListenerList |
listenerList |
protected org.apache.log4j.Logger |
log |
static java.util.Map<java.lang.Integer,java.lang.String> |
LOGGER_STATUS_LOOKUP
Used for internal logging ONLY.
|
static java.lang.String |
NEW_ADDRESSES |
static java.lang.String |
NO_NEW_ADDRESSES |
static java.lang.String |
NON_ACTIVE |
protected int |
opcBrowseTimeout |
static java.lang.String |
REDUNDANT_BACKUP |
static java.lang.String |
REDUNDANT_MASTER |
static java.lang.String |
RELOGIN |
protected int |
socketTimeout |
protected boolean |
ssl |
static int |
STATUS_CONNECT_FAIL |
static int |
STATUS_CONNECT_INACTIVE |
static int |
STATUS_CONNECT_UNKNOWN |
static int |
STATUS_CONNECT_WARNING |
static int |
STATUS_CONNECTED |
static int |
STATUS_CONNECTED_INCOMPATIBLE |
static int |
STATUS_CONNECTING |
_DATE_FORMATTER, ARG_MESSAGETYPE, ARG_MODULEID, ATR_INDEX, ATR_LENGTH, ATR_NAME, ATR_TYPE, booleanNull, byteNull, charNull, DATE_FORMAT_STRING, doubleNull, ELM_ARG, ELM_COLLIST, ELM_COLUMN, ELM_COMPRESSEDROWS, ELM_DATA, ELM_ERRORCODE, ELM_ERRORMESSAGE, ELM_EXCLS, ELM_EXMSG, ELM_EXOVERRIDES_TOSTRING, ELM_EXSTRING, ELM_MBODY, ELM_MESSAGE, ELM_MTYPE, ELM_NOTIFICATION, ELM_NOTIFICATIONS, ELM_RESPONSE, ELM_ROW, ELM_ROWS, ELM_SERIALIZED_RESPONSE, ELM_SETCOOKIE, ELM_STACKTRACE, ELM_STELM, ELM_STELM_DECL, ELM_STELM_FILE, ELM_STELM_LINE, ELM_STELM_METH, ERRNO_ASYNC_CALL, ERRNO_ASYNC_CALL_CANCELED, ERRNO_ASYNC_CALL_FAILED, ERRNO_BROWSE_ERROR, ERRNO_COMM_ERROR, ERRNO_CONNECTION_MODE, ERRNO_DBCONNECTION_NAMING, ERRNO_DBCONNECTION_SQL, ERRNO_HISTORY_QUERY_ERROR, ERRNO_INTERNAL, ERRNO_INVALIDARGS, ERRNO_INVOCATION_EXCEPTION, ERRNO_LICENE_RESTRICTED, ERRNO_LOGIN_FAILED, ERRNO_LOGIN_FAILED_LICENSING, ERRNO_NAMING, ERRNO_NO_SESSION, ERRNO_NON_ACTIVE_NODE, ERRNO_NON_MASTER_NODE, ERRNO_NOT_AUTHORIZED, ERRNO_NOTIMP, ERRNO_OK, ERRNO_PARSE, ERRNO_PASSWORD_EXPIRED, ERRNO_PONG, ERRNO_POST_ERROR, ERRNO_RUNTIME_EXPIRED, ERRNO_SQL, ERRNO_SQLTAGS_PROVIDER_DISABLED, ERRNO_SQLTAGS_PROVIDER_FAULTED, ERRNO_SQLTAGS_PROVIDER_LOADING, ERRNO_SQLTAGS_PROVIDER_MISSING, ERRNO_SQLTAGS_SEND_TAGS, ERRNO_SSL_REQUIRED, ERRNO_TIMEOUT, ERRNO_TRIAL_EXPIRED, ERRNO_VERSION_INCOMPATABILITY, ERROR_MESSAGE_TYPE, floatNull, intNull, longNull, MODE_DISCONNECTED, MODE_FULL, MODE_READ_ONLY, MTYPE_COPY_IMAGE, MTYPE_CREATE_IMAGE_FOLDER, MTYPE_CREATE_PROJECT, MTYPE_DBTEST, MTYPE_GET_NEW_RESOURCEID, MTYPE_INVALID, MTYPE_INVOKE_FUNCTION, MTYPE_LIST_AUTHS, MTYPE_LIST_COLS, MTYPE_LIST_DBS, MTYPE_LIST_IMAGES, MTYPE_LIST_MODULES, MTYPE_LIST_ROLES, MTYPE_LIST_SQLTAG_PROVIDERS, MTYPE_LIST_TABLES, MTYPE_LIST_ZONES, MTYPE_PING, MTYPE_PLATFORM_EDITION, MTYPE_PUBLIC_PING, MTYPE_REMOVE_IMAGE, MTYPE_REPORT_ERROR, MTYPE_SEND_EMAIL, MTYPE_SQLTAGS_ADD_SCANCLASS, MTYPE_SQLTAGS_ADD_TAGS, MTYPE_SQLTAGS_EDIT_SCANCLASS, MTYPE_SQLTAGS_EDIT_TAGS, MTYPE_SQLTAGS_ERROR_LIST, MTYPE_SQLTAGS_FSQL_BROWSE, MTYPE_SQLTAGS_FSQL_LIST, MTYPE_SQLTAGS_GET_SCANCLASS, MTYPE_SQLTAGS_LIST, MTYPE_SQLTAGS_META_LIST, MTYPE_SQLTAGS_POLL, MTYPE_SQLTAGS_REMOVE_SCANCLASS, MTYPE_SQLTAGS_REMOVE_TAGS, MTYPE_SQLTAGS_WRITE, MTYPE_STATUS_POLL, MTYPE_UPLOAD_IMAGE, MTYPE_VERSION_CHECK, PROTECT_DIALOG_TYPE, shortNull, WARNING_MESSAGE_TYPE| Modifier | Constructor and Description |
|---|---|
protected |
AbstractGatewayConnection(LaunchContext launchContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectionListener(ConnectionListener listener) |
void |
addConnectionStatusListener(ConnectionStatusListener listener)
Different from the ConnectionListener in the sense that this listener is intended for use in redundant setups,
where the status of the inactive connection must be updated along with the status of the active connection.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l) |
void |
addPropertyChangeListener(java.lang.String propName,
java.beans.PropertyChangeListener l) |
void |
addPushNotificationListener(PushNotificationListener listener) |
void |
connect(java.util.List<HttpURL> gatewayURLs)
Connect to the gateway(s) specified
|
void |
disconnect() |
protected abstract AuthenticatedUser |
doLogin(GatewayInterface gatewayInterface,
java.lang.String projectName,
AuthChallenge challenge) |
protected void |
fireConnectionEvent(java.lang.String message) |
protected void |
fireConnectionEvent(java.lang.String messageLookup,
HttpURL gatewayAddr,
boolean appendGatewayAddr)
Overloaded method to allow a gateway's connection status to be updated.
|
protected void |
fireConnectionEvent(java.lang.String messageLookup,
HttpURL gatewayAddr,
java.lang.Exception ex,
boolean appendGatewayAddr)
Overloaded method to allow a gateway's connection status to be updated.
|
protected void |
firePushNotification(PushNotification n) |
protected void |
fishForAliveServer(boolean reLogin)
Synchronized method- Tests communication with known servers, and sets the gateway interface to the first gateway
that in can connect to.
|
java.util.List<HttpURL> |
getAllAddresses()
Returns a list of all possible Gateway addresses that are known to the client.
|
AuthChallenge |
getAuthChallenge()
The encrypted auth challenge that was used to log in
|
int |
getConnectionMode()
Returns the current connection mode:
MODE_FULL
MODE_READ_ONLY
MODE_DISCONNECTED
|
int |
getConnectTimeout() |
HttpURL |
getGatewayAddress()
Returns the address of the gateway that is currently being communicated with.
|
GatewayInterface |
getGatewayInterface() |
java.lang.String |
getGatewayNodeRole()
Returns the string version of the currently connected gateway's "Node Role", which will be one of:
Independent
Master
Backup
|
java.util.TimeZone |
getGatewayTimeZone() |
java.lang.String |
getGatewayWebURL()
Returns the url to the web portion of the gateway, like "http[s]://<address>:<port>[/context]"
|
int |
getHttpConcurrency()
The number of concurrent HTTP connections allowed.
|
int |
getOpcBrowseTimeout() |
java.lang.String |
getPlatformEdition()
Platform edition.
|
java.lang.String |
getProjectName()
The name of the project that we are currently logged into, if any.
|
java.util.List<java.lang.String> |
getRoles()
The set of roles that the actively logged in user has, if any.
|
java.lang.String |
getScheme()
Returns "http" or "https" depending on our transport scheme
|
protected abstract int |
getScope()
Returns the scope for this connection.
|
java.util.List<java.lang.String> |
getSecurityZones()
The set of security zones that the actively logged in user has, if any.
|
int |
getSocketTimeout() |
java.lang.String |
getUsername()
The username of the actively logged in user, if any.
|
boolean |
isConnected()
Whether or not we are currently supposed to be in a connected state.
|
static boolean |
isConnectionRelated(java.lang.Exception ex) |
boolean |
isConnectionUp() |
boolean |
isLoggedIn() |
boolean |
isSessionValid() |
AuthenticatedUser |
login(java.lang.String projectName,
AuthChallenge challenge) |
void |
logout() |
protected GatewayInterface |
newGatewayInterface(HttpURL addr)
Creates a new GatewayInterface for the given URL, settings its connect and socket timeouts appropriately
|
void |
notifyGatewayException(GatewayException ex) |
protected abstract void |
onVersionMismatch()
Called when the version is detected to have changed on the gateway.
|
void |
receiveNotification(PushNotification notification) |
void |
removeConnectionListener(ConnectionListener listener) |
void |
removeConnectionStatusListener(ConnectionStatusListener listener) |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l) |
void |
removePropertyChangeListener(java.lang.String propName,
java.beans.PropertyChangeListener l) |
void |
removePushNotificationListener(PushNotificationListener listener) |
void |
removePushNotificationListeners(java.lang.Class<?> c)
Removes all PushNotificationListeners that are of same class as the passed class.
|
protected void |
setConnected(boolean connected) |
void |
setConnectionMode(int connectionMode) |
protected void |
setConnectionUp(boolean connectionUp)
Synchronized method
|
void |
setConnectTimeout(int connectTimeout) |
protected void |
setGatewayInterface(GatewayInterface gi)
Sets the new gateway interface, and adds this as a gateway exception listener and a push notification listener.
|
void |
setHttpConcurrency(int concurrency) |
protected void |
setIndependentAddressList(java.util.List<HttpURL> addresses,
boolean reLogin) |
void |
setOpcBrowseTimeout(int opcBrowseTimeout) |
protected void |
setProjectName(java.lang.String projectName) |
void |
setSocketTimeout(int socketTimeout) |
protected java.lang.String |
toString(HttpURL url)
Returns the HttpURL with the correct security scheme, like: "https://myserver:443/ContextPath"
|
void |
triggerConnectionStatusListeners()
Manually update the status of all connection listeners.
|
void |
updateBackupAddresses(java.util.List<HttpURL> list)
Synchronized method
|
void |
updateGatewayMetaInfo()
Updates the gateway timezone and role info
|
void |
updateMasterAddresses(java.util.List<HttpURL> list)
Synchronized method
|
public static final java.lang.String REDUNDANT_MASTER
public static final java.lang.String REDUNDANT_BACKUP
public static final java.lang.String INDEPENDENT
public static final java.lang.String CONNECT_UNKNOWN
public static final java.lang.String CONNECTING
public static final java.lang.String CONNECT_SUCCESS
public static final java.lang.String CONNECT_FAIL
public static final java.lang.String RELOGIN
public static final java.lang.String NON_ACTIVE
public static final java.lang.String NEW_ADDRESSES
public static final java.lang.String NO_NEW_ADDRESSES
public static final java.lang.String GET_ADDRESSES_ERROR
public static final int STATUS_CONNECT_UNKNOWN
public static final int STATUS_CONNECTING
public static final int STATUS_CONNECTED
public static final int STATUS_CONNECT_FAIL
public static final int STATUS_CONNECT_INACTIVE
public static final int STATUS_CONNECTED_INCOMPATIBLE
public static final int STATUS_CONNECT_WARNING
public static final java.util.Map<java.lang.Integer,java.lang.String> LOGGER_STATUS_LOOKUP
protected int connectTimeout
protected int socketTimeout
protected int opcBrowseTimeout
protected int httpConcurrency
protected org.apache.log4j.Logger log
protected java.beans.PropertyChangeSupport changeSupport
protected javax.swing.event.EventListenerList listenerList
protected HttpURL currentAddress
protected java.util.List<HttpURL> gatewayAddresses
protected LaunchContext launchContext
protected boolean ssl
protected java.util.TimeZone gatewayTimeZone
protected java.lang.String gatewayNodeRole
protected ScopeVersionHash hash
protected AbstractGatewayConnection(LaunchContext launchContext)
public void connect(java.util.List<HttpURL> gatewayURLs)
GatewayConnectionconnect in interface GatewayConnectionpublic void disconnect()
disconnect in interface GatewayConnectionprotected void setIndependentAddressList(java.util.List<HttpURL> addresses, boolean reLogin) throws VersionMismatchException
VersionMismatchExceptionprotected GatewayInterface newGatewayInterface(HttpURL addr)
protected abstract int getScope()
public void updateMasterAddresses(java.util.List<HttpURL> list)
public void updateBackupAddresses(java.util.List<HttpURL> list)
protected void fishForAliveServer(boolean reLogin)
throws VersionMismatchException
VersionMismatchExceptionprotected void setGatewayInterface(GatewayInterface gi)
public void updateGatewayMetaInfo()
public java.lang.String getGatewayNodeRole()
GatewayConnectiongetGatewayNodeRole in interface GatewayConnectionprotected abstract AuthenticatedUser doLogin(GatewayInterface gatewayInterface, java.lang.String projectName, AuthChallenge challenge) throws GatewayException
GatewayExceptionpublic AuthenticatedUser login(java.lang.String projectName, AuthChallenge challenge) throws GatewayException
login in interface GatewayConnectionGatewayExceptionpublic void logout()
logout in interface GatewayConnectionprotected void setConnectionUp(boolean connectionUp)
protected abstract void onVersionMismatch()
public void notifyGatewayException(GatewayException ex)
notifyGatewayException in interface GatewayInterface.GatewayExceptionMonitorpublic void receiveNotification(PushNotification notification)
receiveNotification in interface PushNotificationListenerpublic static boolean isConnectionRelated(java.lang.Exception ex)
public int getConnectionMode()
GatewayConnectiongetConnectionMode in interface GatewayConnectionpublic void setConnectionMode(int connectionMode)
setConnectionMode in interface GatewayConnectionpublic java.util.List<HttpURL> getAllAddresses()
GatewayConnectiongetAllAddresses in interface GatewayConnectionpublic HttpURL getGatewayAddress()
GatewayConnectiongetGatewayAddress in interface GatewayConnectionpublic GatewayInterface getGatewayInterface()
getGatewayInterface in interface GatewayConnectionpublic java.lang.String getGatewayWebURL()
GatewayConnectiongetGatewayWebURL in interface GatewayConnectionpublic java.lang.String getScheme()
GatewayConnectiongetScheme in interface GatewayConnectionpublic java.util.TimeZone getGatewayTimeZone()
getGatewayTimeZone in interface GatewayConnectionpublic boolean isConnectionUp()
isConnectionUp in interface GatewayConnectionpublic boolean isSessionValid()
isSessionValid in interface GatewayConnectionpublic boolean isConnected()
isConnected in interface GatewayConnectionprotected void setConnected(boolean connected)
protected java.lang.String toString(HttpURL url)
public void addPushNotificationListener(PushNotificationListener listener)
addPushNotificationListener in interface GatewayConnectionpublic void removePushNotificationListener(PushNotificationListener listener)
removePushNotificationListener in interface GatewayConnectionpublic void removePushNotificationListeners(java.lang.Class<?> c)
removePushNotificationListeners in interface GatewayConnectionc - The type of listener to removeprotected void firePushNotification(PushNotification n)
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
addPropertyChangeListener in interface GatewayConnectionpublic void removePropertyChangeListener(java.beans.PropertyChangeListener l)
removePropertyChangeListener in interface GatewayConnectionpublic void addPropertyChangeListener(java.lang.String propName,
java.beans.PropertyChangeListener l)
addPropertyChangeListener in interface GatewayConnectionpublic void removePropertyChangeListener(java.lang.String propName,
java.beans.PropertyChangeListener l)
removePropertyChangeListener in interface GatewayConnectionpublic void addConnectionListener(ConnectionListener listener)
addConnectionListener in interface GatewayConnectionpublic void removeConnectionListener(ConnectionListener listener)
removeConnectionListener in interface GatewayConnectionprotected void fireConnectionEvent(java.lang.String messageLookup,
HttpURL gatewayAddr,
boolean appendGatewayAddr)
protected void fireConnectionEvent(java.lang.String messageLookup,
HttpURL gatewayAddr,
java.lang.Exception ex,
boolean appendGatewayAddr)
messageLookup - the String to pass to BundleUtil.get(), such as "GatewayConnectionManager.TestingWith"gatewayAddr - the Gateway HttpURL used in the connection eventex - exception that has just occurred. Pass in null if there were no exceptions thrown.protected void fireConnectionEvent(java.lang.String message)
public boolean isLoggedIn()
public java.lang.String getProjectName()
GatewayConnectiongetProjectName in interface GatewayConnectionpublic java.lang.String getUsername()
GatewayConnectiongetUsername in interface GatewayConnectionpublic AuthChallenge getAuthChallenge()
GatewayConnectiongetAuthChallenge in interface GatewayConnectionpublic java.util.List<java.lang.String> getRoles()
GatewayConnectiongetRoles in interface GatewayConnectionpublic java.util.List<java.lang.String> getSecurityZones()
GatewayConnectiongetSecurityZones in interface GatewayConnectionpublic int getConnectTimeout()
getConnectTimeout in interface GatewayConnectionpublic void setConnectTimeout(int connectTimeout)
setConnectTimeout in interface GatewayConnectionpublic int getSocketTimeout()
getSocketTimeout in interface GatewayConnectionpublic void setSocketTimeout(int socketTimeout)
setSocketTimeout in interface GatewayConnectionpublic int getOpcBrowseTimeout()
getOpcBrowseTimeout in interface GatewayConnectionpublic void setOpcBrowseTimeout(int opcBrowseTimeout)
setOpcBrowseTimeout in interface GatewayConnectionpublic int getHttpConcurrency()
GatewayConnectiongetHttpConcurrency in interface GatewayConnectionpublic void setHttpConcurrency(int concurrency)
setHttpConcurrency in interface GatewayConnectionprotected void setProjectName(java.lang.String projectName)
public void addConnectionStatusListener(ConnectionStatusListener listener)
GatewayConnectionaddConnectionStatusListener in interface GatewayConnectionpublic void removeConnectionStatusListener(ConnectionStatusListener listener)
removeConnectionStatusListener in interface GatewayConnectionpublic void triggerConnectionStatusListeners()
GatewayConnectiontriggerConnectionStatusListeners in interface GatewayConnectionpublic java.lang.String getPlatformEdition()
GatewayConnectiongetPlatformEdition in interface GatewayConnection