1   package com.atlassian.plugins.codegen.modules;
2   
3   import java.io.File;
4   
5   /**
6    *
7    */
8   public class PluginModuleLocation
9   {
10      private final File sourceDirectory;
11      private final File resourcesDir;
12      private final File testDirectory;
13      private final File templateDirectory;
14      private final File pluginXml;
15      private final String groupId;
16      private final String artifactId;
17  
18      private PluginModuleLocation(Builder builder)
19      {
20          this.sourceDirectory = builder.sourceDirectory;
21          this.templateDirectory = builder.templateDirectory;
22          this.resourcesDir = builder.resourcesDirectory;
23          this.testDirectory = builder.testDirectory;
24          this.groupId = builder.groupId;
25          this.artifactId = builder.artifactId;
26          this.pluginXml = new File(resourcesDir, "atlassian-plugin.xml");
27      }
28  
29      public File getSourceDirectory()
30      {
31          return sourceDirectory;
32      }
33  
34      public File getResourcesDir()
35      {
36          return resourcesDir;
37      }
38  
39      public File getTestDirectory()
40      {
41          return testDirectory;
42      }
43  
44      public File getTemplateDirectory()
45      {
46          return templateDirectory;
47      }
48  
49      public File getPluginXml()
50      {
51          return pluginXml;
52      }
53  
54      public String getGroupId()
55      {
56          return groupId;
57      }
58      
59      public String getArtifactId()
60      {
61          return artifactId;
62      }
63      
64      public static class Builder
65      {
66          private File sourceDirectory;
67          private File resourcesDirectory;
68          private File testDirectory;
69          private File templateDirectory;
70          private String groupId;
71          private String artifactId;
72  
73          public Builder(File sourceDirectory)
74          {
75              this.sourceDirectory = sourceDirectory;
76          }
77  
78          public Builder testDirectory(File testDirectory)
79          {
80              this.testDirectory = testDirectory;
81              return this;
82          }
83  
84          public Builder resourcesDirectory(File resourcesDirectory)
85          {
86              this.resourcesDirectory = resourcesDirectory;
87              return this;
88          }
89  
90          public Builder templateDirectory(File templateDirectory)
91          {
92              this.templateDirectory = templateDirectory;
93              return this;
94          }
95  
96          public Builder groupAndArtifactId(String groupId, String artifactId)
97          {
98              this.groupId = groupId;
99              this.artifactId = artifactId;
100             return this;
101         }
102 
103         public PluginModuleLocation build()
104         {
105             return new PluginModuleLocation(this);
106         }
107     }
108 }