Apache CXF API

org.apache.cxf.ws.rm.persistence.jdbc
Class RMTxStore

java.lang.Object
  extended by org.apache.cxf.ws.rm.persistence.jdbc.RMTxStore
All Implemented Interfaces:
RMStore

public class RMTxStore
extends Object
implements RMStore


Field Summary
static String DEFAULT_DATABASE_NAME
           
 
Constructor Summary
RMTxStore()
           
 
Method Summary
protected  void abort()
           
protected  void abort(Connection con)
           
protected  void beginTransaction()
           
protected  void cacheStatement(Connection con, String sql)
           
protected  void cacheStatements()
           
protected  void commit()
          This method assumes that the connection is held and reused.
protected  void commit(Connection con)
           
protected  Connection createConnection()
           
 void createDestinationSequence(DestinationSequence seq)
          Create a destination sequence in the persistent store, with the sequence attributes as specified in the RMSDestinationSequence object.
 void createSourceSequence(SourceSequence seq)
          Create a source sequence in the persistent store, with the sequence attributes as specified in the RMSourceSequence object.
protected  void createTables()
           
protected static ProtocolVariation decodeProtocolVersion(String pv)
           
static void deleteDatabaseFiles()
           
static void deleteDatabaseFiles(String dbName, boolean now)
           
 void destroy()
           
protected static String encodeProtocolVersion(ProtocolVariation pv)
           
 DataSource getDataSource()
           
 DestinationSequence getDestinationSequence(Identifier sid)
          Retrieve the destination sequence with the specified identifier from persistent store.
 Collection<DestinationSequence> getDestinationSequences(String endpointIdentifier)
          Retrieves all sequences managed by the identified RM destination endpoint from persistent store.
 String getDriverClassName()
           
 long getInitialReconnectDelay()
           
 int getMaxReconnectAttempts()
           
 Collection<RMMessage> getMessages(Identifier sid, boolean outbound)
          Retrieves the outbound/inbound messages stored for the source/destination sequence with the given identifier.
 String getPassword()
           
 String getSchemaName()
           
 SourceSequence getSourceSequence(Identifier sid)
          Retrieve the source sequence with the specified identifier from persistent store.
 Collection<SourceSequence> getSourceSequences(String endpointIdentifier)
          Retrieves all sequences managed by the identified RM source endpoint from persistent store.
protected  PreparedStatement getStatement(Connection con, String sql)
          Returns either the locally cached statement or the one from the specified connection depending on whether the connection is held by this store.
 int getTableExistsCode()
           
 String getTableExistsState()
           
 String getUrl()
           
 String getUserName()
           
 void init()
           
 boolean isKeepConnection()
           
protected  boolean isRecoverableError(SQLException ex)
           
protected  boolean isTableExistsError(SQLException ex)
           
 void persistIncoming(DestinationSequence seq, RMMessage msg)
          Called by an RM source upon processing an outbound message.
 void persistOutgoing(SourceSequence seq, RMMessage msg)
          Called by an RM source upon processing an outbound message.
protected  void releaseResources(PreparedStatement stmt, ResultSet rs)
          Releases the statement and any result set.
 void removeDestinationSequence(Identifier sid)
          Remove the destination sequence with the specified identifier from persistent store.
 void removeMessages(Identifier sid, Collection<Long> messageNrs, boolean outbound)
          Removes the messages with the given message numbers and identifiers from the store of outbound/inbound messages.
 void removeSourceSequence(Identifier sid)
          Remove the source sequence with the specified identifier from persistent store.
 void setConnection(Connection c)
           
protected  void setCurrentSchema()
          Sets the current schema associated with the connection.
 void setDataSource(DataSource ds)
           
 void setDriverClassName(String dcn)
           
 void setInitialReconnectDelay(long initialReconnectDelay)
           
 void setKeepConnection(boolean keepConnection)
           
 void setMaxReconnectAttempts(int maxReconnectAttempts)
           
 void setPassword(String p)
           
 void setSchemaName(String sn)
           
 void setTableExistsCode(int tableExistsCode)
           
 void setTableExistsState(String tableExistsState)
           
 void setUrl(String u)
           
 void setUserName(String un)
           
protected  void storeMessage(Connection con, Identifier sid, RMMessage msg, boolean outbound)
           
protected  void storeMessage(Identifier sid, RMMessage msg, boolean outbound)
          this method is only useful when keepConnection is set to true
protected  void updateConnectionState(Connection con, SQLException e)
           
protected  void updateDestinationSequence(Connection con, DestinationSequence seq)
           
protected  void updateDestinationSequence(DestinationSequence seq)
           
protected  void updateSourceSequence(Connection con, SourceSequence seq)
           
protected  void updateSourceSequence(SourceSequence seq)
           
protected  Connection verifyConnection()
           
protected  void verifyTable(Connection con, String tableName, String[][] tableCols)
           
protected  void verifyTable(String tableName, String[][] tableCols)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DATABASE_NAME

public static final String DEFAULT_DATABASE_NAME
See Also:
Constant Field Values
Constructor Detail

RMTxStore

public RMTxStore()
Method Detail

destroy

public void destroy()

setDriverClassName

public void setDriverClassName(String dcn)

getDriverClassName

public String getDriverClassName()

setPassword

public void setPassword(String p)

getPassword

public String getPassword()

setUrl

public void setUrl(String u)

getUrl

public String getUrl()

setUserName

public void setUserName(String un)

getUserName

public String getUserName()

getSchemaName

public String getSchemaName()

setSchemaName

public void setSchemaName(String sn)

getDataSource

public DataSource getDataSource()

setDataSource

public void setDataSource(DataSource ds)

getTableExistsState

public String getTableExistsState()

setTableExistsState

public void setTableExistsState(String tableExistsState)

getTableExistsCode

public int getTableExistsCode()

setTableExistsCode

public void setTableExistsCode(int tableExistsCode)

isKeepConnection

public boolean isKeepConnection()

setKeepConnection

public void setKeepConnection(boolean keepConnection)

getInitialReconnectDelay

public long getInitialReconnectDelay()

setInitialReconnectDelay

public void setInitialReconnectDelay(long initialReconnectDelay)

getMaxReconnectAttempts

public int getMaxReconnectAttempts()

setMaxReconnectAttempts

public void setMaxReconnectAttempts(int maxReconnectAttempts)

setConnection

public void setConnection(Connection c)

createDestinationSequence

public void createDestinationSequence(DestinationSequence seq)
Description copied from interface: RMStore
Create a destination sequence in the persistent store, with the sequence attributes as specified in the RMSDestinationSequence object.

Specified by:
createDestinationSequence in interface RMStore
Parameters:
seq - the sequence

createSourceSequence

public void createSourceSequence(SourceSequence seq)
Description copied from interface: RMStore
Create a source sequence in the persistent store, with the sequence attributes as specified in the RMSourceSequence object.

Specified by:
createSourceSequence in interface RMStore
Parameters:
seq - the sequence

getDestinationSequence

public DestinationSequence getDestinationSequence(Identifier sid)
Description copied from interface: RMStore
Retrieve the destination sequence with the specified identifier from persistent store.

Specified by:
getDestinationSequence in interface RMStore
Parameters:
sid - the sequence
Returns:
the sequence if present; otherwise null

getSourceSequence

public SourceSequence getSourceSequence(Identifier sid)
Description copied from interface: RMStore
Retrieve the source sequence with the specified identifier from persistent store.

Specified by:
getSourceSequence in interface RMStore
Parameters:
sid - the sequence
Returns:
the sequence if present; otherwise null

removeDestinationSequence

public void removeDestinationSequence(Identifier sid)
Description copied from interface: RMStore
Remove the destination sequence with the specified identifier from persistent store.

Specified by:
removeDestinationSequence in interface RMStore
Parameters:
sid - the sequence

removeSourceSequence

public void removeSourceSequence(Identifier sid)
Description copied from interface: RMStore
Remove the source sequence with the specified identifier from persistent store.

Specified by:
removeSourceSequence in interface RMStore
Parameters:
sid - the sequence

getDestinationSequences

public Collection<DestinationSequence> getDestinationSequences(String endpointIdentifier)
Description copied from interface: RMStore
Retrieves all sequences managed by the identified RM destination endpoint from persistent store.

Specified by:
getDestinationSequences in interface RMStore
Parameters:
endpointIdentifier - the identifier for the destination
Returns:
the collection of sequences

getSourceSequences

public Collection<SourceSequence> getSourceSequences(String endpointIdentifier)
Description copied from interface: RMStore
Retrieves all sequences managed by the identified RM source endpoint from persistent store.

Specified by:
getSourceSequences in interface RMStore
Parameters:
endpointIdentifier - the identifier for the source
Returns:
the collection of sequences

getMessages

public Collection<RMMessage> getMessages(Identifier sid,
                                         boolean outbound)
Description copied from interface: RMStore
Retrieves the outbound/inbound messages stored for the source/destination sequence with the given identifier.

Specified by:
getMessages in interface RMStore
Parameters:
sid - the source sequence identifier
outbound - true if the message is outbound
Returns:
the collection of messages *

persistIncoming

public void persistIncoming(DestinationSequence seq,
                            RMMessage msg)
Description copied from interface: RMStore
Called by an RM source upon processing an outbound message. The RMMessage parameter is null for non application (RM protocol) messages.

Specified by:
persistIncoming in interface RMStore
Parameters:
seq - the destination sequence
msg - the incoming message

persistOutgoing

public void persistOutgoing(SourceSequence seq,
                            RMMessage msg)
Description copied from interface: RMStore
Called by an RM source upon processing an outbound message. The RMMessage parameter is null for non application (RM protocol) messages.

Specified by:
persistOutgoing in interface RMStore
Parameters:
seq - the source sequence
msg - the outgoing message

removeMessages

public void removeMessages(Identifier sid,
                           Collection<Long> messageNrs,
                           boolean outbound)
Description copied from interface: RMStore
Removes the messages with the given message numbers and identifiers from the store of outbound/inbound messages.

Specified by:
removeMessages in interface RMStore
Parameters:
sid - the identifier of the source sequence
messageNrs - the collection of message numbers
outbound - true if the message is outbound

beginTransaction

protected void beginTransaction()

commit

protected void commit(Connection con)
               throws SQLException
Throws:
SQLException

commit

protected void commit()
               throws SQLException
This method assumes that the connection is held and reused. Otherwise, use commit(Connection con)

Throws:
SQLException

abort

protected void abort(Connection con)

abort

protected void abort()

storeMessage

protected void storeMessage(Connection con,
                            Identifier sid,
                            RMMessage msg,
                            boolean outbound)
                     throws IOException,
                            SQLException
Throws:
IOException
SQLException

storeMessage

protected void storeMessage(Identifier sid,
                            RMMessage msg,
                            boolean outbound)
                     throws IOException,
                            SQLException
this method is only useful when keepConnection is set to true

Throws:
IOException
SQLException

updateSourceSequence

protected void updateSourceSequence(Connection con,
                                    SourceSequence seq)
                             throws SQLException
Throws:
SQLException

updateSourceSequence

protected void updateSourceSequence(SourceSequence seq)
                             throws SQLException
Throws:
SQLException

updateDestinationSequence

protected void updateDestinationSequence(Connection con,
                                         DestinationSequence seq)
                                  throws SQLException,
                                         IOException
Throws:
SQLException
IOException

updateDestinationSequence

protected void updateDestinationSequence(DestinationSequence seq)
                                  throws SQLException,
                                         IOException
Throws:
IOException
SQLException

createTables

protected void createTables()
                     throws SQLException
Throws:
SQLException

verifyTable

protected void verifyTable(Connection con,
                           String tableName,
                           String[][] tableCols)

verifyTable

protected void verifyTable(String tableName,
                           String[][] tableCols)

setCurrentSchema

protected void setCurrentSchema()
                         throws SQLException
Sets the current schema associated with the connection. If the connection is not set (e.g., keepConnection is false, it has no effect.

Throws:
SQLException

getStatement

protected PreparedStatement getStatement(Connection con,
                                         String sql)
                                  throws SQLException
Returns either the locally cached statement or the one from the specified connection depending on whether the connection is held by this store. If the statement retrieved from the local cache, it is locked until it is released. The retrieved statement must be released using releaseResources(PreparedStatement stmt, ResultSet rs).

Parameters:
con -
sql -
Returns:
Throws:
SQLException

releaseResources

protected void releaseResources(PreparedStatement stmt,
                                ResultSet rs)
Releases the statement and any result set.

Parameters:
stmt -
rs -

cacheStatement

protected void cacheStatement(Connection con,
                              String sql)
                       throws SQLException
Throws:
SQLException

cacheStatements

protected void cacheStatements()
                        throws SQLException
Throws:
SQLException

init

public void init()

createConnection

protected Connection createConnection()

verifyConnection

protected Connection verifyConnection()

updateConnectionState

protected void updateConnectionState(Connection con,
                                     SQLException e)

deleteDatabaseFiles

public static void deleteDatabaseFiles()

deleteDatabaseFiles

public static void deleteDatabaseFiles(String dbName,
                                       boolean now)

encodeProtocolVersion

protected static String encodeProtocolVersion(ProtocolVariation pv)

decodeProtocolVersion

protected static ProtocolVariation decodeProtocolVersion(String pv)

isTableExistsError

protected boolean isTableExistsError(SQLException ex)

isRecoverableError

protected boolean isRecoverableError(SQLException ex)

Apache CXF API

Apache CXF