Server
LocalServer acts as a composite for many services that are all combined
in one domain.
Example:
var server:LocalServer = new LocalServer("local.as2lib.org");
server.putService("myServiceOne", new MyServiceOne());
server.putService("myServiceTwo", new MyServiceTwo());
server.run();
new LocalServer()public function LocalServer(host:String)
Constructs a new LocalServer instance.
host | the name of this server |
| IllegalArgumentException | if the passed-in host is null,
undefined or an empty string
|
public function getServerRegistry(Void):ServerRegistryReturns the currently used server registry.
This is either the server registry set via setServerRegistry or the default registry returned by the LocalConfig.getServerRegistry method.
the currently used server registry
public function setServerRegistry(serverRegistry:ServerRegistry):VoidSets a new server registry.
If serverRegistry is null or undefined the
getServerRegistry method will return the default server registry.
serverRegistry | the new server registry |
public function run(Void):VoidRuns this server.
This involves registering itself at the server registry and running all added services with this host.
If this server is already running a restart will be made. This means it will be stopped and run again.
public function stop(Void):VoidStops this server.
This involves stopping all services and removing itself from the server registry.
public function putService(path:String, service):ServerServiceProxy
Puts the passed-in service to the passed-in path on this server.
service and path are wrapped in a ServerServiceProxy
instance.
path | that path to the service on the host |
service | the service to make locally available |
the newly created server service proxy that wraps service and
path
| IllegalArgumentException | if the passed-in path is null,
undefined or an empty string or if the passed-in service is
null or undefined
|
putService() in org.as2lib.io.conn.core.server.Server
public function addService(serviceProxy:ServerServiceProxy):Void
Adds the passed-in serviceProxy to this service.
If this server is running, the serviceProxy will be run immediately
too.
serviceProxy | the proxy that wraps the actual service |
| IllegalArgumentException | if the passed-in serviceProxy is
null or undefined or if the path of the passed-in serviceProxy
is null, undefined or an empty string or if the path of the passed-in
serviceProxy is already in use
|
addService() in org.as2lib.io.conn.core.server.Server
public function removeService(path:String):ServerServiceProxy
Removes the service registered wiht the passed-in path.
If the service is running it will be stopped.
null will be returned if:
path is null or an empty string. path.path | the path of the service to remove |
the removed server service proxy wrapping the actual service
public function getService(path:String):ServerServiceProxy
Returns the service registered with the passed-in path.
null will be returned if:
path is null or an empty string. path.path | the path of the service to return |
the server service proxy wrapping the actual service
public function isRunning(Void):BooleanReturns whether this server is running.
This server is by default not running. It runs as soon as you call the run method. And stops when you call the method.
true if this server is running else false