View Javadoc

1   package org.apache.maven.changelog;
2   
3   /* ====================================================================
4    *   Licensed to the Apache Software Foundation (ASF) under one or more
5    *   contributor license agreements.  See the NOTICE file distributed with
6    *   this work for additional information regarding copyright ownership.
7    *   The ASF licenses this file to You under the Apache License, Version 2.0
8    *   (the "License"); you may not use this file except in compliance with
9    *   the License.  You may obtain a copy of the License at
10   *
11   *       http://www.apache.org/licenses/LICENSE-2.0
12   *
13   *   Unless required by applicable law or agreed to in writing, software
14   *   distributed under the License is distributed on an "AS IS" BASIS,
15   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   *   See the License for the specific language governing permissions and
17   *   limitations under the License.
18   * ====================================================================
19   */
20  
21  import java.io.IOException;
22  import java.io.InputStream;
23  
24  import java.util.Collection;
25  
26  /**
27   * Instance of <code>ChangeLogParser</code> are intended to parse an {@link
28   * java.io.InputStream} created by a {@link ChangeLogGenerator} into individual
29   * {@link ChangeLogEntry} objects.
30   *
31   * @author Glenn McAllister
32   * @version $Id: ChangeLogParser.java 532339 2007-04-25 12:28:56Z ltheussl $
33   */
34  public interface ChangeLogParser
35  {
36      /**
37       * Initialize the ChangeLogParser instance with the controlling {@link
38       * ChangeLog} instance.  Any configuration required for the parser should
39       * be obtained from the <code>changeLog</code>.  This method is guaranteed
40       * to be called before {@link #parse}.
41       *
42       * @param changeLog the controlling ChangeLog instance
43       */
44      void init( ChangeLog changeLog );
45  
46      /**
47       * Returns a {@link java.util.Collection} of ChangeLogEntry objects, parsed
48       * from the {@link java.io.InputStream}.  This method is guaranteed to be
49       * called after {@link #init} and before {@link #cleanup}.  However, it is
50       * up to a {@link ChangeLogGenerator} instance to call this method, so no
51       * guarantee can be made this this method will be called.
52       *
53       * @param in the input stream to parse
54       * @return a Collection of ChangeLogEntry objects
55       * @throws IOException if there is an error while parsing the input stream
56       */
57      Collection parse( InputStream in )
58          throws IOException;
59  
60      /**
61       * Provides the opportunity for the parser to do any required cleanup.
62       * This method is guaranteed to be called after the {@link #init} (and
63       * presumably the {@link #parse}) method.
64       */
65      void cleanup();
66  
67      /**
68       * Set the date formatter for parse starteam stream
69       * @param dateFormat a dateFormat for replace the local format
70       */
71      public void setDateFormatInFile( String dateFormat );
72  }