View Javadoc
1   package org.codehaus.mojo.keytool;
2   
3   /*
4    * Copyright 2005-2013 The Codehaus
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License" );
7    * you may not use this file except in compliance with the License.
8    * 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, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import org.apache.maven.plugins.annotations.Parameter;
20  
21  /**
22   * Abstract mojo to execute a {@link KeyToolRequestWithKeyStoreAndAliasParameters} request.
23   *
24   * @param <R> generic type of request used by the mojo
25   * @author tchemit <chemit@codelutin.com>
26   * @since 1.2
27   */
28  public abstract class AbstractKeyToolRequestWithKeyStoreAndAliasParametersMojo<R extends KeyToolRequestWithKeyStoreAndAliasParameters>
29      extends AbstractKeyToolRequestWithKeyStoreParametersMojo<R>
30  {
31      /**
32       * Password through protected mechanism.
33       * <p/>
34       * See <a href="http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/keytool.html#Commands">options</a>.
35       *
36       * @since 1.2
37       */
38      @Parameter
39      private boolean passwordProtected;
40  
41      /**
42       * Alias name of the entry to process.
43       * <p/>
44       * See <a href="http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/keytool.html#Commands">options</a>.
45       */
46      @Parameter
47      private String alias;
48  
49      /**
50       * Constructor of abstract mojo.
51       *
52       * @param requestType type of keytool request used by the mojo
53       */
54      protected AbstractKeyToolRequestWithKeyStoreAndAliasParametersMojo( Class<R> requestType )
55      {
56          super( requestType );
57      }
58  
59      /**
60       * {@inheritDoc}
61       */
62      @Override
63      protected R createKeytoolRequest()
64      {
65          R request = super.createKeytoolRequest();
66  
67          request.setPasswordProtected( this.passwordProtected );
68          request.setAlias( this.alias );
69          return request;
70      }
71  }