View Javadoc
1   package org.nuiton.eugene.plugin.writer;
2   
3   /*
4    * #%L
5    * EUGene :: Maven plugin
6    * %%
7    * Copyright (C) 2006 - 2013 CodeLutin
8    * %%
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU Lesser General Public License as 
11   * published by the Free Software Foundation, either version 3 of the 
12   * License, or (at your option) any later version.
13   * 
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Lesser Public License for more details.
18   * 
19   * You should have received a copy of the GNU General Lesser Public 
20   * License along with this program.  If not, see
21   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
22   * #L%
23   */
24  
25  import org.codehaus.plexus.component.annotations.Component;
26  import org.nuiton.eugene.writer.ChainedFileWriter;
27  
28  /**
29   * To create a memory model from yaml model files.
30   *
31   * @author tchemit
32   * @since 2.6.3
33   */
34  @Component(role = ChainedFileWriter.class, hint = "yamlModel2Memory")
35  public class YamlModelChainedFileWriter extends BaseChainedFileWriterToMemoryModel {
36  
37      public YamlModelChainedFileWriter() {
38          super();
39      }
40  
41      @Override
42      protected String getInputType() {
43          return "yaml";
44      }
45  
46      @Override
47      public String getInputProtocol() {
48          return "yamlmodel";
49      }
50  
51      @Override
52      public boolean acceptInclude(String include) {
53          return include.startsWith("yaml:") ||
54                 include.endsWith(".yamlobjectmodel") ||
55                 include.endsWith(".yamlstatemodel");
56      }
57  
58      @Override
59      public String getDefaultIncludes() {
60          return "**/*.yaml*model";
61      }
62  
63      @Override
64      public String getDefaultInputDirectory() {
65          return "src/main/models";
66      }
67  
68      @Override
69      public String getDefaultOutputDirectory() {
70          return "java";
71      }
72  
73      @Override
74      public String getDefaultTestInputDirectory() {
75          return "src/test/models";
76      }
77  
78      @Override
79      public String getDefaultTestOutputDirectory() {
80          return "test-java";
81      }
82  }