View Javadoc

1   package org.apache.torque.generator.configuration.paths;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.io.File;
23  import java.util.Map;
24  
25  /**
26   * Provides the default paths which Torque generator needs to interact with
27   * its surrounding project.
28   * "Default" means that the settings can be overridden in a unit of generation.
29   * NB: This object does not contain any information about how the generator
30   * configuration is organized internally.
31   */
32  public interface ProjectPaths
33  {
34      /**
35       * Returns the path to the Torque generator configuration directory.
36       * The path must either be absolute or relative to the current working
37       * directory.
38       *
39       * @return the path to the Torque generator configuration;
40       *         may (but must not) be null if no configuration is contained
41       *         in the surrounding project;
42       *         must be null if the configuration is read from the class path.
43       *
44       * @throws IllegalStateException if the current state of the object
45       *         is not valid.
46       */
47      File getConfigurationPath();
48  
49      /**
50       * Returns the package of the Torque generator configuration.
51       *
52       * @return the package to the Torque generator configuration. Must be null
53       *         if the configuration is read from the file system or from
54       *         a jar file. Must not be null if the configuration is read
55       *         from the class path.
56       *
57       * @throws IllegalStateException if the current state of the object
58       *         is not valid.
59       */
60      String getConfigurationPackage();
61  
62      /**
63       * Returns the path to the default source directory for the
64       * Torque generator.
65       * The path must either be absolute or relative to the current working
66       * directory.
67       * "Default" means that the setting can be overridden in a unit of
68       * generation. This usually points to a subdirectory
69       * where the sources are located.
70       *
71       * @return the path for the source files, not null.
72       *
73       * @throws IllegalStateException if the current state of the object
74       *         is not valid.
75       */
76      File getDefaultSourcePath();
77  
78      /**
79       * Returns the path to the base directory for the generated output
80       * for the given output key.
81       *
82       * The returned path is either absolute or relative to the current working
83       * directory.
84       *
85       * @param outputDirKey the key which output directory should be returned.
86       *        Null is the key for the default output directory
87       *        and is always mapped to a non-null value.
88       *
89       * @return the base directory for the generated files, not null.
90       *
91       * @throws IllegalStateException if the current state of the object
92       *         is not valid.
93       * @throws IllegalArgumentException if the outputDirKey is unknown.
94       */
95      File getOutputDirectory(String outputDirKey);
96  
97      /**
98       * Returns the output directory map which contains the mapping
99       * from output directory key to output directory.
100      *
101      * @return the output directory map, not null, contains at least
102      *         a mapping for the key null.
103      *
104      * @throws IllegalStateException if the current state of the object
105      *         is not valid.
106      */
107     Map<String, File> getOutputDirectoryMap();
108 
109     /**
110      * Returns the work directory where the torque generator can store
111      * internal files.
112      *
113      * @return the work directory, not null.
114      *
115      * @throws IllegalStateException if the current state of the object
116      *         is not valid.
117      */
118     File getWorkDirectory();
119 }