View Javadoc

1   /*
2    * org.osjava.jardiff.DiffHandler
3    *
4    * $Id: IOThread.java 1952 2005-08-28 18:03:41Z cybertiger $
5    * $URL: https://svn.osjava.org/svn/osjava/trunk/osjava-nio/src/java/org/osjava/nio/IOThread.java $
6    * $Rev: 1952 $
7    * $Date: 2005-08-28 18:03:41 +0000 (Sun, 28 Aug 2005) $
8    * $Author: cybertiger $
9    *
10   * Copyright (c) 2005, Antony Riley
11   * All rights reserved.
12   *
13   * Redistribution and use in source and binary forms, with or without
14   * modification, are permitted provided that the following conditions are met:
15   *
16   * + Redistributions of source code must retain the above copyright notice,
17   *   this list of conditions and the following disclaimer.
18   *
19   * + Redistributions in binary form must reproduce the above copyright notice,
20   *   this list of conditions and the following disclaimer in the documentation
21   *   and/or other materials provided with the distribution.
22   *
23   * + Neither the name JarDiff nor the names of its contributors may
24   *   be used to endorse or promote products derived from this software without
25   *   specific prior written permission.
26   *
27   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30   * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
31   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37   * POSSIBILITY OF SUCH DAMAGE.
38   */
39  package org.osjava.jardiff;
40  
41  /***
42   * An interface for classes which wish to receive information about
43   * differences in class files between two different jar file version to
44   * implement.
45   *
46   * @author <a href="mailto:antony@cyberiantiger.org">Antony Riley</a>
47   */
48  public interface DiffHandler
49  {
50      /***
51       * Start a diff between two versions, where string a is the old version
52       * and string b is the new version.
53       * 
54       * @param a the name of the old version
55       * @param b the name of the new version
56       * @throws DiffException when there is an underlying exception, e.g.
57       *                       writing to a file caused an IOException
58       */
59      public void startDiff(String a, String b)
60          throws DiffException;
61  
62      /***
63       * Start the list of old contents.
64       *
65       * @throws DiffException when there is an underlying exception, e.g.
66       *                       writing to a file caused an IOException
67       */
68      public void startOldContents() throws DiffException;
69  
70      /***
71       * Start the list of new contents.
72       *
73       * @throws DiffException when there is an underlying exception, e.g.
74       *                       writing to a file caused an IOException
75       */
76      public void startNewContents() throws DiffException;
77  
78      /***
79       * Add a contained class.
80       *
81       * @param info information about a class
82       * @throws DiffException when there is an underlying exception, e.g.
83       *                       writing to a file caused an IOException
84       */
85      public void contains(ClassInfo info) throws DiffException;
86  
87      /***
88       * End the list of old contents.
89       *
90       * @throws DiffException when there is an underlying exception, e.g.
91       *                       writing to a file caused an IOException
92       */
93      public void endOldContents() throws DiffException;
94  
95      /***
96       * End the list of new contents.
97       *
98       * @throws DiffException when there is an underlying exception, e.g.
99       *                       writing to a file caused an IOException
100      */
101     public void endNewContents() throws DiffException;
102 
103     /***
104      * Start the list of removed classes.
105      *
106      * @throws DiffException when there is an underlying exception, e.g.
107      *                       writing to a file caused an IOException
108      */
109     public void startRemoved() throws DiffException;
110     
111     /***
112      * Notification that a class was removed.
113      *
114      * @param classinfo information about the class that has been removed.
115      * @throws DiffException when there is an underlying exception, e.g.
116      *                       writing to a file caused an IOException
117      */
118     public void classRemoved(ClassInfo classinfo) throws DiffException;
119     
120     /***
121      * End of list of removed classes.
122      *
123      * @throws DiffException when there is an underlying exception, e.g.
124      *                       writing to a file caused an IOException
125      */
126     public void endRemoved() throws DiffException;
127     
128     /***
129      * Start of list of added classes.
130      *
131      * @throws DiffException when there is an underlying exception, e.g.
132      *                       writing to a file caused an IOException
133      */
134     public void startAdded() throws DiffException;
135     
136     /***
137      * Notification that a class was added.
138      *
139      * @param classinfo information about the class that has been removed.
140      * @throws DiffException when there is an underlying exception, e.g.
141      *                       writing to a file caused an IOException
142      */
143     public void classAdded(ClassInfo classinfo) throws DiffException;
144     
145     /***
146      * End of list of removed classes.
147      *
148      * @throws DiffException when there is an underlying exception, e.g.
149      *                       writing to a file caused an IOException
150      */
151     public void endAdded() throws DiffException;
152     
153     /***
154      * Start list of changed classes.
155      *
156      * @throws DiffException when there is an underlying exception, e.g.
157      *                       writing to a file caused an IOException
158      */
159     public void startChanged() throws DiffException;
160     
161     /***
162      * Start information about class changes for the classname passed.
163      *
164      * @throws DiffException when there is an underlying exception, e.g.
165      *                       writing to a file caused an IOException
166      */
167     public void startClassChanged(String string) throws DiffException;
168     
169     /***
170      * The field was removed for the current class that has changed.
171      *
172      * @param fieldinfo Information about the field removed.
173      * @throws DiffException when there is an underlying exception, e.g.
174      *                       writing to a file caused an IOException
175      */
176     public void fieldRemoved(FieldInfo fieldinfo) throws DiffException;
177     
178     /***
179      * The method was removed for the current class that has changed.
180      *
181      * @param methodinfo Information about the method removed.
182      * @throws DiffException when there is an underlying exception, e.g.
183      *                       writing to a file caused an IOException
184      */
185     public void methodRemoved(MethodInfo methodinfo) throws DiffException;
186     
187     /***
188      * The field was added for the current class that has changed.
189      *
190      * @param fieldinfo Information about the field added.
191      * @throws DiffException when there is an underlying exception, e.g.
192      *                       writing to a file caused an IOException
193      */
194     public void fieldAdded(FieldInfo fieldinfo) throws DiffException;
195     
196     /***
197      * The method was added for the current class that has changed.
198      *
199      * @param methodinfo Information about the method added.
200      * @throws DiffException when there is an underlying exception, e.g.
201      *                       writing to a file caused an IOException
202      */
203     public void methodAdded(MethodInfo methodinfo) throws DiffException;
204     
205     /***
206      * The current class has changed.
207      * This is called when a class's interfaces or superclass or access
208      * flags have changed.
209      *
210      * @param oldClassinfo Information about the old class.
211      * @param newClassinfo Information about the new class.
212      * @throws DiffException when there is an underlying exception, e.g.
213      *                       writing to a file caused an IOException
214      */
215     public void classChanged(ClassInfo oldClassinfo, ClassInfo newClassinfo)
216         throws DiffException;
217     
218     /***
219      * A field on the current class has changed.
220      *
221      * @param oldFieldinfo Information about the old field.
222      * @param newFieldinfo Information about the new field.
223      * @throws DiffException when there is an underlying exception, e.g.
224      *                       writing to a file caused an IOException
225      */
226     public void fieldChanged(FieldInfo oldFieldinfo, FieldInfo newFieldinfo)
227         throws DiffException;
228     
229     /***
230      * A method on the current class has changed.
231      *
232      * @param oldMethodInfo Information about the old method.
233      * @param newMethodInfo Information about the new method.
234      * @throws DiffException when there is an underlying exception, e.g.
235      *                       writing to a file caused an IOException
236      */
237     public void methodChanged
238         (MethodInfo oldMethodInfo, MethodInfo newMethodInfo) throws DiffException;
239     
240     /***
241      * End of changes for the current class.
242      *
243      * @throws DiffException when there is an underlying exception, e.g.
244      *                       writing to a file caused an IOException
245      */
246     public void endClassChanged() throws DiffException;
247     
248     /***
249      * End of class changes.
250      *
251      * @throws DiffException when there is an underlying exception, e.g.
252      *                       writing to a file caused an IOException
253      */
254     public void endChanged() throws DiffException;
255     
256     /***
257      * End of the diff.
258      *
259      * @throws DiffException when there is an underlying exception, e.g.
260      *                       writing to a file caused an IOException
261      */
262     public void endDiff() throws DiffException;
263 }