Changeset 28965
- Timestamp:
- 2014-04-10T14:38:22+12:00 (10 years ago)
- Location:
- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/AbstractBasicDocument.java
r26269 r28965 34 34 35 35 /** XML element for describe requests - the container doc */ 36 protected Document doc = null; // typically a shared reference to the one in ServiceRack36 //protected Document doc = null; // typically a shared reference to the one in ServiceRack 37 37 38 38 static Logger logger = Logger.getLogger(org.greenstone.gsdl3.util.AbstractBasicDocument.class.getName()); 39 39 40 public AbstractBasicDocument( Document doc)40 public AbstractBasicDocument() 41 41 { 42 this.doc = doc;43 42 } 44 43 … … 47 46 * <docNode nodeId='xxx' nodeType='leaf' docType='hierarchy'/> 48 47 */ 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); 51 50 } 52 51 /** create an element to go into a results list. A node element … … 54 53 * <docNode nodeId='xxx' nodeType='leaf' docType='hierarchy' [rank='0.23']/> 55 54 */ 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); 58 57 node.setAttribute(GSXML.NODE_ID_ATT, node_id); 59 58 if (rank != null) { -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/BasicDocument.java
r26045 r28965 34 34 static Logger logger = Logger.getLogger(org.greenstone.gsdl3.util.BasicDocument.class.getName()); 35 35 36 public BasicDocument(Document doc,String default_document_type)36 public BasicDocument(String default_document_type) 37 37 { 38 super( doc);38 super(); 39 39 40 40 this.default_document_type = default_document_type; -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/BasicDocumentDatabase.java
r26045 r28965 52 52 53 53 /** constructor */ 54 public BasicDocumentDatabase(Document doc, 55 String database_type, String site_home, 54 public BasicDocumentDatabase(String database_type, String site_home, 56 55 String cluster_name, String index_stem) 57 56 { 58 super( doc);57 super(); 59 58 60 59 coll_db = new SimpleCollectionDatabase(database_type); … … 130 129 return GSXML.DOC_TYPE_PAGED; 131 130 } 132 if (childtype.equals("PagedHierarchy"))133 {134 135 131 if (childtype.equals("PagedHierarchy")) { 132 133 return GSXML.DOC_TYPE_PAGED_HIERARCHY; 134 } 136 135 return GSXML.DOC_TYPE_HIERARCHY; 137 136 … … 308 307 { 309 308 String child_id = child_ids.get(i); 310 Element child_elem = createDocNode( child_id);309 Element child_elem = createDocNode(doc.getOwnerDocument(), child_id); 311 310 doc.appendChild(child_elem); 312 311 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 102 102 103 103 protected String _siteHome; 104 protected Document _mainDoc; 105 protected MessageRouter _router; 104 protected MessageRouter _router; 106 105 protected HashMap<String, Document> _docCache = new HashMap<String, Document>(); 107 106 108 public GSDocumentModel(String siteHome, Document mainDocument,MessageRouter router)107 public GSDocumentModel(String siteHome, MessageRouter router) 109 108 { 110 109 _siteHome = siteHome; 111 _mainDoc = mainDocument;112 110 _router = router; 113 111 } … … 1702 1700 if (_errorMessageMap.get(_errorStatus) != null) 1703 1701 { 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); 1705 1703 return true; 1706 1704 } … … 2009 2007 { 2010 2008 //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); 2013 2012 dbTypeMessage.appendChild(dbTypeRequest); 2014 2013 Element dbTypeResponse = (Element) _router.process(dbTypeMessage);
Note:
See TracChangeset
for help on using the changeset viewer.