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.Mojo;
20  import org.apache.maven.plugins.annotations.Parameter;
21  import org.codehaus.mojo.keytool.requests.KeyToolPrintCertificateRequestRequest;
22  
23  import java.io.File;
24  
25  /**
26   * To print the content of a certificate request.
27   * <p/>
28   * Implemented as a wrapper around the SDK {@code keytool -printcertreq} command.
29   * <p/>
30   * <strong>Note</strong> This operation was not implemented by the keytool before jdk 1.7.
31   * <p/>
32   * See <a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/keytool.html">keystore documentation</a>.
33   *
34   * @author tchemit <chemit@codelutin.com>
35   * @since 1.2
36   */
37  @Mojo(name = "printCertificateRequest", requiresProject = true)
38  public class PrintCertificateRequestMojo
39      extends AbstractKeyToolRequestMojo<KeyToolPrintCertificateRequestRequest>
40  {
41  
42      /**
43       * Input file name.
44       * <p/>
45       * See <a href="http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/keytool.html#Commands">options</a>.
46       *
47       * @since 1.2
48       */
49      @Parameter
50      private File file;
51  
52      /**
53       * Default contructor.
54       */
55      public PrintCertificateRequestMojo()
56      {
57          super( KeyToolPrintCertificateRequestRequest.class );
58      }
59  
60      /**
61       * {@inheritDoc}
62       */
63      @Override
64      protected KeyToolPrintCertificateRequestRequest createKeytoolRequest()
65      {
66          KeyToolPrintCertificateRequestRequest request = super.createKeytoolRequest();
67  
68          request.setFile( this.file );
69          return request;
70      }
71  
72  }