Class BaseSharedObjectsManager<T extends org.pentaho.di.shared.SharedObjectInterface<T> & org.pentaho.di.repository.RepositoryElementInterface>

java.lang.Object
org.pentaho.di.shared.BaseSharedObjectsManager<T>
All Implemented Interfaces:
org.pentaho.di.core.bowl.CachingManager, SharedObjectsManagementInterface<T>
Direct Known Subclasses:
ClusterSchemaManager, DatabaseConnectionManager, PartitionSchemaManager, SlaveServerManager

public abstract class BaseSharedObjectsManager<T extends org.pentaho.di.shared.SharedObjectInterface<T> & org.pentaho.di.repository.RepositoryElementInterface> extends Object implements SharedObjectsManagementInterface<T>, org.pentaho.di.core.bowl.CachingManager
This class uses the SharedObjectsIO to retrieve and save shared objects. This is used by the UI.

This class caches the state of the underlying SharedObjectsIO, and does not re-read from the source. Only changes written through this interface will be reflected.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.pentaho.di.shared.SharedObjectsIO
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    BaseSharedObjectsManager(String type, org.pentaho.di.shared.SharedObjectsIO sharedObjectsIO)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(T sharedObjectInterface)
    Save the SharedObjectInterface for a type using the persistence mechanism defined by SharedObjectIO and also add to the local map
    void
    addSubscriber(org.pentaho.di.core.bowl.UpdateSubscriber subscriber)
    Subscribe to changes made to this Manager instance.
    void
    Removes all sharedObjects for a type
    void
     
    protected abstract T
    This method is called while populating the sharedObjectMap to create concrete SharedObjectInterface implementation class.
    get(String name)
    Get the SharedObjectInterface object for the type using the name
    Get the list of SharedObjectInterface for the type
    void
     
    void
    remove(String sharedObjectName)
    Remove the provided database
    void
    remove(T sharedObjectInterface)
    Remove the SharedObjectInterface object for a type
    void
    resets the caches in this manager.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • sharedObjectsIO

      protected org.pentaho.di.shared.SharedObjectsIO sharedObjectsIO
  • Constructor Details

    • BaseSharedObjectsManager

      protected BaseSharedObjectsManager(String type, org.pentaho.di.shared.SharedObjectsIO sharedObjectsIO)
  • Method Details

    • createSharedObjectUsingNode

      protected abstract T createSharedObjectUsingNode(Node node) throws org.pentaho.di.core.exception.KettleException
      This method is called while populating the sharedObjectMap to create concrete SharedObjectInterface implementation class. This will be implemented by subclasses.
      Parameters:
      node -
      Returns:
      Throws:
      org.pentaho.di.core.exception.KettleException
    • add

      public void add(T sharedObjectInterface) throws org.pentaho.di.core.exception.KettleException
      Save the SharedObjectInterface for a type using the persistence mechanism defined by SharedObjectIO and also add to the local map
      Specified by:
      add in interface SharedObjectsManagementInterface<T extends org.pentaho.di.shared.SharedObjectInterface<T> & org.pentaho.di.repository.RepositoryElementInterface>
      Parameters:
      sharedObjectInterface -
      Throws:
      org.pentaho.di.core.exception.KettleException
    • getAll

      public List<T> getAll() throws org.pentaho.di.core.exception.KettleException
      Get the list of SharedObjectInterface for the type
      Specified by:
      getAll in interface SharedObjectsManagementInterface<T extends org.pentaho.di.shared.SharedObjectInterface<T> & org.pentaho.di.repository.RepositoryElementInterface>
      Returns:
      Throws:
      org.pentaho.di.core.exception.KettleException
    • get

      public T get(String name) throws org.pentaho.di.core.exception.KettleException
      Get the SharedObjectInterface object for the type using the name
      Specified by:
      get in interface SharedObjectsManagementInterface<T extends org.pentaho.di.shared.SharedObjectInterface<T> & org.pentaho.di.repository.RepositoryElementInterface>
      Parameters:
      name - name of the SharedObject
      Returns:
      Throws:
      org.pentaho.di.core.exception.KettleException
    • remove

      public void remove(T sharedObjectInterface) throws org.pentaho.di.core.exception.KettleException
      Remove the SharedObjectInterface object for a type
      Specified by:
      remove in interface SharedObjectsManagementInterface<T extends org.pentaho.di.shared.SharedObjectInterface<T> & org.pentaho.di.repository.RepositoryElementInterface>
      Parameters:
      sharedObjectInterface - SharedObject to remove
      Throws:
      org.pentaho.di.core.exception.KettleException
    • remove

      public void remove(String sharedObjectName) throws org.pentaho.di.core.exception.KettleException
      Description copied from interface: SharedObjectsManagementInterface
      Remove the provided database
      Specified by:
      remove in interface SharedObjectsManagementInterface<T extends org.pentaho.di.shared.SharedObjectInterface<T> & org.pentaho.di.repository.RepositoryElementInterface>
      Parameters:
      sharedObjectName - name of the SharedObject to remove
      Throws:
      org.pentaho.di.core.exception.KettleException
    • clear

      public void clear() throws org.pentaho.di.core.exception.KettleException
      Description copied from interface: SharedObjectsManagementInterface
      Removes all sharedObjects for a type
      Specified by:
      clear in interface SharedObjectsManagementInterface<T extends org.pentaho.di.shared.SharedObjectInterface<T> & org.pentaho.di.repository.RepositoryElementInterface>
      Throws:
      org.pentaho.di.core.exception.KettleException
    • reset

      public void reset()
      resets the caches in this manager.
    • addSubscriber

      public void addSubscriber(org.pentaho.di.core.bowl.UpdateSubscriber subscriber)
      Subscribe to changes made to this Manager instance.

      Note that this implementation uses a WeakReference to retain the connection to the subscriber, so the caller should hold onto this object as long as it needs to be called for changes.

      Specified by:
      addSubscriber in interface org.pentaho.di.core.bowl.CachingManager
      Parameters:
      subscriber -
    • notifyChanged

      public void notifyChanged()
      Specified by:
      notifyChanged in interface org.pentaho.di.core.bowl.CachingManager
    • clearCache

      public void clearCache()
      Specified by:
      clearCache in interface org.pentaho.di.core.bowl.CachingManager