Class AbstractResource

java.lang.Object
org.gvsig.fmap.dal.resource.spi.AbstractResource
All Implemented Interfaces:
org.gvsig.fmap.dal.resource.Resource, org.gvsig.fmap.dal.resource.spi.ResourceProvider, org.gvsig.tools.observer.Observable, org.gvsig.tools.observer.WeakReferencingObservable
Direct Known Subclasses:
AbstractNonBlockingResource, MultiResource

public abstract class AbstractResource extends Object implements org.gvsig.fmap.dal.resource.spi.ResourceProvider, org.gvsig.tools.observer.WeakReferencingObservable

Base implementation for Resource

This implementation not define the

invalid reference
Resource#begin()
and
invalid reference
Resource#end()

Author:
jmvivo
  • Field Details

    • lock

      protected final Object lock
    • multiResourcelock

      protected Object multiResourcelock
  • Constructor Details

    • AbstractResource

      protected AbstractResource(org.gvsig.fmap.dal.resource.ResourceParameters parameters) throws org.gvsig.fmap.dal.exception.InitializeException
      Throws:
      org.gvsig.fmap.dal.exception.InitializeException
  • Method Details

    • updateLastTimeUsed

      protected final void updateLastTimeUsed()
    • updateLastTimeOpen

      protected final void updateLastTimeOpen()
    • getLastTimeOpen

      public final long getLastTimeOpen()
      Specified by:
      getLastTimeOpen in interface org.gvsig.fmap.dal.resource.Resource
    • getLastTimeUsed

      public final long getLastTimeUsed()
      Specified by:
      getLastTimeUsed in interface org.gvsig.fmap.dal.resource.Resource
    • getParameters

      public org.gvsig.fmap.dal.resource.ResourceParameters getParameters()
      Specified by:
      getParameters in interface org.gvsig.fmap.dal.resource.Resource
    • prepare

      public void prepare(org.gvsig.fmap.dal.resource.ResourceParameters params) throws org.gvsig.fmap.dal.resource.exception.PrepareResourceException
      Throws:
      org.gvsig.fmap.dal.resource.exception.PrepareResourceException
    • prepare

      public void prepare() throws org.gvsig.fmap.dal.resource.exception.PrepareResourceException
      Specified by:
      prepare in interface org.gvsig.fmap.dal.resource.spi.ResourceProvider
      Throws:
      org.gvsig.fmap.dal.resource.exception.PrepareResourceException
    • notifyOpen

      public void notifyOpen() throws org.gvsig.fmap.dal.resource.exception.ResourceNotifyOpenException
      Specified by:
      notifyOpen in interface org.gvsig.fmap.dal.resource.spi.ResourceProvider
      Throws:
      org.gvsig.fmap.dal.resource.exception.ResourceNotifyOpenException
    • notifyClose

      public void notifyClose() throws org.gvsig.fmap.dal.resource.exception.ResourceNotifyCloseException
      Specified by:
      notifyClose in interface org.gvsig.fmap.dal.resource.spi.ResourceProvider
      Throws:
      org.gvsig.fmap.dal.resource.exception.ResourceNotifyCloseException
    • notifyChanges

      public void notifyChanges() throws org.gvsig.fmap.dal.resource.exception.ResourceNotifyChangesException
      Specified by:
      notifyChanges in interface org.gvsig.fmap.dal.resource.spi.ResourceProvider
      Throws:
      org.gvsig.fmap.dal.resource.exception.ResourceNotifyChangesException
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface org.gvsig.fmap.dal.resource.Resource
    • openCount

      public int openCount()
      Specified by:
      openCount in interface org.gvsig.fmap.dal.resource.Resource
    • addObserver

      public void addObserver(org.gvsig.tools.observer.Observer o)
      Specified by:
      addObserver in interface org.gvsig.tools.observer.Observable
    • deleteObserver

      public void deleteObserver(org.gvsig.tools.observer.Observer o)
      Specified by:
      deleteObserver in interface org.gvsig.tools.observer.Observable
    • deleteObservers

      public void deleteObservers()
      Specified by:
      deleteObservers in interface org.gvsig.tools.observer.Observable
    • addObservers

      public final void addObservers(org.gvsig.tools.observer.impl.BaseWeakReferencingObservable observers)
    • addConsumer

      public final void addConsumer(org.gvsig.fmap.dal.resource.spi.ResourceConsumer consumer)
      Specified by:
      addConsumer in interface org.gvsig.fmap.dal.resource.Resource
    • removeConsumer

      public final void removeConsumer(org.gvsig.fmap.dal.resource.spi.ResourceConsumer consumer)
      Specified by:
      removeConsumer in interface org.gvsig.fmap.dal.resource.Resource
    • getConsumersCount

      public int getConsumersCount()
      Specified by:
      getConsumersCount in interface org.gvsig.fmap.dal.resource.Resource
    • getConsumerAt

      public org.gvsig.fmap.dal.resource.spi.ResourceConsumer getConsumerAt(int i)
    • closeRequest

      public void closeRequest() throws org.gvsig.fmap.dal.resource.exception.ResourceException
      Specified by:
      closeRequest in interface org.gvsig.fmap.dal.resource.Resource
      Throws:
      org.gvsig.fmap.dal.resource.exception.ResourceException
    • setData

      public void setData(Object data)
      Specified by:
      setData in interface org.gvsig.fmap.dal.resource.Resource
    • getData

      public Object getData()
      Specified by:
      getData in interface org.gvsig.fmap.dal.resource.Resource
    • notifyObserver

      protected void notifyObserver(String type)
    • notifyDispose

      public void notifyDispose() throws org.gvsig.fmap.dal.resource.exception.ResourceNotifyDisposeException
      Specified by:
      notifyDispose in interface org.gvsig.fmap.dal.resource.spi.ResourceProvider
      Throws:
      org.gvsig.fmap.dal.resource.exception.ResourceNotifyDisposeException
    • inUse

      public final boolean inUse()
      Specified by:
      inUse in interface org.gvsig.fmap.dal.resource.Resource
    • execute

      public Object execute(org.gvsig.fmap.dal.resource.ResourceAction action) throws org.gvsig.fmap.dal.resource.exception.ResourceExecuteException
      Specified by:
      execute in interface org.gvsig.fmap.dal.resource.Resource
      Throws:
      org.gvsig.fmap.dal.resource.exception.ResourceExecuteException
    • performExecution

      protected Object performExecution(org.gvsig.fmap.dal.resource.ResourceAction action) throws Exception
      Throws:
      Exception
    • executeBegins

      protected final void executeBegins()
    • executeEnds

      protected final void executeEnds()
    • getName

      public abstract String getName() throws org.gvsig.fmap.dal.resource.exception.AccessResourceException
      Returns the name of the Resource.
      Specified by:
      getName in interface org.gvsig.fmap.dal.resource.Resource
      Throws:
      org.gvsig.fmap.dal.resource.exception.AccessResourceException - if there is an error while accessing the resource
    • get

      public abstract Object get() throws org.gvsig.fmap.dal.resource.exception.AccessResourceException
      Returns the real resource represented by this object.
      Specified by:
      get in interface org.gvsig.fmap.dal.resource.Resource
      Throws:
      org.gvsig.fmap.dal.resource.exception.AccessResourceException - if there is an error while accessing the resource