Class NewsServiceImpl

  • All Implemented Interfaces:
    NewsService

    public class NewsServiceImpl
    extends Object
    implements NewsService
    Encapsulate access to the news texts.
    Author:
    mhwood
    • Constructor Detail

      • NewsServiceImpl

        protected NewsServiceImpl()
        Not instantiable.
    • Method Detail

      • setAcceptableFilenames

        public void setAcceptableFilenames​(List<String> acceptableFilenames)
      • addLocalesToAcceptableFilenames

        protected List<String> addLocalesToAcceptableFilenames​(List<String> acceptableFilenames)
      • readNewsFile

        public String readNewsFile​(String newsFile)
        Description copied from interface: NewsService
        Reads news from a text file.
        Specified by:
        readNewsFile in interface NewsService
        Parameters:
        newsFile - name of the news file to read in, relative to the news file path.
        Returns:
        contents
      • writeNewsFile

        public String writeNewsFile​(String newsFile,
                                    String news)
        Description copied from interface: NewsService
        Writes news to a text file.
        Specified by:
        writeNewsFile in interface NewsService
        Parameters:
        newsFile - name of the news file to read in, relative to the news file path.
        news - the text to be written to the file.
        Returns:
        string
      • validate

        public boolean validate​(String newsName)
        Description copied from interface: NewsService
        Check if the newsName is an acceptable file name
        Specified by:
        validate in interface NewsService
        Parameters:
        newsName - news name
        Returns:
        true if the newsName is valid