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.repository.ArtifactRepository;
024    
025    import org.codehaus.mojo.pluginsupport.ant.AntMojoSupport;
026    
027    /**
028     * Support for Geronimo mojos.
029     *
030     * @version $Rev: 706640 $ $Date: 2008-10-21 14:44:05 +0000 (Tue, 21 Oct 2008) $
031     */
032    public abstract class GeronimoMojoSupport
033        extends AntMojoSupport
034    {
035        //
036        // NOTE: Not all mojos need Ant support, but due to the inability of Maven to inject custom components
037        //       with their fields initalized we must use inheritence, see below.
038        //
039    
040        //
041        // NOTE: These fields are used by all mojo's except for install, which does not need to
042        //       connect to the server, but there is as of yet, no easy way to share common
043        //       code in a Mavne plugin w/o inheritence, so for now these are duplicated for
044        //       all mojos.
045        //
046    
047        /**
048         * The hostname of the server to connect to.
049         *
050         * @parameter expression="${hostname}" default-value="localhost"
051         */
052        protected String hostname = null;
053    
054        /**
055         * The port number to connect to the server.
056         *
057         * @parameter expression="${port}" default-value="1099"
058         */
059        protected int port = -1;
060    
061        /**
062         * The username to authenticate with.
063         *
064         * @parameter expression="${username}" default-value="system"
065         */
066        protected String username = null;
067    
068        /**
069         * The password to authenticate with.
070         *
071         * @parameter expression="${password}" default-value="manager"
072         */
073        protected String password = null;
074    
075        //
076        // MojoSupport Hooks
077        //
078    
079        /**
080         * The maven project.
081         *
082         * @parameter expression="${project}"
083         * @required
084         * @readonly
085         */
086        protected MavenProject project = null;
087    
088        protected MavenProject getProject() {
089            return project;
090        }
091    
092        /**
093         * ???
094         *
095         * @parameter expression="${localRepository}"
096         * @readonly
097         * @required
098         */
099        protected ArtifactRepository artifactRepository = null;
100    
101        protected ArtifactRepository getArtifactRepository() {
102            return artifactRepository;
103        }
104    }