@@ -0,0 +1,2254 @@
+package org.springframework.roo.support.util;%0A%0Aimport java.io.InputStream;%0Aimport java.io.InputStreamReader;%0Aimport java.util.logging.Level;%0Aimport java.util.logging.Logger;%0A%0Aimport org.springframework.roo.support.logging.HandlerUtils;%0A%0A/**%0A * Retrieves text files from the classloader and displays them on-screen.%0A * %0A * %3Cp%3E%0A * Respects normal Roo conventions such as all resources should appear under the same%0A * package as the bundle itself etc.%0A * %0A * @author Ben Alex%0A * @since 1.1.1%0A *%0A */%0Apublic abstract class MessageDisplayUtils %7B%0A%09public static Logger logger = HandlerUtils.getLogger(MessageDisplayUtils.class);%0A%0A%09/**%0A%09 * Displays the requested file via the logger API.%0A%09 * %0A%09 * %3Cp%3E%0A%09 * Each file must available from the classloader of the %22owner%22. It must also be in the same%0A%09 * package as the class of the %22owner%22. So if the owner is com.foo.Bar, and the file is called%0A%09 * %22hello.txt%22, the file must appear in the same bundle as com.foo.Bar and be available from%0A%09 * the resource path %22/com/foo/Hello.txt%22.%0A%09 * %0A%09 * @param fileName the simple filename (required)%0A%09 * @param owner the class which owns the file (required)%0A%09 * @param important if true, it will display with a higher importance color where possible%0A%09 */%0A%09public static void displayFile(String fileName, Class%3C?%3E owner, boolean important) %7B%0A%09%09Level level = Level.FINE;%0A%09%09if (important) %7B%0A%09%09%09level = Level.SEVERE;%0A%09%09%7D%0A%09%09String owningPackage = owner.getPackage().getName().replace('.', '/');%0A%09%09String fullResourceName = %22/%22 + owningPackage + %22/%22 + fileName;%0A%09%09InputStream stream = owner.getClassLoader().getResourceAsStream(fullResourceName);%0A%09%09if (stream == null) %7B%0A%09%09%09throw new IllegalStateException(%22Could not locate '%22 + fileName + %22'%22);%0A%09%09%7D%0A%09%09try %7B%0A%09%09%09String message = FileCopyUtils.copyToString(new InputStreamReader(stream));%0A%09%09%09logger.log(level, message);%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09throw new IllegalStateException(e);%0A%09%09%7D%0A%09%7D%0A%0A%09/**%0A%09 * Same as %7B@link #displayFile(String, Class, boolean)%7D except it passes false as the%0A%09 * final argument.%0A%09 * %0A%09 * @param fileName the simple filename (required)%0A%09 * @param owner the class which owns the file (required)%0A%09 */%0A%09public static void displayFile(String fileName, Class%3C?%3E owner) %7B%0A%09%09displayFile(fileName, owner, false);%0A%09%7D%0A%7D%0A

Create utility class for displaying text files to console