Class org.as2lib.io.conn.local.server.LocalServerRegistry

org.as2lib.core.BasicClass
   +--org.as2lib.io.conn.local.server.LocalServerRegistry

Implemented Interfaces

ServerRegistry

Description

LocalServerRegistry keeps track of running servers.

This means that servers are registered to be aware of all servers that are currently running. The servers are registered in a kind of gloabl registry, even if you instantiate different instances of this class and in different swfs.

Servers are expected to register themselves at this registry when they start running and unregister themselves when they stop running.

Example: var serverRegistry:LocalServerRegistry = new LocalServerRegistry(); serverRegistry.registerServer("local.as2lib.org"); serverRegistry.containsServer("local.as2lib.org"); serverRegistry.removeServer("local.as2lib.org");

As you can see in the above example, not servers are registered but hosts, that represent servers.

Method Index

new LocalServerRegistry()

containsServer(), registerServer(), removeServer()

Inherited from BasicClass

toString()

Constructor Detail

LocalServerRegistry

public function LocalServerRegistry(Void)

Constructs a new LocalServerRegistry instance.

Method Detail

containsServer

public function containsServer(host:String):Boolean

Returns whether a server with the passed-in host is registered in some registry.

This does not mean that the server is registered in this registry. It can be registered in another registry, even in another swf.

Parameters

hostthe host that acts as an identifier for the server

Return

true if the server with the given host is regitered else false

Specified By

containsServer() in org.as2lib.io.conn.core.server.ServerRegistry

registerServer

public function registerServer(host:String):Void

Registers the server with the given host at this server registry.

The server is registered gloablly, that means that registries in other swfs can check whether the server is registered.

Parameters

hostthe host that acts as an identifier for the server

Throws

IllegalArgumentExceptionif host is null, undefined or an empty string
ReservedHostExceptionif a server with the passed-in host is already running

Specified By

registerServer() in org.as2lib.io.conn.core.server.ServerRegistry

removeServer

public function removeServer(host:String):Void

Removes the server with the given host from this server registry.

Only servers that have been registered directly at this registry can be removed.

Parameters

hostthe host that acts as an identifier for the server to remove

Throws

IllegalArgumentExceptionif you try to unregister a server that has not been registered directly at this registry but at another one

Specified By

removeServer() in org.as2lib.io.conn.core.server.ServerRegistry