edu.sc.seis.sod.hibernate

## Class SodDB

- java.lang.Object
- - edu.sc.seis.fissuresUtil.hibernate.AbstractHibernateDB
  - - edu.sc.seis.sod.hibernate.SodDB

-     public class SodDB
      extends edu.sc.seis.fissuresUtil.hibernate.AbstractHibernateDB

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.Class<? extends AbstractEventChannelPair>` | `defaultEcpClass`
    `java.lang.Class<? extends AbstractEventChannelPair>` | `ecpClass`

    - ### Fields inherited from class edu.sc.seis.fissuresUtil.hibernate.AbstractHibernateDB

      `DEBUG_SESSION_CREATION, DEBUG_SESSION_CREATION_SECONDS`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `SodDB()` database should use one of EventVectorPair or EventChannelPair.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `configHibernate(org.hibernate.cfg.Configuration config)`
    `EventChannelPair` | `createEventChannelPair(StatefulEvent event, edu.iris.Fissures.network.ChannelImpl chan, EventStationPair esp)`
    `EventNetworkPair` | `createEventNetworkPair(StatefulEvent event, edu.iris.Fissures.network.NetworkAttrImpl net)`
    `EventStationPair` | `createEventStationPair(StatefulEvent event, edu.iris.Fissures.network.StationImpl station)`
    `static java.lang.Class<? extends AbstractEventChannelPair>` | `discoverDbEcpClass()`
    `java.util.List<AbstractEventChannelPair>` | `getAll(edu.sc.seis.fissuresUtil.cache.CacheEvent event)`
    `java.util.List<RecordSectionItem>` | `getBestForRecordSection(java.lang.String orientationId, java.lang.String recordSectionId, edu.sc.seis.fissuresUtil.cache.CacheEvent event)`
    `java.util.List<edu.iris.Fissures.network.ChannelImpl>` | `getChannelsForRecordSection(java.lang.String orientationId, edu.sc.seis.fissuresUtil.cache.CacheEvent event, boolean best)`
    `SodConfig` | `getConfig(int configid)`
    `SodConfig` | `getCurrentConfig()`
    `Version` | `getDBVersion()`
    `EventChannelPair` | `getECP(edu.sc.seis.fissuresUtil.cache.CacheEvent event, edu.iris.Fissures.network.ChannelImpl chan)`
    `java.lang.Class<? extends AbstractEventChannelPair>` | `getEcpClass()`
    `java.util.List<edu.sc.seis.fissuresUtil.cache.CacheEvent>` | `getEventsForStation(edu.iris.Fissures.network.StationImpl sta)`
    `java.util.List<AbstractEventChannelPair>` | `getFailed(edu.sc.seis.fissuresUtil.cache.CacheEvent event)`
    `java.util.List<AbstractEventChannelPair>` | `getFailed(edu.sc.seis.fissuresUtil.cache.CacheEvent event, edu.iris.Fissures.network.StationImpl station)`
    `java.util.List<AbstractEventChannelPair>` | `getFailed(edu.iris.Fissures.network.StationImpl station)`
    `int` | `getMaxRetries()`
    `edu.iris.Fissures.model.TimeInterval` | `getMinRetryDelay()`
    `AbstractEventChannelPair` | `getNextECP()` next successful event-channel to process.
    `AbstractEventChannelPair` | `getNextECPFromCache()` next successful event-station to process from memory cache.
    `EventNetworkPair` | `getNextENP()` next successful event-network to process.
    `EventNetworkPair` | `getNextENPFromCache()` next successful event-network to process from cache.
    `EventStationPair` | `getNextESP()` next successful event-station to process.
    `EventStationPair` | `getNextESPFromCache()` next successful event-station to process from memory cache.
    `AbstractEventChannelPair` | `getNextRetryECPFromCache()`
    `int` | `getNumEventNetworkWorkUnits(Standing standing)`
    `int` | `getNumFailed(edu.sc.seis.fissuresUtil.cache.CacheEvent event)`
    `int` | `getNumFailed(edu.sc.seis.fissuresUtil.cache.CacheEvent event, edu.iris.Fissures.network.StationImpl station)`
    `int` | `getNumFailed(edu.iris.Fissures.network.StationImpl station)`
    `int` | `getNumRetry(edu.sc.seis.fissuresUtil.cache.CacheEvent event)`
    `int` | `getNumRetry(edu.sc.seis.fissuresUtil.cache.CacheEvent event, edu.iris.Fissures.network.StationImpl station)`
    `int` | `getNumRetry(edu.iris.Fissures.network.StationImpl station)`
    `int` | `getNumSuccessful()`
    `int` | `getNumSuccessful(edu.sc.seis.fissuresUtil.cache.CacheEvent event)`
    `int` | `getNumSuccessful(edu.sc.seis.fissuresUtil.cache.CacheEvent event, edu.iris.Fissures.network.StationImpl station)`
    `int` | `getNumSuccessful(edu.iris.Fissures.network.StationImpl station)`
    `int` | `getNumWorkUnits(Standing standing)`
    `QueryTime` | `getQueryTime(java.lang.String serverName, java.lang.String serverDNS)`
    `java.util.List<java.lang.String>` | `getRecordSectionId(edu.sc.seis.fissuresUtil.cache.CacheEvent event)` Finds the recordsectionids for this event
    `RecordSectionItem` | `getRecordSectionItem(java.lang.String orientationId, java.lang.String recordSectionId, edu.sc.seis.fissuresUtil.cache.CacheEvent event, edu.iris.Fissures.network.ChannelImpl channel)`
    `RecordSectionItem` | `getRecordSectionItemForEvent(edu.sc.seis.fissuresUtil.cache.CacheEvent event, edu.iris.Fissures.network.ChannelImpl channel)`
    `java.util.List<RecordSectionItem>` | `getRecordSectionItemList(java.lang.String orientationId, java.lang.String recordSectionId, edu.sc.seis.fissuresUtil.cache.CacheEvent event)`
    `java.util.List<java.lang.String>` | `getRecordSectionOrientations(edu.sc.seis.fissuresUtil.cache.CacheEvent event)` Finds the recordsection orientationids for this event
    `java.util.List<AbstractEventChannelPair>` | `getRetry(edu.sc.seis.fissuresUtil.cache.CacheEvent event)`
    `java.util.List<AbstractEventChannelPair>` | `getRetry(edu.sc.seis.fissuresUtil.cache.CacheEvent event, edu.iris.Fissures.network.StationImpl station)`
    `java.util.List<AbstractEventChannelPair>` | `getRetry(edu.iris.Fissures.network.StationImpl station)`
    `java.util.List<AbstractEventChannelPair>` | `getRetryToDo()`
    `static SodDB` | `getSingleton()`
    `java.util.List<edu.iris.Fissures.network.StationImpl>` | `getStationsForEvent(edu.sc.seis.fissuresUtil.cache.CacheEvent event)`
    `java.util.List<edu.iris.Fissures.network.StationImpl>` | `getStationsForRecordSection(java.lang.String orientationId, java.lang.String recordSectionId, edu.sc.seis.fissuresUtil.cache.CacheEvent event, boolean best)`
    `java.util.List<AbstractEventChannelPair>` | `getSuccessful(edu.sc.seis.fissuresUtil.cache.CacheEvent event)`
    `java.util.List<AbstractEventChannelPair>` | `getSuccessful(edu.sc.seis.fissuresUtil.cache.CacheEvent event, edu.iris.Fissures.network.StationImpl station)`
    `java.util.List<AbstractEventChannelPair>` | `getSuccessful(edu.iris.Fissures.network.StationImpl station)`
    `java.util.List<edu.sc.seis.fissuresUtil.cache.CacheEvent>` | `getSuccessfulEventsForStation(edu.iris.Fissures.network.StationImpl sta)`
    `java.util.List<edu.iris.Fissures.network.StationImpl>` | `getSuccessfulStationsForEvent(edu.sc.seis.fissuresUtil.cache.CacheEvent event)`
    `java.util.List<edu.sc.seis.fissuresUtil.cache.CacheEvent>` | `getUnsuccessfulEventsForStation(edu.iris.Fissures.network.StationImpl sta)`
    `java.util.List<edu.iris.Fissures.network.StationImpl>` | `getUnsuccessfulStationsForEvent(edu.sc.seis.fissuresUtil.cache.CacheEvent event)`
    `void` | `initHQLStmts()`
    `boolean` | `isECPTodo()`
    `boolean` | `isENPTodo()`
    `boolean` | `isESPTodo()`
    `boolean` | `isRetryTodo()`
    `java.util.List<EventStationPair>` | `loadESPForNetwork(StatefulEvent event, edu.iris.Fissures.network.NetworkAttrImpl net)`
    `void` | `offerEventChannelPair(java.util.List<AbstractEventChannelPair> chanPairList)`
    `void` | `offerEventNetworkPairs(java.util.List<EventNetworkPair> staPairList)`
    `void` | `offerEventStationPair(java.util.List<EventStationPair> staPairList)`
    `void` | `populateECPToDo()`
    `void` | `populateENPToDo()`
    `void` | `populateESPToDo()`
    `void` | `populateRetryToDo()`
    `EventVectorPair` | `put(EventVectorPair eventVectorPair)`
    `long` | `put(RecordSectionItem item)`
    `int` | `putConfig(SodConfig sodConfig)`
    `protected Version` | `putDBVersion()`
    `int` | `putQueryTime(QueryTime qtime)`
    `java.util.List<RecordSectionItem>` | `recordSectionsForEvent(edu.sc.seis.fissuresUtil.cache.CacheEvent event)`
    `void` | `reopenSuspendedEventChannelPairs(java.lang.String processingRule, boolean vector)`
    `static void` | `setDefaultEcpClass(java.lang.Class<? extends AbstractEventChannelPair> ecpClass)`
    `boolean` | `updateBestForRecordSection(java.lang.String orientationId, java.lang.String recordSectionId, edu.sc.seis.fissuresUtil.cache.CacheEvent event, edu.iris.Fissures.IfNetwork.ChannelId[] channelIds)`

    - ### Methods inherited from class edu.sc.seis.fissuresUtil.hibernate.AbstractHibernateDB

      `commit, createSession, deploySchema, deploySchema, flush, getReadOnlySession, getSession, getTXID, getUnitCache, intern, internUnit, internUnit, isSessionOpen, rollback`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### defaultEcpClass

          public static java.lang.Class<? extends AbstractEventChannelPair> defaultEcpClass

    - #### ecpClass

          public java.lang.Class<? extends AbstractEventChannelPair> ecpClass

  - ### Constructor Detail

    - #### SodDB

          protected SodDB()

      database should use one of EventVectorPair or EventChannelPair. Using AbstractEventChannelPair results in very slow union in selects in hsqldb. By specifying which table we are using, the queries are several orders of magnitude faster and do not use huge amounts of memory, which matters a lot when the number of ecps becomes large.

  - ### Method Detail

    - #### configHibernate

          public static void configHibernate(org.hibernate.cfg.Configuration config)

    - #### reopenSuspendedEventChannelPairs

          public void reopenSuspendedEventChannelPairs(java.lang.String processingRule,
                                                       boolean vector)

    - #### createEventNetworkPair

          public EventNetworkPair createEventNetworkPair(StatefulEvent event,
                                                         edu.iris.Fissures.network.NetworkAttrImpl net)

    - #### offerEventNetworkPairs

          public void offerEventNetworkPairs(java.util.List<EventNetworkPair> staPairList)

    - #### offerEventStationPair

          public void offerEventStationPair(java.util.List<EventStationPair> staPairList)

    - #### offerEventChannelPair

          public void offerEventChannelPair(java.util.List<AbstractEventChannelPair> chanPairList)

    - #### loadESPForNetwork

          public java.util.List<EventStationPair> loadESPForNetwork(StatefulEvent event,
                                                                    edu.iris.Fissures.network.NetworkAttrImpl net)

    - #### createEventStationPair

          public EventStationPair createEventStationPair(StatefulEvent event,
                                                         edu.iris.Fissures.network.StationImpl station)

    - #### createEventChannelPair

          public EventChannelPair createEventChannelPair(StatefulEvent event,
                                                         edu.iris.Fissures.network.ChannelImpl chan,
                                                         EventStationPair esp)

    - #### isECPTodo

          public boolean isECPTodo()

    - #### isESPTodo

          public boolean isESPTodo()

    - #### isENPTodo

          public boolean isENPTodo()

    - #### getNextENPFromCache

          public EventNetworkPair getNextENPFromCache()

      next successful event-network to process from cache. Returns null if no more events in cache.

    - #### getNextENP

          public EventNetworkPair getNextENP()

      next successful event-network to process. Returns null if no more events.

    - #### populateENPToDo

          public void populateENPToDo()

    - #### getNextESPFromCache

          public EventStationPair getNextESPFromCache()

      next successful event-station to process from memory cache. Returns null if no more esp in memory.

    - #### getNextESP

          public EventStationPair getNextESP()

      next successful event-station to process. Returns null if no more events.

    - #### populateESPToDo

          public void populateESPToDo()

    - #### populateECPToDo

          public void populateECPToDo()

    - #### getNextECPFromCache

          public AbstractEventChannelPair getNextECPFromCache()

      next successful event-station to process from memory cache. Returns null if no more esp in memory.

    - #### getNextECP

          public AbstractEventChannelPair getNextECP()

      next successful event-channel to process. Returns null if no more events.

    - #### getNextRetryECPFromCache

          public AbstractEventChannelPair getNextRetryECPFromCache()

    - #### isRetryTodo

          public boolean isRetryTodo()

    - #### getRetryToDo

          public java.util.List<AbstractEventChannelPair> getRetryToDo()

    - #### populateRetryToDo

          public void populateRetryToDo()

    - #### getNumWorkUnits

          public int getNumWorkUnits(Standing standing)

    - #### getNumEventNetworkWorkUnits

          public int getNumEventNetworkWorkUnits(Standing standing)

    - #### getECP

          public EventChannelPair getECP(edu.sc.seis.fissuresUtil.cache.CacheEvent event,
                                         edu.iris.Fissures.network.ChannelImpl chan)

    - #### put

          public EventVectorPair put(EventVectorPair eventVectorPair)

    - #### getMinRetryDelay

          public edu.iris.Fissures.model.TimeInterval getMinRetryDelay()

    - #### getMaxRetries

          public int getMaxRetries()

    - #### getNumSuccessful

          public int getNumSuccessful()

    - #### getNumSuccessful

          public int getNumSuccessful(edu.sc.seis.fissuresUtil.cache.CacheEvent event)

    - #### getNumSuccessful

          public int getNumSuccessful(edu.iris.Fissures.network.StationImpl station)

    - #### getNumSuccessful

          public int getNumSuccessful(edu.sc.seis.fissuresUtil.cache.CacheEvent event,
                                      edu.iris.Fissures.network.StationImpl station)

    - #### getNumFailed

          public int getNumFailed(edu.iris.Fissures.network.StationImpl station)

    - #### getNumFailed

          public int getNumFailed(edu.sc.seis.fissuresUtil.cache.CacheEvent event,
                                  edu.iris.Fissures.network.StationImpl station)

    - #### getNumFailed

          public int getNumFailed(edu.sc.seis.fissuresUtil.cache.CacheEvent event)

    - #### getNumRetry

          public int getNumRetry(edu.iris.Fissures.network.StationImpl station)

    - #### getNumRetry

          public int getNumRetry(edu.sc.seis.fissuresUtil.cache.CacheEvent event)

    - #### getNumRetry

          public int getNumRetry(edu.sc.seis.fissuresUtil.cache.CacheEvent event,
                                 edu.iris.Fissures.network.StationImpl station)

    - #### getAll

          public java.util.List<AbstractEventChannelPair> getAll(edu.sc.seis.fissuresUtil.cache.CacheEvent event)

    - #### getSuccessful

          public java.util.List<AbstractEventChannelPair> getSuccessful(edu.sc.seis.fissuresUtil.cache.CacheEvent event)

    - #### getSuccessful

          public java.util.List<AbstractEventChannelPair> getSuccessful(edu.iris.Fissures.network.StationImpl station)

    - #### getSuccessful

          public java.util.List<AbstractEventChannelPair> getSuccessful(edu.sc.seis.fissuresUtil.cache.CacheEvent event,
                                                                        edu.iris.Fissures.network.StationImpl station)

    - #### getFailed

          public java.util.List<AbstractEventChannelPair> getFailed(edu.iris.Fissures.network.StationImpl station)

    - #### getFailed

          public java.util.List<AbstractEventChannelPair> getFailed(edu.sc.seis.fissuresUtil.cache.CacheEvent event,
                                                                    edu.iris.Fissures.network.StationImpl station)

    - #### getFailed

          public java.util.List<AbstractEventChannelPair> getFailed(edu.sc.seis.fissuresUtil.cache.CacheEvent event)

    - #### getRetry

          public java.util.List<AbstractEventChannelPair> getRetry(edu.iris.Fissures.network.StationImpl station)

    - #### getRetry

          public java.util.List<AbstractEventChannelPair> getRetry(edu.sc.seis.fissuresUtil.cache.CacheEvent event)

    - #### getRetry

          public java.util.List<AbstractEventChannelPair> getRetry(edu.sc.seis.fissuresUtil.cache.CacheEvent event,
                                                                   edu.iris.Fissures.network.StationImpl station)

    - #### getStationsForEvent

          public java.util.List<edu.iris.Fissures.network.StationImpl> getStationsForEvent(edu.sc.seis.fissuresUtil.cache.CacheEvent event)

    - #### getSuccessfulStationsForEvent

          public java.util.List<edu.iris.Fissures.network.StationImpl> getSuccessfulStationsForEvent(edu.sc.seis.fissuresUtil.cache.CacheEvent event)

    - #### getUnsuccessfulStationsForEvent

          public java.util.List<edu.iris.Fissures.network.StationImpl> getUnsuccessfulStationsForEvent(edu.sc.seis.fissuresUtil.cache.CacheEvent event)

    - #### getEventsForStation

          public java.util.List<edu.sc.seis.fissuresUtil.cache.CacheEvent> getEventsForStation(edu.iris.Fissures.network.StationImpl sta)

    - #### getSuccessfulEventsForStation

          public java.util.List<edu.sc.seis.fissuresUtil.cache.CacheEvent> getSuccessfulEventsForStation(edu.iris.Fissures.network.StationImpl sta)

    - #### getUnsuccessfulEventsForStation

          public java.util.List<edu.sc.seis.fissuresUtil.cache.CacheEvent> getUnsuccessfulEventsForStation(edu.iris.Fissures.network.StationImpl sta)

    - #### put

          public long put(RecordSectionItem item)

    - #### getRecordSectionItemForEvent

          public RecordSectionItem getRecordSectionItemForEvent(edu.sc.seis.fissuresUtil.cache.CacheEvent event,
                                                                edu.iris.Fissures.network.ChannelImpl channel)

    - #### getRecordSectionId

          public java.util.List<java.lang.String> getRecordSectionId(edu.sc.seis.fissuresUtil.cache.CacheEvent event)

      Finds the recordsectionids for this event

    - #### getRecordSectionOrientations

          public java.util.List<java.lang.String> getRecordSectionOrientations(edu.sc.seis.fissuresUtil.cache.CacheEvent event)

      Finds the recordsection orientationids for this event

    - #### getRecordSectionItem

          public RecordSectionItem getRecordSectionItem(java.lang.String orientationId,
                                                        java.lang.String recordSectionId,
                                                        edu.sc.seis.fissuresUtil.cache.CacheEvent event,
                                                        edu.iris.Fissures.network.ChannelImpl channel)

    - #### getStationsForRecordSection

          public java.util.List<edu.iris.Fissures.network.StationImpl> getStationsForRecordSection(java.lang.String orientationId,
                                                                                                   java.lang.String recordSectionId,
                                                                                                   edu.sc.seis.fissuresUtil.cache.CacheEvent event,
                                                                                                   boolean best)

    - #### getChannelsForRecordSection

          public java.util.List<edu.iris.Fissures.network.ChannelImpl> getChannelsForRecordSection(java.lang.String orientationId,
                                                                                                   edu.sc.seis.fissuresUtil.cache.CacheEvent event,
                                                                                                   boolean best)

    - #### getBestForRecordSection

          public java.util.List<RecordSectionItem> getBestForRecordSection(java.lang.String orientationId,
                                                                           java.lang.String recordSectionId,
                                                                           edu.sc.seis.fissuresUtil.cache.CacheEvent event)

    - #### updateBestForRecordSection

          public boolean updateBestForRecordSection(java.lang.String orientationId,
                                                    java.lang.String recordSectionId,
                                                    edu.sc.seis.fissuresUtil.cache.CacheEvent event,
                                                    edu.iris.Fissures.IfNetwork.ChannelId[] channelIds)

    - #### getRecordSectionItemList

          public java.util.List<RecordSectionItem> getRecordSectionItemList(java.lang.String orientationId,
                                                                            java.lang.String recordSectionId,
                                                                            edu.sc.seis.fissuresUtil.cache.CacheEvent event)

    - #### recordSectionsForEvent

          public java.util.List<RecordSectionItem> recordSectionsForEvent(edu.sc.seis.fissuresUtil.cache.CacheEvent event)

    - #### putConfig

          public int putConfig(SodConfig sodConfig)

    - #### getCurrentConfig

          public SodConfig getCurrentConfig()

    - #### getConfig

          public SodConfig getConfig(int configid)

    - #### getQueryTime

          public QueryTime getQueryTime(java.lang.String serverName,
                                        java.lang.String serverDNS)

    - #### putQueryTime

          public int putQueryTime(QueryTime qtime)

    - #### getDBVersion

          public Version getDBVersion()

    - #### putDBVersion

          protected Version putDBVersion()

    - #### initHQLStmts

          public void initHQLStmts()

    - #### discoverDbEcpClass

          public static java.lang.Class<? extends AbstractEventChannelPair> discoverDbEcpClass()

    - #### setDefaultEcpClass

          public static void setDefaultEcpClass(java.lang.Class<? extends AbstractEventChannelPair> ecpClass)

    - #### getEcpClass

          public java.lang.Class<? extends AbstractEventChannelPair> getEcpClass()

    - #### getSingleton

          public static SodDB getSingleton()