KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > dsmlv2 > Dsmlv2Container


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. 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,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  *
19  */

20
21 package org.apache.directory.ldapstudio.dsmlv2;
22
23
24 import org.apache.directory.ldapstudio.dsmlv2.reponse.BatchResponse;
25 import org.apache.directory.ldapstudio.dsmlv2.request.BatchRequest;
26 import org.xmlpull.v1.XmlPullParser;
27
28
29 /**
30  * This class represents the DSML Container.
31  * It used by the DSML Parser to store information.
32  *
33  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
34  * @version $Rev$, $Date$
35  */

36 public class Dsmlv2Container implements Container
37 {
38     /** The current state of the decoding */
39     private int state;
40
41     /** The current transition */
42     private int transition;
43
44     /** Store the different states for debug purpose */
45     private IStates states;
46
47     /** The pool parser */
48     private XmlPullParser parser;
49
50     /** The BatchRequest of the parsing */
51     private BatchRequest batchRequest;
52
53     /** The BatchResponse of the parsing */
54     private BatchResponse batchResponse;
55
56     /** The associated grammar */
57     private AbstractGrammar grammar;
58
59
60     /**
61      * Gets the DSML Batch Request
62      *
63      * @return
64      * Returns the Batch Request
65      */

66     public BatchRequest getBatchRequest()
67     {
68         return batchRequest;
69     }
70
71
72     /**
73      * Sets the DSML Batch Request
74      *
75      * @param batchRequest
76      * the Batch Request to set
77      */

78     public void setBatchRequest( BatchRequest batchRequest )
79     {
80         this.batchRequest = batchRequest;
81     }
82
83
84     /**
85      * Gets the DSML Batch Response
86      *
87      * @return
88      * Returns the Batch Response
89      */

90     public BatchResponse getBatchResponse()
91     {
92         return batchResponse;
93     }
94
95
96     /**
97      * Sets the DSML Batch Request
98      *
99      * @param batchRequest
100      * the Batch Response to set
101      */

102     public void setBatchResponse( BatchResponse batchResponse )
103     {
104         this.batchResponse = batchResponse;
105     }
106
107
108     /**
109      * Gets the parser
110      *
111      * @return
112      * the parser
113      */

114     public XmlPullParser getParser()
115     {
116         return parser;
117     }
118
119
120     /**
121      * Sets the parser
122      *
123      * @param parser
124      * the parser to set
125      */

126     public void setParser( XmlPullParser parser )
127     {
128         this.parser = parser;
129     }
130
131
132     /**
133      * Get the current grammar state
134      *
135      * @return
136      * the current grammar state
137      */

138     public int getState()
139     {
140         return state;
141     }
142
143
144     /**
145      * Set the new current state
146      *
147      * @param state
148      * the new state
149      */

150     public void setState( int state )
151     {
152         this.state = state;
153     }
154
155
156     /**
157      * Get the transition
158      *
159      * @return
160      * the transition from the previous state to the new state
161      */

162     public int getTransition()
163     {
164         return transition;
165     }
166
167
168     /**
169      * Update the transition from a state to another
170      *
171      * @param transition
172      * the transition to set
173      */

174     public void setTransition( int transition )
175     {
176         this.transition = transition;
177     }
178
179
180     /**
181      * Get the states for this container's grammars
182      *
183      * @return
184      * the states.
185      */

186     public IStates getStates()
187     {
188         return states;
189     }
190
191
192     /**
193      * Gets the grammar
194      *
195      * @return
196      * the grammar
197      */

198     public AbstractGrammar getGrammar()
199     {
200         return grammar;
201     }
202
203
204     /**
205      * Sets the Grammar
206      *
207      * @param grammar
208      * the grammar to set
209      */

210     public void setGrammar( AbstractGrammar grammar )
211     {
212         this.grammar = grammar;
213     }
214
215
216     /**
217      * Get the transition associated with the state and tag
218      *
219      * @param state
220      * the current state
221      * @param tag
222      * the current tag
223      * @return
224      * a valid transition if any, or null.
225      */

226     public GrammarTransition getTransition( int state, Tag tag )
227     {
228         return grammar.getTransition( state, tag );
229     }
230 }
231
Popular Tags