KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > orb > portableInterceptor > RequestInterceptorIterator


1 /*
2  * JacORB - a free Java ORB
3  *
4  * Copyright (C) 1999-2004 Gerald Brose
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the Free
18  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  */

21 package org.jacorb.orb.portableInterceptor;
22
23 import org.omg.PortableInterceptor.*;
24 import org.jacorb.orb.SystemExceptionHelper;
25
26 /**
27  * This class is an iterator over an array
28  * of RequestInterceptors.
29  *
30  * @author Nicolas Noffke
31  * @version $Id: RequestInterceptorIterator.java,v 1.7 2004/05/06 12:40:00 nicolas Exp $
32  */

33
34 public abstract class RequestInterceptorIterator
35     extends AbstractInterceptorIterator
36 {
37
38     private boolean reversed = false;
39     private boolean forward = true;
40
41     protected short op = -1;
42     protected Exception JavaDoc interceptor_ex = null;
43
44     public RequestInterceptorIterator(Interceptor[] interceptors)
45     {
46     super(interceptors);
47     }
48
49     /**
50      * Reverses the direction in which the list is traversed.
51      * The element returned by the next call to nextElement()
52      * is the one previous to that returned by the last
53      * call to nextElement(). <br>
54      * The direction can only be reversed one time and only if
55      * the starting direction was "forward".
56      */

57
58     protected void reverseDirection()
59     {
60     if (! reversed && forward)
61         {
62         increment *= -1;
63         index += (2 * increment);
64       
65         reversed = true;
66     }
67     }
68
69     protected void setDirection(boolean forward)
70     {
71     this.forward = forward;
72
73     if (forward){
74         index = 0;
75         increment = 1;
76     }
77     else{
78         index = interceptors.length - 1;;
79         increment = -1;
80     }
81     }
82 } // RequestInterceptorIterator
83

84
85
86
87
88
89
90
91
92
93
94
95
Popular Tags