|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.gridsystems.innergrid.api.WrapperConnection
public class WrapperConnection
Connection implementation that wraps another connection, optionally changing one of its fields.
Field Summary |
---|
Fields inherited from interface com.gridsystems.innergrid.api.Connection |
---|
DEFAULT_TIMEOUT, DIME, MIME, MTOM |
Constructor Summary | |
---|---|
WrapperConnection(Connection con,
Credentials cred)
Creates a new wrapper that will use alternative credentials. |
|
WrapperConnection(Connection con,
java.lang.String h,
int p,
boolean secure)
Creates a wrapper around the specified connection, and changes the URL. |
Method Summary | |
---|---|
void |
checkConnection()
Checks that the connection is directed to an open port with the proper protocol. |
void |
close()
Disposes the object and releases kept resources. |
java.lang.String |
getAttachmentFormat()
Gets the attachment format (DIME, MIME or MTOM). |
java.lang.String |
getContextPath()
Gets the connection context path. |
Credentials |
getCredentials()
Gets the credentials for the connection. |
java.lang.String |
getHost()
Gets the Host to connect to. |
int |
getPort()
Gets the port to connect to. |
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()
Checks if the connection is done through SSL. |
void |
manageException(KernelException ke,
int retry)
Manages exceptions (Internal use only). |
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 |
setKeepAliveEnabled(boolean enabled)
Sets the keep-alive control flag value. |
void |
setTimeout(int timeout)
Sets the connection timeout. |
void |
success()
Notifies to the Connection instance that the target API has been reached. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WrapperConnection(Connection con, java.lang.String h, int p, boolean secure) throws KernelException
con
- the connection to wraph
- a string with the remote Server host name or address of the wrapperp
- the remote Server port of the wrappersecure
- a boolean set to true
if a secure protocol(HTTPS)
must be used; false
otherwise
KernelException
- CLT011
if the connection is null
KernelException
- CLT012
if the URL is null
public WrapperConnection(Connection con, Credentials cred) throws KernelException
con
- a connection to wrapcred
- credentials to use
KernelException
- CLT011
if the connection is null
Method Detail |
---|
public java.lang.String getHost()
getHost
in interface Connection
public int getPort()
getPort
in interface Connection
public boolean isSecured()
isSecured
in interface Connection
true
if this connection uses SSL.public java.lang.String getAttachmentFormat()
getAttachmentFormat
in interface Connection
public java.lang.String getContextPath()
By default, Kernel services are located in /kernel/api.
getContextPath
in interface Connection
public int getTimeout()
getTimeout
in interface Connection
public boolean isChunkedTransferEnabled()
This flag is set to true by default.
isChunkedTransferEnabled
in interface Connection
public boolean isKeepAliveEnabled()
isKeepAliveEnabled
in interface Connection
public void setAttachmentFormat(java.lang.String format)
setAttachmentFormat
in interface Connection
format
- The attachment format to usepublic 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 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 void setTimeout(int timeout)
setTimeout
in interface Connection
timeout
- The connection timeout in millisecondspublic 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 void manageException(KernelException ke, int retry) throws KernelException
manageException
in interface Connection
ke
- KernelException capturedretry
- number of retries
KernelException
- the ke
exception if it passes along the
exception without managingpublic void checkConnection() throws KernelException
checkConnection
in interface Connection
KernelException
- CLT060
if the port cannot be reached.public void close()
Connection
close
in interface Connection
Connection.close()
public void success()
Connection
success
in interface Connection
Connection.success()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |