org.objectweb.easybeans.server
Class Embedded

java.lang.Object
  extended by org.objectweb.easybeans.server.Embedded

public class Embedded
extends java.lang.Object

Allows to create an embedded EJB3 server.

Author:
Florent Benoit

Field Summary
private  ServerConfig config
          Configuration of this server.
private  java.util.Map<java.lang.String,EZBContainer> containers
          Map of managed ejb3 containers.
private static JLog logger
          Logger.
private static int SLEEP_VALUE
          Default sleep value (for server loop).
 
Constructor Summary
Embedded()
          Creates a new Embedded server.
It will take default values of configuration.
Embedded(ServerConfig config)
          Creates a new embedded server with a given configuration.
 
Method Summary
private  void configure()
          Configure the server by using the given configuration.
 EZBContainer createContainer(java.io.File archive)
          Creates and adds an ejb3 container to the managed container.
protected  ServerConfig getConfig()
           
 EZBContainer getContainer(java.lang.String id)
          Gets a container managed by this server.
protected  java.util.Map<java.lang.String,EZBContainer> getContainers()
           
static void main(java.lang.String[] args)
          Main method called by default.
 void start()
          Starts the EJB3 server.
 void stop()
          Stops the EJB3 server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SLEEP_VALUE

private static final int SLEEP_VALUE
Default sleep value (for server loop).

See Also:
Constant Field Values

logger

private static JLog logger
Logger.


config

private ServerConfig config
Configuration of this server.


containers

private java.util.Map<java.lang.String,EZBContainer> containers
Map of managed ejb3 containers.

Constructor Detail

Embedded

public Embedded()
Creates a new Embedded server.
It will take default values of configuration.


Embedded

public Embedded(ServerConfig config)
Creates a new embedded server with a given configuration.

Parameters:
config - the server configuration.
Method Detail

start

public void start()
           throws EmbeddedException
Starts the EJB3 server.

Throws:
EmbeddedException - if there is a failure while starting the server.

stop

public void stop()
          throws EmbeddedException
Stops the EJB3 server.

Throws:
EmbeddedException - if container cannot be stopped.

getContainer

public EZBContainer getContainer(java.lang.String id)
Gets a container managed by this server.

Parameters:
id - the container id.
Returns:
the container if it is found, else null.

configure

private void configure()
Configure the server by using the given configuration.


createContainer

public EZBContainer createContainer(java.io.File archive)
Creates and adds an ejb3 container to the managed container.

Parameters:
archive - jar file or exploded archive.
Returns:
the created container.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Main method called by default.

Parameters:
args - the arguments for the main method
Throws:
java.lang.Exception - if failures

getConfig

protected ServerConfig getConfig()
Returns:
the configuration of this server.

getContainers

protected java.util.Map<java.lang.String,EZBContainer> getContainers()
Returns:
the containers managed by this server.