PageRenderTime 25ms CodeModel.GetById 19ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://bitbucket.org/mmeinhold/amps
Java | 89 lines | 70 code | 14 blank | 5 comment | 0 complexity | 51c5711566acfe36c7fb7e654943a42c MD5 | raw file
 1package com.atlassian.maven.plugins.amps.product.studio;
 2
 3import com.atlassian.maven.plugins.amps.DataSource;
 4import com.atlassian.maven.plugins.amps.MavenContext;
 5import com.atlassian.maven.plugins.amps.MavenGoals;
 6import com.atlassian.maven.plugins.amps.Product;
 7import com.atlassian.maven.plugins.amps.ProductArtifact;
 8import com.atlassian.maven.plugins.amps.product.ConfluenceProductHandler;
 9import org.apache.maven.plugin.MojoExecutionException;
10
11import java.io.File;
12import java.util.Arrays;
13import java.util.HashMap;
14import java.util.List;
15import java.util.Map;
16
17import static com.atlassian.maven.plugins.amps.product.ProductHandlerFactory.STUDIO_CONFLUENCE;
18import static com.atlassian.maven.plugins.amps.util.FileUtils.fixWindowsSlashes;
19import static java.lang.String.format;
20
21/**
22 * Handler for Studio-Confluence
23 * @since 3.6
24 */
25public class StudioConfluenceProductHandler extends ConfluenceProductHandler implements StudioComponentProductHandler
26{
27
28    public StudioConfluenceProductHandler(MavenContext context, MavenGoals goals)
29    {
30        super(context, goals);
31    }
32
33    @Override
34    public String getId()
35    {
36        return STUDIO_CONFLUENCE;
37    }
38
39    @Override
40    public ProductArtifact getArtifact()
41    {
42        return new ProductArtifact("com.atlassian.confluence", "confluence-studio-webapp", "RELEASE");
43    }
44
45    @Override
46    public Map<String, String> getSystemProperties(final Product product)
47    {
48        Map<String, String> systemProperties = new HashMap<String, String>(super.getSystemProperties(product));
49
50        // We also add common studio system properties
51        systemProperties.putAll(product.getStudioProperties().getSystemProperties());
52
53        return systemProperties;
54    }
55    
56    @Override
57    protected DataSource getDefaultDataSource(Product ctx)
58    {
59        DataSource dataSource = new DataSource();
60        dataSource.setJndi("jdbc/DefaultDS");
61        dataSource.setUrl(format("jdbc:hsqldb:%s/database/confluencedb;hsqldb.tx=MVCC", fixWindowsSlashes(getHomeDirectory(ctx).getAbsolutePath())));
62        dataSource.setDriver("org.hsqldb.jdbcDriver");
63        dataSource.setType("javax.sql.DataSource");
64        dataSource.setUsername("sa");
65        dataSource.setPassword("");
66        return dataSource;
67    }
68
69    @Override
70    public List<ProductArtifact> getExtraContainerDependencies()
71    {
72        return Arrays.asList(
73                new ProductArtifact("org.hsqldb", "hsqldb", "2.2.4"),
74                new ProductArtifact("jta", "jta", "1.0.1"));
75    }
76
77    @Override
78    public void processHomeDirectory(Product ctx, File homeDir) throws MojoExecutionException
79    {
80        super.processHomeDirectory(ctx, homeDir);
81        StudioProductHandler.processProductsHomeDirectory(log, ctx, homeDir);
82    }
83
84    @Override
85    protected void customiseInstance(Product ctx, File homeDir, File explodedWarDir) throws MojoExecutionException
86    {
87        StudioProductHandler.addProductHandlerOverrides(log, ctx, homeDir, explodedWarDir);
88    }
89}