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      protected File getPluginsDirectory(final String webappDir, File homeDir)
31      {
32          return null;
33      }
34  
35      protected List<ProductArtifact> getExtraContainerDependencies()
36      {
37          return Collections.emptyList();
38      }
39  
40      protected String getBundledPluginPath(Product ctx)
41      {
42          return "WEB-INF/classes/atlassian-bundled-plugins.zip";
43      }
44  
45      protected void processHomeDirectory(Product ctx, File homeDir) throws MojoExecutionException
46      {
47      }
48  
49      protected List<ProductArtifact> getDefaultLibPlugins()
50      {
51          return Collections.emptyList();
52      }
53  
54      protected List<ProductArtifact> getDefaultBundledPlugins()
55      {
56          return Collections.emptyList();
57      }
58  
59      protected Map<String, String> getSystemProperties(Product ctx)
60      {
61          Map<String, String> map = new HashMap<String, String>();
62          map.put("refapp.home", getHomeDirectory(ctx).getPath());
63          map.put("osgi.cache", getHomeDirectory(ctx).getPath()+ "/osgi-cache");
64          map.put("bundledplugins.cache", getHomeDirectory(ctx).getPath()+ "/bundled-plugins");
65          return map;
66      }
67  
68      protected ProductArtifact getArtifact()
69      {
70          return new ProductArtifact("com.atlassian.refapp", "atlassian-refapp", VersionUtils.getVersion());
71      }
72  
73      protected ProductArtifact getTestResourcesArtifact()
74      {
75          return null;
76      }
77  
78      private static class RefappPluginProvider extends AbstractPluginProvider
79      {
80  
81          @Override
82          protected Collection<ProductArtifact> getSalArtifacts(String salVersion)
83          {
84              return Arrays.asList(
85                  new ProductArtifact("com.atlassian.sal", "sal-api", salVersion),
86                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-appproperties-plugin", salVersion),
87                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-component-plugin", salVersion),
88                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-executor-plugin", salVersion),
89                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-lifecycle-plugin", salVersion),
90                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-message-plugin", salVersion),
91                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-net-plugin", salVersion),
92                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-pluginsettings-plugin", salVersion),
93                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-project-plugin", salVersion),
94                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-search-plugin", salVersion),
95                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-transaction-plugin", salVersion),
96                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-upgrade-plugin", salVersion),
97                  new ProductArtifact("com.atlassian.sal", "sal-refimpl-user-plugin", salVersion));
98          }
99  
100         @Override
101         protected Collection<ProductArtifact> getPdkInstallArtifacts(String pdkInstallVersion)
102         {
103             return Collections.emptyList();
104         }
105     }
106 }