From 56f15587acd089ee43e2ab1e06fa0cf7c5f0bedf Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 27 Jul 2012 07:48:59 +0200 Subject: [PATCH] Create data directory helper on load. --- .../java/net/pterodactylus/demoscenemusic/core/Core.java | 13 +++++++++++++ src/main/webapp/WEB-INF/web.xml.template | 12 +++--------- 2 files changed, 16 insertions(+), 9 deletions(-) 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 -- 2.7.4