001: /*
002: * CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
003: * NETSCAPE COMMUNICATIONS CORPORATION
004: *
005: * Copyright (c) 1996 Netscape Communications Corporation.
006: * All Rights Reserved.
007: * Use of this Source Code is subject to the terms of the applicable
008: * license agreement from Netscape Communications Corporation.
009: */
010:
011: package soif;
012:
013: import util.ReportError;
014:
015: /**
016: * Get that taxonomy.
017: * <p>
018: * <b><font color="#FF0050">Note:</font></b>
019: * The RDMHeader class is not currently used to formulate requests.
020: * <b>This may change.</b>
021: * Both <i>SchemaGetter</i> and <i>TaxonomyGetter</i> initialize
022: * their RDM header strings with a correct RDM request.
023: * Because there are other schema and taxonomy requests that can be
024: * made which are currently not well (or not at all) documented
025: * the standard request can be changed using <i>setRDMHeader()</i>
026: * which allows you to put in anything but prevents you from changing
027: * the request during processing (the scope of the processing
028: * phase far exceeds the requirement for safe operation).
029: * The <i>setRDMHeader()</i> method should be used with the
030: * understanding that the interface will very likely change.
031: * It is also possible that the constructors will change,
032: * but the most likely scenario is that RDMHeader savvy
033: * constructors will be added.
034: *
035: */
036: public class TaxonomyGetter extends SOIFGetter {
037: /**
038: * Taxonomy.
039: */
040: private Taxonomy taxonomy;
041:
042: /**
043: * Constructor.
044: */
045: public TaxonomyGetter() {
046: super ();
047: }
048:
049: /**
050: * Constructor.
051: * @param CGILocation cgi path
052: * @param exe cgi executable
053: * @param csid compass server id
054: */
055: public TaxonomyGetter(String CGILocation, String exe, CSID csid) {
056: super (CGILocation, exe, csid);
057: taxonomy = null;
058: setRDMHead("type=taxonomy-description-request&csid="
059: + csid.toString());
060: }
061:
062: /**
063: * Return the taxonomy.
064: */
065: public Taxonomy getTaxonomy() {
066: if (taxonomy == null)
067: ReportError.reportError(ReportError.INTERNAL,
068: "TaxonomyGetter", "getTaxonomy",
069: Messages.NOTAXONOMYFOUND);
070: return taxonomy;
071: }
072:
073: /**
074: * Run that thread, get that taxonomy.
075: */
076: public void run() {
077: if (getStatus() != PREPARED) {
078: ReportError.reportError(ReportError.INTERNAL,
079: "TaxonomyGetter", "run", Messages.UNINITIALIZED);
080: System.out.println(Messages.COMPLETETAXONOMYTHREAD);
081: return;
082: }
083:
084: boolean errors = false;
085:
086: try {
087: getSOIF();
088: if (getStatus() == ABEND) {
089: errors = true;
090: return;
091: }
092:
093: if (sl == null) {
094: ReportError.reportError(ReportError.INTERNAL,
095: "TaxonomyGetter", "run",
096: Messages.GETSOIFNEXTNULL);
097: System.out.println(slp.toRawSOIFString());
098: return;
099: }
100:
101: taxonomy = new Taxonomy(sl);
102: } finally {
103: if (errors)
104: setStatus(ABEND);
105: else
106: setStatus(COMPLETE);
107: System.out.println(Messages.COMPLETETAXONOMYTHREAD);
108: }
109: }
110:
111: }
|