1 /*
2 * $Id: DirectoryHolder.java 2993 2011-11-24 19:51:48Z andrewinkler $
3 * ============================================================================
4 * Project gluehloch-homepage-core
5 * Copyright (c) 2004-2010 by Andre Winkler. All rights reserved.
6 * ============================================================================
7 * GNU LESSER GENERAL PUBLIC LICENSE
8 * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26 package de.awtools.homegen;
27
28 import de.awtools.homegen.config.GHConfiguration;
29 import de.awtools.homegen.directory.GHDirectory;
30 import de.awtools.homegen.directory.file.FileBuilder;
31 import de.awtools.homegen.directory.file.FileScanner;
32
33 /**
34 * Verwaltet die Source und Target Verzeichnisse des Generators.
35 *
36 * @version $LastChangedRevision: 2993 $ $LastChangedDate: 2011-11-24 20:51:48 +0100 (Thu, 24 Nov 2011) $
37 * @author by Andre Winkler, $LastChangedBy: andrewinkler $
38 */
39 public class DirectoryHolder {
40
41 /** <code>PROJECT/www */
42 private GHDirectory sourceDirectory;
43
44 /** PROJECT/target/resource */
45 private GHDirectory targetResourceWebDirectory;
46
47 /** PROJECT/target/www-prep */
48 private GHDirectory targetWwwDirectory;
49
50 /** PROJECT/target/www */
51 private GHDirectory targetWwwPrepDirectory;
52
53 /**
54 * Scannt die Verzeichnisse <code>PROJECT/www</code>,
55 * <code>PROJECT/target/resource</code>,
56 * <code>PROJECT/target/www-prep</code> und
57 * <code>PROJECT/target/www</code> ein.
58 *
59 * @param config Konfiguration der Anwendung.
60 */
61 public DirectoryHolder(final GHConfiguration config) {
62 FileBuilder sourceFileBuilder = new FileBuilder();
63
64 // <PROJECT_HOME>/www
65 FileScanner sourceFileScanner = new FileScanner(config.getWww(),
66 sourceFileBuilder);
67 sourceDirectory = sourceFileScanner.scan();
68
69 // <PROJECT_HOME>/target/resource/web/(bootstrap)|(yaml) (css, js, images)
70 FileScanner resourceFileScanner = new FileScanner(
71 config.getTargetResourceWeb(), sourceFileBuilder);
72 targetResourceWebDirectory = resourceFileScanner.scan();
73
74 // <PROJECT_HOME>/target/www
75 FileScanner targetFileScanner = new FileScanner(config.getTargetWww(),
76 sourceFileBuilder);
77 targetWwwDirectory = targetFileScanner.scan();
78
79 // <PROJECT_HOME>/target/www-prep
80 FileScanner wwwPrepFileScanner = new FileScanner(
81 config.getTargetWwwPrep(), sourceFileBuilder);
82 targetWwwPrepDirectory = wwwPrepFileScanner.scan();
83 }
84
85 /**
86 * @return Returns the sourceDirectory.
87 */
88 public GHDirectory getSourceDirectory() {
89 return sourceDirectory;
90 }
91
92 /**
93 * @return Returns the targetResourceDirectory.
94 */
95 public GHDirectory getTargetResourceWebDirectory() {
96 return targetResourceWebDirectory;
97 }
98
99 /**
100 * @return Returns the targetWwwDirectory.
101 */
102 public GHDirectory getTargetWwwDirectory() {
103 return targetWwwDirectory;
104 }
105
106 /**
107 * @return Returns the targetWwwPrepDirectory.
108 */
109 public GHDirectory getTargetWwwPrepDirectory() {
110 return targetWwwPrepDirectory;
111 }
112
113 }