Package com.zeroc.Glacier2
Class SessionFactoryHelper
java.lang.Object
com.zeroc.Glacier2.SessionFactoryHelper
A helper class for using Glacier2 with GUI applications.
Applications should create a session factory for each Glacier2 router to which the application will
connect. To connect with the Glacier2 router, call
connect(). The callback object is
notified of the various life cycle events. Once the session is torn down for whatever reason, the application
can use the session factory to create another connection.-
Constructor Summary
ConstructorsConstructorDescriptionSessionFactoryHelper(SessionCallback callback) Creates a SessionFactory object.SessionFactoryHelper(com.zeroc.Ice.InitializationData initData, SessionCallback callback) Creates a SessionFactory object.SessionFactoryHelper(com.zeroc.Ice.Properties properties, SessionCallback callback) Creates a SessionFactory object. -
Method Summary
Modifier and TypeMethodDescriptionconnect()Connects to the Glacier2 router using the associated SSL credentials.Connect the Glacier2 session using user name and password credentials.com.zeroc.Ice.InitializationDataReturns the initialization data used to initialize the communicator.intgetPort()Returns the Glacier2 router port to connect to.Returns the protocol that will be used by the session factory to establish the connection.Returns the host on which the Glacier2 router runs.com.zeroc.Ice.IdentityReturns the object identity of the Glacier2 router.booleanDeprecated.deprecated, use SessionFactoryHelper.getProtocol insteadintReturns the connect and connection timeout associated with the Glacier2 router.booleanIndicates whether a newly-created session will also create an object adapter that the client can use for receiving callbacks.voidsetConnectContext(Map<String, String> context) Sets the request context to use while establishing a connection to the Glacier2 router.voidsetPort(int port) Sets the Glacier2 router port to connect to.voidsetProtocol(String protocol) Sets the protocol that will be used by the session factory to establish the connection.voidsetRouterHost(String hostname) Sets the host on which the Glacier2 router runs.voidsetRouterIdentity(com.zeroc.Ice.Identity identity) Set the router object identity.voidsetSecure(boolean secure) Deprecated.deprecated, use SessionFactoryHelper.setProtocol insteadvoidsetTimeout(int timeoutMillisecs) Sets the connect and connection timeout for the Glacier2 router.voidsetUseCallbacks(boolean useCallbacks) Determines whether the session should create an object adapter that the client can use for receiving callbacks.
-
Constructor Details
-
SessionFactoryHelper
Creates a SessionFactory object.- Parameters:
callback- The callback object for notifications.- Throws:
com.zeroc.Ice.InitializationException- If a failure occurred while initializing the communicator.
-
SessionFactoryHelper
public SessionFactoryHelper(com.zeroc.Ice.InitializationData initData, SessionCallback callback) throws com.zeroc.Ice.InitializationException Creates a SessionFactory object.- Parameters:
initData- The initialization data to use when creating the communicator.callback- The callback object for notifications.- Throws:
com.zeroc.Ice.InitializationException- If a failure occurred while initializing the communicator.
-
SessionFactoryHelper
public SessionFactoryHelper(com.zeroc.Ice.Properties properties, SessionCallback callback) throws com.zeroc.Ice.InitializationException Creates a SessionFactory object.- Parameters:
properties- The properties to use when creating the communicator.callback- The callback object for notifications.- Throws:
com.zeroc.Ice.InitializationException- If a failure occurred while initializing the communicator.
-
-
Method Details
-
setRouterIdentity
public void setRouterIdentity(com.zeroc.Ice.Identity identity) Set the router object identity.- Parameters:
identity- The Glacier2 router's identity.
-
getRouterIdentity
public com.zeroc.Ice.Identity getRouterIdentity()Returns the object identity of the Glacier2 router.- Returns:
- The Glacier2 router's identity.
-
setRouterHost
Sets the host on which the Glacier2 router runs.- Parameters:
hostname- The host name (or IP address) of the router host.
-
getRouterHost
Returns the host on which the Glacier2 router runs.- Returns:
- The Glacier2 router host.
-
setSecure
Deprecated.deprecated, use SessionFactoryHelper.setProtocol insteadSets whether to connect with the Glacier2 router securely.- Parameters:
secure- Iftrue, the client connects to the router via SSL; otherwise, the client connects via TCP.
-
getSecure
Deprecated.deprecated, use SessionFactoryHelper.getProtocol insteadReturns whether the session factory will establish a secure connection to the Glacier2 router.- Returns:
- The secure flag.
-
setProtocol
Sets the protocol that will be used by the session factory to establish the connection.- Parameters:
protocol- The communication protocol.
-
getProtocol
Returns the protocol that will be used by the session factory to establish the connection.- Returns:
- The protocol.
-
setTimeout
public void setTimeout(int timeoutMillisecs) Sets the connect and connection timeout for the Glacier2 router.- Parameters:
timeoutMillisecs- The timeout in milliseconds. A zero or negative timeout value indicates that the router proxy has no associated timeout.
-
getTimeout
public int getTimeout()Returns the connect and connection timeout associated with the Glacier2 router.- Returns:
- The timeout.
-
setPort
public void setPort(int port) Sets the Glacier2 router port to connect to.- Parameters:
port- The port. If 0, then the default port (4063 for TCP or 4064 for SSL) is used.
-
getPort
public int getPort()Returns the Glacier2 router port to connect to.- Returns:
- The port.
-
getInitializationData
public com.zeroc.Ice.InitializationData getInitializationData()Returns the initialization data used to initialize the communicator.- Returns:
- The initialization data.
-
setConnectContext
Sets the request context to use while establishing a connection to the Glacier2 router.- Parameters:
context- The request context.
-
setUseCallbacks
public void setUseCallbacks(boolean useCallbacks) Determines whether the session should create an object adapter that the client can use for receiving callbacks.- Parameters:
useCallbacks- True if the session should create an object adapter.
-
getUseCallbacks
public boolean getUseCallbacks()Indicates whether a newly-created session will also create an object adapter that the client can use for receiving callbacks.- Returns:
- True if the session will create an object adapter.
-
connect
Connects to the Glacier2 router using the associated SSL credentials. Once the connection is established,SessionCallback.connected(com.zeroc.Glacier2.SessionHelper)is called on the callback object; upon failure,SessionCallback.connectFailed(com.zeroc.Glacier2.SessionHelper, java.lang.Throwable)is called with the exception.- Returns:
- The connected session.
-
connect
Connect the Glacier2 session using user name and password credentials. Once the connection is established,SessionCallback.connected(com.zeroc.Glacier2.SessionHelper)is called on the callback object; upon failure,SessionCallback.connectFailed(com.zeroc.Glacier2.SessionHelper, java.lang.Throwable)is called with the exception.- Parameters:
username- The user name.password- The password.- Returns:
- The connected session.
-