org.eclipse.ecf.server.generic
Class GenericServerContainerGroup

java.lang.Object
  extended by org.eclipse.ecf.server.generic.GenericServerContainerGroup
All Implemented Interfaces:
IGenericServerContainerGroup

public class GenericServerContainerGroup
extends java.lang.Object
implements IGenericServerContainerGroup

Since:
4.0

Field Summary
 
Fields inherited from interface org.eclipse.ecf.server.generic.IGenericServerContainerGroup
DEFAULT_KEEPALIVE
 
Constructor Summary
GenericServerContainerGroup(java.lang.String hostname, int port, java.util.Map defaultContainerProperties)
           
 
Method Summary
 void close()
          Close this generic server container group.
 ISharedObjectContainer createContainer(java.lang.String path)
          Create a shared object container within this container group, given a path, a keepAlive value, and a Map of properties that will be provided to the created container.
 ISharedObjectContainer createContainer(java.lang.String path, int keepAlive)
          Create a shared object container within this container group, given a path, a keepAlive value, and a Map of properties that will be provided to the created container.
 ISharedObjectContainer createContainer(java.lang.String path, int keepAlive, java.util.Map properties)
          Create a shared object container within this container group, given a path, a keepAlive value, and a Map of properties that will be provided to the created container.
protected  TCPServerSOContainer createGenericServerContainer(java.lang.String path, int keepAlive, java.util.Map properties)
           
protected  ID createGenericServerID(java.lang.String path, java.util.Map properties)
           
protected  java.util.Map createGenericServerProperties(java.lang.String path, java.util.Map properties)
           
 ISharedObjectContainer getContainer(java.lang.String path)
          Get the container instance associated with the given path.
 java.util.Map getContainers()
          Get a map (String->ISharedObjectContainer) of the path->containers previously created.
 java.net.URI getGroupEndpoint()
          Get the URI for the group endpoint.
protected  org.eclipse.ecf.server.generic.GenericServerContainerGroup.GenericServerSOContainerGroup getServerGroup()
           
 boolean isListening()
          Returns true if this container group previously started listening via a successful call to IGenericServerContainerGroup.startListening()).
 ISharedObjectContainer removeContainer(java.lang.String path)
          Remove previously created container with given path.
 void startListening()
          Start listening on the port given to this generic server container group upon creation.
 void stopListening()
          Stop listening on port given to this generic server container group upon creation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericServerContainerGroup

public GenericServerContainerGroup(java.lang.String hostname,
                                   int port,
                                   java.util.Map defaultContainerProperties)
Method Detail

getContainers

public java.util.Map getContainers()
Description copied from interface: IGenericServerContainerGroup
Get a map (String->ISharedObjectContainer) of the path->containers previously created.

Specified by:
getContainers in interface IGenericServerContainerGroup
Returns:
map of the path->container map for this generic server container group. Will not return null, but may return a Map of size==0.

createContainer

public ISharedObjectContainer createContainer(java.lang.String path,
                                              int keepAlive,
                                              java.util.Map properties)
                                       throws ContainerCreateException
Description copied from interface: IGenericServerContainerGroup
Create a shared object container within this container group, given a path, a keepAlive value, and a Map of properties that will be provided to the created container.

Specified by:
createContainer in interface IGenericServerContainerGroup
Parameters:
path - the uri path suffix for defining the container's identity. For example, if IGenericServerContainerGroup.getGroupEndpoint() returns 'ecftcp://localhost:3282', and a path of '/server' is used to create a new container, then the container's id will be 'ecftcp://localhost:3282/server'. Must not be null.
keepAlive - a value (in milliseconds) that defines the keepAlive for the resulting container.
properties - to be associated to the returned container upon instantiation.
Returns:
shared object container. Will not be null.
Throws:
ContainerCreateException - if container with given path, keepAlive, and properties could not be created.

createContainer

public ISharedObjectContainer createContainer(java.lang.String path,
                                              int keepAlive)
                                       throws ContainerCreateException
Description copied from interface: IGenericServerContainerGroup
Create a shared object container within this container group, given a path, a keepAlive value, and a Map of properties that will be provided to the created container.

Specified by:
createContainer in interface IGenericServerContainerGroup
Parameters:
path - the uri path suffix for defining the container's identity. For example, if IGenericServerContainerGroup.getGroupEndpoint() returns 'ecftcp://localhost:3282', and a path of '/server' is used to create a new container, then the container's id will be 'ecftcp://localhost:3282/server'. Must not be null.
keepAlive - a value (in milliseconds) that defines the keepAlive for the resulting container.
Returns:
shared object container. Will not be null.
Throws:
ContainerCreateException - if container with given path, keepAlive, and properties could not be created.

createContainer

public ISharedObjectContainer createContainer(java.lang.String path)
                                       throws ContainerCreateException
Description copied from interface: IGenericServerContainerGroup
Create a shared object container within this container group, given a path, a keepAlive value, and a Map of properties that will be provided to the created container.

Specified by:
createContainer in interface IGenericServerContainerGroup
Parameters:
path - the uri path suffix for defining the container's identity. For example, if IGenericServerContainerGroup.getGroupEndpoint() returns 'ecftcp://localhost:3282', and a path of '/server' is used to create a new container, then the container's id will be 'ecftcp://localhost:3282/server'. Must not be null.
Returns:
shared object container. Will not be null.
Throws:
ContainerCreateException - if container with given path, keepAlive, and properties could not be created.

getServerGroup

protected org.eclipse.ecf.server.generic.GenericServerContainerGroup.GenericServerSOContainerGroup getServerGroup()
Since:
5.1

createGenericServerContainer

protected TCPServerSOContainer createGenericServerContainer(java.lang.String path,
                                                            int keepAlive,
                                                            java.util.Map properties)
                                                     throws ContainerCreateException
Throws:
ContainerCreateException

createGenericServerProperties

protected java.util.Map createGenericServerProperties(java.lang.String path,
                                                      java.util.Map properties)

createGenericServerID

protected ID createGenericServerID(java.lang.String path,
                                   java.util.Map properties)
                            throws ContainerCreateException
Throws:
ContainerCreateException

getContainer

public ISharedObjectContainer getContainer(java.lang.String path)
Description copied from interface: IGenericServerContainerGroup
Get the container instance associated with the given path.

Specified by:
getContainer in interface IGenericServerContainerGroup
Parameters:
path - of the container to return. Must not be null.
Returns:
the previously created shared object container associated with the given path.

removeContainer

public ISharedObjectContainer removeContainer(java.lang.String path)
Description copied from interface: IGenericServerContainerGroup
Remove previously created container with given path.

Specified by:
removeContainer in interface IGenericServerContainerGroup
Parameters:
path - of the shared object container to remove.
Returns:
shared object container removed. If no shared object container was previously created with the given path, then null will be returned.

startListening

public void startListening()
                    throws java.io.IOException
Description copied from interface: IGenericServerContainerGroup
Start listening on the port given to this generic server container group upon creation.

Specified by:
startListening in interface IGenericServerContainerGroup
Throws:
java.io.IOException - if the server port cannot be opened for listening.
See Also:
IGenericServerContainerGroupFactory.createContainerGroup(String, int, Map)

isListening

public boolean isListening()
Description copied from interface: IGenericServerContainerGroup
Returns true if this container group previously started listening via a successful call to IGenericServerContainerGroup.startListening()).

Specified by:
isListening in interface IGenericServerContainerGroup
Returns:
true if currently listening, false otherwise.

stopListening

public void stopListening()
Description copied from interface: IGenericServerContainerGroup
Stop listening on port given to this generic server container group upon creation.

Specified by:
stopListening in interface IGenericServerContainerGroup

close

public void close()
Description copied from interface: IGenericServerContainerGroup
Close this generic server container group. This method will:
  1. iterate through all containers created via IGenericServerContainerGroup.createContainer(String, int, Map) within this group, and for each one:
    1. remove it from the set of containers within this group
    2. call IContainer.dispose()
  2. stop listening on the port given to this generic server container group upon creation.

Specified by:
close in interface IGenericServerContainerGroup

getGroupEndpoint

public java.net.URI getGroupEndpoint()
Description copied from interface: IGenericServerContainerGroup
Get the URI for the group endpoint. For

Specified by:
getGroupEndpoint in interface IGenericServerContainerGroup
Returns:
uri that is the group endpoint. For example uri='ecftcp://localhost:3282'