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  
18  package net.rwx.maven.asciidoc.backends.impl;
19  
20  import java.io.IOException;
21  import java.util.HashMap;
22  import java.util.Map;
23  import net.rwx.maven.asciidoc.backends.Backend;
24  import net.rwx.maven.asciidoc.backends.BackendService;
25  import net.rwx.maven.asciidoc.constants.Extension;
26  
27  /**
28   * 
29   * @author Arnaud Fonce <arnaud.fonce@r-w-x.net>
30   */
31  public class BackendServiceImpl implements BackendService {
32  
33      private Map<String, Backend> map;
34      
35      public BackendServiceImpl() throws IOException {
36          map = new HashMap<String, Backend>();
37  
38          // only asciidoc compilation
39          map.put( Backend.HTML,    new Backend( Backend.HTML,    Extension.HTML ) );
40          map.put( Backend.XHTML,   new Backend( Backend.XHTML,   Extension.HTML ) );
41          map.put( Backend.HTML4,   new Backend( Backend.HTML4,   Extension.HTML ) );
42          map.put( Backend.SLIDY,   new Backend( Backend.SLIDY,   Extension.HTML ) );
43          map.put( Backend.DOCBOOK, new Backend( Backend.DOCBOOK, Extension.XML ) );
44          
45          // asciidoc compilation with docbook transformations
46          map.put( Backend.PDF, new Backend( Backend.DOCBOOK, Extension.XML, true, Extension.FO, "fo/docbook.xsl", true ) );
47      }
48  
49      @Override
50      public Backend getBackend( String name ) {
51          return map.get( name );
52      }
53  }