001    /*
002    // This java file was automatically generated
003    // from XOM model 'resource'
004    // on Sat Nov 01 14:29:29 GMT-08:00 2008
005    // Do not edit this file by hand.
006    */
007    
008    package org.eigenbase.resgen;
009    /**
010     * This model specifies the elements which make up a resource file. See
011     * {@link ResourceGenTask} for more information.
012     * <p>This class was generated from XOM model 'resource' on Sat Nov 01 14:29:29 GMT-08:00 2008
013     */
014    public class ResourceDef {
015    
016            public static java.lang.Class getXMLDefClass()
017            {
018                    return ResourceDef.class;
019            }
020    
021            public static String[] _elements = {
022                    "resourceBundle",
023                    "Code",
024                    "resource",
025                    "message",
026                    "text",
027                    "exception",
028                    "property"
029            };
030    
031            /**
032             * A ResourceBundle is a collection of resources.
033             * The resource generator generates a class from a resource bundle
034             * which has an accessor method for each resource.
035             */
036            public static class ResourceBundle extends org.eigenbase.xom.ElementDef
037            {
038                    public ResourceBundle()
039                    {
040                    }
041    
042                    public ResourceBundle(org.eigenbase.xom.DOMWrapper _def)
043                            throws org.eigenbase.xom.XOMException
044                    {
045                            try {
046                                    org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", ResourceDef.class);
047                                    org.eigenbase.xom.NodeDef[] _tempArray;
048                                    locale = (String)_parser.getAttribute("locale", "String", null, null, true);
049                                    exceptionClassName = (String)_parser.getAttribute("exceptionClassName", "String", null, null, false);
050                                    cppNamespace = (String)_parser.getAttribute("cppNamespace", "String", null, null, false);
051                                    cppCommonInclude = (String)_parser.getAttribute("cppCommonInclude", "String", null, null, false);
052                                    cppExceptionClassName = (String)_parser.getAttribute("cppExceptionClassName", "String", null, null, false);
053                                    cppExceptionClassLocation = (String)_parser.getAttribute("cppExceptionClassLocation", "String", null, null, false);
054                                    _tempArray = _parser.getArray(Resource.class, 0, 0);
055                                    resources = new Resource[_tempArray.length];
056                                    for (int _i = 0; _i < resources.length; _i++)
057                                            resources[_i] = (Resource)_tempArray[_i];
058                                    code = (Code)_parser.getElement(Code.class, false);
059                            } catch(org.eigenbase.xom.XOMException _ex) {
060                                    throw new org.eigenbase.xom.XOMException("In " + getName() + ": " + _ex.getMessage());
061                            }
062                    }
063    
064                    public String locale;  // required attribute
065                    public String exceptionClassName;  // optional attribute
066                    public String cppNamespace;  // optional attribute
067                    public String cppCommonInclude;  // optional attribute
068                    public String cppExceptionClassName;  // optional attribute
069                    public String cppExceptionClassLocation;  // optional attribute
070    
071                    public Resource[] resources;  //optional array
072                    /**
073                     * Text within this element is included in the generated class.
074                     */
075                    public Code code;  //optional element
076    
077                    public String getName()
078                    {
079                            return "ResourceBundle";
080                    }
081    
082                    public void display(java.io.PrintWriter _out, int _indent)
083                    {
084                            _out.println(getName());
085                            displayAttribute(_out, "locale", locale, _indent+1);
086                            displayAttribute(_out, "exceptionClassName", exceptionClassName, _indent+1);
087                            displayAttribute(_out, "cppNamespace", cppNamespace, _indent+1);
088                            displayAttribute(_out, "cppCommonInclude", cppCommonInclude, _indent+1);
089                            displayAttribute(_out, "cppExceptionClassName", cppExceptionClassName, _indent+1);
090                            displayAttribute(_out, "cppExceptionClassLocation", cppExceptionClassLocation, _indent+1);
091                            displayElementArray(_out, "resources", resources, _indent+1);
092                            displayElement(_out, "code", code, _indent+1);
093                    }
094                    public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent)
095                    {
096                            _out.beginTag("resourceBundle", new org.eigenbase.xom.XMLAttrVector()
097                                    .add("locale", locale)
098                                    .add("exceptionClassName", exceptionClassName)
099                                    .add("cppNamespace", cppNamespace)
100                                    .add("cppCommonInclude", cppCommonInclude)
101                                    .add("cppExceptionClassName", cppExceptionClassName)
102                                    .add("cppExceptionClassLocation", cppExceptionClassLocation)
103                                    );
104                            displayXMLElementArray(_out, resources);
105                            displayXMLElement(_out, code);
106                            _out.endTag("resourceBundle");
107                    }
108                    public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent)
109                    {
110                            ResourceBundle _cother = (ResourceBundle)_other;
111                            boolean _diff = displayAttributeDiff("locale", locale, _cother.locale, _out, _indent+1);
112                            _diff = _diff && displayAttributeDiff("exceptionClassName", exceptionClassName, _cother.exceptionClassName, _out, _indent+1);
113                            _diff = _diff && displayAttributeDiff("cppNamespace", cppNamespace, _cother.cppNamespace, _out, _indent+1);
114                            _diff = _diff && displayAttributeDiff("cppCommonInclude", cppCommonInclude, _cother.cppCommonInclude, _out, _indent+1);
115                            _diff = _diff && displayAttributeDiff("cppExceptionClassName", cppExceptionClassName, _cother.cppExceptionClassName, _out, _indent+1);
116                            _diff = _diff && displayAttributeDiff("cppExceptionClassLocation", cppExceptionClassLocation, _cother.cppExceptionClassLocation, _out, _indent+1);
117                            _diff = _diff && displayElementArrayDiff("resources", resources, _cother.resources, _out, _indent+1);
118                            _diff = _diff && displayElementDiff("code", code, _cother.code, _out, _indent+1);
119                            return _diff;
120                    }
121            }
122    
123            public static class Code extends org.eigenbase.xom.ElementDef
124            {
125                    public Code()
126                    {
127                    }
128    
129                    public Code(org.eigenbase.xom.DOMWrapper _def)
130                            throws org.eigenbase.xom.XOMException
131                    {
132                            try {
133                                    org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", ResourceDef.class);
134                                    cdata = _parser.getText();
135                            } catch(org.eigenbase.xom.XOMException _ex) {
136                                    throw new org.eigenbase.xom.XOMException("In " + getName() + ": " + _ex.getMessage());
137                            }
138                    }
139    
140    
141                    public String cdata;  // All text goes here
142                    public String getName()
143                    {
144                            return "Code";
145                    }
146    
147                    public void display(java.io.PrintWriter _out, int _indent)
148                    {
149                            _out.println(getName());
150                            displayString(_out, "cdata", cdata, _indent+1);
151                    }
152                    public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent)
153                    {
154                            _out.beginTag("Code", new org.eigenbase.xom.XMLAttrVector()
155                                    );
156                            _out.cdata(cdata);
157                            _out.endTag("Code");
158                    }
159                    public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent)
160                    {
161                            Code _cother = (Code)_other;
162                            boolean _diff = displayStringDiff("cdata", cdata, _cother.cdata, _out, _indent+1);
163                            return _diff;
164                    }
165            }
166    
167            public static abstract class Resource extends org.eigenbase.xom.ElementDef
168            {
169                    public Resource()
170                    {
171                    }
172    
173                    public Resource(org.eigenbase.xom.DOMWrapper _def)
174                            throws org.eigenbase.xom.XOMException
175                    {
176                            try {
177                                    org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", ResourceDef.class);
178                                    org.eigenbase.xom.NodeDef[] _tempArray;
179                                    name = (String)_parser.getAttribute("name", "String", null, null, true);
180                                    _tempArray = _parser.getArray(Property.class, 0, 0);
181                                    properties = new Property[_tempArray.length];
182                                    for (int _i = 0; _i < properties.length; _i++)
183                                            properties[_i] = (Property)_tempArray[_i];
184                                    text = (Text)_parser.getElement(Text.class, false);
185                            } catch(org.eigenbase.xom.XOMException _ex) {
186                                    throw new org.eigenbase.xom.XOMException("In " + getName() + ": " + _ex.getMessage());
187                            }
188                    }
189    
190                    public String name;  // required attribute
191    
192                    public Property[] properties;  //optional array
193                    public Text text;  //optional element
194    
195                    public String getName()
196                    {
197                            return "Resource";
198                    }
199    
200                    public void display(java.io.PrintWriter _out, int _indent)
201                    {
202                            _out.println(getName());
203                            displayAttribute(_out, "name", name, _indent+1);
204                            displayElementArray(_out, "properties", properties, _indent+1);
205                            displayElement(_out, "text", text, _indent+1);
206                    }
207                    public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent)
208                    {
209                            _out.beginTag("(%resource;)", new org.eigenbase.xom.XMLAttrVector()
210                                    .add("name", name)
211                                    );
212                            displayXMLElementArray(_out, properties);
213                            displayXMLElement(_out, text);
214                            _out.endTag("(%resource;)");
215                    }
216                    public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent)
217                    {
218                            Resource _cother = (Resource)_other;
219                            boolean _diff = displayAttributeDiff("name", name, _cother.name, _out, _indent+1);
220                            _diff = _diff && displayElementArrayDiff("properties", properties, _cother.properties, _out, _indent+1);
221                            _diff = _diff && displayElementDiff("text", text, _cother.text, _out, _indent+1);
222                            return _diff;
223                    }
224                    // BEGIN pass-through code block ---
225    abstract org.eigenbase.xom.DOMWrapper getDef();
226                    // END pass-through code block ---
227            }
228    
229            /**
230             * A message.
231             */
232            public static class Message extends Resource
233            {
234                    public Message()
235                    {
236                    }
237    
238                    public Message(org.eigenbase.xom.DOMWrapper _def)
239                            throws org.eigenbase.xom.XOMException
240                    {
241                            this._def = _def;
242                            try {
243                                    org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", ResourceDef.class);
244                                    org.eigenbase.xom.NodeDef[] _tempArray;
245                                    name = (String)_parser.getAttribute("name", "String", null, null, true);
246                                    _tempArray = _parser.getArray(Property.class, 0, 0);
247                                    properties = new Property[_tempArray.length];
248                                    for (int _i = 0; _i < properties.length; _i++)
249                                            properties[_i] = (Property)_tempArray[_i];
250                                    text = (Text)_parser.getElement(Text.class, false);
251                            } catch(org.eigenbase.xom.XOMException _ex) {
252                                    throw new org.eigenbase.xom.XOMException("In " + getName() + ": " + _ex.getMessage());
253                            }
254                    }
255    
256                    public org.eigenbase.xom.DOMWrapper _def;
257    
258    
259                    public String getName()
260                    {
261                            return "Message";
262                    }
263    
264                    public void display(java.io.PrintWriter _out, int _indent)
265                    {
266                            _out.println(getName());
267                            displayAttribute(_out, "name", name, _indent+1);
268                            displayElementArray(_out, "properties", properties, _indent+1);
269                            displayElement(_out, "text", text, _indent+1);
270                    }
271                    public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent)
272                    {
273                            _out.beginTag("message", new org.eigenbase.xom.XMLAttrVector()
274                                    .add("name", name)
275                                    );
276                            displayXMLElementArray(_out, properties);
277                            displayXMLElement(_out, text);
278                            _out.endTag("message");
279                    }
280                    public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent)
281                    {
282                            Message _cother = (Message)_other;
283                            boolean _diff = displayElementArrayDiff("properties", properties, _cother.properties, _out, _indent+1);
284                            _diff = _diff && displayElementDiff("text", text, _cother.text, _out, _indent+1);
285                            return _diff;
286                    }
287                    // BEGIN pass-through code block ---
288    org.eigenbase.xom.DOMWrapper getDef() { return _def; }
289                    // END pass-through code block ---
290            }
291    
292            public static class Text extends org.eigenbase.xom.ElementDef
293            {
294                    public Text()
295                    {
296                    }
297    
298                    public Text(org.eigenbase.xom.DOMWrapper _def)
299                            throws org.eigenbase.xom.XOMException
300                    {
301                            try {
302                                    org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", ResourceDef.class);
303                                    cdata = _parser.getText();
304                            } catch(org.eigenbase.xom.XOMException _ex) {
305                                    throw new org.eigenbase.xom.XOMException("In " + getName() + ": " + _ex.getMessage());
306                            }
307                    }
308    
309    
310                    public String cdata;  // All text goes here
311                    public String getName()
312                    {
313                            return "Text";
314                    }
315    
316                    public void display(java.io.PrintWriter _out, int _indent)
317                    {
318                            _out.println(getName());
319                            displayString(_out, "cdata", cdata, _indent+1);
320                    }
321                    public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent)
322                    {
323                            _out.beginTag("text", new org.eigenbase.xom.XMLAttrVector()
324                                    );
325                            _out.cdata(cdata);
326                            _out.endTag("text");
327                    }
328                    public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent)
329                    {
330                            Text _cother = (Text)_other;
331                            boolean _diff = displayStringDiff("cdata", cdata, _cother.cdata, _out, _indent+1);
332                            return _diff;
333                    }
334            }
335    
336            /**
337             * An exception defines a message which is issued in response
338             * to some invalid condition. It has a type, which must be derived from
339             * {@link Throwable}. The generated newExceptionName
340             * method creates an instance of this exception with the appropriate
341             * parameters.
342             */
343            public static class Exception extends Resource
344            {
345                    public Exception()
346                    {
347                    }
348    
349                    public Exception(org.eigenbase.xom.DOMWrapper _def)
350                            throws org.eigenbase.xom.XOMException
351                    {
352                            this._def = _def;
353                            try {
354                                    org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", ResourceDef.class);
355                                    org.eigenbase.xom.NodeDef[] _tempArray;
356                                    className = (String)_parser.getAttribute("className", "String", null, null, false);
357                                    cppClassName = (String)_parser.getAttribute("cppClassName", "String", null, null, false);
358                                    cppClassLocation = (String)_parser.getAttribute("cppClassLocation", "String", null, null, false);
359                                    cppChainExceptions = (String)_parser.getAttribute("cppChainExceptions", "String", null, null, false);
360                                    name = (String)_parser.getAttribute("name", "String", null, null, true);
361                                    _tempArray = _parser.getArray(Property.class, 0, 0);
362                                    properties = new Property[_tempArray.length];
363                                    for (int _i = 0; _i < properties.length; _i++)
364                                            properties[_i] = (Property)_tempArray[_i];
365                                    text = (Text)_parser.getElement(Text.class, false);
366                            } catch(org.eigenbase.xom.XOMException _ex) {
367                                    throw new org.eigenbase.xom.XOMException("In " + getName() + ": " + _ex.getMessage());
368                            }
369                    }
370    
371                    public String className;  // optional attribute
372                    public String cppClassName;  // optional attribute
373                    public String cppClassLocation;  // optional attribute
374                    public String cppChainExceptions;  // optional attribute
375                    public org.eigenbase.xom.DOMWrapper _def;
376    
377    
378                    public String getName()
379                    {
380                            return "Exception";
381                    }
382    
383                    public void display(java.io.PrintWriter _out, int _indent)
384                    {
385                            _out.println(getName());
386                            displayAttribute(_out, "className", className, _indent+1);
387                            displayAttribute(_out, "cppClassName", cppClassName, _indent+1);
388                            displayAttribute(_out, "cppClassLocation", cppClassLocation, _indent+1);
389                            displayAttribute(_out, "cppChainExceptions", cppChainExceptions, _indent+1);
390                            displayAttribute(_out, "name", name, _indent+1);
391                            displayElementArray(_out, "properties", properties, _indent+1);
392                            displayElement(_out, "text", text, _indent+1);
393                    }
394                    public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent)
395                    {
396                            _out.beginTag("exception", new org.eigenbase.xom.XMLAttrVector()
397                                    .add("className", className)
398                                    .add("cppClassName", cppClassName)
399                                    .add("cppClassLocation", cppClassLocation)
400                                    .add("cppChainExceptions", cppChainExceptions)
401                                    .add("name", name)
402                                    );
403                            displayXMLElementArray(_out, properties);
404                            displayXMLElement(_out, text);
405                            _out.endTag("exception");
406                    }
407                    public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent)
408                    {
409                            Exception _cother = (Exception)_other;
410                            boolean _diff = displayAttributeDiff("className", className, _cother.className, _out, _indent+1);
411                            _diff = _diff && displayAttributeDiff("cppClassName", cppClassName, _cother.cppClassName, _out, _indent+1);
412                            _diff = _diff && displayAttributeDiff("cppClassLocation", cppClassLocation, _cother.cppClassLocation, _out, _indent+1);
413                            _diff = _diff && displayAttributeDiff("cppChainExceptions", cppChainExceptions, _cother.cppChainExceptions, _out, _indent+1);
414                            _diff = _diff && displayElementArrayDiff("properties", properties, _cother.properties, _out, _indent+1);
415                            _diff = _diff && displayElementDiff("text", text, _cother.text, _out, _indent+1);
416                            return _diff;
417                    }
418                    // BEGIN pass-through code block ---
419    org.eigenbase.xom.DOMWrapper getDef() { return _def; }
420                    // END pass-through code block ---
421            }
422    
423            public static class Property extends org.eigenbase.xom.ElementDef
424            {
425                    public Property()
426                    {
427                    }
428    
429                    public Property(org.eigenbase.xom.DOMWrapper _def)
430                            throws org.eigenbase.xom.XOMException
431                    {
432                            try {
433                                    org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", ResourceDef.class);
434                                    name = (String)_parser.getAttribute("name", "String", null, null, true);
435                                    cdata = _parser.getText();
436                            } catch(org.eigenbase.xom.XOMException _ex) {
437                                    throw new org.eigenbase.xom.XOMException("In " + getName() + ": " + _ex.getMessage());
438                            }
439                    }
440    
441                    public String name;  // required attribute
442    
443                    public String cdata;  // All text goes here
444                    public String getName()
445                    {
446                            return "Property";
447                    }
448    
449                    public void display(java.io.PrintWriter _out, int _indent)
450                    {
451                            _out.println(getName());
452                            displayAttribute(_out, "name", name, _indent+1);
453                            displayString(_out, "cdata", cdata, _indent+1);
454                    }
455                    public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent)
456                    {
457                            _out.beginTag("property", new org.eigenbase.xom.XMLAttrVector()
458                                    .add("name", name)
459                                    );
460                            _out.cdata(cdata);
461                            _out.endTag("property");
462                    }
463                    public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent)
464                    {
465                            Property _cother = (Property)_other;
466                            boolean _diff = displayAttributeDiff("name", name, _cother.name, _out, _indent+1);
467                            _diff = _diff && displayStringDiff("cdata", cdata, _cother.cdata, _out, _indent+1);
468                            return _diff;
469                    }
470            }
471    
472    
473    }