Package com.streambase.liveview.client
Class LiveViewConnectionFactory
java.lang.Object
com.streambase.liveview.client.LiveViewConnectionFactory
A factory for retrieving a
LiveViewConnection
based on ConnectionConfig
A connection can also be retrieved by provide a simple String based URI.
The URI must have the following syntax:
lv://<host>[:<port>]
The default port, when not provided, is specified by DEFAULT_SERVER_PORT
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic LiveViewConnection
getConnection
(ConnectionConfig config) Retrieves aLiveViewConnection
based on theConnectionConfig
static LiveViewMultiConnection
getConnection
(MultiConnectionConfig config, boolean waitForConnection) Retrieves aLiveViewMultiConnection
based on the givenMultiConnectionConfig
.static LiveViewConnection
getConnection
(String uri) Retrieves aLiveViewConnection
based on a valid URI.
-
Field Details
-
DEFAULT_SERVER_PORT
public static final int DEFAULT_SERVER_PORTThe factory uses this as the default port when not specified in the connect URI: value 11080.- See Also:
-
DEFAULT_SERVER_SSL_PORT
public static final int DEFAULT_SERVER_SSL_PORT- See Also:
-
DEFAULT_HOST
The default server host- See Also:
-
DEFAULT_URI
The default server uri- See Also:
-
-
Method Details
-
getConnection
Retrieves aLiveViewConnection
based on a valid URI.- Parameters:
uri
- valid URI supported by LiveView- Returns:
- A connection to LiveView server
- Throws:
LiveViewException
- if connection cannot be establishedNullPointerException
- if URI is null
-
getConnection
public static LiveViewConnection getConnection(ConnectionConfig config) throws LiveViewException, LiveViewConnectionCanceledException Retrieves aLiveViewConnection
based on theConnectionConfig
- Parameters:
config
- Connection configuration- Returns:
- A connection to LiveView server
- Throws:
LiveViewException
- if a server exception occurs on connectLiveViewConnectionCanceledException
- if user cancels the connection via aProgressMonitor
NullPointerException
- if the configuration URI is null
-
getConnection
public static LiveViewMultiConnection getConnection(MultiConnectionConfig config, boolean waitForConnection) throws LiveViewException Retrieves aLiveViewMultiConnection
based on the givenMultiConnectionConfig
. Note that this call has no declared exceptions, as errors connecting to individual servers are handled internally and available as statuses for each underlyingLiveViewConnectionControl
.Important: see the Javadoc for
LiveViewMultiConnection
for limitations to expect when connect to servers this way.- Parameters:
config
- configuration, identifying the servers you want to connect to, plus some flags that control how you connectwaitForConnection
- true if you want to wait until at least one connection is made before this call returns. If false, this method returns immediately although many operations will throw an exception until a connection is later established.- Returns:
LiveViewMultiConnection
the connection object- Throws:
LiveViewException
- may be thrown on errors. Note that most errors will be reported using the listeners attached to the configuration instead.- Since:
- 2.0
-