org.objectweb.easybeans.component.joram
Class JoramComponent

java.lang.Object
  extended by org.objectweb.easybeans.component.joram.JoramComponent
All Implemented Interfaces:
EZBComponent, JMSComponent

public class JoramComponent
extends java.lang.Object
implements JMSComponent

Class that start/stop a simple collocated JORAM server. It also creates some initial Topics/Queues.

Author:
Florent Benoit

Field Summary
private static java.lang.String CONN_FACT_NAME
          Connection factory (for external components).
private static java.lang.String DEFAULT_HOST_NAME
          Default hostname.
private static java.lang.String DEFAULT_PERSISTENCE_DIRECTORY
          Default name of the persistence directory (won't be used).
private static int DEFAULT_PORT_NUMBER
          Default port number.
private  java.lang.String host
          Host.
private  javax.naming.InitialContext ictx
          Initial Context.
private static short ID
          ID of the JORAM server.
private  org.objectweb.joram.client.connector.JoramAdapter joramAdapter
          Instance of the resource adapter.
private static JLog logger
          Logger.
private static int MAX_THREADS
          Maximum threads.
private static int MIN_THREADS
          Minimum threads.
private  int port
          Port number.
private static java.lang.String QUEUE_CONN_FACT_NAME
          Queue connection factory (for external components).
private  java.util.List<java.lang.String> queues
          List of queues to create.
private  boolean started
          Server is started ?
private static int THREAD_TIMEOUT
          Thread timeout.
private static java.lang.String TOPIC_CONN_FACT_NAME
          Topic connection factory (for external components).
private  java.util.List<java.lang.String> topics
          List of topics to create.
private static java.lang.String TRANSACTION_PROPERTY
          Transaction property (Set to remove persistence settings : transient).
 
Constructor Summary
JoramComponent()
          Default constructor.
 
Method Summary
private  void connectToCollocated()
          Connect to the collocated server to performg administration tasks.
private  void createConnectionFactories()
          Create connection factories.
private  void createInitialQueues()
          Create the list of the defined queues.
private  void createInitialTopics()
          Create the list of the defined topics.
private  void createQueue(java.lang.String name)
          Creates a queue with a given name.
private  void createTopic(java.lang.String name)
          Creates a topic with a given name.
private  void disconnectFromCollocated()
          Disconnect from the collocated server.
 javax.resource.spi.ResourceAdapter getResourceAdapter()
          Gets the resource adapter instance.
 void init()
          Init method.
This method is called before the start method.
 void setHostname(java.lang.String host)
          Sets the hostname to use.
 void setPort(int port)
          Sets the port number to use.
 void setQueues(java.util.List<java.lang.String> queues)
          Sets the initial queues of the Joram server.
 void setTopics(java.util.List<java.lang.String> topics)
          Sets the initial topics of the Joram server.
 void start()
          Starts a Joram Server without persistence.
 void stop()
          Stops the JORAM server (if started).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static JLog logger
Logger.


QUEUE_CONN_FACT_NAME

private static final java.lang.String QUEUE_CONN_FACT_NAME
Queue connection factory (for external components).

See Also:
Constant Field Values

TOPIC_CONN_FACT_NAME

private static final java.lang.String TOPIC_CONN_FACT_NAME
Topic connection factory (for external components).

See Also:
Constant Field Values

CONN_FACT_NAME

private static final java.lang.String CONN_FACT_NAME
Connection factory (for external components).

See Also:
Constant Field Values

DEFAULT_PORT_NUMBER

private static final int DEFAULT_PORT_NUMBER
Default port number.

See Also:
Constant Field Values

port

private int port
Port number.


DEFAULT_HOST_NAME

private static final java.lang.String DEFAULT_HOST_NAME
Default hostname.

See Also:
Constant Field Values

host

private java.lang.String host
Host.


ID

private static final short ID
ID of the JORAM server.

See Also:
Constant Field Values

TRANSACTION_PROPERTY

private static final java.lang.String TRANSACTION_PROPERTY
Transaction property (Set to remove persistence settings : transient). It avoids the creation of a directory.

See Also:
Constant Field Values

DEFAULT_PERSISTENCE_DIRECTORY

private static final java.lang.String DEFAULT_PERSISTENCE_DIRECTORY
Default name of the persistence directory (won't be used).

See Also:
Constant Field Values

started

private boolean started
Server is started ?


MIN_THREADS

private static final int MIN_THREADS
Minimum threads.

See Also:
Constant Field Values

MAX_THREADS

private static final int MAX_THREADS
Maximum threads.

See Also:
Constant Field Values

THREAD_TIMEOUT

private static final int THREAD_TIMEOUT
Thread timeout.

See Also:
Constant Field Values

joramAdapter

private org.objectweb.joram.client.connector.JoramAdapter joramAdapter
Instance of the resource adapter.


topics

private java.util.List<java.lang.String> topics
List of topics to create.


queues

private java.util.List<java.lang.String> queues
List of queues to create.


ictx

private javax.naming.InitialContext ictx
Initial Context.

Constructor Detail

JoramComponent

public JoramComponent()
Default constructor.

Method Detail

init

public void init()
          throws EZBComponentException
Init method.
This method is called before the start method.

Specified by:
init in interface EZBComponent
Throws:
EZBComponentException - if the initialization has failed.

start

public void start()
           throws EZBComponentException
Starts a Joram Server without persistence.

Specified by:
start in interface EZBComponent
Throws:
EZBComponentException - if start fails

stop

public void stop()
          throws EZBComponentException
Stops the JORAM server (if started).

Specified by:
stop in interface EZBComponent
Throws:
EZBComponentException - if stop is failing

connectToCollocated

private void connectToCollocated()
                          throws JoramException
Connect to the collocated server to performg administration tasks. It needs to be called before any admin task.

Throws:
JoramException - if the connection to the collocated server fails

disconnectFromCollocated

private void disconnectFromCollocated()
Disconnect from the collocated server. It needs to be called when stopping to use admin task.

Throws:
org.objectweb.joram.client.jms.admin.AdminException
java.net.ConnectException

createConnectionFactories

private void createConnectionFactories()
                                throws JoramException
Create connection factories.

Throws:
JoramException - if factories are not created.

createTopic

private void createTopic(java.lang.String name)
                  throws JoramException
Creates a topic with a given name.

Parameters:
name - the topic's name.
Throws:
JoramException - if the topic can't be created

createQueue

private void createQueue(java.lang.String name)
                  throws JoramException
Creates a queue with a given name.

Parameters:
name - the topic's name.
Throws:
JoramException - if the queue can't be created

createInitialTopics

private void createInitialTopics()
                          throws JoramException
Create the list of the defined topics.

Throws:
JoramException - if topics can't be created

createInitialQueues

private void createInitialQueues()
                          throws JoramException
Create the list of the defined queues.

Throws:
JoramException - if queues can't be created

setQueues

public void setQueues(java.util.List<java.lang.String> queues)
Sets the initial queues of the Joram server.

Parameters:
queues - the list of the name of the queues.

setTopics

public void setTopics(java.util.List<java.lang.String> topics)
Sets the initial topics of the Joram server.

Parameters:
topics - the list of the name of the topics.

getResourceAdapter

public javax.resource.spi.ResourceAdapter getResourceAdapter()
Gets the resource adapter instance.

Specified by:
getResourceAdapter in interface JMSComponent
Returns:
resource adapter instance.

setHostname

public void setHostname(java.lang.String host)
Sets the hostname to use.

Parameters:
host - the host to use.

setPort

public void setPort(int port)
Sets the port number to use.

Parameters:
port - the given port.