View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *  http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.geronimo.mavenplugins.geronimo;
21  
22  import org.apache.maven.project.MavenProject;
23  import org.apache.maven.artifact.factory.ArtifactFactory;
24  import org.apache.maven.artifact.resolver.ArtifactResolver;
25  import org.apache.maven.artifact.repository.ArtifactRepository;
26  
27  import org.apache.geronimo.genesis.AntMojoSupport;
28  
29  /**
30   * Support for Geronimo mojos.
31   *
32   * @version $Rev: 450613 $ $Date: 2006-09-27 15:45:46 -0700 (Wed, 27 Sep 2006) $
33   */
34  public abstract class GeronimoMojoSupport
35      extends AntMojoSupport
36  {
37      //
38      // NOTE: Not all mojos need Ant support, but due to the inability of Maven to inject custom components
39      //       with their fields initalized we must use inheritence, see below.
40      //
41  
42      //
43      // NOTE: These fields are used by all mojo's except for install, which does not need to
44      //       connect to the server, but there is as of yet, no easy way to share common
45      //       code in a Mavne plugin w/o inheritence, so for now these are duplicated for
46      //       all mojos.
47      //
48  
49      /**
50       * The hostname of the server to connect to.
51       *
52       * @parameter expression="${hostname}" default-value="localhost"
53       */
54      protected String hostname = null;
55  
56      /**
57       * The port number to connect to the server.
58       *
59       * @parameter expression="${port}" default-value="1099"
60       */
61      protected int port = -1;
62  
63      /**
64       * The username to authenticate with.
65       *
66       * @parameter expression="${username}" default-value="system"
67       */
68      protected String username = null;
69  
70      /**
71       * The password to authenticate with.
72       *
73       * @parameter expression="${password}" default-value="manager"
74       */
75      protected String password = null;
76  
77      //
78      // MojoSupport Hooks
79      //
80  
81      /**
82       * The maven project.
83       *
84       * @parameter expression="${project}"
85       * @required
86       * @readonly
87       */
88      protected MavenProject project = null;
89  
90      protected MavenProject getProject() {
91          return project;
92      }
93  
94      /**
95       * ???
96       *
97       * @component
98       * @required
99       * @readonly
100      */
101     protected ArtifactFactory artifactFactory = null;
102 
103     protected ArtifactFactory getArtifactFactory() {
104         return artifactFactory;
105     }
106 
107     /**
108      * ???
109      *
110      * @component
111      * @required
112      * @readonly
113      */
114     protected ArtifactResolver artifactResolver = null;
115 
116     protected ArtifactResolver getArtifactResolver() {
117         return artifactResolver;
118     }
119 
120     /**
121      * ???
122      *
123      * @parameter expression="${localRepository}"
124      * @readonly
125      * @required
126      */
127     protected ArtifactRepository artifactRepository = null;
128 
129     protected ArtifactRepository getArtifactRepository() {
130         return artifactRepository;
131     }
132 }