Package org.apache.nifi.nar
Interface NarPersistenceProvider
public interface NarPersistenceProvider
Provides persistence for NAR files dynamically added to NiFi.
-
Method Summary
Modifier and TypeMethodDescriptioncreateTempFile
(InputStream inputStream) Creates a temporary file containing the contents of the given input stream.void
deleteNar
(BundleCoordinate narCoordinate) Deletes the contents of the NAR with the given coordinate.boolean
exists
(BundleCoordinate narCoordinate) Indicates if a NAR with the given coordinate exists in this persistence provider.getNarInfo
(BundleCoordinate narCoordinate) Retrieves the persistence info for the NAR with the given NAR coordinate.void
initialize
(NarPersistenceProviderInitializationContext initializationContext) Called after instantiation to initialize the provider.readNar
(BundleCoordinate narCoordinate) Obtains an input stream to read the contents of the NAR with the given coordinate.saveNar
(NarPersistenceContext persistenceContext, File tempNarFile) Saves the temporary NAR file to its final destination.void
shutdown()
Shuts down the provider and cleans up any resources held by it.
-
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
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 informationtempNarFile
- 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
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 existIOException
- if an I/O error occurred deleting the NAR
-
readNar
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
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
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
- 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 theinitialize(NarPersistenceProviderInitializationContext)
method.
-