Interface AssetManager


public interface AssetManager
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.nifi.asset.Asset
    createAsset(String parameterContextId, String assetName, InputStream contents)
    Creates a new Asset with the given name and contents.
    org.apache.nifi.asset.Asset
    createMissingAsset(String parameterContextId, String assetName)
    Creates an Asset with the given name and associates it with the given parameter context.
    Optional<org.apache.nifi.asset.Asset>
    Deletes the Asset with the given id, if it exists.
    Optional<org.apache.nifi.asset.Asset>
    Retrieves the Asset with the given id, if it exists.
    List<org.apache.nifi.asset.Asset>
    getAssets(String parameterContextId)
    Retrieves the Assets that belong to the given parameter context.
    void
    Initializes the AssetManager, providing the context necessary for the manager to operate.
  • Method Details

    • initialize

      void initialize(AssetManagerInitializationContext context)
      Initializes the AssetManager, providing the context necessary for the manager to operate.
      Parameters:
      context - the context that provides all necessary initialization information
    • createAsset

      org.apache.nifi.asset.Asset createAsset(String parameterContextId, String assetName, InputStream contents) throws IOException
      Creates a new Asset with the given name and contents.
      Parameters:
      parameterContextId - the id of the parameter context
      assetName - the name of the asset
      contents - the contents of the asset
      Returns:
      the created asset
      Throws:
      IOException - if there is an error creating the asset
    • getAsset

      Optional<org.apache.nifi.asset.Asset> getAsset(String id)
      Retrieves the Asset with the given id, if it exists.
      Parameters:
      id - the id of the asset to retrieve
      Returns:
      the asset, if it exists
    • getAssets

      List<org.apache.nifi.asset.Asset> getAssets(String parameterContextId)
      Retrieves the Assets that belong to the given parameter context.
      Parameters:
      parameterContextId - the id of the parameter context
      Returns:
      the list of assets for the given context
    • createMissingAsset

      org.apache.nifi.asset.Asset createMissingAsset(String parameterContextId, String assetName)
      Creates an Asset with the given name and associates it with the given parameter context. If the asset already exists, it is returned. Otherwise, an asset is created but the underlying file is not created. This allows the asset to be referenced but any component that attempts to use the asset will still see a File that does not exist, which will typically lead to an invalid component.
      Parameters:
      parameterContextId - the id of the parameter context
      assetName - the name of the asset
      Returns:
      the created asset
    • deleteAsset

      Optional<org.apache.nifi.asset.Asset> deleteAsset(String id)
      Deletes the Asset with the given id, if it exists.
      Parameters:
      id - the id of the asset to delete
      Returns:
      the deleted asset, if it existed