001    /*
002    // This java file was automatically generated
003    // from XOM model 'datasourcesconfig'
004    // on Sat May 17 09:06:54 GMT-08:00 2008
005    // Do not edit this file by hand.
006    */
007    
008    package mondrian.xmla;
009    /**
010     * This is the XML model for XMLA DataSources Configuration.
011     * Revision is $Id: //open/mondrian/src/main/mondrian/xmla/DataSourcesConfig.xml#4 $
012     * <p>This class was generated from XOM model 'datasourcesconfig' on Sat May 17 09:06:54 GMT-08:00 2008
013     */
014    public class DataSourcesConfig {
015    
016            public static java.lang.Class getXMLDefClass()
017            {
018                    return DataSourcesConfig.class;
019            }
020    
021            public static String[] _elements = {
022                    "DataSources",
023                    "DataSource",
024                    "DataSourceName",
025                    "DataSourceDescription",
026                    "URL",
027                    "DataSourceInfo",
028                    "ProviderName",
029                    "ProviderType",
030                    "AuthenticationMode",
031                    "Definition",
032                    "Catalogs",
033                    "Catalog"
034            };
035    
036            /**
037             * The list of data sources supported by XMLA service.
038             */
039            public static class DataSources extends org.eigenbase.xom.ElementDef
040            {
041                    public DataSources()
042                    {
043                    }
044    
045                    public DataSources(org.eigenbase.xom.DOMWrapper _def)
046                            throws org.eigenbase.xom.XOMException
047                    {
048                            try {
049                                    org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", DataSourcesConfig.class);
050                                    _parser = _parser;
051                                    org.eigenbase.xom.NodeDef[] _tempArray = null;
052                                    _tempArray = _tempArray;
053                                    _tempArray = _parser.getArray(DataSource.class, 0, 0);
054                                    dataSources = new DataSource[_tempArray.length];
055                                    for(int _i=0; _i<dataSources.length; _i++)
056                                            dataSources[_i] = (DataSource)_tempArray[_i];
057                            } catch(org.eigenbase.xom.XOMException _ex) {
058                                    throw new org.eigenbase.xom.XOMException("In " + getName() + ": " + _ex.getMessage());
059                            }
060                    }
061    
062    
063                    /**
064                     * The list of data sources supported by XMLA service.
065                     */
066                    public DataSource[] dataSources;  //optional array
067    
068                    public String getName()
069                    {
070                            return "DataSources";
071                    }
072    
073                    public void display(java.io.PrintWriter _out, int _indent)
074                    {
075                            _out.println(getName());
076                            displayElementArray(_out, "dataSources", dataSources, _indent+1);
077                    }
078                    public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent)
079                    {
080                            _out.beginTag("DataSources", new org.eigenbase.xom.XMLAttrVector()
081                                    );
082                            displayXMLElementArray(_out, dataSources);
083                            _out.endTag("DataSources");
084                    }
085                    public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent)
086                    {
087                            boolean _diff = true;
088                            DataSources _cother = (DataSources)_other;
089                            _diff = _diff && displayElementArrayDiff("dataSources", dataSources, _cother.dataSources, _out, _indent+1);
090                            return _diff;
091                    }
092            }
093    
094            /**
095             * Definition of a data source.
096             */
097            public static class DataSource extends org.eigenbase.xom.ElementDef
098            {
099                    public DataSource()
100                    {
101                    }
102    
103                    public DataSource(org.eigenbase.xom.DOMWrapper _def)
104                            throws org.eigenbase.xom.XOMException
105                    {
106                            try {
107                                    org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", DataSourcesConfig.class);
108                                    _parser = _parser;
109                                    name = _parser.getString(DataSourceName, true);
110                                    description = _parser.getString(DataSourceDescription, true);
111                                    url = _parser.getString(URL, true);
112                                    dataSourceInfo = _parser.getString(DataSourceInfo, true);
113                                    providerName = _parser.getString(ProviderName, true);
114                                    providerType = _parser.getString(ProviderType, true);
115                                    authenticationMode = _parser.getString(AuthenticationMode, true);
116                                    catalogs = (Catalogs)_parser.getElement(Catalogs.class, true);
117                            } catch(org.eigenbase.xom.XOMException _ex) {
118                                    throw new org.eigenbase.xom.XOMException("In " + getName() + ": " + _ex.getMessage());
119                            }
120                    }
121    
122    
123                    /**
124                     * Name.
125                     */
126                    public String name;  //required element
127                    /**
128                     * Description.
129                     */
130                    public String description;  //required element
131                    /**
132                     * URL of Web Services invocation.
133                     */
134                    public String url;  //required element
135                    /**
136                     * ConnectString of Mondrian (minus the catalog entry).
137                     * Required, but catalog may override.
138                     */
139                    public String dataSourceInfo;  //required element
140                    /**
141                     * Customized Service Provider Name.
142                     */
143                    public String providerName;  //required element
144                    /**
145                     * Ignored. Only return "MDP" for DISCOVER_DATASOURCES.
146                     */
147                    public String providerType;  //required element
148                    /**
149                     * Ignored. Only return "Unauthenticated" for DISCOVER_DATASOURCES.
150                     */
151                    public String authenticationMode;  //required element
152                    /**
153                     * One or more Catalogs.
154                     */
155                    public Catalogs catalogs;  //required element
156    
157                    public String getName()
158                    {
159                            return "DataSource";
160                    }
161    
162                    public void display(java.io.PrintWriter _out, int _indent)
163                    {
164                            _out.println(getName());
165                            displayString(_out, "name", name, _indent+1);
166                            displayString(_out, "description", description, _indent+1);
167                            displayString(_out, "url", url, _indent+1);
168                            displayString(_out, "dataSourceInfo", dataSourceInfo, _indent+1);
169                            displayString(_out, "providerName", providerName, _indent+1);
170                            displayString(_out, "providerType", providerType, _indent+1);
171                            displayString(_out, "authenticationMode", authenticationMode, _indent+1);
172                            displayElement(_out, "catalogs", catalogs, _indent+1);
173                    }
174                    public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent)
175                    {
176                            _out.beginTag("DataSource", new org.eigenbase.xom.XMLAttrVector()
177                                    );
178                            displayXMLString(_out, "DataSourceName", name);
179                            displayXMLString(_out, "DataSourceDescription", description);
180                            displayXMLString(_out, "URL", url);
181                            displayXMLString(_out, "DataSourceInfo", dataSourceInfo);
182                            displayXMLString(_out, "ProviderName", providerName);
183                            displayXMLString(_out, "ProviderType", providerType);
184                            displayXMLString(_out, "AuthenticationMode", authenticationMode);
185                            displayXMLElement(_out, catalogs);
186                            _out.endTag("DataSource");
187                    }
188                    public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent)
189                    {
190                            boolean _diff = true;
191                            DataSource _cother = (DataSource)_other;
192                            _diff = _diff && displayStringDiff("name", name, _cother.name, _out, _indent+1);
193                            _diff = _diff && displayStringDiff("description", description, _cother.description, _out, _indent+1);
194                            _diff = _diff && displayStringDiff("url", url, _cother.url, _out, _indent+1);
195                            _diff = _diff && displayStringDiff("dataSourceInfo", dataSourceInfo, _cother.dataSourceInfo, _out, _indent+1);
196                            _diff = _diff && displayStringDiff("providerName", providerName, _cother.providerName, _out, _indent+1);
197                            _diff = _diff && displayStringDiff("providerType", providerType, _cother.providerType, _out, _indent+1);
198                            _diff = _diff && displayStringDiff("authenticationMode", authenticationMode, _cother.authenticationMode, _out, _indent+1);
199                            _diff = _diff && displayElementDiff("catalogs", catalogs, _cother.catalogs, _out, _indent+1);
200                            return _diff;
201                    }
202                    // BEGIN pass-through code block ---
203    public static final String PROVIDER_TYPE_TDP = "TDP";
204                public static final String PROVIDER_TYPE_MDP = "MDP";
205                public static final String PROVIDER_TYPE_DMP = "DMP";
206                public static final String AUTH_MODE_UNAUTHENTICATED = "Unauthenticated";
207                public static final String AUTH_MODE_AUTHENTICATED = "Authenticated";
208                public static final String AUTH_MODE_INTEGRATED = "Integrated";
209    
210                public String getDataSourceName() {
211                    return name;
212                }
213    
214                public String getDataSourceDescription() {
215                    return description;
216                }
217    
218                public String getURL() {
219                    return url;
220                }
221    
222                public String getDataSourceInfo() {
223                    return dataSourceInfo;
224                }
225    
226                public String getProviderName() {
227                    return providerName;
228                }
229    
230                public String[] getProviderType() {
231                    return new String[] {PROVIDER_TYPE_MDP};
232                }
233    
234                public String getAuthenticationMode() {
235                    return authenticationMode;
236                }
237                    // END pass-through code block ---
238            }
239    
240            public static final String DataSourceName = "DataSourceName";
241    
242            public static final String DataSourceDescription = "DataSourceDescription";
243    
244            public static final String URL = "URL";
245    
246            public static final String DataSourceInfo = "DataSourceInfo";
247    
248            public static final String ProviderName = "ProviderName";
249    
250            public static final String ProviderType = "ProviderType";
251    
252            public static final String AuthenticationMode = "AuthenticationMode";
253    
254            public static final String Definition = "Definition";
255    
256            /**
257             * The list of catalogs associated with a data source.
258             */
259            public static class Catalogs extends org.eigenbase.xom.ElementDef
260            {
261                    public Catalogs()
262                    {
263                    }
264    
265                    public Catalogs(org.eigenbase.xom.DOMWrapper _def)
266                            throws org.eigenbase.xom.XOMException
267                    {
268                            try {
269                                    org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", DataSourcesConfig.class);
270                                    _parser = _parser;
271                                    org.eigenbase.xom.NodeDef[] _tempArray = null;
272                                    _tempArray = _tempArray;
273                                    _tempArray = _parser.getArray(Catalog.class, 0, 0);
274                                    catalogs = new Catalog[_tempArray.length];
275                                    for(int _i=0; _i<catalogs.length; _i++)
276                                            catalogs[_i] = (Catalog)_tempArray[_i];
277                            } catch(org.eigenbase.xom.XOMException _ex) {
278                                    throw new org.eigenbase.xom.XOMException("In " + getName() + ": " + _ex.getMessage());
279                            }
280                    }
281    
282    
283                    /**
284                     * The list of catalogs.
285                     */
286                    public Catalog[] catalogs;  //optional array
287    
288                    public String getName()
289                    {
290                            return "Catalogs";
291                    }
292    
293                    public void display(java.io.PrintWriter _out, int _indent)
294                    {
295                            _out.println(getName());
296                            displayElementArray(_out, "catalogs", catalogs, _indent+1);
297                    }
298                    public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent)
299                    {
300                            _out.beginTag("Catalogs", new org.eigenbase.xom.XMLAttrVector()
301                                    );
302                            displayXMLElementArray(_out, catalogs);
303                            _out.endTag("Catalogs");
304                    }
305                    public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent)
306                    {
307                            boolean _diff = true;
308                            Catalogs _cother = (Catalogs)_other;
309                            _diff = _diff && displayElementArrayDiff("catalogs", catalogs, _cother.catalogs, _out, _indent+1);
310                            return _diff;
311                    }
312            }
313    
314            public static class Catalog extends org.eigenbase.xom.ElementDef
315            {
316                    public Catalog()
317                    {
318                    }
319    
320                    public Catalog(org.eigenbase.xom.DOMWrapper _def)
321                            throws org.eigenbase.xom.XOMException
322                    {
323                            try {
324                                    org.eigenbase.xom.DOMElementParser _parser = new org.eigenbase.xom.DOMElementParser(_def, "", DataSourcesConfig.class);
325                                    _parser = _parser;
326                                    name = (String)_parser.getAttribute("name", "String", null, null, true);
327                                    dataSourceInfo = _parser.getString(DataSourceInfo, false);
328                                    definition = _parser.getString(Definition, true);
329                            } catch(org.eigenbase.xom.XOMException _ex) {
330                                    throw new org.eigenbase.xom.XOMException("In " + getName() + ": " + _ex.getMessage());
331                            }
332                    }
333    
334                    public String name;  // required attribute
335    
336                    /**
337                     * ConnectString of Mondrian (minus the catalog entry).
338                     * This entry is optional; if present, it overrides the
339                     * DataSourceInfo within the DataSource.
340                     */
341                    public String dataSourceInfo;  //optional element
342                    /**
343                     * URI of the schema definition file, for example
344                     * "/WEB-INF/schema/Marketing.xml".
345                     */
346                    public String definition;  //required element
347    
348                    public String getName()
349                    {
350                            return "Catalog";
351                    }
352    
353                    public void display(java.io.PrintWriter _out, int _indent)
354                    {
355                            _out.println(getName());
356                            displayAttribute(_out, "name", name, _indent+1);
357                            displayString(_out, "dataSourceInfo", dataSourceInfo, _indent+1);
358                            displayString(_out, "definition", definition, _indent+1);
359                    }
360                    public void displayXML(org.eigenbase.xom.XMLOutput _out, int _indent)
361                    {
362                            _out.beginTag("Catalog", new org.eigenbase.xom.XMLAttrVector()
363                                    .add("name", name)
364                                    );
365                            displayXMLString(_out, "DataSourceInfo", dataSourceInfo);
366                            displayXMLString(_out, "Definition", definition);
367                            _out.endTag("Catalog");
368                    }
369                    public boolean displayDiff(org.eigenbase.xom.ElementDef _other, java.io.PrintWriter _out, int _indent)
370                    {
371                            boolean _diff = true;
372                            Catalog _cother = (Catalog)_other;
373                            _diff = _diff && displayAttributeDiff("name", name, _cother.name, _out, _indent+1);
374                            _diff = _diff && displayStringDiff("dataSourceInfo", dataSourceInfo, _cother.dataSourceInfo, _out, _indent+1);
375                            _diff = _diff && displayStringDiff("definition", definition, _cother.definition, _out, _indent+1);
376                            return _diff;
377                    }
378                    // BEGIN pass-through code block ---
379    private DataSource dataSource;
380    
381                /**
382                  * Sets this catalog's parent data source, so that the data
383                  * source's definition can be inherited.
384                  */
385                public void setDataSource(DataSource dataSource) {
386                    this.dataSource = dataSource;
387                }
388    
389                /**
390                  * Returns this catalog's parent data source.
391                  */
392                public DataSource getDataSource() {
393                    return dataSource;
394                }
395    
396                /**
397                  * Returns this catalog's connect string, or its parent's
398                  * connect string if not set.
399                  */
400                public String getDataSourceInfo() {
401                    if (dataSourceInfo != null) {
402                        return dataSourceInfo;
403                    } else if (dataSource != null) {
404                        return dataSource.dataSourceInfo;
405                    } else {
406                        return null;
407                    }
408                }
409                    // END pass-through code block ---
410            }
411    
412    
413    }