View Javadoc

1   package com.ashlux.mavenoc4jplugin;
2   
3   import org.apache.maven.plugin.AbstractMojo;
4   import org.apache.maven.plugin.MojoExecutionException;
5   import org.apache.maven.plugin.MojoFailureException;
6   
7   import java.io.IOException;
8   
9   abstract public class AbstractOc4jMojo extends AbstractMojo {
10  
11    final public void execute() throws MojoExecutionException, MojoFailureException {
12      String command = buildCommand();
13      try {
14        ProcessHelper.startProcess(command, getLog());
15      } catch (IOException e) {
16        getLog().error(e);
17        throw new MojoExecutionException("Failed to wait for java process.  Sad Panda. :-(", e);
18      } catch (InterruptedException e) {
19        getLog().error(e);
20        throw new MojoExecutionException("Could not start java process.  Sad Panda. :-(", e);
21      }
22    }
23  
24  
25    abstract String buildCommand();
26  
27    /**
28     * Java home
29     *
30     * @parameter expression="${java.home}
31     * @readonly
32     */
33    private String javaHome;
34  
35    /**
36     * J2EE home, directory where admin.jar or admin_client.jar is located.
37     *
38     * @parameter expression="${oc4j.j2eeHome}"
39     * @required
40     */
41    private String j2eeHome;
42  
43    /**
44     * Admin jar located in #{oc4j.j2eeHome}.  Example: Admin.jar or admin_client.jar.
45     *
46     * @parameter expression="${oc4j.adminJar}"  default-value="admin.jar"
47     */
48    private String adminJar;
49  
50    /**
51     * ORMI URL.
52     *
53     * @parameter expression="${oc4j.connectionUri}" default-value="ormi://localhost/"
54     */
55    private String connectionUri;
56  
57    /**
58     * Username used for deploying.
59     *
60     * @parameter expression="${oc4j.username}"
61     * @required
62     */
63    private String username;
64  
65    /**
66     * Password used for deploying.
67     *
68     * @parameter expression="${oc4j.password}"
69     * @required
70     */
71    private String password;
72  
73    public String getJavaHome() {
74      return javaHome;
75    }
76  
77    public void setJavaHome(String javaHome) {
78      this.javaHome = javaHome;
79    }
80  
81    public String getJ2eeHome() {
82      return j2eeHome;
83    }
84  
85    public void setJ2eeHome(String j2eeHome) {
86      this.j2eeHome = j2eeHome;
87    }
88  
89    public String getAdminJar() {
90      return adminJar;
91    }
92  
93    public void setAdminJar(String adminJar) {
94      this.adminJar = adminJar;
95    }
96  
97    public String getConnectionUri() {
98      return connectionUri;
99    }
100 
101   public void setConnectionUri(String connectionUri) {
102     this.connectionUri = connectionUri;
103   }
104 
105   public String getUsername() {
106     return username;
107   }
108 
109   public void setUsername(String username) {
110     this.username = username;
111   }
112 
113   public String getPassword() {
114     return password;
115   }
116 
117   public void setPassword(String password) {
118     this.password = password;
119   }
120 }