org.objectweb.easybeans.jms.joram
Class JoramService

java.lang.Object
  extended by org.objectweb.easybeans.jms.joram.JoramService

public class JoramService
extends java.lang.Object

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_PERSISTENCE_DIRECTORY
          Default name of the persistence directory (won't be used).
private static int DEFAULT_PORT_NUMBER
          Default port number.
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 int MAX_THREADS
          Maximum threads.
private static int MIN_THREADS
          Minimum threads.
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
JoramService()
          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 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

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

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

JoramService

public JoramService()
Default constructor.

Method Detail

start

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

Throws:
JoramException - if start fails

stop

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

Throws:
JoramException - 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.

Returns:
resource adapter instance.