Interface NarPersistenceProvider


public interface NarPersistenceProvider
Provides persistence for NAR files dynamically added to NiFi.
  • Method Details

    • initialize

      void initialize(NarPersistenceProviderInitializationContext initializationContext) throws IOException
      Called after instantiation to initialize the provider.
      Parameters:
      initializationContext - the context containing and properties and configuration required to initialize the provider
      Throws:
      IOException
    • createTempFile

      File createTempFile(InputStream inputStream) throws IOException
      Creates a temporary file containing the contents of the given input stream.
      Parameters:
      inputStream - the input stream
      Returns:
      the file containing the contents of the input stream
      Throws:
      IOException - if an I/O error occurs writing the stream to the temp file
    • saveNar

      NarPersistenceInfo saveNar(NarPersistenceContext persistenceContext, File tempNarFile) throws IOException
      Saves the temporary NAR file to its final destination.
      Parameters:
      persistenceContext - the context information
      tempNarFile - the temporary file created from calling createTempFile
      Returns:
      the information about the persisted NAR, including the saved file
      Throws:
      IOException - if an I/O error occurs saving the temp NAR file
    • deleteNar

      void deleteNar(BundleCoordinate narCoordinate) throws IOException
      Deletes the contents of the NAR with the given coordinate.
      Parameters:
      narCoordinate - the coordinate of the NAR to delete
      Throws:
      FileNotFoundException - if a NAR with the given coordinate does not exist
      IOException - if an I/O error occurred deleting the NAR
    • readNar

      InputStream readNar(BundleCoordinate narCoordinate) throws FileNotFoundException
      Obtains an input stream to read the contents of the NAR with the given coordinate.
      Parameters:
      narCoordinate - the coordinate of the NAR
      Returns:
      the input stream for the NAR
      Throws:
      FileNotFoundException - if a NAR with the given coordinate does not exist
    • getNarInfo

      NarPersistenceInfo getNarInfo(BundleCoordinate narCoordinate) throws IOException
      Retrieves the persistence info for the NAR with the given NAR coordinate.
      Parameters:
      narCoordinate - the coordinate of the NAR
      Returns:
      the persistence info
      Throws:
      IOException - if an I/O error occurs reading the persistence info
    • exists

      boolean exists(BundleCoordinate narCoordinate)
      Indicates if a NAR with the given coordinate exists in this persistence provider.
      Parameters:
      narCoordinate - the coordinate of the NAR
      Returns:
      true if a NAR with the coordinate exists, false otherwise
    • getAllNarInfo

      Set<NarPersistenceInfo> getAllNarInfo() throws IOException
      Returns:
      the info for all NARs persisted by this persistence provider
      Throws:
      IOException
    • shutdown

      void shutdown()
      Shuts down the provider and cleans up any resources held by it. Once this method has returned, the provider may be initialized once again via the initialize(NarPersistenceProviderInitializationContext) method.