From: David ‘Bombe’ Roden Date: Fri, 27 Jul 2012 05:48:59 +0000 (+0200) Subject: Create data directory helper on load. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=56f15587acd089ee43e2ab1e06fa0cf7c5f0bedf;p=demoscenemusic.git Create data directory helper on load. --- diff --git a/src/main/java/net/pterodactylus/demoscenemusic/core/Core.java b/src/main/java/net/pterodactylus/demoscenemusic/core/Core.java index aa3f31e..d0ba5a0 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/core/Core.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/core/Core.java @@ -39,6 +39,9 @@ public class Core implements ServletContextListener { private DataManager dataManager; + /** The data directory. */ + private DataDirectory dataDirectory; + private final ConsumerManager consumerManager = new ConsumerManager(); public DataManager getDataManager() { @@ -52,6 +55,15 @@ public class Core implements ServletContextListener { return consumerManager; } + /** + * Returns the data directory helper. + * + * @return The data directory + */ + public DataDirectory getDataDirectory() { + return dataDirectory; + } + // // SERVLETCONTEXTLISTENER METHODS // @@ -62,6 +74,7 @@ public class Core implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent servletContextEvent) { servletContextEvent.getServletContext().setAttribute("core", this); + dataDirectory = new DataDirectory(servletContextEvent.getServletContext().getInitParameter("data-directory")); try { Context context = new InitialContext(); DataSource dataSource = (DataSource) context.lookup("java:/comp/env/jdbc/demosceneMusic"); diff --git a/src/main/webapp/WEB-INF/web.xml.template b/src/main/webapp/WEB-INF/web.xml.template index 3e1f823..efc292d 100644 --- a/src/main/webapp/WEB-INF/web.xml.template +++ b/src/main/webapp/WEB-INF/web.xml.template @@ -10,15 +10,9 @@ - The directory where the streaming files (MP3, Vorbis, etc.) are stored. - storage.streamed - /var/lib/demoscene-music/streamed - - - - The directory where the original files (binaries, SID files, MOD files, etc.) are stored. - storage.original - /var/lib/demoscene-music/original + The directory where the files are stored. + data-directory + /var/lib/demoscene-music/files