001: /*
002: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
003: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
004: */
005:
006: package com.sun.portal.search.rdm;
007:
008: import com.sun.portal.search.soif.*;
009:
010: /** RDM Server Description
011: *
012: * Server Descriptions provide system-level access information to the
013: * client (such as supported RDM query languages), help distributed
014: * query routing clients better select promising catalog services to
015: * search, and provide human-readable descriptions of a catalog service.
016: * A server description is written as a single SOIF object with the
017: * object type of RDMSERVER.
018: *
019: * The @RDMSERVER definition contains the following attributes:
020: * Supported-RDM-Type single-value,comma-sep
021: * Supported-RDM-Query-Language single-value,comma-sep
022: * SD-Last-Modified single-value
023: * SD-Expires single-value
024: * Description single-value
025: * Supported-Catalog-Service-ID single-value,comma-sep
026: * Maintainer single-value
027: * Sample-RD multivalued
028: */
029: public class RDMServerDescription {
030:
031: SOIF soif;
032:
033: public RDMServerDescription(String url) {
034: soif = new SOIF(RDM.A_SN_RDM_SERVER, url);
035: }
036:
037: public RDMServerDescription(SOIFInputStream ss, String url)
038: throws Exception {
039: SOIF s = ss.readSOIF();
040: // Received valid RDMServer?
041: if (s == null
042: || !s.getSchemaName().equalsIgnoreCase(
043: RDM.A_SN_RDM_SERVER))
044: throw new Exception("Invalid server description");
045: soif = new SOIF(RDM.A_SN_RDM_SERVER, url);
046: soif.merge(s);
047: }
048:
049: /** Macros for accessing single-value @RDMSERVER values
050: */
051: public String getSupportedRDMType() {
052: return soif.getValue(RDM.A_RDM_SUPTYPE);
053: }
054:
055: public String getSupportedRDMQL() {
056: return soif.getValue(RDM.A_RDM_SUPQL);
057: }
058:
059: public String getSupportedCSID() {
060: return soif.getValue(RDM.A_RDM_SUPCSID);
061: }
062:
063: public String getLastModified() {
064: return soif.getValue(RDM.A_RDM_SD_LMT);
065: }
066:
067: public String getExpires() {
068: return soif.getValue(RDM.A_RDM_SD_EXPIRE);
069: }
070:
071: public String getDescription() {
072: return soif.getValue(RDM.A_RDM_DESC);
073: }
074:
075: public String getMaintainer() {
076: return soif.getValue(RDM.A_RDM_MAINT);
077: }
078:
079: public SOIF getSOIF() {
080: return soif;
081: }
082:
083: /** Macros for defining single-value @RDMSERVER values
084: */
085: public void setSupportedRDMType(String s) throws SOIFException {
086: soif.replace(RDM.A_RDM_SUPTYPE, s);
087: }
088:
089: public void setSupportedRDMQL(String s) throws SOIFException {
090: soif.replace(RDM.A_RDM_SUPQL, s);
091: }
092:
093: public void setSupportedCSID(String s) throws SOIFException {
094: soif.replace(RDM.A_RDM_SUPCSID, s);
095: }
096:
097: public void setLastModified(String s) throws SOIFException {
098: soif.replace(RDM.A_RDM_SD_LMT, s);
099: }
100:
101: public void setExpires(String s) throws SOIFException {
102: soif.replace(RDM.A_RDM_SD_EXPIRE, s);
103: }
104:
105: public void setDescription(String s) throws SOIFException {
106: soif.replace(RDM.A_RDM_DESC, s);
107: }
108:
109: public void setMaintainer(String s) throws SOIFException {
110: soif.replace(RDM.A_RDM_MAINT, s);
111: }
112:
113: }
|