1   package com.atlassian.maven.plugins.amps.product;
2   
3   import com.atlassian.maven.plugins.amps.MavenGoals;
4   import com.atlassian.maven.plugins.amps.Product;
5   import com.atlassian.maven.plugins.amps.ProductArtifact;
6   import com.atlassian.maven.plugins.amps.util.VersionUtils;
7   import org.apache.maven.plugin.MojoExecutionException;
8   import org.apache.maven.project.MavenProject;
9   
10  import java.io.File;
11  import java.util.*;
12  
13  public class RefappProductHandler extends AbstractWebappProductHandler
14  {
15      public RefappProductHandler(MavenProject project, MavenGoals goals)
16      {
17          super(project, goals, new RefappPluginProvider());
18      }
19  
20      public String getId()
21      {
22          return "refapp";
23      }
24  
25      public int getDefaultHttpPort()
26      {
27          return 5990;
28      }
29  
30      @Override
31      protected File getUserInstalledPluginsDirectory(final File webappDir, File homeDir)
32      {
33          return null;
34      }
35  
36      @Override
37      protected List<ProductArtifact> getExtraContainerDependencies()
38      {
39          return Collections.emptyList();
40      }
41  
42      @Override
43      protected String getBundledPluginPath(Product ctx)
44      {
45          return "WEB-INF/classes/atlassian-bundled-plugins.zip";
46      }
47  
48      @Override
49      protected void processHomeDirectory(Product ctx, File homeDir) throws MojoExecutionException
50      {
51      }
52  
53      @Override
54      protected List<ProductArtifact> getDefaultLibPlugins()
55      {
56          return Collections.emptyList();
57      }
58  
59      @Override
60      protected List<ProductArtifact> getDefaultBundledPlugins()
61      {
62          return Collections.emptyList();
63      }
64  
65      @Override
66      protected Map<String, String> getSystemProperties(Product ctx)
67      {
68          Map<String, String> map = new HashMap<String, String>();
69          map.put("refapp.home", getHomeDirectory(ctx).getPath());
70          map.put("osgi.cache", getHomeDirectory(ctx).getPath()+ "/osgi-cache");
71          map.put("bundledplugins.cache", getHomeDirectory(ctx).getPath()+ "/bundled-plugins");
72          return map;
73      }
74  
75      @Override
76      protected ProductArtifact getArtifact()
77      {
78          return new ProductArtifact("com.atlassian.refapp", "atlassian-refapp", VersionUtils.getVersion());
79      }
80  
81      @Override
82      protected ProductArtifact getTestResourcesArtifact()
83      {
84          return null;
85      }
86  
87      private static class RefappPluginProvider extends AbstractPluginProvider
88      {
89  
90          @Override
91          protected Collection<ProductArtifact> getSalArtifacts(String salVersion)
92          {
93              return Arrays.asList(
94                  new ProductArtifact("com.atlassian.sal", "sal-api", salVersion),
95                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-appproperties-plugin", salVersion),
96                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-component-plugin", salVersion),
97                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-executor-plugin", salVersion),
98                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-lifecycle-plugin", salVersion),
99                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-message-plugin", salVersion),
100                 new ProductArtifact("com.atlassian.sal", "sal-refimpl-net-plugin", salVersion),
101                 new ProductArtifact("com.atlassian.sal", "sal-refimpl-pluginsettings-plugin", salVersion),
102                 new ProductArtifact("com.atlassian.sal", "sal-refimpl-project-plugin", salVersion),
103                 new ProductArtifact("com.atlassian.sal", "sal-refimpl-search-plugin", salVersion),
104                 new ProductArtifact("com.atlassian.sal", "sal-refimpl-transaction-plugin", salVersion),
105                 new ProductArtifact("com.atlassian.sal", "sal-refimpl-upgrade-plugin", salVersion),
106                 new ProductArtifact("com.atlassian.sal", "sal-refimpl-user-plugin", salVersion));
107         }
108 
109         @Override
110         protected Collection<ProductArtifact> getPdkInstallArtifacts(String pdkInstallVersion)
111         {
112             return Collections.emptyList();
113         }
114     }
115 }