Access keys

LocalServer

Kind of class: class
Inherits from: BasicClass
Implements:
Author: Simon Wacker, Christoph Atteneder
Classpath: org.as2lib.io.conn.local.server.LocalServer
File last modified: Thursday, 05 May 2005, 17:04:10
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();

Constructor

LocalServer

function LocalServer (
host:String)
Constructs a new LocalServer instance.
Parameters:
host:
the name of this server
Throws:
org.as2lib.env.except.IllegalArgumentException if the passed-in host is null,
undefined or an empty string

Instance methods

addService

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.

Parameters:
serviceProxy:
the proxy that wraps the actual service
Throws:
org.as2lib.env.except.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
See also:

getHost

function getHost (
Void) : String
Returns the host of this server.
Returns:
this host of this server

getServerRegistry

function getServerRegistry (
Returns the currently used server registry.

This is either the server registry set via setServerRegistry or the
default registry returned by the org.as2lib.io.conn.local.LocalConfig.getServerRegistry method.

Returns:
the currently used server registry

getService

function getService (
path:String) : ServerServiceProxy
Returns the service registered with the passed-in path.

null will be returned if:

  • The passed-in path is null or an empty string.
  • There is no service registered with the passed-in path.
Parameters:
path:
the path of the service to return
Returns:
the server service proxy wrapping the actual service

isRunning

function isRunning (
Void) : Boolean
Returns 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 {@ink #stop} method.

Returns:
true if this server is running else false

putService

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 org.as2lib.io.conn.core.server.ServerServiceProxy
instance.

Parameters:
path :
that path to the service on the host
service:
the service to make locally available
Returns:
the newly created server service proxy that wraps service and
path
Throws:
org.as2lib.env.except.IllegalArgumentException if the passed-in path is null,
undefined or an empty string or if the passed-in service is
null or undefined
See also:

removeService

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:

  • The passed-in path is null or an empty string.
  • There is no registered service with the passed-in path.
Parameters:
path:
the path of the service to remove
Returns:
the removed server service proxy wrapping the actual service

run

function run (
Void) : Void
Runs 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.

setServerRegistry

function setServerRegistry (
serverRegistry:ServerRegistry) : Void
Sets a new server registry.

If serverRegistry is null or undefined the
getServerRegistry method will return the default server registry.

Parameters:
serverRegistry:
the new server registry

stop

function stop (
Void) : Void
Stops this server.

This involves stopping all services and removing itself from the server registry.