Create data directory helper on load.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 27 Jul 2012 05:48:59 +0000 (07:48 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 27 Jul 2012 05:48:59 +0000 (07:48 +0200)
src/main/java/net/pterodactylus/demoscenemusic/core/Core.java
src/main/webapp/WEB-INF/web.xml.template

index aa3f31e..d0ba5a0 100644 (file)
@@ -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");
index 3e1f823..efc292d 100644 (file)
        </listener>
 
        <context-param>
-               <description>The directory where the streaming files (MP3, Vorbis, etc.) are stored.</description>
-               <param-name>storage.streamed</param-name>
-               <param-value>/var/lib/demoscene-music/streamed</param-value>
-       </context-param>
-
-       <context-param>
-               <description>The directory where the original files (binaries, SID files, MOD files, etc.) are stored.</description>
-               <param-name>storage.original</param-name>
-               <param-value>/var/lib/demoscene-music/original</param-value>
+               <description>The directory where the files are stored.</description>
+               <param-name>data-directory</param-name>
+               <param-value>/var/lib/demoscene-music/files</param-value>
        </context-param>
 
        <resource-ref>