com.metamatrix.jdbc
Class EmbeddedConnectionFactoryImpl

java.lang.Object
  extended by com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl
All Implemented Interfaces:
ServerConnectionFactory
Direct Known Subclasses:
Server

public class EmbeddedConnectionFactoryImpl
extends java.lang.Object
implements ServerConnectionFactory

A factory class which creates the connections to the embedded DQP instance. This is also responsible for initializing the DQP if the DQP instance is not already alive.


Constructor Summary
EmbeddedConnectionFactoryImpl()
           
 
Method Summary
 ServerConnection createConnection(java.util.Properties connectionProperties)
          Establish a connection to the server.
 ApplicationService findService(java.lang.String type)
           
 java.net.InetAddress getAddress()
           
 org.teiid.dqp.internal.process.DQPCore getDQP()
           
 JMXUtil getJMXServer()
           
 MMProcess getProcess()
           
 long getStartTime()
           
 void initialize(java.util.Properties props)
          When the DQP is restarted using the admin API, it only shuts it down, it gets restarted when the next time connection is made, however this factory may be holding on to a previous transport handler, so we need to check if the DQP is still alive and create a new one if necessary.
 boolean isAlive()
          Is the connection factory alive
 boolean shouldRestart()
           
 void shutdown(boolean restart)
          A shutdown could happen when somebody calls stop/restart on DQP or in normal course of process, we may have just closed the last connection in both cases we want to handle the situation of graceful/proper shutdown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmbeddedConnectionFactoryImpl

public EmbeddedConnectionFactoryImpl()
Method Detail

createConnection

public ServerConnection createConnection(java.util.Properties connectionProperties)
                                  throws CommunicationException,
                                         ConnectionException
Description copied from interface: ServerConnectionFactory
Establish a connection to the server.

Specified by:
createConnection in interface ServerConnectionFactory
Returns:
A connection, never null
Throws:
CommunicationException - If an error occurs in connecting, typically due to problems with the connection properties (bad user name, bad password, bad host name, etc)
ConnectionException - If an error occurs communicating between client and server

initialize

public void initialize(java.util.Properties props)
                throws MetaMatrixCoreException
When the DQP is restarted using the admin API, it only shuts it down, it gets restarted when the next time connection is made, however this factory may be holding on to a previous transport handler, so we need to check if the DQP is still alive and create a new one if necessary.

Specified by:
initialize in interface ServerConnectionFactory
Parameters:
props -
Throws:
ApplicationInitializationException
MetaMatrixCoreException
Since:
4.3

getAddress

public java.net.InetAddress getAddress()

isAlive

public boolean isAlive()
Description copied from interface: ServerConnectionFactory
Is the connection factory alive

Specified by:
isAlive in interface ServerConnectionFactory
Returns:
true if alive; false otherwise.

getStartTime

public long getStartTime()

getDQP

public org.teiid.dqp.internal.process.DQPCore getDQP()

findService

public ApplicationService findService(java.lang.String type)

shutdown

public void shutdown(boolean restart)
A shutdown could happen when somebody calls stop/restart on DQP or in normal course of process, we may have just closed the last connection in both cases we want to handle the situation of graceful/proper shutdown.

Specified by:
shutdown in interface ServerConnectionFactory
See Also:
com.metamatrix.jdbc.EmbeddedConnectionFactory#shutdown()

getJMXServer

public JMXUtil getJMXServer()

getProcess

public MMProcess getProcess()

shouldRestart

public boolean shouldRestart()


Copyright © 2009. All Rights Reserved.