1 package com.atlassian.maven.plugins.amps.product;
2
3 import com.atlassian.maven.plugins.amps.MavenGoals;
4 import org.apache.maven.project.MavenProject;
5 import org.apache.maven.plugin.logging.Log;
6
7 import java.util.Arrays;
8 import java.util.Collection;
9
10 public class ProductHandlerFactory
11 {
12 public static final String REFAPP = "refapp";
13 public static final String CONFLUENCE = "confluence";
14 public static final String JIRA = "jira";
15 public static final String BAMBOO = "bamboo";
16 public static final String FECRU = "fecru";
17 public static final String CROWD = "crowd";
18
19 public static ProductHandler create(String id, MavenProject project, MavenGoals goals, Log log)
20 {
21 if (REFAPP.equals(id))
22 {
23 return new RefappProductHandler(project, goals);
24 }
25 else if (CONFLUENCE.equals(id))
26 {
27 return new ConfluenceProductHandler(project, goals);
28 }
29 else if (JIRA.equals(id))
30 {
31 return new JiraProductHandler(project, goals);
32 }
33 else if (BAMBOO.equals(id))
34 {
35 return new BambooProductHandler(project, goals);
36 }
37 else if (FECRU.equals(id))
38 {
39 return new FeCruProductHandler(project, goals, log);
40 }
41 else if (CROWD.equals(id))
42 {
43 return new CrowdProductHandler(project, goals);
44 }
45
46 throw new IllegalArgumentException("Unknown product id:" + id);
47 }
48
49 public static Collection<String> getIds()
50 {
51 return Arrays.asList(REFAPP, CONFLUENCE, JIRA, BAMBOO, FECRU, CROWD);
52 }
53 }