Changeset 28965

Show
Ignore:
Timestamp:
10.04.2014 14:38:22 (6 years ago)
Author:
kjdon
Message:

removing stored Document field - now get passed it as needed or work it out from Element owner documents

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/AbstractBasicDocument.java

    r26269 r28965  
    3434 
    3535    /** XML element for describe requests - the container doc */ 
    36     protected Document doc = null; // typically a shared reference to the one in ServiceRack 
     36    //protected Document doc = null; // typically a shared reference to the one in ServiceRack 
    3737 
    3838    static Logger logger = Logger.getLogger(org.greenstone.gsdl3.util.AbstractBasicDocument.class.getName()); 
    3939 
    40     public AbstractBasicDocument(Document doc)  
     40    public AbstractBasicDocument()  
    4141    { 
    42     this.doc = doc; 
    4342    } 
    4443 
     
    4746     * <docNode nodeId='xxx' nodeType='leaf' docType='hierarchy'/> 
    4847     */ 
    49   public Element createDocNode(String node_id) { 
    50     return createDocNode(node_id, null); 
     48  public Element createDocNode(Document doc, String node_id) { 
     49    return createDocNode(doc, node_id, null); 
    5150  } 
    5251    /** create an element to go into a results list. A node element 
     
    5453     * <docNode nodeId='xxx' nodeType='leaf' docType='hierarchy' [rank='0.23']/> 
    5554     */ 
    56     public Element createDocNode(String node_id, String rank) { 
    57     Element node = this.doc.createElement(GSXML.DOC_NODE_ELEM); 
     55  public Element createDocNode(Document doc, String node_id, String rank) { 
     56    Element node = doc.createElement(GSXML.DOC_NODE_ELEM); 
    5857    node.setAttribute(GSXML.NODE_ID_ATT, node_id); 
    5958    if (rank != null) { 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/BasicDocument.java

    r26045 r28965  
    3434    static Logger logger = Logger.getLogger(org.greenstone.gsdl3.util.BasicDocument.class.getName()); 
    3535 
    36     public BasicDocument(Document doc, String default_document_type) 
     36  public BasicDocument(String default_document_type) 
    3737    { 
    38     super(doc); 
     38    super(); 
    3939 
    4040    this.default_document_type = default_document_type; 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/BasicDocumentDatabase.java

    r26045 r28965  
    5252 
    5353    /** constructor */ 
    54     public BasicDocumentDatabase(Document doc,  
    55                   String database_type, String site_home, 
     54    public BasicDocumentDatabase(String database_type, String site_home, 
    5655                  String cluster_name,  String index_stem) 
    5756    { 
    58     super(doc); 
     57    super(); 
    5958 
    6059    coll_db = new SimpleCollectionDatabase(database_type); 
     
    130129        return GSXML.DOC_TYPE_PAGED; 
    131130    } 
    132         if (childtype.equals("PagedHierarchy")) 
    133           { 
    134             return GSXML.DOC_TYPE_PAGED_HIERARCHY; 
    135           } 
     131    if (childtype.equals("PagedHierarchy")) { 
     132       
     133      return GSXML.DOC_TYPE_PAGED_HIERARCHY; 
     134    } 
    136135    return GSXML.DOC_TYPE_HIERARCHY; 
    137136 
     
    308307        { 
    309308            String child_id = child_ids.get(i); 
    310             Element child_elem = createDocNode(child_id); 
     309            Element child_elem = createDocNode(doc.getOwnerDocument(), child_id); 
    311310            doc.appendChild(child_elem); 
    312311            if (recursive && (!child_elem.getAttribute(GSXML.NODE_TYPE_ATT).equals(GSXML.NODE_TYPE_LEAF) || child_elem.getAttribute(GSXML.DOC_TYPE_ATT).equals(GSXML.DOC_TYPE_PAGED))) 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSDocumentModel.java

    r25635 r28965  
    102102 
    103103    protected String _siteHome; 
    104     protected Document _mainDoc; 
    105     protected MessageRouter _router; 
     104    protected MessageRouter _router; 
    106105    protected HashMap<String, Document> _docCache = new HashMap<String, Document>(); 
    107106 
    108     public GSDocumentModel(String siteHome, Document mainDocument, MessageRouter router) 
     107    public GSDocumentModel(String siteHome, MessageRouter router) 
    109108    { 
    110109        _siteHome = siteHome; 
    111         _mainDoc = mainDocument; 
    112110        _router = router; 
    113111    } 
     
    17021700        if (_errorMessageMap.get(_errorStatus) != null) 
    17031701        { 
    1704             GSXML.addError(elem.getOwnerDocument(), elem, methodName + ": " + _errorMessageMap.get(_errorStatus), GSXML.ERROR_TYPE_SYNTAX); 
     1702            GSXML.addError(elem, methodName + ": " + _errorMessageMap.get(_errorStatus), GSXML.ERROR_TYPE_SYNTAX); 
    17051703            return true; 
    17061704        } 
     
    20092007    { 
    20102008        //Find out what kind of database we have 
    2011         Element dbTypeMessage = _mainDoc.createElement(GSXML.MESSAGE_ELEM); 
    2012         Element dbTypeRequest = GSXML.createBasicRequest(_mainDoc, GSXML.REQUEST_TYPE_DESCRIBE, collection, userContext); 
     2009      Document doc = XMLConverter.newDOM(); 
     2010        Element dbTypeMessage = doc.createElement(GSXML.MESSAGE_ELEM); 
     2011        Element dbTypeRequest = GSXML.createBasicRequest(doc, GSXML.REQUEST_TYPE_DESCRIBE, collection, userContext); 
    20132012        dbTypeMessage.appendChild(dbTypeRequest); 
    20142013        Element dbTypeResponse = (Element) _router.process(dbTypeMessage);