Class ServerConfigUtils


  • public final class ServerConfigUtils
    extends Object
    A utility class holding useful methods for writing WebSphere Liberty server config files.
    • Method Detail

      • open

        public static PrintStream open​(File xmlFile)
                                throws IOException
        Opens a new server.xml for writing and writes the opening server element
        Parameters:
        xmlFile - the file to write into
        Returns:
        a print stream for writing into
        Throws:
        IOException - if an exception occurred
      • close

        public static void close​(PrintStream writer)
        Closes a server.xml and writes the closing server element.
        Parameters:
        writer - the print stream to close
      • writeLibrary

        public static void writeLibrary​(PrintStream writer,
                                        String id,
                                        String[] cp)
        Write a library.
        Parameters:
        writer - the writer to write the library to
        id - the id for the library, if null no id is written.
        cp - the classpath, must be non null
      • writeDataSource

        public static void writeDataSource​(PrintStream writer,
                                           DataSource ds)
        Writes a datasource to the write.
        Parameters:
        writer - the writer.
        ds - the datasource.