KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xml > internal > resolver > CatalogManager


1 // CatalogManager.java - Access CatalogManager.properties
2

3 /*
4  * Copyright 2001-2004 The Apache Software Foundation or its licensors,
5  * as applicable.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */

19
20 package com.sun.org.apache.xml.internal.resolver;
21
22 import java.io.InputStream JavaDoc;
23
24 import java.net.URL JavaDoc;
25 import java.net.MalformedURLException JavaDoc;
26
27 import java.util.MissingResourceException JavaDoc;
28 import java.util.PropertyResourceBundle JavaDoc;
29 import java.util.ResourceBundle JavaDoc;
30 import java.util.StringTokenizer JavaDoc;
31 import java.util.Vector JavaDoc;
32
33 import com.sun.org.apache.xml.internal.resolver.helpers.Debug;
34 import com.sun.org.apache.xml.internal.resolver.helpers.BootstrapResolver;
35 import com.sun.org.apache.xml.internal.resolver.Catalog;
36
37 /**
38  * CatalogManager provides an interface to the catalog properties.
39  *
40  * <p>Properties can come from two places: from system properties or
41  * from a <i>CatalogManager.properties</i> file. This class provides a transparent
42  * interface to both, with system properties preferred over property file values.</p>
43  *
44  * <p>The following table summarizes the properties:</p>
45  *
46  * <table border="1">
47  * <thead>
48  * <tr>
49  * <td>System Property</td>
50  * <td>CatalogManager.properties<br/>Property</td>
51  * <td>Description</td>
52  * </tr>
53  * </thead>
54  * <tbody>
55  * <tr>
56  * <td>xml.catalog.ignoreMissing</td>
57  * <td>&#160;</td>
58  * <td>If true, a missing <i>CatalogManager.properties</i> file or missing properties
59  * within that file will not generate warning messages. See also the
60  * <i>ignoreMissingProperties</i> method.</td>
61  * </tr>
62  *
63  * <tr>
64  * <td>xml.catalog.files</td>
65  * <td>catalogs</td>
66  * <td>The <emph>semicolon-delimited</emph> list of catalog files.</td>
67  * </tr>
68  *
69  * <tr>
70  * <td>&#160;</td>
71  * <td>relative-catalogs</td>
72  * <td>If false, relative catalog URIs are made absolute with respect to the base URI of
73  * the <i>CatalogManager.properties</i> file. This setting only applies to catalog
74  * URIs obtained from the <i>catalogs</i> property <emph>in the</emph>
75  * <i>CatalogManager.properties</i> file</td>
76  * </tr>
77  *
78  * <tr>
79  * <td>xml.catalog.verbosity</td>
80  * <td>verbosity</td>
81  * <td>If non-zero, the Catalog classes will print informative and debugging messages.
82  * The higher the number, the more messages.</td>
83  * </tr>
84  *
85  * <tr>
86  * <td>xml.catalog.prefer</td>
87  * <td>prefer</td>
88  * <td>Which identifier is preferred, "public" or "system"?</td>
89  * </tr>
90  *
91  * <tr>
92  * <td>xml.catalog.staticCatalog</td>
93  * <td>static-catalog</td>
94  * <td>Should a single catalog be constructed for all parsing, or should a different
95  * catalog be created for each parser?</td>
96  * </tr>
97  *
98  * <tr>
99  * <td>xml.catalog.allowPI</td>
100  * <td>allow-oasis-xml-catalog-pi</td>
101  * <td>If the source document contains "oasis-xml-catalog" processing instructions,
102  * should they be used?</td>
103  * </tr>
104  *
105  * <tr>
106  * <td>xml.catalog.className</td>
107  * <td>catalog-class-name</td>
108  * <td>If you're using the convenience classes
109  * <tt>com.sun.org.apache.xml.internal.resolver.tools.*</tt>), this setting
110  * allows you to specify an alternate class name to use for the underlying
111  * catalog.</td>
112  * </tr>
113  * </tbody>
114  * </table>
115  *
116  * @see Catalog
117  *
118  * @author Norman Walsh
119  * <a HREF="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
120  *
121  * @version 1.0
122  */

123
124 public class CatalogManager {
125   private static String JavaDoc pFiles = "xml.catalog.files";
126   private static String JavaDoc pVerbosity = "xml.catalog.verbosity";
127   private static String JavaDoc pPrefer = "xml.catalog.prefer";
128   private static String JavaDoc pStatic = "xml.catalog.staticCatalog";
129   private static String JavaDoc pAllowPI = "xml.catalog.allowPI";
130   private static String JavaDoc pClassname = "xml.catalog.className";
131   private static String JavaDoc pIgnoreMissing = "xml.catalog.ignoreMissing";
132
133   /** A static CatalogManager instance for sharing */
134   private static CatalogManager staticManager = new CatalogManager();
135
136   /** The bootstrap resolver to use when loading XML Catalogs. */
137   private BootstrapResolver bResolver = new BootstrapResolver();
138
139   /** Flag to ignore missing property files and/or properties */
140   private boolean ignoreMissingProperties
141     = (System.getProperty(pIgnoreMissing) != null
142        || System.getProperty(pFiles) != null);
143
144   /** Holds the resources after they are loaded from the file. */
145   private ResourceBundle JavaDoc resources;
146
147   /** The name of the CatalogManager properties file. */
148   private String JavaDoc propertyFile = "CatalogManager.properties";
149
150   /** The location of the propertyFile */
151   private URL JavaDoc propertyFileURI = null;
152
153   /** Default catalog files list. */
154   private String JavaDoc defaultCatalogFiles = "./xcatalog";
155
156   /** Current catalog files list. */
157   private String JavaDoc catalogFiles = null;
158
159   /** Did the catalogFiles come from the properties file? */
160   private boolean fromPropertiesFile = false;
161
162   /** Default verbosity level if there is no property setting for it. */
163   private int defaultVerbosity = 1;
164
165   /** Current verbosity level. */
166   private Integer JavaDoc verbosity = null;
167
168   /** Default preference setting. */
169   private boolean defaultPreferPublic = true;
170
171   /** Current preference setting. */
172   private Boolean JavaDoc preferPublic = null;
173
174   /** Default setting of the static catalog flag. */
175   private boolean defaultUseStaticCatalog = true;
176
177   /** Current setting of the static catalog flag. */
178   private Boolean JavaDoc useStaticCatalog = null;
179
180   /** The static catalog used by this manager. */
181   private static Catalog staticCatalog = null;
182
183   /** Default setting of the oasisXMLCatalogPI flag. */
184   private boolean defaultOasisXMLCatalogPI = true;
185
186   /** Current setting of the oasisXMLCatalogPI flag. */
187   private Boolean JavaDoc oasisXMLCatalogPI = null;
188
189   /** Default setting of the relativeCatalogs flag. */
190   private boolean defaultRelativeCatalogs = true;
191
192   /** Current setting of the relativeCatalogs flag. */
193   private Boolean JavaDoc relativeCatalogs = null;
194
195   /** Current catalog class name. */
196   private String JavaDoc catalogClassName = null;
197
198   /** The manager's debug object. Used for printing debugging messages.
199    *
200    * <p>This field is public so that objects that have access to this
201    * CatalogManager can use this debug object.</p>
202    */

203   public Debug debug = null;
204
205   /** Constructor. */
206   public CatalogManager() {
207     debug = new Debug();
208     // Note that we don't setDebug() here; we do that lazily. Either the
209
// user will set it explicitly, or we'll do it automagically if they
210
// read from the propertyFile for some other reason. That way, there's
211
// no attempt to read from the file before the caller has had a chance
212
// to avoid it.
213
}
214
215   /** Constructor that specifies an explicit property file. */
216   public CatalogManager(String JavaDoc propertyFile) {
217     this.propertyFile = propertyFile;
218
219     debug = new Debug();
220     // Note that we don't setDebug() here; we do that lazily. Either the
221
// user will set it explicitly, or we'll do it automagically if they
222
// read from the propertyFile for some other reason. That way, there's
223
// no attempt to read from the file before the caller has had a chance
224
// to avoid it.
225
}
226
227   /** Set the bootstrap resolver.*/
228   public void setBootstrapResolver(BootstrapResolver resolver) {
229     bResolver = resolver;
230   }
231
232   /** Get the bootstrap resolver.*/
233   public BootstrapResolver getBootstrapResolver() {
234     return bResolver;
235   }
236
237   /**
238    * Load the properties from the propertyFile and build the
239    * resources from it.
240    */

241   private synchronized void readProperties() {
242     try {
243       propertyFileURI = CatalogManager.class.getResource("/"+propertyFile);
244       InputStream JavaDoc in =
245     CatalogManager.class.getResourceAsStream("/"+propertyFile);
246       if (in==null) {
247     if (!ignoreMissingProperties) {
248       System.err.println("Cannot find "+propertyFile);
249       // there's no reason to give this warning more than once
250
ignoreMissingProperties = true;
251     }
252     return;
253       }
254       resources = new PropertyResourceBundle JavaDoc(in);
255     } catch (MissingResourceException JavaDoc mre) {
256       if (!ignoreMissingProperties) {
257     System.err.println("Cannot read "+propertyFile);
258       }
259     } catch (java.io.IOException JavaDoc e) {
260       if (!ignoreMissingProperties) {
261     System.err.println("Failure trying to read "+propertyFile);
262       }
263     }
264
265     // This is a bit of a hack. After we've successfully read the properties,
266
// use them to set the default debug level, if the user hasn't already set
267
// the default debug level.
268
if (verbosity == null) {
269       try {
270     String JavaDoc verbStr = resources.getString("verbosity");
271     int verb = Integer.parseInt(verbStr.trim());
272     debug.setDebug(verb);
273     verbosity = new Integer JavaDoc(verb);
274       } catch (Exception JavaDoc e) {
275     // nop
276
}
277     }
278   }
279
280   /**
281    * Allow access to the static CatalogManager
282    */

283   public static CatalogManager getStaticManager() {
284     return staticManager;
285   }
286
287   /**
288    * How are missing properties handled?
289    *
290    * <p>If true, missing or unreadable property files will
291    * not be reported. Otherwise, a message will be sent to System.err.
292    * </p>
293    */

294   public boolean getIgnoreMissingProperties() {
295     return ignoreMissingProperties;
296   }
297
298   /**
299    * How should missing properties be handled?
300    *
301    * <p>If ignore is true, missing or unreadable property files will
302    * not be reported. Otherwise, a message will be sent to System.err.
303    * </p>
304    */

305   public void setIgnoreMissingProperties(boolean ignore) {
306     ignoreMissingProperties = ignore;
307   }
308
309   /**
310    * How are missing properties handled?
311    *
312    * <p>If ignore is true, missing or unreadable property files will
313    * not be reported. Otherwise, a message will be sent to System.err.
314    * </p>
315    *
316    * @deprecated No longer static; use get/set methods.
317    */

318   public void ignoreMissingProperties(boolean ignore) {
319     setIgnoreMissingProperties(ignore);
320   }
321
322   /**
323    * Obtain the verbosity setting from the properties.
324    *
325    * @return The verbosity level from the propertyFile or the
326    * defaultVerbosity.
327    */

328   private int queryVerbosity () {
329     String JavaDoc defaultVerbStr = Integer.toString(defaultVerbosity);
330
331     String JavaDoc verbStr = System.getProperty(pVerbosity);
332
333     if (verbStr == null) {
334       if (resources==null) readProperties();
335       if (resources != null) {
336     try {
337       verbStr = resources.getString("verbosity");
338     } catch (MissingResourceException JavaDoc e) {
339       verbStr = defaultVerbStr;
340     }
341       } else {
342     verbStr = defaultVerbStr;
343       }
344     }
345
346     int verb = defaultVerbosity;
347
348     try {
349       verb = Integer.parseInt(verbStr.trim());
350     } catch (Exception JavaDoc e) {
351       System.err.println("Cannot parse verbosity: \"" + verbStr + "\"");
352     }
353
354     // This is a bit of a hack. After we've successfully got the verbosity,
355
// we have to use it to set the default debug level,
356
// if the user hasn't already set the default debug level.
357
if (verbosity == null) {
358       debug.setDebug(verb);
359       verbosity = new Integer JavaDoc(verb);
360     }
361
362     return verb;
363   }
364
365   /**
366    * What is the current verbosity?
367    */

368   public int getVerbosity() {
369     if (verbosity == null) {
370       verbosity = new Integer JavaDoc(queryVerbosity());
371     }
372
373     return verbosity.intValue();
374   }
375
376   /**
377    * Set the current verbosity.
378    */

379   public void setVerbosity (int verbosity) {
380     this.verbosity = new Integer JavaDoc(verbosity);
381     debug.setDebug(verbosity);
382   }
383
384   /**
385    * What is the current verbosity?
386    *
387    * @deprecated No longer static; use get/set methods.
388    */

389   public int verbosity () {
390     return getVerbosity();
391   }
392
393   /**
394    * Obtain the relativeCatalogs setting from the properties.
395    *
396    * @return The relativeCatalogs setting from the propertyFile or the
397    * defaultRelativeCatalogs.
398    */

399   private boolean queryRelativeCatalogs () {
400     if (resources==null) readProperties();
401
402     if (resources==null) return defaultRelativeCatalogs;
403
404     try {
405       String JavaDoc allow = resources.getString("relative-catalogs");
406       return (allow.equalsIgnoreCase("true")
407           || allow.equalsIgnoreCase("yes")
408           || allow.equalsIgnoreCase("1"));
409     } catch (MissingResourceException JavaDoc e) {
410       return defaultRelativeCatalogs;
411     }
412   }
413
414   /**
415    * Get the relativeCatalogs setting.
416    *
417    * <p>This property is used when the catalogFiles property is
418    * interrogated. If true, then relative catalog entry file names
419    * are returned. If false, relative catalog entry file names are
420    * made absolute with respect to the properties file before returning
421    * them.</p>
422    *
423    * <p>This property <emph>only applies</emph> when the catalog files
424    * come from a properties file. If they come from a system property or
425    * the default list, they are never considered relative. (What would
426    * they be relative to?)</p>
427    *
428    * <p>In the properties, a value of 'yes', 'true', or '1' is considered
429    * true, anything else is false.</p>
430    *
431    * @return The relativeCatalogs setting from the propertyFile or the
432    * defaultRelativeCatalogs.
433    */

434   public boolean getRelativeCatalogs () {
435     if (relativeCatalogs == null) {
436       relativeCatalogs = new Boolean JavaDoc(queryRelativeCatalogs());
437     }
438
439     return relativeCatalogs.booleanValue();
440   }
441
442   /**
443    * Set the relativeCatalogs setting.
444    *
445    * @see #getRelativeCatalogs()
446    */

447   public void setRelativeCatalogs (boolean relative) {
448     relativeCatalogs = new Boolean JavaDoc(relative);
449   }
450
451   /**
452    * Get the relativeCatalogs setting.
453    *
454    * @deprecated No longer static; use get/set methods.
455    */

456   public boolean relativeCatalogs () {
457     return getRelativeCatalogs();
458   }
459
460   /**
461    * Obtain the list of catalog files from the properties.
462    *
463    * @return A semicolon delimited list of catlog file URIs
464    */

465   private String JavaDoc queryCatalogFiles () {
466     String JavaDoc catalogList = System.getProperty(pFiles);
467     fromPropertiesFile = false;
468
469     if (catalogList == null) {
470       if (resources == null) readProperties();
471       if (resources != null) {
472     try {
473       catalogList = resources.getString("catalogs");
474       fromPropertiesFile = true;
475     } catch (MissingResourceException JavaDoc e) {
476       System.err.println(propertyFile + ": catalogs not found.");
477       catalogList = null;
478     }
479       }
480     }
481
482     if (catalogList == null) {
483       catalogList = defaultCatalogFiles;
484     }
485
486     return catalogList;
487   }
488
489   /**
490    * Return the current list of catalog files.
491    *
492    * @return A vector of the catalog file names or null if no catalogs
493    * are available in the properties.
494    */

495   public Vector JavaDoc getCatalogFiles() {
496     if (catalogFiles == null) {
497       catalogFiles = queryCatalogFiles();
498     }
499
500     StringTokenizer JavaDoc files = new StringTokenizer JavaDoc(catalogFiles, ";");
501     Vector JavaDoc catalogs = new Vector JavaDoc();
502     while (files.hasMoreTokens()) {
503       String JavaDoc catalogFile = files.nextToken();
504       URL JavaDoc absURI = null;
505
506       if (fromPropertiesFile && !relativeCatalogs()) {
507     try {
508       absURI = new URL JavaDoc(propertyFileURI, catalogFile);
509       catalogFile = absURI.toString();
510     } catch (MalformedURLException JavaDoc mue) {
511       absURI = null;
512     }
513       }
514
515       catalogs.add(catalogFile);
516     }
517
518     return catalogs;
519   }
520
521   /**
522    * Set the list of catalog files.
523    */

524   public void setCatalogFiles(String JavaDoc fileList) {
525     catalogFiles = fileList;
526     fromPropertiesFile = false;
527   }
528
529   /**
530    * Return the current list of catalog files.
531    *
532    * @return A vector of the catalog file names or null if no catalogs
533    * are available in the properties.
534    *
535    * @deprecated No longer static; use get/set methods.
536    */

537   public Vector JavaDoc catalogFiles() {
538     return getCatalogFiles();
539   }
540
541   /**
542    * Obtain the preferPublic setting from the properties.
543    *
544    * <p>In the properties, a value of 'public' is true,
545    * anything else is false.</p>
546    *
547    * @return True if prefer is public or the
548    * defaultPreferSetting.
549    */

550   private boolean queryPreferPublic () {
551     String JavaDoc prefer = System.getProperty(pPrefer);
552
553     if (prefer == null) {
554       if (resources==null) readProperties();
555       if (resources==null) return defaultPreferPublic;
556       try {
557     prefer = resources.getString("prefer");
558       } catch (MissingResourceException JavaDoc e) {
559     return defaultPreferPublic;
560       }
561     }
562
563     if (prefer == null) {
564       return defaultPreferPublic;
565     }
566
567     return (prefer.equalsIgnoreCase("public"));
568   }
569
570   /**
571    * Return the current prefer public setting.
572    *
573    * @return True if public identifiers are preferred.
574    */

575   public boolean getPreferPublic () {
576     if (preferPublic == null) {
577       preferPublic = new Boolean JavaDoc(queryPreferPublic());
578     }
579     return preferPublic.booleanValue();
580   }
581
582   /**
583    * Set the prefer public setting.
584    */

585   public void setPreferPublic (boolean preferPublic) {
586     this.preferPublic = new Boolean JavaDoc(preferPublic);
587   }
588
589   /**
590    * Return the current prefer public setting.
591    *
592    * @return True if public identifiers are preferred.
593    *
594    * @deprecated No longer static; use get/set methods.
595    */

596   public boolean preferPublic () {
597     return getPreferPublic();
598   }
599
600   /**
601    * Obtain the static-catalog setting from the properties.
602    *
603    * <p>In the properties, a value of 'yes', 'true', or '1' is considered
604    * true, anything else is false.</p>
605    *
606    * @return The static-catalog setting from the propertyFile or the
607    * defaultUseStaticCatalog.
608    */

609   private boolean queryUseStaticCatalog () {
610     String JavaDoc staticCatalog = System.getProperty(pStatic);
611
612     if (staticCatalog == null) {
613       if (resources==null) readProperties();
614       if (resources==null) return defaultUseStaticCatalog;
615       try {
616     staticCatalog = resources.getString("static-catalog");
617       } catch (MissingResourceException JavaDoc e) {
618     return defaultUseStaticCatalog;
619       }
620     }
621
622     if (staticCatalog == null) {
623       return defaultUseStaticCatalog;
624     }
625
626     return (staticCatalog.equalsIgnoreCase("true")
627         || staticCatalog.equalsIgnoreCase("yes")
628         || staticCatalog.equalsIgnoreCase("1"));
629   }
630
631   /**
632    * Get the current use static catalog setting.
633    */

634   public boolean getUseStaticCatalog() {
635     if (useStaticCatalog == null) {
636       useStaticCatalog = new Boolean JavaDoc(queryUseStaticCatalog());
637     }
638
639     return useStaticCatalog.booleanValue();
640   }
641
642   /**
643    * Set the use static catalog setting.
644    */

645   public void setUseStaticCatalog(boolean useStatic) {
646     useStaticCatalog = new Boolean JavaDoc(useStatic);
647   }
648
649   /**
650    * Get the current use static catalog setting.
651    *
652    * @deprecated No longer static; use get/set methods.
653    */

654   public boolean staticCatalog() {
655     return getUseStaticCatalog();
656   }
657
658   /**
659    * Get a new catalog instance.
660    *
661    * This method always returns a new instance of the underlying catalog class.
662    */

663   public Catalog getPrivateCatalog() {
664     Catalog catalog = staticCatalog;
665
666     if (useStaticCatalog == null) {
667       useStaticCatalog = new Boolean JavaDoc(getUseStaticCatalog());
668     }
669
670     if (catalog == null || !useStaticCatalog.booleanValue()) {
671
672       try {
673     String JavaDoc catalogClassName = getCatalogClassName();
674
675     if (catalogClassName == null) {
676       catalog = new Catalog();
677     } else {
678       try {
679         catalog = (Catalog) Class.forName(catalogClassName).newInstance();
680       } catch (ClassNotFoundException JavaDoc cnfe) {
681         debug.message(1,"Catalog class named '"
682               + catalogClassName
683               + "' could not be found. Using default.");
684         catalog = new Catalog();
685       } catch (ClassCastException JavaDoc cnfe) {
686         debug.message(1,"Class named '"
687               + catalogClassName
688               + "' is not a Catalog. Using default.");
689         catalog = new Catalog();
690       }
691     }
692
693     catalog.setCatalogManager(this);
694     catalog.setupReaders();
695     catalog.loadSystemCatalogs();
696       } catch (Exception JavaDoc ex) {
697     ex.printStackTrace();
698       }
699
700       if (useStaticCatalog.booleanValue()) {
701     staticCatalog = catalog;
702       }
703     }
704
705     return catalog;
706   }
707
708   /**
709    * Get a catalog instance.
710    *
711    * If this manager uses static catalogs, the same static catalog will
712    * always be returned. Otherwise a new catalog will be returned.
713    */

714   public Catalog getCatalog() {
715     Catalog catalog = staticCatalog;
716
717     if (useStaticCatalog == null) {
718       useStaticCatalog = new Boolean JavaDoc(getUseStaticCatalog());
719     }
720
721     if (catalog == null || !useStaticCatalog.booleanValue()) {
722       catalog = getPrivateCatalog();
723       if (useStaticCatalog.booleanValue()) {
724     staticCatalog = catalog;
725       }
726     }
727
728     return catalog;
729   }
730
731   /**
732    * <p>Obtain the oasisXMLCatalogPI setting from the properties.</p>
733    *
734    * <p>In the properties, a value of 'yes', 'true', or '1' is considered
735    * true, anything else is false.</p>
736    *
737    * @return The oasisXMLCatalogPI setting from the propertyFile or the
738    * defaultOasisXMLCatalogPI.
739    */

740   public boolean queryAllowOasisXMLCatalogPI () {
741     String JavaDoc allow = System.getProperty(pAllowPI);
742
743     if (allow == null) {
744       if (resources==null) readProperties();
745       if (resources==null) return defaultOasisXMLCatalogPI;
746       try {
747     allow = resources.getString("allow-oasis-xml-catalog-pi");
748       } catch (MissingResourceException JavaDoc e) {
749     return defaultOasisXMLCatalogPI;
750       }
751     }
752
753     if (allow == null) {
754       return defaultOasisXMLCatalogPI;
755     }
756
757     return (allow.equalsIgnoreCase("true")
758         || allow.equalsIgnoreCase("yes")
759         || allow.equalsIgnoreCase("1"));
760   }
761
762   /**
763    * Get the current XML Catalog PI setting.
764    */

765   public boolean getAllowOasisXMLCatalogPI () {
766     if (oasisXMLCatalogPI == null) {
767       oasisXMLCatalogPI = new Boolean JavaDoc(queryAllowOasisXMLCatalogPI());
768     }
769
770     return oasisXMLCatalogPI.booleanValue();
771   }
772
773   /**
774    * Set the XML Catalog PI setting
775    */

776   public void setAllowOasisXMLCatalogPI(boolean allowPI) {
777     oasisXMLCatalogPI = new Boolean JavaDoc(allowPI);
778   }
779
780   /**
781    * Get the current XML Catalog PI setting.
782    *
783    * @deprecated No longer static; use get/set methods.
784    */

785   public boolean allowOasisXMLCatalogPI() {
786     return getAllowOasisXMLCatalogPI();
787   }
788
789   /**
790    * Obtain the Catalog class name setting from the properties.
791    *
792    */

793   public String JavaDoc queryCatalogClassName () {
794     String JavaDoc className = System.getProperty(pClassname);
795
796     if (className == null) {
797       if (resources==null) readProperties();
798       if (resources==null) return null;
799       try {
800     return resources.getString("catalog-class-name");
801       } catch (MissingResourceException JavaDoc e) {
802     return null;
803       }
804     }
805
806     return className;
807   }
808
809   /**
810    * Get the current Catalog class name.
811    */

812   public String JavaDoc getCatalogClassName() {
813     if (catalogClassName == null) {
814       catalogClassName = queryCatalogClassName();
815     }
816
817     return catalogClassName;
818   }
819
820   /**
821    * Set the Catalog class name.
822    */

823   public void setCatalogClassName(String JavaDoc className) {
824     catalogClassName = className;
825   }
826
827   /**
828    * Get the current Catalog class name.
829    *
830    * @deprecated No longer static; use get/set methods.
831    */

832   public String JavaDoc catalogClassName() {
833     return getCatalogClassName();
834   }
835 }
836
Popular Tags