|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.gridsystems.innergrid.api.AbstractConnection
public abstract class AbstractConnection
Connects to a single server.
Field Summary | |
---|---|
protected java.lang.String |
attachmentFormat
Attachments format. |
protected boolean |
chunkedTransferEnabled
Chunked Transfer encoding control flag. |
protected boolean |
connChecked
Flag that avoid repeating the connection test. |
protected java.lang.String |
contextPath
Web-application context path base. |
protected Credentials |
credentials
The credentials to use. |
static int |
DEFAULT_RETRIES
Default retries. |
protected java.lang.String |
host
Host to connect. |
protected boolean |
keepAliveEnabled
Keep-Alive control flag. |
protected int |
port
Port to connect. |
protected int |
retries
Number of retries. |
protected boolean |
secured
Secured connection. |
protected SSLConnectionInfo |
sslInfo
SSL Connection Info. |
protected java.lang.Object |
sync
To synchronise host, port, and secured access. |
protected int |
timeout
Connection timeout. |
Fields inherited from interface com.gridsystems.innergrid.api.Connection |
---|
DEFAULT_TIMEOUT, DIME, MIME, MTOM |
Constructor Summary | |
---|---|
AbstractConnection(java.lang.String h,
int p,
boolean secure,
SSLConnectionInfo sslinfo,
Credentials credentials)
Creates an instance of the connector to the specified host:port, and using the specified credentials. |
|
AbstractConnection(java.lang.String h,
int p,
java.lang.String ctxPath,
boolean secure,
SSLConnectionInfo sslinfo,
Credentials credentials)
Creates an instance of the connector to the specified host:port, and using the specified credentials. |
Method Summary | |
---|---|
void |
checkConnection()
Checks that the connection is directed to an open port with the proper protocol. |
void |
clearChecks()
Avoids checking the connection data. |
java.lang.String |
getAttachmentFormat()
Gets the attachment format (DIME, MIME or MTOM). |
abstract java.lang.String |
getBaseUrl()
Gets the base URL for all API URLs. |
java.lang.String |
getContextPath()
Gets the connection context path. |
Credentials |
getCredentials()
Gets the credentials for the connection. |
java.lang.String |
getHost()
Gets Host to connect. |
int |
getPort()
Gets Port to connect. |
int |
getRetries()
Gets retries. |
SSLConnectionInfo |
getSSLConnectionInfo()
Obtain additional information to establish SSL connection. |
int |
getTimeout()
Gets the connection timeout. |
java.net.URL |
getUrl(java.lang.String apiName)
Gets a target URL to the SOAP service for the specified API (Internal use only). |
boolean |
isChunkedTransferEnabled()
Gets the value of the chunked transfer control flag. |
boolean |
isKeepAliveEnabled()
Gets the keep-alive control flag value. |
boolean |
isSecured()
Use a secured connection. |
abstract void |
manageException(KernelException ke,
int retry)
Manage Exceptions. |
void |
setAttachmentFormat(java.lang.String format)
Sets the attachment format (DIME, MIME or MTOM). |
void |
setChunkedTransferEnabled(boolean enabled)
Enables or disables chunked transfer encoding (it is enabled by default). |
void |
setContextPath(java.lang.String ctxPath)
Sets the context path template. |
void |
setKeepAliveEnabled(boolean enabled)
Sets the keep-alive control flag value. |
void |
setRetries(int retries)
Sets retires. |
void |
setTimeout(int timeout)
Sets the connection timeout. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.gridsystems.innergrid.api.Connection |
---|
close, success |
Field Detail |
---|
public static final int DEFAULT_RETRIES
protected java.lang.String host
protected int port
protected java.lang.String contextPath
protected boolean secured
protected SSLConnectionInfo sslInfo
protected Credentials credentials
protected int timeout
protected boolean chunkedTransferEnabled
protected boolean keepAliveEnabled
protected java.lang.String attachmentFormat
protected int retries
protected boolean connChecked
protected java.lang.Object sync
Constructor Detail |
---|
public AbstractConnection(java.lang.String h, int p, java.lang.String ctxPath, boolean secure, SSLConnectionInfo sslinfo, Credentials credentials)
h
- The remote server host name or addressp
- The remote server portctxPath
- Context path basesecure
- Whether to use a secure protocol(HTTPS) or notsslinfo
- Additional info to establish SSL connectioncredentials
- The user name.public AbstractConnection(java.lang.String h, int p, boolean secure, SSLConnectionInfo sslinfo, Credentials credentials)
h
- The remote server host name or addressp
- The remote server portsecure
- Whether to use a secure protocol(HTTPS) or notsslinfo
- Additional info to establish SSL connectioncredentials
- The user name.Method Detail |
---|
public java.lang.String getHost()
getHost
in interface Connection
public int getPort()
getPort
in interface Connection
public java.lang.String getContextPath()
By default, Kernel services are located in /kernel/api.
getContextPath
in interface Connection
public void setContextPath(java.lang.String ctxPath)
ctxPath
- Templatepublic boolean isSecured()
isSecured
in interface Connection
public int getTimeout()
getTimeout
in interface Connection
public void setTimeout(int timeout)
setTimeout
in interface Connection
timeout
- The connection timeout in millisecondspublic boolean isChunkedTransferEnabled()
This flag is set to true by default.
isChunkedTransferEnabled
in interface Connection
public void setChunkedTransferEnabled(boolean enabled)
This flag must be set to false when connecting to servers that do not support this transfer encoding. In particular, simple servers used by MUSE for event notification require this flag to be disabled.
Embedded servers used during unit tests will usually require this encoding to be disabled too.
setChunkedTransferEnabled
in interface Connection
enabled
- The new flag valuepublic boolean isKeepAliveEnabled()
isKeepAliveEnabled
in interface Connection
public void setKeepAliveEnabled(boolean enabled)
Keep-alive is disabled by default for scalability reasons. However, if several calls must be performed in a short time period, enabling it can drastically improve the performance.
setKeepAliveEnabled
in interface Connection
enabled
- The new flag valuepublic java.lang.String getAttachmentFormat()
getAttachmentFormat
in interface Connection
public void setAttachmentFormat(java.lang.String format)
setAttachmentFormat
in interface Connection
format
- The attachment format to usepublic int getRetries()
public void setRetries(int retries)
retries
- New value for retriespublic java.net.URL getUrl(java.lang.String apiName) throws KernelException
getUrl
in interface Connection
apiName
- the name of the API
KernelException
- CLT008
if the resulting URL is invalidpublic Credentials getCredentials()
getCredentials
in interface Connection
public SSLConnectionInfo getSSLConnectionInfo()
public abstract java.lang.String getBaseUrl() throws KernelException
KernelException
- If the URL is not well formedpublic abstract void manageException(KernelException ke, int retry) throws KernelException
manageException
in interface Connection
ke
- KernelException capturedretry
- Number of retry
KernelException
- Throws ke exception if do not desire retry.public final void clearChecks()
When the connection is used the first time, it performs a test to find out if the data (specially the protocol used) is right. Calling this method avoids calling the tests, improving the connection performance for that first time.
public final void checkConnection() throws KernelException
checkConnection
in interface Connection
KernelException
- CLT060
if the port cannot be reached.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |