Class NetServerManager
java.lang.Object
cl.obcom.desktopfx.netserver.NetServerManager
Manages a collection of
NetServerChannels.
Channels are added to this collection using the createChannel method, and they are removed from the collection using the
release method of the channel.
There exists only one NetServerManager, which can be obtain using the
getNetServerManager method.
-
Constructor Summary
ConstructorsConstructorDescriptionNetServerManager(Object owner, Object options) Constructs a newNetServerManagerinstance. -
Method Summary
Modifier and TypeMethodDescriptioncreateChannel(String name, URI netserURI, URI layoutURI, boolean encryptAll, boolean autoLogin) Creates aNetServerChannelindexed byname.createClient(String channelName, String description, DesktopTask task) Creates a NetServer client bound to specified desktop task.getChannel(String channelName) Returns theNetServerChannelindexed by the given name.Returns an unmodifiable collection with allNetServerChannel.booleanReturnstrueif tracing inbound and outbound messages.voidrelease()Closes thisNetServerManager, relinquishing any underlying resources.voidsetTracing(boolean tracing) Enables or disables tracing of inbound and outbound messages.
-
Constructor Details
-
NetServerManager
Constructs a newNetServerManagerinstance.- Parameters:
owner- the owner of this NetServerManager.options- the options of this NetServerManager.- Throws:
NullPointerException- if an argument isnull.IllegalArgumentException- if an argument is invalid.Exception- if another error occurs.
-
-
Method Details
-
isTracing
public boolean isTracing()Returnstrueif tracing inbound and outbound messages.- Returns:
trueif tracing inbound and outbound messages.
-
setTracing
public void setTracing(boolean tracing) Enables or disables tracing of inbound and outbound messages.- Parameters:
tracing- iftruemessages will be traced.
-
getChannels
Returns an unmodifiable collection with allNetServerChannel.- Returns:
- an unmodifiable collection with all
NetServerChannel. - Throws:
IllegalStateException- if this NetServerManager is closed.
-
getChannel
Returns theNetServerChannelindexed by the given name. Returnsnullif the channel is not defined.- Parameters:
channelName- the name of theNetServerChannel.- Returns:
- the channel or
nullif the channel is not defined. - Throws:
NullPointerException- ifchannelNameisnull.IllegalStateException- if this NetServerManager is closed.
-
createClient
Creates a NetServer client bound to specified desktop task.- Parameters:
channelName- the name of the NetServer channel.description- the description of the NetServer client.task- a desktop task instance (can be null).- Returns:
- a new NetServer client bound to specified task.
- Throws:
NullPointerException- if an argument isnull.IllegalArgumentException- if channel does not exist.IllegalStateException- if this NetServerManager is closed.
-
createChannel
public NetServerChannel createChannel(String name, URI netserURI, URI layoutURI, boolean encryptAll, boolean autoLogin) throws Exception Creates aNetServerChannelindexed byname. There can be one oneNetServerChannelwith a given name, so if a channel is already defined with the specifiedname, the existing channel is returned instead of creating a new one.netserURIspecifies the direct or indirect address of OBCOM NetServer. The protocol (scheme) ofnetserURIcan be either "net" for classic connections, or "nets" for SSL/TLS connections. IfnetserURIdoes not specify a protocol, it is interpreted as the relative address of a servlet that comunicates with OBCOM NetServer. In this case,netserURIis converted to an absolute address using the desktop secure codebase. Examples of valid netserURI:net://www.obcom.cl:10104 nets://0.0.0.0:10114 netservlet
layoutURIspecifies the address used to download layouts. IflayoutURIis relative, it is converted to an absolute address using the desktop secure codebase.layoutURImust contain at least one occurrence of the special placeholder character "*". Before each download, all occurrences of this placeholder are replaced with the name of the requieredLayout. Examples of valid layoutURI:layouts/*.jsp http://www.obcom.cl/desktopfx/layouts/*.aspx
- Parameters:
name- the name of theNetServerChannel.netserURI- the server URI of theNetServerChannel.layoutURI- the layout URI of theNetServerChannel.encryptAll- iftrueall messages are sent encrypted.autoLogin- iftruelogin is performed after connecting.- Returns:
- a new
NetServerChannelindexed byname. - Throws:
NullPointerException- if an argument isnull.IllegalArgumentException- if an argument is invalid.Exception- if another error occurs.
-
release
public void release()Closes thisNetServerManager, relinquishing any underlying resources. No other method of thisNetServerManagercan be used after this method has been issued. Calling this method more than once is allowed but has no effect after the first invocation.
-