Class ContentLoader<InternalType>

java.lang.Object
rife.cmf.loader.ContentLoader<InternalType>
Direct Known Subclasses:
ImageContentLoader, XhtmlContentLoader

public abstract class ContentLoader<InternalType> extends Object
This is an abstract class that needs to be extended by all the classes that are able to load raw data and converted it to a common internal type.

Each content loader has a collection of back-ends that are able to interpret the raw data. All that should be done by an extending class, is implement the getBackends method and return a List of supported loader back-ends.

Since:
1.0
See Also:
  • Constructor Details

    • ContentLoader

      public ContentLoader()
  • Method Details

    • load

      public LoadedContent<InternalType> load(Object data, boolean fragment, Set<String> errors) throws ContentManagerException
      Loads raw data and returns the internal type after successful loading and handling.

      Should any errors occur in the back-ends, then they will be added as text messages to the errors collection.

      Parameters:
      data - the raw data that has to be loaded
      fragment - true if the raw data is a fragment; or

      false if the raw data is a complete document or file

      errors - a set to which possible error messages will be added
      Returns:
      an instance of the LoadedContent with the internal type as data that is common for all loaders for the handled content type, for instance java.awt.Image for loaders that handle images; or

      null if the raw data couldn't be loaded

      Throws:
      ContentManagerException
      Since:
      1.4
    • getBackends

      public abstract List<ContentLoaderBackend<InternalType>> getBackends()
      Returns a list of support content loading back-ends.

      This method should be implemented by all concrete content loaders.

      Returns:
      the list of content loader back-ends
      Since:
      1.0