001package org.andromda.maven.plugin.andromdapp.eclipse;
002
003import java.io.File;
004
005import org.andromda.core.common.ResourceUtils;
006import org.apache.maven.plugin.logging.Log;
007import org.apache.maven.project.MavenProject;
008
009/**
010 * Provides Eclipse configuration file writing
011 * capabilities.
012 *
013 * @author Chad Brandon
014 */
015public abstract class EclipseWriter
016{
017    /** */
018    protected Log logger;
019
020    /** */
021    protected MavenProject project;
022
023    /**
024     * @param project
025     * @param logger
026     */
027    public EclipseWriter(final MavenProject project, final Log logger)
028    {
029        this.project = project;
030        this.logger = logger;
031    }
032
033    /**
034     * Gets the project relative file given the <code>name</code> of the file.
035     *
036     * @param name the name of the file.
037     * @return the actual file instance.
038     */
039    protected File getFile(final String name)
040    {
041        final String rootDirectory = ResourceUtils.normalizePath(this.project.getBasedir().toString());
042        final File file = new File(rootDirectory, name);
043        return file;
044    }
045
046}