org.xmlBlaster.util.queue.jdbc
Class XBRefFactory
java.lang.Object
org.xmlBlaster.util.queue.jdbc.XBFactoryBase
org.xmlBlaster.util.queue.jdbc.XBFactory
org.xmlBlaster.util.queue.jdbc.XBRefFactory
public class XBRefFactory
- extends XBFactory
- Author:
- Marcel Ruff, Michele Laghi
Fields inherited from class org.xmlBlaster.util.queue.jdbc.XBFactory |
base, countSt, createSt, deleteAllSt, deleteCompleteSt, deleteSt, deleteTransientsSt, dropSt, getAllSt, getCompleteSt, getFirstEntriesSt, getNumOfAllSt, getSt, inList, insertSt, prefix, table |
Fields inherited from class org.xmlBlaster.util.queue.jdbc.XBFactoryBase |
DB2, FIREBIRD, HSQLDB, LDBC, MYSQL, ORACLE, POSTGRES, SQLITE, SQLSERVER_2000, SQLSERVER_2005, UNKNOWN |
Method Summary |
int |
deleteAllStore(XBStore store,
java.sql.Connection conn,
int timeout)
|
long |
deleteList(XBStore store,
java.sql.Connection conn,
XBEntry[] entries,
int maxStLength,
int maxNumSt,
boolean commitInBetween,
int timeout)
Deletes the specified entries. |
long |
deleteWithLimit(XBStore store,
java.sql.Connection conn,
XBRef limitEntry,
boolean inclusive)
deletes the first numOfEntries of the queue until the limitEntry is reached. |
protected void |
doInit(org.xmlBlaster.contrib.I_Info info)
|
XBRef |
get(XBStore store,
long id,
java.sql.Connection conn,
int timeout)
|
protected long |
getByteSize(java.sql.ResultSet rs,
int offset)
|
java.util.List<XBRef> |
getEntriesByPriority(XBStore store,
java.sql.Connection conn,
int numOfEntries,
long numOfBytes,
int minPrio,
int maxPrio,
boolean onlyId)
gets the first numOfEntries of the queue which have the priority in the
range specified by prioMin and prioMax (inclusive). |
java.util.List<XBRef> |
getEntriesBySamePriority(XBStore store,
java.sql.Connection conn,
int numOfEntries,
long numOfBytes)
gets the first numOfEntries of the queue which have the same priority. |
java.util.List<XBRef> |
getFirstRefEntries(XBStore store,
java.sql.Connection conn,
long numOfEntries,
long numOfBytes,
int timeout)
|
java.util.List<XBRef> |
getFirstRefEntriesStartAt(XBStore store,
java.sql.Connection conn,
long numOfEntries,
long numOfBytes,
int timeout,
I_QueueEntry firstEntryExlusive)
|
java.util.List<XBRef> |
getWithLimit(XBStore store,
java.sql.Connection conn,
XBRef limitRef)
|
void |
insert(XBRef xbRef,
java.sql.Connection conn,
int timeout)
Inserts an entry in the database |
protected void |
prepareDefaultStatements()
This method must be implemented in all underlying extentions to this class. |
protected XBRef |
rsToEntry(XBStore store,
java.sql.ResultSet rs)
|
Methods inherited from class org.xmlBlaster.util.queue.jdbc.XBFactory |
checkSameStore, count, create, delete, deleteTransients, drop, fillDbCol, getDbCol, getList, getNumOfAll, init, isTrue, readStream, whereInStatement |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XBRefFactory
public XBRefFactory(java.lang.String prefix)
prepareDefaultStatements
protected void prepareDefaultStatements()
- Description copied from class:
XBFactory
- This method must be implemented in all underlying extentions to this class. It returns (for the different
database vendors a default for the creation of the table.
- Overrides:
prepareDefaultStatements
in class XBFactory
doInit
protected void doInit(org.xmlBlaster.contrib.I_Info info)
throws XmlBlasterException
- Specified by:
doInit
in class XBFactoryBase
- Throws:
XmlBlasterException
insert
public void insert(XBRef xbRef,
java.sql.Connection conn,
int timeout)
throws java.sql.SQLException,
java.io.UnsupportedEncodingException
- Inserts an entry in the database
- Parameters:
table
- xbMeat
- The object to store. Note thatconn
- The database connection to usetimeout
- the time in seconds it has to wait for a response. If less than 1 it is not
set.
- Throws:
java.sql.SQLException
- If an exception occurs in the backend. For example if the entry already
exists in the database.
java.io.UnsupportedEncodingException
rsToEntry
protected XBRef rsToEntry(XBStore store,
java.sql.ResultSet rs)
throws java.sql.SQLException,
java.io.IOException
- Specified by:
rsToEntry
in class XBFactory
- Throws:
java.sql.SQLException
java.io.IOException
getFirstRefEntries
public java.util.List<XBRef> getFirstRefEntries(XBStore store,
java.sql.Connection conn,
long numOfEntries,
long numOfBytes,
int timeout)
throws java.sql.SQLException,
java.io.IOException
- Throws:
java.sql.SQLException
java.io.IOException
getFirstRefEntriesStartAt
public java.util.List<XBRef> getFirstRefEntriesStartAt(XBStore store,
java.sql.Connection conn,
long numOfEntries,
long numOfBytes,
int timeout,
I_QueueEntry firstEntryExlusive)
throws java.sql.SQLException,
java.io.IOException
- Throws:
java.sql.SQLException
java.io.IOException
get
public XBRef get(XBStore store,
long id,
java.sql.Connection conn,
int timeout)
throws java.sql.SQLException,
java.io.IOException
- Parameters:
sql
- The select statement to use to fill the objects.conn
-
- Returns:
- null if the object has not been found or the object if it has been found on the backend.
- Throws:
java.sql.SQLException
java.io.IOException
getEntriesByPriority
public java.util.List<XBRef> getEntriesByPriority(XBStore store,
java.sql.Connection conn,
int numOfEntries,
long numOfBytes,
int minPrio,
int maxPrio,
boolean onlyId)
throws java.sql.SQLException,
java.io.IOException
- gets the first numOfEntries of the queue which have the priority in the
range specified by prioMin and prioMax (inclusive).
If there are not so many entries in the queue, all elements in the queue
are returned.
- Parameters:
storageId
- the storageId of the queue/storage from which to retrieve the information.numOfEntries
- the maximum number of elements to retrieve. If negative there is no constriction.numOfBytes
- the maximum number of bytes to retrieve. If negative, there is no constriction.minPrio
- the minimum priority to retreive (inclusive).maxPrio
- the maximum priority to retrieve (inclusive).
- Throws:
java.sql.SQLException
java.io.IOException
getWithLimit
public java.util.List<XBRef> getWithLimit(XBStore store,
java.sql.Connection conn,
XBRef limitRef)
throws java.sql.SQLException,
java.io.IOException
- Throws:
java.sql.SQLException
java.io.IOException
getEntriesBySamePriority
public java.util.List<XBRef> getEntriesBySamePriority(XBStore store,
java.sql.Connection conn,
int numOfEntries,
long numOfBytes)
throws java.sql.SQLException,
java.io.IOException
- gets the first numOfEntries of the queue which have the same priority.
If there are not so many entries in the queue, all elements in the queue
are returned.
- Parameters:
numOfEntries
- the maximum number of elements to retrieve
- Throws:
java.sql.SQLException
java.io.IOException
deleteWithLimit
public long deleteWithLimit(XBStore store,
java.sql.Connection conn,
XBRef limitEntry,
boolean inclusive)
throws java.sql.SQLException
- deletes the first numOfEntries of the queue until the limitEntry is reached.
- Parameters:
numOfEntries
- the maximum number of elements to retrieve
- Throws:
java.sql.SQLException
deleteAllStore
public int deleteAllStore(XBStore store,
java.sql.Connection conn,
int timeout)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
getByteSize
protected long getByteSize(java.sql.ResultSet rs,
int offset)
throws java.sql.SQLException
- Specified by:
getByteSize
in class XBFactory
- Throws:
java.sql.SQLException
deleteList
public long deleteList(XBStore store,
java.sql.Connection conn,
XBEntry[] entries,
int maxStLength,
int maxNumSt,
boolean commitInBetween,
int timeout)
throws java.sql.SQLException
- Deletes the specified entries. Since all entry may not fit in one single operation,
they are splitted over different operations.
If you specified commitInBetween or the auto-commit flag is set to true,
It always returns the number of deleted entries. If a batch could not be completely deleted,
it returns the number of operations previously deleted.
- Overrides:
deleteList
in class XBFactory
- Parameters:
store
- the store to use.the
- connection to be used.ids
- the array containing all ids to delete.
- Returns:
- the number of entries successfully processed. These are the first. If an
error occurs it stops.
- Throws:
java.sql.SQLException
Copyright © 1999-2014 The xmlBlaster.org contributers.