Class NetServerManager

java.lang.Object
cl.obcom.desktopfx.netserver.NetServerManager

public final class NetServerManager extends Object
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 Details

    • NetServerManager

      public NetServerManager(Object owner, Object options) throws Exception
      Constructs a new NetServerManager instance.
      Parameters:
      owner - the owner of this NetServerManager.
      options - the options of this NetServerManager.
      Throws:
      NullPointerException - if an argument is null.
      IllegalArgumentException - if an argument is invalid.
      Exception - if another error occurs.
  • Method Details

    • isTracing

      public boolean isTracing()
      Returns true if tracing inbound and outbound messages.
      Returns:
      true if tracing inbound and outbound messages.
    • setTracing

      public void setTracing(boolean tracing)
      Enables or disables tracing of inbound and outbound messages.
      Parameters:
      tracing - if true messages will be traced.
    • getChannels

      public Collection<NetServerChannel> getChannels()
      Returns an unmodifiable collection with all NetServerChannel.
      Returns:
      an unmodifiable collection with all NetServerChannel.
      Throws:
      IllegalStateException - if this NetServerManager is closed.
    • getChannel

      public NetServerChannel getChannel(String channelName)
      Returns the NetServerChannel indexed by the given name. Returns null if the channel is not defined.
      Parameters:
      channelName - the name of the NetServerChannel.
      Returns:
      the channel or null if the channel is not defined.
      Throws:
      NullPointerException - if channelName is null.
      IllegalStateException - if this NetServerManager is closed.
    • createClient

      public NetServerClient createClient(String channelName, String description, DesktopTask task)
      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 is null.
      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 a NetServerChannel indexed by name. There can be one one NetServerChannel with a given name, so if a channel is already defined with the specified name, the existing channel is returned instead of creating a new one.

      netserURI specifies the direct or indirect address of OBCOM NetServer. The protocol (scheme) of netserURI can be either " net" for classic connections, or "nets" for SSL/TLS connections. If netserURI does not specify a protocol, it is interpreted as the relative address of a servlet that comunicates with OBCOM NetServer. In this case, netserURI is 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
      layoutURI specifies the address used to download layouts. If layoutURI is relative, it is converted to an absolute address using the desktop secure codebase. layoutURI must 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 requiered Layout. Examples of valid layoutURI:
       layouts/*.jsp
       http://www.obcom.cl/desktopfx/layouts/*.aspx
      Parameters:
      name - the name of the NetServerChannel.
      netserURI - the server URI of the NetServerChannel.
      layoutURI - the layout URI of the NetServerChannel.
      encryptAll - if true all messages are sent encrypted.
      autoLogin - if true login is performed after connecting.
      Returns:
      a new NetServerChannel indexed by name.
      Throws:
      NullPointerException - if an argument is null.
      IllegalArgumentException - if an argument is invalid.
      Exception - if another error occurs.
    • release

      public void release()
      Closes this NetServerManager, relinquishing any underlying resources. No other method of this NetServerManager can be used after this method has been issued. Calling this method more than once is allowed but has no effect after the first invocation.