Class RMTxStore
- java.lang.Object
-
- org.apache.cxf.ws.rm.persistence.jdbc.RMTxStore
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_DATABASE_NAME
-
Constructor Summary
Constructors Constructor Description RMTxStore()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidabort()protected voidabort(Connection con)protected voidbeginTransaction()protected voidcacheStatement(Connection con, String sql)protected voidcacheStatements()protected voidcommit()This method assumes that the connection is held and reused.protected voidcommit(Connection con)protected ConnectioncreateConnection()voidcreateDestinationSequence(DestinationSequence seq)Create a destination sequence in the persistent store, with the sequence attributes as specified in theRMSDestinationSequenceobject.voidcreateSourceSequence(SourceSequence seq)Create a source sequence in the persistent store, with the sequence attributes as specified in theRMSourceSequenceobject.protected voidcreateTables()protected static ProtocolVariationdecodeProtocolVersion(String pv)static voiddeleteDatabaseFiles()static voiddeleteDatabaseFiles(String dbName, boolean now)voiddestroy()protected static StringencodeProtocolVersion(ProtocolVariation pv)DataSourcegetDataSource()DestinationSequencegetDestinationSequence(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.StringgetDriverClassName()longgetInitialReconnectDelay()intgetMaxReconnectAttempts()Collection<RMMessage>getMessages(Identifier sid, boolean outbound)Retrieves the outbound/inbound messages stored for the source/destination sequence with the given identifier.StringgetPassword()StringgetSchemaName()SourceSequencegetSourceSequence(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 PreparedStatementgetStatement(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.intgetTableExistsCode()StringgetTableExistsState()StringgetUrl()StringgetUserName()voidinit()booleanisKeepConnection()protected booleanisRecoverableError(SQLException ex)protected booleanisTableExistsError(SQLException ex)voidpersistIncoming(DestinationSequence seq, RMMessage msg)Called by an RM source upon processing an outbound message.voidpersistOutgoing(SourceSequence seq, RMMessage msg)Called by an RM source upon processing an outbound message.protected voidreleaseResources(PreparedStatement stmt, ResultSet rs)Releases the statement and any result set.voidremoveDestinationSequence(Identifier sid)Remove the destination sequence with the specified identifier from persistent store.voidremoveMessages(Identifier sid, Collection<Long> messageNrs, boolean outbound)Removes the messages with the given message numbers and identifiers from the store of outbound/inbound messages.voidremoveSourceSequence(Identifier sid)Remove the source sequence with the specified identifier from persistent store.voidsetConnection(Connection c)protected voidsetCurrentSchema()Sets the current schema associated with the connection.voidsetDataSource(DataSource ds)voidsetDriverClassName(String dcn)voidsetInitialReconnectDelay(long initialReconnectDelay)voidsetKeepConnection(boolean keepConnection)voidsetMaxReconnectAttempts(int maxReconnectAttempts)voidsetPassword(String p)voidsetSchemaName(String sn)voidsetTableExistsCode(int tableExistsCode)voidsetTableExistsState(String tableExistsState)voidsetUrl(String u)voidsetUserName(String un)protected voidstoreMessage(Connection con, Identifier sid, RMMessage msg, boolean outbound)protected voidstoreMessage(Identifier sid, RMMessage msg, boolean outbound)this method is only useful when keepConnection is set to trueprotected voidupdateConnectionState(Connection con, SQLException e)protected voidupdateDestinationSequence(Connection con, DestinationSequence seq)protected voidupdateDestinationSequence(DestinationSequence seq)protected voidupdateSourceSequence(Connection con, SourceSequence seq)protected voidupdateSourceSequence(SourceSequence seq)protected ConnectionverifyConnection()protected voidverifyTable(String tableName, String[][] tableCols)protected voidverifyTable(Connection con, String tableName, String[][] tableCols)
-
-
-
Field Detail
-
DEFAULT_DATABASE_NAME
public static final String DEFAULT_DATABASE_NAME
- See Also:
- Constant Field Values
-
-
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:RMStoreCreate a destination sequence in the persistent store, with the sequence attributes as specified in theRMSDestinationSequenceobject.- Specified by:
createDestinationSequencein interfaceRMStore- Parameters:
seq- the sequence
-
createSourceSequence
public void createSourceSequence(SourceSequence seq)
Description copied from interface:RMStoreCreate a source sequence in the persistent store, with the sequence attributes as specified in theRMSourceSequenceobject.- Specified by:
createSourceSequencein interfaceRMStore- Parameters:
seq- the sequence
-
getDestinationSequence
public DestinationSequence getDestinationSequence(Identifier sid)
Description copied from interface:RMStoreRetrieve the destination sequence with the specified identifier from persistent store.- Specified by:
getDestinationSequencein interfaceRMStore- Parameters:
sid- the sequence- Returns:
- the sequence if present; otherwise null
-
getSourceSequence
public SourceSequence getSourceSequence(Identifier sid)
Description copied from interface:RMStoreRetrieve the source sequence with the specified identifier from persistent store.- Specified by:
getSourceSequencein interfaceRMStore- Parameters:
sid- the sequence- Returns:
- the sequence if present; otherwise null
-
removeDestinationSequence
public void removeDestinationSequence(Identifier sid)
Description copied from interface:RMStoreRemove the destination sequence with the specified identifier from persistent store.- Specified by:
removeDestinationSequencein interfaceRMStore- Parameters:
sid- the sequence
-
removeSourceSequence
public void removeSourceSequence(Identifier sid)
Description copied from interface:RMStoreRemove the source sequence with the specified identifier from persistent store.- Specified by:
removeSourceSequencein interfaceRMStore- Parameters:
sid- the sequence
-
getDestinationSequences
public Collection<DestinationSequence> getDestinationSequences(String endpointIdentifier)
Description copied from interface:RMStoreRetrieves all sequences managed by the identified RM destination endpoint from persistent store.- Specified by:
getDestinationSequencesin interfaceRMStore- Parameters:
endpointIdentifier- the identifier for the destination- Returns:
- the collection of sequences
-
getSourceSequences
public Collection<SourceSequence> getSourceSequences(String endpointIdentifier)
Description copied from interface:RMStoreRetrieves all sequences managed by the identified RM source endpoint from persistent store.- Specified by:
getSourceSequencesin interfaceRMStore- 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:RMStoreRetrieves the outbound/inbound messages stored for the source/destination sequence with the given identifier.- Specified by:
getMessagesin interfaceRMStore- Parameters:
sid- the source sequence identifieroutbound- true if the message is outbound- Returns:
- the collection of messages *
-
persistIncoming
public void persistIncoming(DestinationSequence seq, RMMessage msg)
Description copied from interface:RMStoreCalled by an RM source upon processing an outbound message. TheRMMessageparameter is null for non application (RM protocol) messages.- Specified by:
persistIncomingin interfaceRMStore- Parameters:
seq- the destination sequencemsg- the incoming message
-
persistOutgoing
public void persistOutgoing(SourceSequence seq, RMMessage msg)
Description copied from interface:RMStoreCalled by an RM source upon processing an outbound message. TheRMMessageparameter is null for non application (RM protocol) messages.- Specified by:
persistOutgoingin interfaceRMStore- Parameters:
seq- the source sequencemsg- the outgoing message
-
removeMessages
public void removeMessages(Identifier sid, Collection<Long> messageNrs, boolean outbound)
Description copied from interface:RMStoreRemoves the messages with the given message numbers and identifiers from the store of outbound/inbound messages.- Specified by:
removeMessagesin interfaceRMStore- Parameters:
sid- the identifier of the source sequencemessageNrs- the collection of message numbersoutbound- 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 SQLExceptionThis 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:
IOExceptionSQLException
-
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:
IOExceptionSQLException
-
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:
SQLExceptionIOException
-
updateDestinationSequence
protected void updateDestinationSequence(DestinationSequence seq) throws SQLException, IOException
- Throws:
IOExceptionSQLException
-
createTables
protected void createTables() throws SQLException- Throws:
SQLException
-
verifyTable
protected void verifyTable(Connection con, String tableName, String[][] tableCols)
-
setCurrentSchema
protected void setCurrentSchema() throws SQLExceptionSets 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)
-
-