View Javadoc
1   package org.andromda.maven.plugin.andromdapp.eclipse;
2   
3   import java.io.File;
4   
5   import org.andromda.core.common.ResourceUtils;
6   import org.apache.maven.plugin.logging.Log;
7   import org.apache.maven.project.MavenProject;
8   
9   /**
10   * Provides Eclipse configuration file writing
11   * capabilities.
12   *
13   * @author Chad Brandon
14   */
15  public abstract class EclipseWriter
16  {
17      /** */
18      protected Log logger;
19  
20      /** */
21      protected MavenProject project;
22  
23      /**
24       * @param project
25       * @param logger
26       */
27      public EclipseWriter(final MavenProject project, final Log logger)
28      {
29          this.project = project;
30          this.logger = logger;
31      }
32  
33      /**
34       * Gets the project relative file given the <code>name</code> of the file.
35       *
36       * @param name the name of the file.
37       * @return the actual file instance.
38       */
39      protected File getFile(final String name)
40      {
41          final String rootDirectory = ResourceUtils.normalizePath(this.project.getBasedir().toString());
42          final File file = new File(rootDirectory, name);
43          return file;
44      }
45  
46  }