PageRenderTime 14ms CodeModel.GetById 7ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/maven-amps-plugin/src/main/java/com/atlassian/maven/plugins/amps/product/ProductHandlerFactory.java

https://bitbucket.org/mmeinhold/amps
Java | 109 lines | 94 code | 13 blank | 2 comment | 27 complexity | 8a0a02a1f89dcd73fe43dceab204dc75 MD5 | raw file
  1package com.atlassian.maven.plugins.amps.product;
  2
  3import com.atlassian.maven.plugins.amps.MavenContext;
  4import com.atlassian.maven.plugins.amps.MavenGoals;
  5import com.atlassian.maven.plugins.amps.product.studio.StudioBambooProductHandler;
  6import com.atlassian.maven.plugins.amps.product.studio.StudioConfluenceProductHandler;
  7import com.atlassian.maven.plugins.amps.product.studio.StudioCrowdProductHandler;
  8import com.atlassian.maven.plugins.amps.product.studio.StudioFeCruProductHandler;
  9import com.atlassian.maven.plugins.amps.product.studio.StudioJiraProductHandler;
 10import com.atlassian.maven.plugins.amps.product.studio.StudioProductHandler;
 11
 12import java.util.Arrays;
 13import java.util.Collection;
 14
 15public class ProductHandlerFactory
 16{
 17    public static final String REFAPP = "refapp";
 18    public static final String CONFLUENCE = "confluence";
 19    public static final String JIRA = "jira";
 20    public static final String BAMBOO = "bamboo";
 21    public static final String FECRU = "fecru";
 22    public static final String CROWD = "crowd";
 23    public static final String STASH = "stash";
 24    public static final String CTK_SERVER = "ctk-server";
 25
 26    public static final String STUDIO = "studio";
 27    public static final String STUDIO_CONFLUENCE = "studio-confluence";
 28    public static final String STUDIO_JIRA = "studio-jira";
 29    public static final String STUDIO_BAMBOO = "studio-bamboo";
 30    public static final String STUDIO_FECRU = "studio-fecru";
 31    public static final String STUDIO_CROWD = "studio-crowd";
 32
 33
 34
 35    public static ProductHandler create(String id, MavenContext context, MavenGoals goals)
 36    {
 37        if (REFAPP.equals(id))
 38        {
 39            return new RefappProductHandler(context, goals);
 40        }
 41        else if (CONFLUENCE.equals(id))
 42        {
 43            return new ConfluenceProductHandler(context, goals);
 44        }
 45        else if (JIRA.equals(id))
 46        {
 47            return new JiraProductHandler(context, goals);
 48        }
 49        else if (BAMBOO.equals(id))
 50        {
 51            return new BambooProductHandler(context, goals);
 52        }
 53        else if (FECRU.equals(id))
 54        {
 55            return new FeCruProductHandler(context, goals);
 56        }
 57        else if (CROWD.equals(id))
 58        {
 59            return new CrowdProductHandler(context, goals);
 60        }
 61
 62        else if (STASH.equals(id))
 63        {
 64            return new StashProductHandler(context, goals);
 65        }
 66        else if (CTK_SERVER.equals(id))
 67        {
 68            return new CtkServerProductHandler(context, goals);
 69        }
 70
 71        // The Studio product itself
 72        else if (STUDIO.equals(id))
 73        {
 74            return new StudioProductHandler(context, goals);
 75        }
 76
 77        // The Studio products (products which are part of)
 78        else if (STUDIO_CONFLUENCE.equals(id))
 79        {
 80            return new StudioConfluenceProductHandler(context, goals);
 81        }
 82        else if (STUDIO_JIRA.equals(id))
 83        {
 84            return new StudioJiraProductHandler(context, goals);
 85        }
 86        else if (STUDIO_BAMBOO.equals(id))
 87        {
 88            return new StudioBambooProductHandler(context, goals);
 89        }
 90        else if (STUDIO_FECRU.equals(id))
 91        {
 92            return new StudioFeCruProductHandler(context, goals);
 93        }
 94        else if (STUDIO_CROWD.equals(id))
 95        {
 96            return new StudioCrowdProductHandler(context, goals);
 97        }
 98
 99
100        throw new IllegalArgumentException("Unknown product id: '" + id + "' Valid values: "
101            + Arrays.toString(getIds().toArray()));
102    }
103
104    public static Collection<String> getIds()
105    {
106        return Arrays.asList(REFAPP, CONFLUENCE, JIRA, BAMBOO, FECRU, CROWD, STASH, CTK_SERVER,
107                STUDIO, STUDIO_CONFLUENCE, STUDIO_JIRA, STUDIO_BAMBOO, STUDIO_FECRU, STUDIO_CROWD);
108    }
109}