1 9 package org.ozoneDB.xml.core; 10 11 import java.util.Map ; 12 import java.util.HashMap ; 13 import java.util.Set ; 14 import java.util.HashSet ; 15 16 import org.ozoneDB.OzoneObject; 17 18 import org.xmldb.api.base.Resource; 19 20 25 public class XMLCollectionImpl extends OzoneObject 26 implements XMLCollection { 27 28 private Set xmlDocuments = null; 33 private Map childCollections = null; 34 private XMLCollection parentCollection = null; 35 private String collectionName = null; 36 37 public XMLCollectionImpl() { 38 xmlDocuments = new HashSet (); 40 childCollections = new HashMap (); 42 } 43 44 46 public XMLCollection getParentCollection() { 47 return parentCollection; 48 } 49 50 53 public void setParentCollection(XMLCollection parentCollection) { 54 this.parentCollection = parentCollection; 55 } 56 57 59 public String getName() { 60 return collectionName; 61 } 62 63 65 public void setName(String name) { 66 collectionName = name; 67 } 68 69 71 public int getChildCollectionCount() { 72 return childCollections.size(); 73 } 74 75 77 public synchronized String [] listChildCollections() { 78 return (String []) childCollections.keySet().toArray( new String [childCollections.keySet().size()] ); 79 } 80 81 83 public XMLCollection getChildCollection( String name ) { 84 return (XMLCollection)childCollections.get(name); 85 } 86 87 public int getResourceCount() { 88 return xmlDocuments.size(); 89 } 90 91 public Set getResources() { 92 return xmlDocuments; 93 } 94 95 public boolean hasResource(String id) { 96 return xmlDocuments.contains(id); 97 } 98 99 public void addResource(String id) { 100 System.out.println("XMLCollectionImpl.addResource() - Adding container to Set"); 101 xmlDocuments.add(id); 102 } 103 104 public void storeResource( String id, Resource res ) { 105 System.out.println("XMLCOllectionImpl.storeResource() - Dont know what to do here"); 106 } 107 108 111 public void setChildCollection(String childName, XMLCollection childCollection) { 112 childCollections.put(childName,childCollection); 113 } 114 } 115 | Popular Tags |