View Javadoc

1   /*
2    * Copyright (C) 2013 Room Work eXperience
3    *
4    * This program is free software: you can redistribute it and/or modify
5    * it under the terms of the GNU General Public License as published by
6    * the Free Software Foundation, either version 3 of the License, or
7    * (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16   */
17  package net.rwx.maven.asciidoc.services.impl;
18  
19  import net.rwx.maven.asciidoc.backends.Backend;
20  import net.rwx.maven.asciidoc.configuration.Document;
21  import net.rwx.maven.asciidoc.services.RootService;
22  import org.apache.commons.io.FilenameUtils;
23  import org.apache.maven.plugin.logging.Log;
24  
25  /**
26   *
27   * @author Arnaud Fonce <arnaud.fonce@r-w-x.net>
28   */
29  public abstract class RootServiceImpl implements RootService {
30  
31      private Log logger;
32      private String outputPath;
33      
34      @Override
35      public void setLogger(Log logger) {
36          this.logger = logger;
37      }
38      
39      public Log getLogger() {
40          return logger;
41      }
42  
43      protected abstract void setOuputPath( String inputPath, Backend backend );
44      
45      protected void setOutputPath( String inputPath, String extension ) {
46          StringBuilder builder = new StringBuilder();
47          builder.append( FilenameUtils.removeExtension( inputPath ) );
48          builder.append( extension );
49          
50          setOutputPath( builder.toString() );
51      }
52      
53      protected void setOutputPath( String outputPath ) {
54          this.outputPath = outputPath;
55      }
56  
57      @Override
58      public String getOuputPath() {
59          return outputPath;
60      }
61  }