Class AbstractDBResourceBlocker

java.lang.Object
org.gvsig.fmap.dal.resource.spi.AbstractResource
org.gvsig.fmap.dal.resource.db.AbstractDBResourceBlocker
All Implemented Interfaces:
org.gvsig.fmap.dal.resource.db.DBResource, org.gvsig.fmap.dal.resource.Resource, org.gvsig.fmap.dal.resource.spi.ResourceProvider, org.gvsig.tools.observer.Observable, org.gvsig.tools.observer.WeakReferencingObservable

public abstract class AbstractDBResourceBlocker extends org.gvsig.fmap.dal.resource.spi.AbstractResource implements org.gvsig.fmap.dal.resource.db.DBResource
Abstract Data Base Resource implementation that prevents the concurrent access.
Author:
jmvivo
  • Field Summary

    Fields inherited from class org.gvsig.fmap.dal.resource.spi.AbstractResource

    lock, multiResourcelock
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Default constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    Establish connection to data base
    protected abstract void
    final implementation method to Establish connection to data base
    Called from get()

    protected boolean
     
    get()
    Return a connection to the data base.
    Connect to the Data Base if is needed
    Return a connection to the data base.
    Connect to the Data Base if is needed
    protected abstract Object
    final implementation method to get a connection to data base
    Called from connect()

    This method is called with the connection establish
    boolean
    isThis(org.gvsig.fmap.dal.resource.ResourceParameters parameters)
    Check if parameters is the same for this resource.

    Note: override this method to add checks for specify final implementation parameters

    Methods inherited from class org.gvsig.fmap.dal.resource.spi.AbstractResource

    addConsumer, addObserver, addObservers, closeRequest, deleteObserver, deleteObservers, execute, executeBegins, executeEnds, getConsumerAt, getConsumersCount, getData, getLastTimeOpen, getLastTimeUsed, getName, getParameters, inUse, isOpen, notifyChanges, notifyClose, notifyDispose, notifyObserver, notifyOpen, openCount, performExecution, prepare, prepare, removeConsumer, setData, updateLastTimeOpen, updateLastTimeUsed

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.gvsig.fmap.dal.resource.db.DBResource

    isConnected

    Methods inherited from interface org.gvsig.fmap.dal.resource.Resource

    addConsumer, closeRequest, execute, getConsumersCount, getData, getLastTimeOpen, getLastTimeUsed, getName, getParameters, inUse, isOpen, openCount, removeConsumer, setData
  • Constructor Details

    • AbstractDBResourceBlocker

      protected AbstractDBResourceBlocker(AbstractDBResourceParameters parameters) throws org.gvsig.fmap.dal.exception.InitializeException
      Default constructor
      Parameters:
      parameters -
      Throws:
      org.gvsig.fmap.dal.exception.InitializeException
  • Method Details

    • get

      public Object get() throws org.gvsig.fmap.dal.resource.exception.AccessResourceException
      Return a connection to the data base.
      Connect to the Data Base if is needed
      Specified by:
      get in interface org.gvsig.fmap.dal.resource.Resource
      Specified by:
      get in class org.gvsig.fmap.dal.resource.spi.AbstractResource
      Returns:
      connection to the data base
      Throws:
      org.gvsig.fmap.dal.resource.exception.AccessResourceException
    • getConnection

      public Object getConnection() throws org.gvsig.fmap.dal.resource.exception.AccessResourceException
      Return a connection to the data base.
      Connect to the Data Base if is needed
      Returns:
      connection to the data base
      Throws:
      org.gvsig.fmap.dal.resource.exception.AccessResourceException
      See Also:
    • connect

      public final void connect() throws org.gvsig.fmap.dal.exception.DataException
      Establish connection to data base
      Throws:
      org.gvsig.fmap.dal.exception.DataException
    • isThis

      public boolean isThis(org.gvsig.fmap.dal.resource.ResourceParameters parameters) throws org.gvsig.fmap.dal.resource.exception.ResourceException
      Check if parameters is the same for this resource.

      Note: override this method to add checks for specify final implementation parameters
      Specified by:
      isThis in interface org.gvsig.fmap.dal.resource.spi.ResourceProvider
      Throws:
      org.gvsig.fmap.dal.resource.exception.ResourceException
      See Also:
      • ResourceProvider.isThis(ResourceParameters)
    • equals

      protected boolean equals(Comparable v1, Comparable v2)
    • connectToDB

      protected abstract void connectToDB() throws org.gvsig.fmap.dal.exception.DataException
      final implementation method to Establish connection to data base
      Called from get()

      Throws:
      org.gvsig.fmap.dal.exception.DataException
    • getTheConnection

      protected abstract Object getTheConnection() throws org.gvsig.fmap.dal.exception.DataException
      final implementation method to get a connection to data base
      Called from connect()

      This method is called with the connection establish
      Throws:
      org.gvsig.fmap.dal.exception.DataException