001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *  http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    
020    package org.apache.geronimo.mavenplugins.geronimo;
021    
022    import org.apache.maven.project.MavenProject;
023    import org.apache.maven.artifact.factory.ArtifactFactory;
024    import org.apache.maven.artifact.resolver.ArtifactResolver;
025    import org.apache.maven.artifact.repository.ArtifactRepository;
026    
027    import org.apache.geronimo.genesis.AntMojoSupport;
028    
029    /**
030     * Support for Geronimo mojos.
031     *
032     * @version $Rev: 450613 $ $Date: 2006-09-27 15:45:46 -0700 (Wed, 27 Sep 2006) $
033     */
034    public abstract class GeronimoMojoSupport
035        extends AntMojoSupport
036    {
037        //
038        // NOTE: Not all mojos need Ant support, but due to the inability of Maven to inject custom components
039        //       with their fields initalized we must use inheritence, see below.
040        //
041    
042        //
043        // NOTE: These fields are used by all mojo's except for install, which does not need to
044        //       connect to the server, but there is as of yet, no easy way to share common
045        //       code in a Mavne plugin w/o inheritence, so for now these are duplicated for
046        //       all mojos.
047        //
048    
049        /**
050         * The hostname of the server to connect to.
051         *
052         * @parameter expression="${hostname}" default-value="localhost"
053         */
054        protected String hostname = null;
055    
056        /**
057         * The port number to connect to the server.
058         *
059         * @parameter expression="${port}" default-value="1099"
060         */
061        protected int port = -1;
062    
063        /**
064         * The username to authenticate with.
065         *
066         * @parameter expression="${username}" default-value="system"
067         */
068        protected String username = null;
069    
070        /**
071         * The password to authenticate with.
072         *
073         * @parameter expression="${password}" default-value="manager"
074         */
075        protected String password = null;
076    
077        //
078        // MojoSupport Hooks
079        //
080    
081        /**
082         * The maven project.
083         *
084         * @parameter expression="${project}"
085         * @required
086         * @readonly
087         */
088        protected MavenProject project = null;
089    
090        protected MavenProject getProject() {
091            return project;
092        }
093    
094        /**
095         * ???
096         *
097         * @component
098         * @required
099         * @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    }