xmlBlaster 2.2.0 client API

org.xmlBlaster.util.queue.jdbc
Class XBDatabaseAccessorDelegate

java.lang.Object
  extended by org.xmlBlaster.util.queue.jdbc.XBFactoryBase
      extended by org.xmlBlaster.util.queue.jdbc.XBDatabaseAccessor
          extended by org.xmlBlaster.util.queue.jdbc.XBDatabaseAccessorDelegate
All Implemented Interfaces:
I_StorageProblemListener, I_StorageProblemNotifier

public final class XBDatabaseAccessorDelegate
extends XBDatabaseAccessor


Field Summary
 
Fields inherited from class org.xmlBlaster.util.queue.jdbc.XBFactoryBase
DB2, FIREBIRD, HSQLDB, LDBC, MYSQL, ORACLE, POSTGRES, SQLITE, SQLSERVER_2000, SQLSERVER_2005, UNKNOWN
 
Fields inherited from interface org.xmlBlaster.util.queue.I_StorageProblemListener
AVAILABLE, UNAVAILABLE, UNDEF
 
Constructor Summary
XBDatabaseAccessorDelegate()
           
 
Method Summary
 int[] addEntries(XBStore store, I_Entry[] entries)
          Adds several rows to the specified queue table in batch mode to improve performance
 boolean addEntry(XBStore store, I_Entry entry)
          Adds a row to the specified queue table
 int cleanUp(XBStore store)
          Cleans up the specified queue.
 long clearQueue(XBStore store)
           
 long deleteAllTransient(XBStore store)
          deletes all transient messages
 int deleteEntries(XBStore store, long refId, long meatId)
           
 long deleteEntries(XBStore store, XBRef[] refs, XBMeat[] meats)
          Deletes the entries specified by the entries array.
 long deleteFirstRefs(XBStore store, long numOfEntries)
          Deletes number of entries specified by the argument list.
 void deleteStore(long storeId)
          Deletes the store.
protected  void doInit(org.xmlBlaster.contrib.I_Info info)
           
 ReturnDataHolder getAndDeleteLowest(XBStore store, int numOfEntries, long numOfBytes, int maxPriority, long minUniqueId, boolean leaveOne, boolean doDelete, I_Storage storage)
          Under the same transaction it gets and deletes all the entries which fit into the constrains specified in the argument list.
 java.util.List<I_Entry> getEntries(XBStore store, int numOfEntries, long numOfBytes, I_EntryFilter entryFilter, boolean isRef, I_Storage storage)
          gets the first numOfEntries of the queue.
 java.util.List<I_Entry> getEntries(XBStore store, XBRef[] refs, XBMeat[] meats)
          gets all the entries which have the dataid specified in the argument list.
 java.util.List<I_Entry> getEntriesByPriority(XBStore store, int numOfEntries, long numOfBytes, int minPrio, int maxPrio)
          gets the first numOfEntries of the queue which have the priority in the range specified by prioMin and prioMax (inclusive).
 java.util.List<I_Entry> getEntriesBySamePriority(XBStore store, int numOfEntries, long numOfBytes)
          gets the first numOfEntries of the queue which have the same priority.
 XBEntry[] getEntriesLike(java.lang.String queueNamePattern, java.lang.String flag, int numOfEntries, long numOfBytes, I_EntryFilter entryFilter)
          Raw access to the table.
 java.util.List<I_Entry> getEntriesWithLimit(XBStore store, I_Entry limitEntry, I_Storage storage)
          gets the first numOfEntries of the queue until the limitEntry is reached.
 EntryCount getNumOfAll(XBStore store)
          Gets the real number of entries.
 java.util.List<I_Entry> getRefEntries(XBStore store, int numOfEntries, long numOfBytes, I_EntryFilter entryFilter, I_Storage storage, I_QueueEntry firstEntryExlusive)
           
 long modifyEntry(XBStore store, XBMeat entry, XBMeat oldEntry, boolean onlyRefCounters)
          modifies a row in the specified queue table
 long removeEntriesWithLimit(XBStore store, XBRef limitEntry, boolean inclusive)
          deletes the first numOfEntries of the queue until the limitEntry is reached.
 int wipeOutDB(boolean doSetupNewTables)
          Wipes out the entire DB.
 
Methods inherited from class org.xmlBlaster.util.queue.jdbc.XBDatabaseAccessor
checkIfDBLoss, checkIfDBLoss, createInstance, deleteEntry, dumpMetaData, getAllOfType, getIsolationLevel, getPool, getStorageProblemListenerArr, getXBStore, getXBStoreFactory, init, initFactory, isolationToString, ping, registerQueue, registerStorageProblemListener, setUp, shutdown, storageAvailable, storageUnavailable, unregisterQueue, unRegisterStorageProblemListener, wipeOutDB
 
Methods inherited from class org.xmlBlaster.util.queue.jdbc.XBFactoryBase
getDbVendor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XBDatabaseAccessorDelegate

public XBDatabaseAccessorDelegate()
Method Detail

doInit

protected void doInit(org.xmlBlaster.contrib.I_Info info)
               throws XmlBlasterException
Overrides:
doInit in class XBDatabaseAccessor
Throws:
XmlBlasterException

modifyEntry

public long modifyEntry(XBStore store,
                        XBMeat entry,
                        XBMeat oldEntry,
                        boolean onlyRefCounters)
                 throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
modifies a row in the specified queue table

Overrides:
modifyEntry in class XBDatabaseAccessor
entry - the object to be stored.
oldEntry - the old one
Returns:
true on success
Throws:
XmlBlasterException - if an error occurred when trying to get a connection or an SQLException occurred.

addEntry

public boolean addEntry(XBStore store,
                        I_Entry entry)
                 throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
Adds a row to the specified queue table

Overrides:
addEntry in class XBDatabaseAccessor
entry - the object to be stored.
Returns:
true on success
Throws:
XmlBlasterException - if an error occured when trying to get a connection

addEntries

public int[] addEntries(XBStore store,
                        I_Entry[] entries)
                 throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
Adds several rows to the specified queue table in batch mode to improve performance

Overrides:
addEntries in class XBDatabaseAccessor
entries - the entries to store
Returns:
array of boolean telling which entries where stored and which not.
Throws:
XmlBlasterException - if an error occured when trying to get a connection

cleanUp

public int cleanUp(XBStore store)
            throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
Cleans up the specified queue. It deletes all queue entries in the 'entries' table.

Overrides:
cleanUp in class XBDatabaseAccessor
Returns:
the number of queues deleted (not the number of entries).
Throws:
XmlBlasterException

wipeOutDB

public int wipeOutDB(boolean doSetupNewTables)
              throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
Wipes out the entire DB. i.e. it deletes the three tables from the DB. IMPORTANT:

Overrides:
wipeOutDB in class XBDatabaseAccessor
Parameters:
doSetupNewTables - if set to 'true' it recreates the necessary empty tables.
Throws:
XmlBlasterException

deleteAllTransient

public long deleteAllTransient(XBStore store)
                        throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
deletes all transient messages

Overrides:
deleteAllTransient in class XBDatabaseAccessor
Throws:
XmlBlasterException

getAndDeleteLowest

public ReturnDataHolder getAndDeleteLowest(XBStore store,
                                           int numOfEntries,
                                           long numOfBytes,
                                           int maxPriority,
                                           long minUniqueId,
                                           boolean leaveOne,
                                           boolean doDelete,
                                           I_Storage storage)
                                    throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
Under the same transaction it gets and deletes all the entries which fit into the constrains specified in the argument list. The entries are really deleted only if doDelete is true, otherwise they are left untouched on the queue

Overrides:
getAndDeleteLowest in class XBDatabaseAccessor
Throws:
XmlBlasterException
See Also:
I_Queue.takeLowest(int, long, org.xmlBlaster.util.queue.I_QueueEntry, boolean)

deleteStore

public void deleteStore(long storeId)
                 throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
Deletes the store.

Overrides:
deleteStore in class XBDatabaseAccessor
Throws:
XmlBlasterException

deleteEntries

public long deleteEntries(XBStore store,
                          XBRef[] refs,
                          XBMeat[] meats)
                   throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
Deletes the entries specified by the entries array. Since all entries are deleted at the same time, in case of an exception the result is uncertain (it depends on what the used database will do). In case the statement would be too long for the DB, the request is split into several statements which are invoked separately.

Overrides:
deleteEntries in class XBDatabaseAccessor
refs - the array containing all entries to delete for the refs.
meats - the array containing all entries to delete for the meats.
Throws:
XmlBlasterException

deleteEntries

public int deleteEntries(XBStore store,
                         long refId,
                         long meatId)
                  throws XmlBlasterException
Throws:
XmlBlasterException

deleteFirstRefs

public long deleteFirstRefs(XBStore store,
                            long numOfEntries)
                     throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
Deletes number of entries specified by the argument list. If less than that amount of elements is given, then all entries will be deleted. If you specify -1 as the number of entries, then all entries will be deleted.

Overrides:
deleteFirstRefs in class XBDatabaseAccessor
numOfEntries - the number of entries to be deleted.
Throws:
XmlBlasterException

getEntriesByPriority

public java.util.List<I_Entry> getEntriesByPriority(XBStore store,
                                                    int numOfEntries,
                                                    long numOfBytes,
                                                    int minPrio,
                                                    int maxPrio)
                                             throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
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.

Overrides:
getEntriesByPriority in class XBDatabaseAccessor
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:
XmlBlasterException

getEntriesBySamePriority

public java.util.List<I_Entry> getEntriesBySamePriority(XBStore store,
                                                        int numOfEntries,
                                                        long numOfBytes)
                                                 throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
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.

Overrides:
getEntriesBySamePriority in class XBDatabaseAccessor
numOfEntries - the maximum number of elements to retrieve
Throws:
XmlBlasterException

getRefEntries

public java.util.List<I_Entry> getRefEntries(XBStore store,
                                             int numOfEntries,
                                             long numOfBytes,
                                             I_EntryFilter entryFilter,
                                             I_Storage storage,
                                             I_QueueEntry firstEntryExlusive)
                                      throws XmlBlasterException
Overrides:
getRefEntries in class XBDatabaseAccessor
Throws:
XmlBlasterException

getEntries

public java.util.List<I_Entry> getEntries(XBStore store,
                                          int numOfEntries,
                                          long numOfBytes,
                                          I_EntryFilter entryFilter,
                                          boolean isRef,
                                          I_Storage storage)
                                   throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
gets the first numOfEntries of the queue. If there are not so many entries in the queue, all elements in the queue are returned.

Is public for testsuite only.

Overrides:
getEntries in class XBDatabaseAccessor
numOfEntries - Access num entries, if -1 access all entries currently found
numOfBytes - is the maximum size in bytes of the array to return, -1 is unlimited .
Throws:
XmlBlasterException

getEntriesLike

public XBEntry[] getEntriesLike(java.lang.String queueNamePattern,
                                java.lang.String flag,
                                int numOfEntries,
                                long numOfBytes,
                                I_EntryFilter entryFilter)
                         throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
Raw access to the table. If there are not so many entries in the queue, all elements in the queue are returned.

Overrides:
getEntriesLike in class XBDatabaseAccessor
numOfEntries - the maximum number of elements to retrieve
Throws:
XmlBlasterException

getEntriesWithLimit

public java.util.List<I_Entry> getEntriesWithLimit(XBStore store,
                                                   I_Entry limitEntry,
                                                   I_Storage storage)
                                            throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
gets the first numOfEntries of the queue until the limitEntry is reached.

Overrides:
getEntriesWithLimit in class XBDatabaseAccessor
Throws:
XmlBlasterException

removeEntriesWithLimit

public long removeEntriesWithLimit(XBStore store,
                                   XBRef limitEntry,
                                   boolean inclusive)
                            throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
deletes the first numOfEntries of the queue until the limitEntry is reached.

Overrides:
removeEntriesWithLimit in class XBDatabaseAccessor
Throws:
XmlBlasterException

getEntries

public java.util.List<I_Entry> getEntries(XBStore store,
                                          XBRef[] refs,
                                          XBMeat[] meats)
                                   throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
gets all the entries which have the dataid specified in the argument list. If the list is empty or null, an empty ArrayList object is returned.

Overrides:
getEntries in class XBDatabaseAccessor
Throws:
XmlBlasterException

getNumOfAll

public EntryCount getNumOfAll(XBStore store)
                       throws XmlBlasterException
Description copied from class: XBDatabaseAccessor
Gets the real number of entries. That is it really makes a call to the DB to find out how big the size is.

Overrides:
getNumOfAll in class XBDatabaseAccessor
Returns:
never null
Throws:
XmlBlasterException

clearQueue

public long clearQueue(XBStore store)
                throws XmlBlasterException
Overrides:
clearQueue in class XBDatabaseAccessor
Throws:
XmlBlasterException

xmlBlaster 2.2.0 client API

Copyright © 1999-2014 The xmlBlaster.org contributers.